Maintains an agent's core memory, the editable part of its system prompt. Use to modify the agent's core behavior, embed critical knowledge (needed on every turn), or instruct the agent on how to use deferred memory.
93%
Does it follow best practices?
Run evals on this skill
Adds up to 20 points to the overall score
Passed
No findings from the security scan
Core memory is the agent's prompt, refined over its lifetime. Treat each change as a revision of that prompt, not an append to a log: the usual edit sharpens, merges, or replaces an existing principle, and a new one earns its place only when no existing one can absorb it.
The agent's system prompt is compiled from the Markdown files at the root of $MEMORY_DIR. Each root file except MEMORY.md becomes a block named after the file, in alphabetical order by filename, followed by the root MEMORY.md:
{{base system prompt}}
<human>
<description>{{description from human.md frontmatter}}</description>
{{body of human.md}}
</human>
<persona>
<description>{{description from persona.md frontmatter}}</description>
{{body of persona.md}}
</persona>
<memory>
{{body of root MEMORY.md}}
<deferred-memory>
<directory path="{{dir}}/" index="{{dir}}/MEMORY.md" />
</deferred-memory>
</memory>Every root file except MEMORY.md starts with frontmatter containing exactly two fields:
---
name: human
description: Who the user is and how they want to work together.
---human.md renders as <human>. Choose short, stable names.description is rendered into the prompt. Write it for the agent: one line saying what the block holds.MEMORY.md has no frontmatter. Its body is the only part of <memory> you write.<deferred-memory> list is generated: one entry per top-level directory that has its own MEMORY.md, showing only the path. skills/ is never listed; skills appear separately.Read $MEMORY_DIR/.memfs.config.json if it exists. The memory repository's pre-commit hook enforces it:
maxCoreMemoryCharacters caps the total size of all root Markdown (default 65,536 characters).maxFileCharacters caps each memory file, frontmatter included (default 20,000 characters). fileCharacterLimits overrides it per glob; the first match wins and null removes the cap.readOnlyFiles lists globs whose files cannot change. Do not edit them.When the config file is absent, the defaults apply. Treat the limits as a ceiling, not a target: stay well below them. When an edit does not fit, move detail into deferred memory instead of raising a limit; change the config only when the user asks.
Core memory is the agent's working model: who it is, how the user thinks and what they value, and the principles that follow. It is not a list of rules.
$SECRET_NAME.A correction that reveals a gap in a principle calls for sharpening its wording. A correction the principle already covers, such as the user pointing out the same kind of mistake again, means the principle is too abstract to apply: attach a contrastive example to it instead of rewording it again or adding another rule.
- Lead with the answer, because the user reads the first line and skims the rest.
- Not: "I looked at the config, then the logs, and it turns out the timeout is too low." Instead: "The timeout is too low: 5s, and the slow query takes 8s."The agent consults deferred memory only when something in its prompt tells it to. The generated <deferred-memory> list gives directory paths and nothing else, so root MEMORY.md decides whether everything outside core memory is ever read. A directory with no useful entry here is effectively lost.
MEMORY.md and the indexes beneath it.When a root file is long or the total is near its limit:
MEMORY.md.Every memory commit must let someone reading git log or git blame on a memory or skill line trace back to the events that justified it. Commit each learning separately; a learning may touch several files. When a turn produces several learnings, finish and commit one before editing for the next. From the repository root, stage only that learning's files and commit in one shell call:
git add <changed files> && git commit -m "memory(<origin>): <what was learned>
<what happened: the events that led to this learning and why it should persist>
Sources:
- <conversation ID> (<message IDs>), <who>, <date>: <what happened there>"<origin> is self when you edit your own memory during a conversation, or dream when you are a reflection or dream subagent reviewing past transcripts.Sources:. The memory line states only the resulting rule or fact. For example, the file says "Be concise" and the commit says "feedback 'talk more concisely' from Charles on ". Git dates the commit, not the event, so write the event date.memory(self): Sarah wants one commit per learning, not the file edit.Sources: lists the evidence precisely enough to find again, with one line on what happened at each: a conversation ID with the message IDs where it happened, a transcript or session ID, a file path, a URL, PR, or issue, or a commit hash. When the user explicitly asked for the change, cite that request. Resolve values such as $CONVERSATION_ID before writing them; never commit a literal variable name.Sources: unknown and say why in the body.letta-ai/letta-code
64fdf59
If you maintain this skill, you can claim it as your own. Once claimed, you can manage eval scenarios, bundle related skills, attach documentation or rules, and ensure cross-agent compatibility.