Persistent Memory
Use /remember to capture stray preferences, conventions, and commands. AtomCode injects them into the system prompt on every turn. It complements .atomcode.md project instructions: instructions are for full specs; memory is for the "oh, I should tell it about that" facts.
Command overview
| Command | Effect |
|---|---|
/remember <content> | Record an entry in project memory (default scope, bound to the current working directory) |
/remember --global <content> | Record an entry in global memory (shared across all projects) |
/forget <keyword> | Delete every entry in global + project memory matching the keyword (case-insensitive); the output lists what got removed |
/memory | Show all active memory entries, grouped under [Global] / [Project], with disk paths |
Storage locations
| Scope | Path |
|---|---|
| Global | ~/.atomcode/memory.md (or $ATOMCODE_HOME/memory.md) |
| Project | <project_root>/.atomcode/memory.md |
The format is plain Markdown — one entry per - -prefixed list item. Use /remember or hand-edit; AtomCode rereads on the next turn. Lines not starting with - are ignored, so feel free to add comments, blank lines, or grouping headings without affecting entries.
How the model "uses" memory
For every request, AtomCode merges global + project memory and injects it into the system prompt (crates/atomcode-core/src/agent/prompt.rs:64), formatted as:
=== MEMORY ===
The user has asked you to remember these facts and preferences:
[Global]
- Prefers concise answers, no long-winded explanations
- Reply in Chinese, but write commit messages in English
[Project: atomcode]
- Test command is cargo test --workspace --no-fail-fast
- When CI fails, first check .github/workflows/ci.yml lines 78-92
The model sees this block on every turn. There is no "semantic retrieval" or "on-demand recall" — it's unconditional full injection. The more entries, the more tokens per turn. Prune stale entries to keep this tight.
Capacity limits
| Limit | Value | What happens at the limit |
|---|---|---|
| Single memory file size | 64 KB | Only the trailing 64 KB is read (aligned to line boundaries — UTF-8 characters are never split) |
| Total characters in the injected prompt | 4000 chars | Truncated with a trailing [...truncated, run /memory to review] note |
Once you hit the limit, use /forget to clean up — drop entries that are no longer relevant.
Suggested uses
1. Project-specific commands, conventions, footguns (project scope)
> /remember use npm run check for type-checking (not npm run typecheck)
> /remember when CI fails, check .github/workflows/ci.yml lines 78-92 first
> /remember never use sed -i in this repo (macOS/Linux behaviour differs)
> /remember DB migration SQL must run on staging before main
2. Global coding preferences, workflows (global)
> /remember --global run tests before committing
> /remember --global don't git push on your own — let me confirm manually
> /remember --global reply in Chinese but write commit messages in English
> /remember --global prefer editing existing files — don't create docs (*.md) on your own
3. Personal or team info (global)
> /remember --global my GitHub username is alice
> /remember --global default timezone Asia/Shanghai
> /remember --global team standup is Mon/Wed/Fri at 9:30
4. Cleaning up stale memories
> /forget npm run check
[project] - use npm run check for type-checking (not npm run typecheck)
(removed 1 matching entry)
> /memory
[Global] (/Users/alice/.atomcode/memory.md)
- run tests before committing
- don't git push on your own — let me confirm manually
[Project] (/Users/alice/code/myrepo/.atomcode/memory.md)
- when CI fails, check .github/workflows/ci.yml lines 78-92 first
Memory vs project instructions vs session history
AtomCode offers three ways to persist "context", each with a different role:
.atomcode.md | Memory (memory.md) | Sessions (/resume) | |
|---|---|---|---|
| Best for | Full specs, tech stack, detailed conventions | Stray facts, personal preferences, command cheats | Past conversation + tool calls |
| Scope | Project | Project + global | One specific session |
| How to add | Hand-edit | /remember or hand-edit | Auto-saved per conversation |
| Injection | Loaded into system prompt at startup | Injected into system prompt every turn | Restored wholesale via /resume |
| Token cost | High (full doc) | Capped at 4000 chars | Bounded by the context window |
Typical combinations:
- Team conventions in
.atomcode.md(commit it; shared by everyone) - Personal preferences via
/remember --global(only on your machine) - Project-specific footguns via
/remember(lives in the project's local.atomcode/memory.md; commit or gitignore your call)
Whether to commit .atomcode/memory.md: if the team also uses AtomCode and the memory is project knowledge (footguns, conventions), commit it; if it's personal notes, add it to .gitignore.
Next steps
- Project Instructions — the best home for full specs
- Slash Commands — full command reference
- Sessions & Undo — the details of
/resume