The cold-start problem
Agents are stateless by design. Each session opens with a blank context window. Anything your agent learned in a previous session — the pattern you established, the dead end you already explored, the architectural decision you made — is gone. You either re-explain it every time, or the agent rediscovers it from scratch. The cost compounds as your project grows. The more conventions, boundaries, and gotchas your codebase accumulates, the more time each session wastes on context re-establishment instead of actual work.The two-file solution
The Agent Context System gives your agent two files to read at the start of every session:AGENTS.md
Committed and shared. Always loaded into the agent’s prompt. Stays under 120 lines. Contains compressed project knowledge: patterns, boundaries, gotchas, commands, and architecture. Every agent on your team reads this file.
.agents.local.md
Gitignored and personal. Your private scratchpad. Grows over time as the agent logs what it learns at the end of each session. Session notes, dead ends, preferences, and patterns that haven’t been promoted yet.
The session workflow
Agent reads both files at session start
When you open a session, the agent reads
AGENTS.md first — giving it compressed project knowledge it can act on immediately. Then it reads .agents.local.md, loading accumulated learnings from past sessions. The agent now has context that persists across sessions without you lifting a finger.Agent does the task
With both files loaded, the agent works with the full context of your project: the patterns to follow, the boundaries to respect, the gotchas to avoid. It doesn’t need to rediscover these things — they’re already in its prompt.
Agents don’t have session-end hooks. Sessions end when you stop talking. Logging only happens if you prompt the agent: “log this session” or “update the scratchpad.” Claude Code handles this automatically via auto memory. For other agents, build the habit of asking for a log when meaningful work was done.
Why passive context beats active retrieval
You might wonder: why not just keep all this knowledge in separate reference docs and let the agent look things up when it needs them? Vercel ran evals that answer this directly:| Approach | Pass rate |
|---|---|
| No docs | 53% |
| Skills (agent decides when to read) | 53% |
| Compressed docs embedded in root file | 100% |
AGENTS.md is designed to be passive context: always loaded, always present, always applied. The agent doesn’t choose to use it — it’s already there.
The instruction budget
Frontier LLMs reliably follow about 150-200 instructions. Claude Code’s built-in system prompt already uses around 50 of those. That leaves roughly 120 instructions for your project context — which is exactly whyAGENTS.md has a 120-line limit.
Going over that limit doesn’t give you more coverage. It gives you instructions that quietly get deprioritized. Staying under 120 lines is a feature, not a constraint.
This budget matters even more when you use subagents. Each subagent spawned by a lead agent starts fresh with a clean context window. If your
AGENTS.md is 500 lines, you’re paying that token cost for every agent you spawn — and still risking deprioritization. Under 120 lines keeps the shared brain lean and reliable.