仓库 →

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

CommandEffect
/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
/memoryShow all active memory entries, grouped under [Global] / [Project], with disk paths

Storage locations

ScopePath
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

LimitValueWhat happens at the limit
Single memory file size64 KBOnly the trailing 64 KB is read (aligned to line boundaries — UTF-8 characters are never split)
Total characters in the injected prompt4000 charsTruncated 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.mdMemory (memory.md)Sessions (/resume)
Best forFull specs, tech stack, detailed conventionsStray facts, personal preferences, command cheatsPast conversation + tool calls
ScopeProjectProject + globalOne specific session
How to addHand-edit/remember or hand-editAuto-saved per conversation
InjectionLoaded into system prompt at startupInjected into system prompt every turnRestored wholesale via /resume
Token costHigh (full doc)Capped at 4000 charsBounded by the context window

Typical combinations:

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