1
0
Fork 0
claude-code-complete-agent/examples/05-memory-system/prompt.md
Kjell Tore Guttormsen 06ae605051 fix: pedagogical review - add expected output, CLAUDE.md, fix consistency
Address findings from pedagogical review simulating a non-expert user:

- Add CLAUDE.md to project root (was referenced but missing)
- Fix README score from 12/9/1 to 13/8/1 (match feature-map.md)
- Add Expected Output sections to examples 01, 02, 05, 09, 10
- Create pipeline-output/ and briefings/ directories
- Add example ordering guidance in README
- Add plan requirements for examples 11/13 in prerequisites
- Add skill frontmatter explanation in GETTING-STARTED.md
- Explain Cowork/Dispatch with links in cowork-integration
- Expand .gitignore with node_modules and generated output files
- Add model override hints in agent frontmatter comments

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-26 20:25:45 +01:00

87 lines
2.7 KiB
Markdown

# Example 05: Memory System
**Capability:** Claude Code maintains persistent memory across sessions through a
hierarchy of markdown files. What is written in one session is available in the next.
**OpenClaw equivalent:** Daily markdown logs + MEMORY.md + vector search (SQLite-vec).
---
## How the Hierarchy Works
Claude Code loads context in this order, from broadest to narrowest:
1. `~/.claude/CLAUDE.md` - global preferences, always loaded
2. `CLAUDE.md` in the project root - project-specific config, always loaded
3. `memory/MEMORY.md` - session state, loaded if referenced in CLAUDE.md
4. `.claude/` managed memory - auto-updated by Claude when `--memory` is active
The file loaded earlier provides the frame. Later files narrow it.
---
## The Prompt
```
Read this project's CLAUDE.md and summarize what you learn about the project
in three bullet points.
Then create a file at memory/project-notes.md with:
- Today's date as a header
- The three-bullet summary
- A note that says "Memory system demonstrated successfully"
Finally, explain in one paragraph how this file will be available in the
next Claude Code session without re-reading CLAUDE.md.
```
---
## What Happens
Claude Code will:
1. Use Read to load `CLAUDE.md` from the project root
2. Synthesize the project context into three bullets
3. Use Write to create `memory/project-notes.md`
4. Explain how CLAUDE.md references cause files to be auto-loaded
---
## Expected Output
Claude creates `memory/project-notes.md` and then explains how memory works.
The file will look like:
```markdown
# March 26, 2026
- This is a companion repo comparing OpenClaw and Claude Code capabilities
- It contains 13 examples, agents, skills, hooks, and documentation
- The project maps 22 OpenClaw features to Claude Code equivalents
Memory system demonstrated successfully.
```
Claude will then explain something like:
> "This file is inside the `memory/` directory, which is referenced in
> CLAUDE.md. Because Claude Code loads CLAUDE.md at every session start,
> and CLAUDE.md mentions the memory directory, files here persist across
> sessions without any extra setup."
**How you know it worked:**
- `memory/project-notes.md` exists and contains today's date
- The three bullets accurately summarize what CLAUDE.md says
- Claude's explanation mentions the CLAUDE.md hierarchy
---
## Why This Matters
OpenClaw uses SQLite-vec for semantic memory search across sessions. Claude Code
uses structured markdown with explicit file references. Both achieve persistence.
The markdown approach is more inspectable: you can read, edit, and version control
every piece of memory Claude has about your project.
The `memory/MEMORY.md` file in this repo shows the pattern at scale.