persistent-agent-context
AGENTS.md0 starsChanged 4 months agoMITView on GitHub
This repo maintains a persistent knowledge base in /docs so any coding agent — Codex, GitHub Copilot, Claude Code, Cursor, or similar — starts with full project context instead of re-investigating the codebase every session. 1. Check whether /docs exists. - If it does not: create it and generate the structure below. - If it does: read docs/agent-context.md first, then whichever other files are relevant to the current task. 2. Use that documentation as project memory for this session —…
Where files are headingNew AGENTS.md files have more rules about keeping secrets out of the code, and fewer about checking a change actually works.
Of the AGENTS.md files we read, the 11,736 first seen in the last six months, against the older ones: the kind of rule that gained most share, and the kind that lost most. About files like this in general, not this one, and an estimate, since a kind is a pattern in the words.
In this repository2 other files it gives its agents.
- CLAUDE.mdCLAUDE.md
- repo-memorySkill
The file
We split this AGENTS.md into the rules it gives an agent
9 rules. About 1 is common, 3 are distinctive, and 5 are very specific to this project.
≈1
Common · estimate
Many files like this have a rule of this kind.
≈3
Distinctive · estimate
This author's own choices. Worth a look.
5
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- could be automatic: a setting could enforce it
- Very specific: line 10
Check whether /docs exists.
- Distinctive: line 11
If it does not: create it and generate the structure below.
- Very specific: line 12
If it does: read docs/agent-context.md first, then whichever other files are relevant to the current task.
- Distinctive: line 14
Use that documentation as project memory for this session — don't re-derive what's already documented.
- Distinctive: line 35
Update docs continuously as you discover things — immediately after a major finding, not batched at session end.
- Very specific: line 39
Remove anything proven incorrect.
- Very specific: line 43
Add a Last Updated timestamp to any file you touch.
- Very specific: line 44
Before finishing a task, review and update affected /docs files so the knowledge base reflects current understanding, not a stale snapshot.
- Common: line 49
Never commit API keys, tokens, credentials, connection strings, customer or employee PII, or internal-only business logic to these files.
≈ “Common” is an estimate: at least 1 in 5 of the 16,597 AGENTS.md files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Agent Instructions
This repo maintains a persistent knowledge base in /docs so any coding
agent — Codex, GitHub Copilot, Claude Code, Cursor, or similar — starts
with full project context instead of re-investigating the codebase every
session.
Before doing anything else
- Check whether
/docsexists.- If it does not: create it and generate the structure below.
- If it does: read
docs/agent-context.mdfirst, then whichever other files are relevant to the current task.
- Use that documentation as project memory for this session — don't re-derive what's already documented.
/docs structure
agent-context.md— read this first, always. Project summary, business purpose, tech stack, architecture snapshot, constraints, coding standards, recurring pitfalls, active workstreams.architecture.md— system architecture, app flow, major modules, component relationships, integrations, deployment/build info.code-patterns.md— coding conventions, reusable patterns, state management, data access, testing patterns, examples.findings.md— repo discoveries, undocumented behavior, important file locations, framework-specific notes, troubleshooting.issues-and-decisions.md— bugs and root causes, fixes implemented, design decisions, tradeoffs, lessons learned.future-work.md— technical debt, open questions, known limitations, pending investigations.
Keeping it current
- Update docs continuously as you discover things — immediately after a major finding, not batched at session end.
- Edit existing sections rather than appending new ones. This is what keeps the knowledge base from turning into a stale, ever-growing log.
- Remove anything proven incorrect; mark uncertain findings
Needs Verificationinstead of stating them as fact. - For every significant discovery, record: what was found, the evidence, relevant file paths, the impact, and recommended action if any.
- Add a
Last Updatedtimestamp to any file you touch. - Before finishing a task, review and update affected
/docsfiles so the knowledge base reflects current understanding, not a stale snapshot.
Redaction — required before every write to /docs
Never commit API keys, tokens, credentials, connection strings, customer or employee PII, or internal-only business logic to these files. Describe the shape of an issue rather than including literal secrets.
Style
Record facts, not assumptions. Short, searchable sections. Bullet points over prose. Include file paths and code references. Don't duplicate information across files — link between them instead. Optimize for AI consumption, not a human skim-read.
Success bar
A brand-new session should be able to read docs/agent-context.md
alone and understand at least 80% of the project's architecture,
conventions, constraints, known issues, and current direction — without
re-investigating the codebase.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

