This file defines document structure, Markdown tiers, writing rules, and verify-doc-budgets ceilings. Use dsh-doc-standards for placement and validation, and dsh-prose-standard for required coverage and editorial judgment; the doc-tiers Agent Note owns rationale.
These rules apply to human-facing documentation; Agent Notes remain outside their scope. A postmortem is an incident-scoped reference; chronology records evidence, not a teaching sequence. A document's subject and tree position fix its scope: describe its own subject at appropriate detail and direct children only by purpose, responsibility, and high-level behavior; link to the owning descendant for lower-level detail. Document type does not widen that scope. A reference may be exhaustive only about its own subject. Testing mechanisms, fixtures, and harnesses belong at the lowest owning level; higher documents link there.
Classify every in-scope document as a tutorial or reference. Tutorials follow an ordered path to an outcome and introduce only what each step needs. References define a lookup scope and current behavior without a teaching sequence. Separate substantial tutorial and reference content; label a section when either part is small.
Before writing a tutorial, privately classify the reader's starting knowledge and each concept as beginner, intermediate, or advanced. Establish prerequisites before dependent concepts, increase difficulty gradually, and move unnecessary advanced material to a later tutorial or reference.
Author in this order: locate the document in the tree; set its permitted detail; choose tutorial or reference; for a tutorial, order concepts by prerequisite and difficulty; relocate descendant-owned detail; replace lower-level explanations with links to their owners.
Each fact has one home: the tier whose job it is; elsewhere, link there.
| Tier | Job | Does NOT belong there |
|---|---|---|
Root AGENTS.md |
Standing orders: rules an agent needs in context in every session, one to three lines each, linking its home | Stories, worked examples, situational procedures, anything restated from a linked home |
Subtree AGENTS.md (packages/, examples/, docs/, .agents/notes/) |
Orders specific to that subtree | Repo-wide rules the root file already carries |
| architecture.md | System map: services, loop, capability seams, extension points — read before changing packages/ |
Type definitions (→ subsystems), per-package detail (→ package READMEs), decision rationale (→ Agent Notes), implementation-status annotations |
| subsystems/ | One reference page per subsystem: type definitions, semantics, and the generated Cordis API | Behavior narration (→ architecture.md) |
| Agent Notes | Active decision records: the why, what-was-given-up, and required verification; implemented/ notes describe shipped reality in present tense |
Migration plans, acceptance-task checklists, fixture walkthroughs, and spec-speak ("should…") once the decision has shipped; archived notes are frozen history, never current authority |
| postmortem/ | Incident stories — the only tier where war-story narrative belongs | — |
| cookbook/ | Step-by-step how-tos with numbered verify steps | Design rationale (→ the Agent Note each guide links) |
| user/ | Product-facing guides published by the documentation website | Generated reference tables, contributor procedures, decision history |
| Package README | The per-package contract: config, semantics, limitations, extension points, and Model Experience | JSDoc restatement, generated-catalog restatement (event/tool tables), other packages' concerns |
| development.md | Contributor setup, daily workflow, and a summary of CI; a bilingual pair under the i18n contract | Runtime/version rationale (→ Agent Notes), check-by-check lists that drift from package.json scripts |
Generated reference: the per-page cordis-surface regions in subsystems/, the Cordis core API + inherited tier, tool-catalog, config-catalog, persistence-catalog, module-graph.md |
Exhaustive English sources regenerated from source and freshness-gated; reviewed Chinese counterparts follow the pairing workflow | Hand edits to generated English sources or regions; Chinese counterparts update through pairing only |
Skills (.agents/skills/) |
Reusable workflows and specialized decision standards | Product and runtime contracts (→ docs or source) |
Placement: bugs → postmortems; rationale → Agent Notes; procedures → cookbooks; type definitions → subsystems; package contracts → READMEs; standing orders → root AGENTS.md with a rationale link.
verify-md-wrap): use editor soft-wrap. Code blocks, tables, and list structure keep their formatting; code comments stay under the linter's column limit.ts blocks must compile (doc-typecheck); a pasted type declaration and its original JSDoc use ts type-equiv `, while a body-stripped public class declaration uses `ts public-api; register either in the manifest so neither can drift (mechanics).verify-type-equiv catches drifted pastes, not never-documented new types; a type is documented on its declaring package group's page (page scoping).seam for the defined capability. Name the exact check, type, API, operation, or behavior instead of metaphorical "gate", "vocabulary", or "surface".scripts/doc-budgets.manifest.json sets standing-doc ceilings; pnpm run verify-doc-budgets rejects excess or missing files.
When the gate goes red:
Ceilings are guardrails, not reduction targets. At or below target, retain at least 5% headroom; above target, freeze the ceiling until relocation or condensation brings the document under target. Lower a ceiling only when the document still has room, and raise it when content would otherwise be deleted. Targets: root AGENTS.md ≤ 1,600 words; architecture.md ≤ 1,800; subtree AGENTS.md ≤ 600, except packages/AGENTS.md ≤ 650 and this file ≤ 1,250; packages/README.md ≤ 600. Review governs unbudgeted tiers.
Hunt these in any doc; dsh-doc-standards runs this list as an audit:
implemented/ Agent Notes: "should", migration plans, acceptance checklists. An implemented Agent Note describes what is, per the implemented-note instructions.Link repository references with relative Markdown paths, never bare filenames or Agent Note numbers. verify-md-links rejects missing targets and dead #fragment anchors (rationale).