What coding agents forget between sessions
A new session can reread the code, but it cannot reread the conversation where the team decided not to use a particular pattern. That is a memory problem, not a context-window problem.
- Repository conventions that are not written in a linter or a style guide.
- Architecture decisions and the reasons behind them.
- Review feedback that was resolved in a pull request but never documented.
- Approaches that were tried and failed, including the failure mode.
- Which module owns a concern when the codebase has two plausible answers.
What to store and what to leave out
| Store | Do not store |
|---|---|
| Repo conventions and naming decisions. | Secrets, tokens and private keys. |
| Architecture decisions and tradeoffs. | Raw terminal output with no lasting signal. |
| Review feedback that changed the code. | Every line of a long build log. |
| Failed approaches and why they failed. | Personal data unrelated to the task. |
| Ownership and module boundaries. | Temporary debugging state. |
Scopes for a coding workflow
Use a session scope for branch-specific state and a repository or tenant scope for conventions that should survive every branch. Do not let a temporary task memory become a permanent rule.
| Scope | What it represents | Example |
|---|---|---|
| Tenant | The organization or workspace. | tenant:acme |
| User | The developer. | user:dana |
| Agent | The coding agent or tool. | agent:claude-code |
| Session | The task, branch or pull request. | session:pr-4821 |
Share memory across Claude Code, Cursor and Codex
Teams rarely use one coding tool. A developer may use Claude Code in the terminal, Cursor in the editor and Codex for a specific task. The memory should follow the repository and the team, not the tool.
A shared memory layer gives each agent the same conventions and decisions while keeping task state separate. The agent still reads the code; memory tells it what the code alone cannot explain.
memory.add(
text="The payments module owns idempotency keys; do not generate them in the handler.",
user_id="dana",
agent_id="claude-code",
metadata={
"tenant": "acme",
"repo": "checkout-service",
"source": "pr-4821-review",
"kind": "convention",
},
)A workflow that actually changes the next session
- Before the task: search memory for repository conventions and decisions related to the files being changed.
- During the task: keep branch-specific notes in a session scope, not in the permanent graph.
- After review: write the feedback that changed the code, with the pull request id and the reason.
- After merge: supersede any convention that the review changed.
- On deletion: remove task memories when the branch is closed, unless they contain a durable lesson.
Security and retention for code memory
- Redact secrets, tokens, customer data and internal URLs before the write.
- Keep repository-level memories scoped to the tenant, not to a single developer.
- Set a retention window for review comments and task state.
- Export the graph when a repository is archived or a team leaves.
- Audit who can search across repositories.
Frequently asked questions
Does AI Memory read my repository automatically?
No. You send the events, review feedback or document excerpts you want to remember. The coding agent still reads the code through its normal tools.
Can Claude Code, Cursor and Codex share the same memory?
Yes. They can write to the same scoped memory layer while keeping their own agent and session scopes. That lets conventions and decisions follow the repository rather than the tool.
Should I store every pull request comment?
No. Store the comments that changed the code or established a convention. Keep the pull request id and the reason, and set a retention window for the rest.
How do I avoid storing secrets?
Redact before the write. Treat memory as a persistence layer with backups and exports, not as a temporary scratchpad.
What is the highest-value memory for a coding agent?
Architecture decisions, repository conventions, review feedback and failed approaches. These are the things a new session cannot reliably infer from the code alone.
Can I self-host code memory?
AI Memory publishes a self-hosted path for the same API. Confirm the current deployment options if code memory cannot leave your network.
