agentleFS
cristobaltormocristobaltormo/cortex-md/docs/agents.md

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.

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
  1. Very specific:

    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 …

    line 58
  2. Very specific:

    Add an install_<agent> function to bin/install-hooks.py, a transcript source and extractor in bin/transcripts.py, a branch in context.py …

    line 64

≈ “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.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
agents.md

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.

AgentHooks (automatic context)SkillsInstructions fileStatus
Claude CodeSessionStart, UserPromptSubmit, SessionEnd~/.claude/skillsCLAUDE.mdTested end to end, including the nightly curator
Antigravity CLISessionStart, PreInvocation, Stop~/.gemini/config/skills.json entryGEMINI.md or AGENTS.mdHooks verified against a real antigravity run
Codex CLISessionStart, UserPromptSubmit, SessionEnd~/.agents/skillsAGENTS.mdWritten from the official hooks documentation; not run against a real Codex yet
Anything that reads AGENTS.mdNoneRead the filesAGENTS.mdWorks by instruction only: no automatic context
./install.sh                        # detects the agents installed on this machine
./install.sh --agents all           # or choose: --agents claude,codex,antigravity

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.

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 Stop after each turn. The hook runs session-end.sh --light: it commits whenever something changed, and pushes in the background at most once every five minutes. Codex uses SessionEnd, whose timeout is a few seconds, so it uses the same light mode.
  • Memory directory. autoMemoryDirectory is 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.py lists 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 with CLAUDE_PROJECTS_DIR, GEMINI_HOME and CODEX_HOME.
  • Hook payloads. inject-memory.py detects the agent from the payload (prompt for Claude Code and Codex, lastUserInput for Antigravity) and answers in the format that agent expects. context.py --agent antigravity prints 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.

Download now (ZIP)

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
What did you use it for? e.g. Reviewing pull requests in a Rails app

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.