Cortex
AGENTS.md1 starsChanged 18 days agoMITView on GitHub
The single source of truth for any AI agent working in this repository. Claude reads CLAUDE.md, Gemini reads GEMINI.md — both are shims importing this file. Other tools read it natively. Cortex is a project: a context manager for new and legacy codebases, shipped as a Claude plugin and as a clone-and-run repo. People point it at their codebases — personal repos, and team repos at work where several developers share one committed context layer (AGENTS.md, scoped briefs, CONTEXT.md, docs/adr/,…
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,843 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 repository43 other files it gives its agents.
- core/AGENTS.mdAGENTS.md
- evals/AGENTS.mdAGENTS.md
- index/AGENTS.mdAGENTS.md
- mcp/AGENTS.mdAGENTS.md
- tools/AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- architecture-reviewSkill
- audit-notesSkill
- challenge-planSkill
- change-impactSkill
- clarify-requestSkill
- connect-mcpSkill
- create-teamSkill
- daily-planSkill
- debug-issueSkill
- define-termsSkill
- design-specSkill
- end-of-day-summarySkill
- handover-notesSkill
- join-teamSkill
- merge-workSkill
- migrate-legacy-engineSkill
- personal-setupSkill
- quick-noteSkill
- register-projectsSkill
- repo-mapSkill
- resolve-conflictsSkill
- resume-workSkill
- retrospectiveSkill
- review-changeSkill
- set-profileSkill
- setup-repoSkill
- story-mapSkill
- suggest-skillsSkill
- summarize-filesSkill
- sync-websiteSkill
- trim-agent-docsSkill
- update-pluginSkill
- weekly-reviewSkill
- whats-changedSkill
- write-agent-docsSkill
- write-area-briefSkill
- write-context-docsSkill
The file
We split this AGENTS.md into the rules it gives an agent
5 rules. About 0 are common, 3 are distinctive, and 2 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈3
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
- Distinctive: line 15
Treat this repository the way its users treat theirs — as source code with contributors, tests, CI and releases.
- Distinctive: line 20
This repository holds the product and nothing else: No user's content lives here — committed or untracked — because the product is cloned, …
- Very specific: line 46
Every ritual took a plain job name in 3.0.0.
- Very specific: line 89
Run node tools/cortex-capability.mjs for what each ritual needs from the setup running it, and node tools/cortex-skill-graph.mjs for how …
- Distinctive: line 161
Read this file, match your work to a row, then open one leaf.
≈ “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
Cortex — Agent Brief
The single source of truth for any AI agent working in this repository. Claude reads
CLAUDE.md, Gemini reads GEMINI.md — both are shims importing this file. Other tools read it
natively.
What this is
Cortex is a project: a context manager for new and legacy codebases, shipped as a Claude plugin
and as a clone-and-run repo. People point it at their codebases — personal repos, and team repos
at work where several developers share one committed context layer (AGENTS.md, scoped briefs,
CONTEXT.md, docs/adr/, .cortex/memory/). The rituals below are its interface; core/,
index/ and mcp/ are its implementation.
Treat this repository the way its users treat theirs — as source code with contributors, tests, CI and releases. It is not anybody's second brain.
The one rule (data-free)
This repository holds the product and nothing else. No user's content lives here — committed or untracked — because the product is cloned, forked and read by strangers, and gitignore is not a security boundary. That covers personal notes, employer or client names, work tickets, colleague names, and any team's internal architecture. Examples in docs and fixtures stay generic.
A vault — the optional personal second brain the capture rituals serve — lives in its own
private repository and is reached through CORTEX_ROOT. Its operating manual, including the
firewall that keeps a home vault and a work vault apart, is
templates/vault-AGENTS.md; a vault carries a copy as its own
AGENTS.md. When a ritual says "the firewall", that file holds the rule and
ADR 0015 the reasoning.
The product's history is its git log and CHANGELOG.md; archives/ is kept only for a vault and
is ignored in full here.
Vague prompts go through /clarify-request first. A UserPromptSubmit hook scores them in
Claude Code; other agents apply the rules in skills/clarify-request/SKILL.md by judgment.
The rituals
Each is a plain-markdown SKILL.md under skills/ — the canonical copy. Expose them as /slash
commands with bash tools/cortex-sync-skills.sh, or just name a ritual to any AI tool. That
mirror is gitignored, so nothing keeps it current — --check reports drift, and a plain cp -r
never removes anything or refreshes a changed skill. An installed plugin loads skills/ directly
and needs no mirror at all.
Every ritual took a plain job name in 3.0.0. docs/renamed-rituals.md
maps each old name to its new one, for a user or a doc still typing the old command.
| Ritual | When | Does |
/setup-repo | per repo — start here | the single install: index, report, and stamp the whole SDLC loop in one pass, after one confirmation. A report-only path indexes and reports and writes nothing else |
/personal-setup | once | interview the user; fill context/, home.md, connections.md |
/quick-note | anytime | one-line drop to inbox/ or today's daily note |
/daily-plan | each day | open today's note; surface priorities + due items |
/weekly-review | weekly | empty inbox/, update projects/, restamp current-focus |
/retrospective | biweekly | Notice→Decide→Build interview; ship one artifact |
/audit-notes | periodic | vault health: find + fix orphans, dead links, misplaced files, privacy leaks; score for the read-only four-layer score, graph to rebuild the navigator |
/resume-work | starting on work already in flight, or lost in the setup | committed · uncommitted · diverged, then what is left — before touching anything; where the repo is in the setup sequence, and the one command to run now |
/merge-work | work is finished | judge it against the repo's docs, one PR at a time, merge in an order that strands nothing |
/sync-website | after a Cortex release | bring Cortex's public site back in line with the source — refresh its facts, redraft changed pages, PR after approval |
/update-plugin | a skill edit had no effect | make the Cortex this session runs the one you edited |
/repo-map | after install | render the index as one offline HTML page — overview, map, structure, files, areas, gaps |
/write-context-docs | on request | write the context layer — root AGENTS.md, shims, CONTEXT.md, docs/adr/ |
/summarize-files | on request | add summaries/roles/tags on top of the index. Costs tokens; optional |
/write-area-brief | per critical area | write scoped AGENTS.md leaves + wire the root routing table |
/suggest-skills | after scaffold | propose + write skills that fit the detected stack |
/change-impact | before a change | who depends on these files, and which of it no test covers; --against — where it collides with another session's change set; --size — one agent or a team, recommended |
/review-change | before committing | judge a change against the repo's own docs, and spot the ones it made wrong |
/debug-issue | on a hard bug | build a red-capable loop first, ranked against the repo’s own invariants |
/set-profile | per machine | show or set which world this install serves — home · work · lab |
/end-of-day-summary | end of day | consolidate the day into the repo's committed .cortex/memory/ |
/handover-notes | leaving work mid-flight | compact this conversation to the OS temp dir for the next agent |
/trim-agent-docs | per repo, or when the skill collection has grown | audit + slim that repo's agent context files; judge which skills are never reached, redundant, or weaker than a plain prompt |
/write-agent-docs | writing any agent-facing doc, or a new skill | the authoring discipline behind every file Cortex writes, and the steps that create and wire a new skills/<name>/SKILL.md |
/define-terms | per repo, ongoing | sharpen that repo's glossary — write its CONTEXT.md + ADRs |
/design-spec | per risky feature | brainstorm → design spec → plan. No code. |
/migrate-legacy-engine | per repo, once | move off the retired .ai-os/ engine |
/resolve-conflicts | on conflict | resolve a stuck merge/rebase by intent, hunk by hunk. Never --abort |
/register-projects | anytime | register personal repos into projects/ — metadata only |
/connect-mcp | once per machine | install the Cortex Core plugin bundle, and register mcp/server.js at user scope for recall/capture |
/create-team | leader, once | create + seed the shared team-brain repo |
/join-team | per product repo | clone the team-brain; drop .cortex/connector.json |
/whats-changed | after time away | brain notes + team-brain git history → what changed & why |
/story-map | a PM's status, any time | each epic traced to the code its stories touched, what waits on an open ask, where the risk is. Never estimates |
/challenge-plan | before committing to a plan | interview in rounds until the design tree has no unresolved branch |
/architecture-review | on request | find deepening opportunities in a repo, report them as HTML, work one |
/clarify-request | automatic | the prompt gate — scores a vague prompt and sharpens it before work starts |
Run node tools/cortex-capability.mjs for what each ritual needs from the setup running it, and
node tools/cortex-skill-graph.mjs for how they reach each other — which ritual hands off to which,
and whether anything is stranded. A ritual nothing points at is not broken, it is unreachable except
by a user who already knows it exists, which is the same failure as it not being there.
Picking the right ritual:
- On a repo that has never seen Cortex, that is
/setup-repo— working project or brand new, the same command. It indexes, reports, and stamps the whole artifact chain in one pass behind one confirmation, handing off to/write-context-docs,/write-area-briefand/suggest-skillswhere those already own the writing. The table above is a menu and a menu is not an answer; the front door is.index/lib/loop.mjsdecides what a repo is missing andindex/cortex-loop.mjsprints it. - When you are mid-sequence and lost, that is
/resume-worktoo. It reads state off disk and names the single next command, which is the right question once/setup-repohas run and something was deferred.node index/cortex-view.mjs .shows the same sequence as a Next steps tab beside the repo's import graph. /setup-repohas a report-only path. The full pass indexes, reports, offers, and then closes the artifact chain —REVIEW.md, the PR review workflow, the verification block, the verifier, the agent team,intent/, the hooks, the evals, the bands. Ask for a report only to look at a repo without being walked to a served one./debug-issueand/review-changeboth read the context layer and are not interchangeable: review judges a change you already made, diagnosis hunts a symptom you cannot explain. The overlap is diagnosis's first step, where it borrows the review evidence to rank its hypotheses.- Five rituals are typed, never reached from a request:
/quick-note,/daily-plan,/weekly-review,/retrospectiveand/register-projectscarrydisable-model-invocation, beside the once-only ones. A ritual that hands off to one tells the user to type it. ADR 0025 has the measurement. /migrate-legacy-engineharvests the old memory store intoAGENTS.mdbefore deleting anything. Harvest first, delete second — otherwise knowledge is lost across the breaking change./design-specis the heavyweight path;/plan-feature(written by/suggest-skills) stays the lightweight one for routine tickets./register-projectsnever lets company code into ahomevault — that's the vault firewall intemplates/vault-AGENTS.md, not a style preference./write-area-briefnests one filename (AGENTS.md), never a sprawl of per-topic files. Split only where a real invariant or gotcha lives./trim-agent-docstargets other repos;/audit-notestargets a vault. It never deletes prose on its own authority./write-agent-docsis its other half — the discipline for writing an agent-facing document, reached before authoring a brief or a skill, not after an audit calls it bloated./resume-workis the front door to the context-gap rituals, and it exists because they were not being reached. A session that opens on work in flight asks "what's left" as a question to the model, when it is a question for the repo — the branches, the open PRs,.cortex/memory/andcortex-next.mjsall answer it off disk. Resume reads those, states the state, and routes to whichever of/end-of-day-summary,/handover-notes,/whats-changedor/merge-workthe answer calls for./handover-notes,/end-of-day-summaryand/whats-changedall move context across a gap and are not interchangeable. The cut is in-flight state versus durable knowledge:/handover-noteswrites ephemerally to the OS temp dir for the next agent right now,/end-of-day-summarycommits what a future reader of the codebase needs,/whats-changedwrites nothing and reads. Running/handover-notesalone on a day that taught you something loses the lesson./story-mapand/whats-changedboth answer a project manager and are not interchangeable: one says where each epic stands against the code, the other what happened since a date. The pm role pack carries/story-maponly, because/whats-changedruns a script;/story-mapcovers the catch-up there through thecatch_me_uptool./define-termswrites aCONTEXT.mdin the target repo — that repo's glossary of terms. It is not a vault'scontext/(who you are), and its ADRs are notdecisions/log.md(your personal decisions). Same word, two different things; never merge them.
Changing Cortex itself — the contributor invariants (version stamping, the capability floor,
the consent gate, the shell path guard, the two tests that matter) live in
docs/changing-cortex.md. Read it before editing anything in this
repository, whichever package you are in. It is not optional background: several of those rules
exist because the mistake they prevent has already been made here once.
The code layers
core/ shared kernel — depends on nothing else in this repo
/ \ paths (the root guard) · scrub (the secret gate) · memory · date
index/ mcp/ leaves — depend on core, never on each otherWhere to look
Read this file, match your work to a row, then open one leaf. Do not read all three.
First, though: docs/changing-cortex.md holds the invariants that apply
to every row below — how versions are stamped, what a destructive shell tool must route
through, what a ritual must declare. Read it once before your first change here.
| Working in | Read first |
core/ — paths, scrub, memory, date | core/AGENTS.md |
index/ — indexer, findings, enrichment | index/AGENTS.md |
mcp/ — the live brain, the ai-os CLI | mcp/AGENTS.md |
tools/ — the scripts a person runs, and the repo's self-checks | tools/AGENTS.md |
evals/ — scored tasks for skills, training them with SkillOpt, and the outcome harness | evals/AGENTS.md, then evals/README.md for how to run them |
skills/, templates/, references/ | this file is enough |
Domain terms are defined once in CONTEXT.md; decisions and their rejected
alternatives are in docs/adr/.
core/test/architecture.test.js enforces this: it fails if core/ reaches upward, or if either
leaf imports the other. It exists because the rule was already broken once — index/ was pulling
the secret scanner and a date helper straight out of mcp/lib/. Shared code goes in core/;
convenience imports across leaves are how two packages get welded into one.
- Leaf-internal invariants live in the leaf, not here.
mcp/AGENTS.mdowns the Vault door, the two server modes and the mode/audience seam;index/AGENTS.mdowns determinism, regex import resolution, the three coverage signals, and why the walker asks git rather than.cortexignore. Copies of them here drifted once already; read the leaf before changing behaviour it governs, and write the detail there. - [[codebase-design]] is vocabulary, not a ritual — the words for how code is shaped (module,
interface, depth, seam, adapter). [[operating-principles]] decides what to build; that decides
what it looks like.
/design-specand/write-area-briefshould both speak it.
Two subagents live in agents/ — cortex-auditor (dispatched by /audit-notes) and
cortex-role-reviewer (dispatched by /review-change, once per angle: security, performance,
accessibility, data-integrity, operability, dx). A role reviewer grounds itself in the target repo's
index and must cite path:line — an ungrounded persona gives advice true everywhere and actionable
nowhere. Both live in agents/ because an installed plugin loads subagents from there;
.claude/agents/ would work in this checkout and ship to nobody.
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.

