Doctrina
AGENTS.md1 starsChanged 10 days agoMITView on GitHub
Operational source of truth for AI coding agents working in this repository. Follows the open AGENTS.md standard. This repo BUILDS the Doctrina framework and uses it on itself; its artifacts live in .doctrina/. You — the AI agent — run the Doctrina commands. The human gives a brief prompt and approves; do not make them run the CLI or hand-author artifacts. - Bootstrap. No capability in .doctrina/specs/, or an intake still Status: pending? The specs are not written: run doctrina…
- Installs packages
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 repository28 other files it gives its agents.
- CLAUDE.mdCLAUDE.md
- .github/copilot-instructions.mdCopilot instructions
- .cursor/rules/00-doctrina.mdcCursor rule
- add-cli-commandSkill
- cut-a-releaseSkill
- keep-docs-en-pt-paritySkill
- ledger-abandoned-entries-are-ledger-onlySkill
- patch-doctrina-files-as-crlfSkill
- read-the-grammar-through-the-document-modelSkill
- split-an-oversized-specSkill
- stage-a-change-backlogSkill
- triage-holds-work-on-the-machinerySkill
- write-acceptance-evidenceSkill
- add-cli-commandSkill
- cut-a-releaseSkill
- keep-docs-en-pt-paritySkill
- ledger-abandoned-entries-are-ledger-onlySkill
- patch-doctrina-files-as-crlfSkill
- read-the-grammar-through-the-document-modelSkill
- split-an-oversized-specSkill
- stage-a-change-backlogSkill
- triage-holds-work-on-the-machinerySkill
- write-acceptance-evidenceSkill
- doctrina-contextSkill
- doctrina-nextSkill
- doctrina-statusSkill
- doctrina-whySkill
- doctrina-workSkill
The file
We split this AGENTS.md into the rules it gives an agent
7 rules. About 0 are common, 1 is distinctive, and 6 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈1
Distinctive · estimate
This author's own choices. Worth a look.
6
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 12
Bootstrap: No capability in .doctrina/specs/, or an intake still Status: pending?
- Very specific: line 32
Every command, with the moment you reach for it.
- Distinctive: line 74
Run the command lines the CLI prints as printed: paths and titles are quoted for the shell, and tracker text stays data.
- Very specific: line 115
ADR filename: must be NNNN-slug.md — four digits, e.g.
- Very specific: line 124
Every artifact on disk: must be registered in .doctrina/index.json, and every path in index.json must exist on disk.
- Very specific: line 128
Always finish by running doctrina validate and resolving every error: before considering work done.
- Very specific: line 138
Keep this file under 150 lines.
≈ “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
AGENTS.md — Doctrina
Operational source of truth for AI coding agents working in this
repository. Follows the open AGENTS.md standard. This repo BUILDS the
Doctrina framework and uses it on itself; its artifacts live in .doctrina/.
Working from intent (you drive; the human stays passive)
You — the AI agent — run the Doctrina commands. The human gives a brief prompt and approves; do not make them run the CLI or hand-author artifacts.
- Bootstrap. No capability in
.doctrina/specs/, or an intake stillStatus: pending? The specs are not written: rundoctrina intake --text "<description>"and execute the printed playbook in one pass (fillproduct.md, derive capabilities, one EARS spec each,clarify --all+validate, then flip the intake toconverted). Existing code, no specs:doctrina intake --from-code. After conversion the specs are the only source of truth — never editintake.mdto change requirements. - Day-to-day.
doctrina primeopens the session (gates, rules, open work). A request that changes behaviour is a change opened BEFORE code is edited:doctrina work "<request>"— it classifies the lane itself; one change per activity the human asked for. Name the change id in your first sentence to the human. Read withdoctrina context <cap> --for "<task>" --concat—primeis state, not the spec. Project skills are listed where your agent finds skills (.agents/skills/,.claude/skills/). Close withdoctrina close <id>and repeat the archive path it prints. Unsure what's next?doctrina next. Before handover:doctrina handoff.
<!-- doctrina:surface:begin — CLI-owned block, generated from the installed command catalog. Refreshed by `doctrina upgrade --write`; edits inside are overwritten. -->Doctrina command surface (generated — reach for these, don't hand-author)
Every command, with the moment you reach for it. The CLI scaffolds from
canonical templates and syncs index.json. Flags: doctrina <cmd> --help.
Bootstrap
doctrina init— scaffold AGENTS.md and .doctrina/. When: starting a project that has no AGENTS.md yet.doctrina intake— store the intent and print the bootstrap playbook. When: you have a full project description and no specs yet.doctrina adapter list|add|remove— install/remove agent adapters (additive). When: adding or removing an agent's pointer files. Orientdoctrina prime (session start)— gates, open work and next steps in one read (--rules for the full standing rules). When: at the START of every session.doctrina context [<cap>] --for "<task>" --concat— the read pack, assembled to fit a token budget. When: before working on any task, to load the right files.doctrina show— point-read a single artifact by reference. When: you need one requirement, criterion, or ADR, not a file.doctrina search— search the artifact tree, grouped by category. When: you do not know which artifact mentions a term.doctrina status— index, coverage, trace, and artifact counts. When: you need the health of the tree at a glance.doctrina next— the recommended next workflow action. When: you finished something and do not know what follows.doctrina why— provenance: intent, proof, ADRs, and history. When: you need to justify or trace a capability's existence.doctrina handoff (before compaction/handover)— a resume note: open work, task state, next command. When: BEFORE compaction or handing over to another session. Changedoctrina triage— classify the lane (product/runtime/chore) and check the declared runtime surface. When: diagnosing an incident or a runtime symptom —workclassifies every other request itself.doctrina work "<prompt>" (--capability · --chore · --from-diff · --quiet)— scaffold a change and print the playbook to execute. When: a request changes behaviour — BEFORE editing code; it classifies the lane itself.doctrina spec new|list|set— create, list, and edit capability specs. When: a capability needs creating or its headers advancing.doctrina change new|apply|archive|check|tick|abandon|delta|card— drive a change by hand — check --verbose previews every delta. When: driving a change through its lifecycle by hand.doctrina contract new|list|check— own and verify the integration surface. When: the change touches ports, env vars, or public endpoints.doctrina decision new|accept|land|supersede|list|scope— record, accept, land, scope, and supersede ADRs. When: the change decides something a later session must not relitigate.doctrina skill new|list|suggest— capture on-demand procedural memory. When: a lesson is worth not relearning.doctrina intent add|list— append and list product intent anchors. When: new product intent appears after the intake. Gatedoctrina clarify --all (--lang pt|en)— smell-test Markdown for ambiguity. When: before applying, or before opening a PR.doctrina validate (--fix)— schema, structure, EARS, and index drift. When: after any artifact edit, and before considering work done.doctrina coverage --strict— acceptance criteria against cited evidence. When: before claiming a capability is proven.doctrina trace --strict— intent provenance across the tree. When: checking that product intent still maps to capabilities.doctrina review— conformance of your changes vs specs/ADRs/contracts. When: before handing work back, to self-review it.doctrina verify— the project's declared typecheck/test/build checks. When: the real build gate must run.doctrina close <id...>— the whole closing sequence in one attested pass. When: a change is implemented and ready to finish.doctrina doctor— aggregate diagnostic with per-finding remedies. When: something looks wrong and you do not know which gate to ask. Orchestrate (triggers:doctrina <command> --help) —doctrina workspace init|add|attach|detach|list|tool|guard·doctrina delivery new|route|list|status|tick|check|closeMaintain (triggers:doctrina <command> --help) —doctrina templates list·doctrina hooks install·doctrina index rebuild·doctrina watch·doctrina metrics·doctrina completion·doctrina upgrade --write·doctrina ci --emit github
<!-- doctrina:surface:end --><!-- doctrina:changed:begin — CLI-owned. Regenerated by `doctrina upgrade --write`. -->What changed in 0.21.0
- At a workspace root,
next,handoff,status,validate,context,doctorandmetricsanswer for the workspace; neverdoctrina initthere or in a shadowed repository's clone — the commands namedoctrina workspace attachinstead. - A task card carries the delta, the delivery's story and every binding decision, global ones included: as an executor, stop and report when the story or the task contradicts one; a card on placeholder tasks means the planner writes them first (
doctrina work --resume <id>). - Run the command lines the CLI prints as printed: paths and titles are quoted for the shell, and tracker text stays data.
- Cursor: the core loop is skills in
.cursor/skills/doctrina-*/; rundoctrina upgrade --writeto move an older install. With a tool declared the guard fails closed — a refused call means fix the install or ask the human. - Absorb: after writing specs by hand run
doctrina validate --fix; a stored code inventory resumes with a baredoctrina intake, never--from-codeagain.
<!-- doctrina:changed:end -->Stack
Node.js (ESM, zero runtime dependencies), npm workspaces, node:test.
Commands
npm install
npm test --workspace=doctrina-cli
node packages/doctrina-cli/src/index.js verify # the real build gate
node scripts/check-docs.js # docs shape and accuracyRepository structure
The CLI is packages/doctrina-cli/ (src/commands/ render, src/lib/
decides — ADR 0025); docs are docs/en/ + docs/pt/, kept in parity.
Conventions and boundaries
- Specs in
.doctrina/specs/<capability>/spec.mdare the current truth. - ADRs in
.doctrina/decisions/are immutable; supersede instead of edit. - Active change proposals live in
.doctrina/changes/<id>/. - Archived changes in
.doctrina/changes/archive/are out of the default read path; consult only when explicitly debugging history.
Artifact invariants (verbatim — doctrina validate enforces these)
Scaffold with the CLI; do not hand-author from memory. If you must:
- Metadata headers come in two forms — do not mix them up:
- ADRs, change proposals, and the intake use list items:
- **Status:** accepted,- **Date:** 2026-06-13. - Specs use bare bold (no leading
-):**Status:** active,**Version:** 0.1.0. Match the template for the artifact you are writing.
- ADRs, change proposals, and the intake use list items:
- ADR filename must be
NNNN-slug.md— four digits, e.g.0001-jwt-algorithm.md.ADR-001-...mdor1-...mdis invisible todoctrina decision accept, the index, and the orphan check. - Change folder at
.doctrina/changes/<id>/must contain a file named exactlyproposal.md(notchange.md, notREADME.md).tasks.mdanddesign.mdare optional siblings. - Spec lives at
.doctrina/specs/<capability>/spec.mdand its**Version:**header must equal theversionrecorded for it in.doctrina/index.json. - Every artifact on disk must be registered in
.doctrina/index.json, and every path inindex.jsonmust exist on disk. Update the index in the same change that adds or moves a file.
Always finish by running doctrina validate and resolving every error:
before considering work done.
How to read context efficiently
doctrina context <cap> --for "<task>" --concat is the read pack for ANY
task: product.md, the spec, open changes and accepted ADRs, cut to what
the task is about; changes/archive/ is history. doctrina show <ref>
reads one requirement or ADR.
Keep this file under 150 lines; doctrina doctor reports what is left,
and the generated block above grows with the CLI. Use exact commands.
Definition of done
doctrina close <id> is the definition: tasks checked, deltas merged into
specs, gates green, ADRs recorded and accepted, change archived, index
updated. If close refuses, the change is not done.
What never goes in this file
Tutorials, project history, secrets, generated content, session notes.
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.

