cortex-md
AGENTS.md1 starsChanged 4 days agoMITView on GitHub
The brain is plain files, so any agent that can read markdown can use it. What differs is how much runs automatically. cortex-md has three tiers. The installer merges into each agent's own configuration, keeps a timestamped backup of any file it changes, never overwrites hooks it did not write, and is idempotent. Claude Code. Hooks in ~/.claude/settings.json, autoMemoryDirectory pointing at memory/, and each skill linked into ~/.claude/skills. Antigravity CLI. A hook group named cortex-md in ~/.gemini/config/hooks.json: SessionStart injects the…
Where files are headingNew AGENTS.md files have more rules about keeping secrets out of the code, and fewer about code style.
Of the AGENTS.md files we read, the 31,439 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 repository3 other files it gives its agents.
- close-sessionSkill
- memory-keepingSkill
- rememberSkill
The file
We split this agents.md into the rules it gives an agent
2 rules. About 0 are common, 0 are distinctive, and 2 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈0
Distinctive · estimate
This author's own choices. Worth a look.
2
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 58
Put the same instructions file where the agent reads it (AGENTS.md covers most of them) and tell it to read memory/MEMORY.md at the start …
- Very specific: line 64
Add an install_<agent> function to bin/install-hooks.py, a transcript source and extractor in bin/transcripts.py, a branch in context.py …
≈ “Common” is an estimate: at least 1 in 5 of the 40,246 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
Supported agents
The brain is plain files, so any agent that can read markdown can use it. What differs is how much runs automatically. cortex-md has three tiers.
| Agent | Hooks (automatic context) | Skills | Instructions file | Status |
| Claude Code | SessionStart, UserPromptSubmit, SessionEnd | ~/.claude/skills | CLAUDE.md | Tested end to end, including the nightly curator |
| Antigravity CLI | SessionStart, PreInvocation, Stop | ~/.gemini/config/skills.json entry | GEMINI.md or AGENTS.md | Hooks verified against a real antigravity run |
| Codex CLI | SessionStart, UserPromptSubmit, SessionEnd | ~/.agents/skills | AGENTS.md | Written from the official hooks documentation; not run against a real Codex yet |
Anything that reads AGENTS.md | None | Read the files | AGENTS.md | Works by instruction only: no automatic context |
./install.sh # detects the agents installed on this machine
./install.sh --agents all # or choose: --agents claude,codex,antigravityThe installer merges into each agent's own configuration, keeps a timestamped backup of any file it changes, never overwrites hooks it did not write, and is idempotent.
What each agent gets
Claude Code. Hooks in ~/.claude/settings.json, autoMemoryDirectory pointing at memory/,
and each skill linked into ~/.claude/skills.
Antigravity CLI. A hook group named cortex-md in ~/.gemini/config/hooks.json:
SessionStart injects the continuity context as a persistent system message, PreInvocation
injects the suggested notes as an ephemeral message before every model call, and Stop commits the
brain. The brain's skills/ directory is registered in ~/.gemini/config/skills.json. Antigravity
reads GEMINI.md and AGENTS.md from the working directory upward and expands @[label](path)
includes, so the instructions file can include memory/MEMORY.md directly.
Codex CLI. Hooks in ~/.codex/hooks.json (the output format is the same one Claude Code uses),
skills linked into ~/.agents/skills. Codex asks you to review new hooks once: run /hooks in the
CLI and trust them. If your ~/.codex/config.toml already defines inline [hooks], Codex uses one
representation per layer and the installer warns you.
Differences you should know about
- Stop versus SessionEnd. Antigravity has no end-of-session event, only
Stopafter each turn. The hook runssession-end.sh --light: it commits whenever something changed, and pushes in the background at most once every five minutes. Codex usesSessionEnd, whose timeout is a few seconds, so it uses the same light mode. - Memory directory.
autoMemoryDirectoryis a Claude Code setting. Other agents find the notes through the instructions file and the per-message suggestions. - The curator. The nightly curator runs through the Claude Code CLI but reads the conversations of
all three agents:
bin/transcripts.pylists them (Claude Code under~/.claude/projects, Antigravity under~/.gemini/antigravity*/brain/*/.system_generated/logs, Codex under~/.codex/sessions). Claude Code and Antigravity formats are tested; the Codex one is read best-effort. Override the locations withCLAUDE_PROJECTS_DIR,GEMINI_HOMEandCODEX_HOME. - Hook payloads.
inject-memory.pydetects the agent from the payload (promptfor Claude Code and Codex,lastUserInputfor Antigravity) and answers in the format that agent expects.context.py --agent antigravityprints the Antigravity format; the default is the Claude Code and Codex one.
Using the brain from an agent without hooks
Put the same instructions file where the agent reads it (AGENTS.md covers most of them) and tell
it to read memory/MEMORY.md at the start and to follow the memory-keeping skill when it writes.
You lose the automatic continuity and the per-message suggestions, and keep everything else.
Adding another agent
Add an install_<agent> function to bin/install-hooks.py, a transcript source and extractor in
bin/transcripts.py, a branch in context.py and
inject-memory.py if its hook output differs, and a test in tests/test_engine.py. The engine has
no other agent-specific code.
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.

