Claude Code Memory Agent
A long-term memory agent that keeps a persistent, file-based memory in a ChatBotKit Space, using the same conventions as Claude Code's memory system: a MEMORY.md index plus one-fact-per-file memories with frontmatter, typed as user, feedback, project, or reference, and cross-linked with [[slug]] references. The agent reads its index at the start of every conversation and curates what it learns over time.
Most chat agents forget everything between sessions. This blueprint gives an agent a durable memory by storing it as plain Markdown files in a ChatBotKit Space, following the same conventions Claude Code uses for its own file-based memory.
The design is deliberately simple. A single /memory/MEMORY.md file
acts as an index - one line per memory - and is the only file the
agent reads in full when a conversation begins. Each individual
memory is its own file holding a single fact, with frontmatter that
records a slug, a one-line description used for recall, and a type:
user, feedback, project, or reference. Memories
cross-reference each other with [[slug]] links, so related facts
form a small graph the agent can follow.
The Space is the storage layer. Six abilities map directly onto the filesystem operations Claude Code relies on: list, read, write, search, move, and delete. Recall is a read of the index followed by targeted reads of the relevant files. Saving is a write of a new memory file plus a one-line pointer in the index. Updating an existing memory is preferred over creating a near-duplicate, and wrong memories get deleted.
A live file browser tool shows the /memory/ tree as it grows, so
you can watch the agent build and curate its knowledge over time.
Because everything is just Markdown in a Space, the memory is
portable, inspectable, and editable by hand.
Extend this by adding a trigger that periodically prunes stale memories, wiring the memory into a larger multi-agent setup as shared context, or pointing several bots at the same Space so they share a brain.
Backstory
Common information about the bot's experience, skills and personality. For more information, see the Backstory documentation.
Skillset
This example uses a dedicated Skillset. Skillsets are collections of abilities that can be used to create a bot with a specific set of functions and features it can perform.
List Memories
List the files under /memory/ in the Space to see the index and every individual memory file. Use recursive listing to see the whole tree.Read Memory
Read the content of a memory file. Use it for /memory/MEMORY.md (the index) at the start of a conversation and for individual /memory/<slug>.md files when recalling relevant facts.Write Memory
Create or update a memory file. Use it to write /memory/<slug>.md with frontmatter (name, description, type) and to add a one-line pointer to /memory/MEMORY.md. Prefer updating an existing file over creating a duplicate.Search Memories
Search the memory files in the Space by keyword to find existing memories before saving a new one and to recall facts relevant to the current request.Rename Memory
Move or rename a memory file in the Space. Use it to change a memory's slug, keeping the index pointer in /memory/MEMORY.md in sync.Delete Memory
Delete a memory file from the Space when it turns out to be wrong or obsolete. Remember to also remove its pointer line from /memory/MEMORY.md.
Terraform Code
This blueprint can be deployed using Terraform, enabling infrastructure-as-code management of your ChatBotKit resources. Use the code below to recreate this example in your own environment.
A dedicated team of experts is available to help you create your perfect chatbot. Reach out via or chat for more information.