What the doctor is
The harness reads the project's docs/ folder as its brief. The doctor is the blocking validator of that contract: a deterministic stdlib script, no model involved, same verdict in CI as in a session. It checks the machine-checkable subset of the harness-project API. Judgment checks (rationale quality, contradictions, enforceability) belong to the audit-docs skill, not here.
Layout
The doctor's engine, manifest, and tests live in the project-side scripts/ directory, beside handoff.py and grading.py; this skill holds the instructions and the brief templates. Keeping the engine in scripts/ means it resolves at a project-relative path under every channel. That includes marketplace, where the skill itself ships in the plugin cache.
| File | Role |
|------|------|
| scripts/doctor.py | The engine. Stdlib only, Python 3.11+. Project-side, like every harness engine. |
| scripts/doctor-expectations.toml | The manifest: roster, required sections, slots, patterns. Harness-owned; consumers never edit it. |
| scripts/tests/test_doctor.py | The suite: one class per check subject, and an anchor test proving a freshly materialized project passes. |
| templates/ | One template per roster file (in this skill). Defaults are complete house-style documents; stubs are structure-only. A stack's <brief>.realization.md beside them is the body init writes into that brief's ## Language Realization section; a stack without one leaves the section to the owner. |
Running
python3 scripts/doctor.py check
python3 scripts/doctor.py check --project-root /path/to/project --json
On the marketplace channel, add --plugin-version-date <plugin-root>/VERSION-DATE — Claude Code expands the plugin root as ${CLAUDE_PLUGIN_ROOT}; Copilot uses its plugin-cache directory. The doctor compares the plugin's bundled release date to the AGENTS.md harness stamp. A mismatch reports an advisory WARN version-skew naming the stale side — typically a plugin update without the marketplace-setup re-run. WARN never changes the exit code.
Exit 0: all checks pass. Exit 1: at least one failure, each printed as FAIL <check>: <detail>. Exit 2: doctor misconfiguration (bad manifest path, unparseable manifest).
What it checks
- Project data —
scripts/layout.tomldeclares a[harness]table withchannel(copy,manifest, ormarketplace) and aspec_versionmatching the manifest. - Roster existence — all seven brief files exist.
- Required sections — exact
##headings per the manifest. - Slots — required data inside sections (the numeric pyramid shares).
- ADR conventions —
docs/adr/README.mdexists; entries matchYYYY-MM-DD-kebab.md. - Cross-doc — every REQ-ID cited in
docs/system-design.mdis defined indocs/prd.md. - Doc word budgets —
docs/prd.mdanddocs/system-design.mdstay under a word ceiling (default 18000 / 12000), overridable per project inscripts/layout.toml[harness](prd_max_words,system_design_max_words). Words, not lines: under the no-hard-wrap writing standard a paragraph is one line, so a line count is blind to prose bloat. A project with genuine scale raises the ceiling deliberately — a recorded, reviewable edit, never silent drift. The ceiling is a backstop; the per-contract discipline indocument-writingis the primary lever. - Field tables —
docs/system-design.mdcarries no field/parameter table headers. Source is authoritative for field lists; a table that mirrors a struct rots when the code changes (the prose form of the same violation is thedoc-reviewer's catch, not the doctor's). - Requirement acceptance — every REQ-ID in
docs/prd.mdappears in at least one Markdown list item. The PRD is narrative prose tagged inline with[REQ-XX-NNN]; the bounded, testable contract is the requirement's "Done when" acceptance bullet. A requirement that lives only in prose has no bar for the fresh-eyes reviewer to judge against. - Handbook references — no roster file references a harness-owned document; the brief stays self-sufficient.
- Handbook documents absent — the project's
docs/carries no harness-owned handbook document (the manifest denylist); their content ships with the harness, and/materializeproposes removing a migrated copy. - Channel invariants — on the manifest and marketplace channels, no harness runtime files are tracked by git.
- Reviewer roster — the four-reviewer floor (code-quality, test, security, doc) has an agent body in every declared tool surface, and each
extra_reviewersentry in[harness]is named*-reviewer, present in every declared surface, listed inextensions, and carries the dispatch-event tokens (dispatch-start,review-workflow) — without the stanza, truncation detection is blind to that reviewer. A*-reviewerbody present but undeclared fails — it would silently never gate. On the marketplace channel the floor check is skipped (those bodies ship in the plugin); extras are project-owned, so their checks and the drift scan still run. - Reviewer fresh-eyes — no reviewer body in the tree instructs reading the implementer's working memory: the retired
implementation-planfile (with or without.md). A project-owned reviewer written against an older harness may still name it. Runs on every channel — every in-tree reviewer body gets the scan, floor or extra (on marketplace only extras are in-tree; the floor ships in the plugin, rendered from the same gated source). Skipped only when the tree carries no reviewer bodies. Reviewers judge the change set against long-term memory (docs/), never the implementer's working memory. - Hook registration — every hook script in
.claude/hooks/is referenced in.claude/settings.json(orsettings.local.json). A delivered-but-unregistered hook never runs. This catches the upgrade gap: hook scripts are harness-owned runtime that materialize replaces. Its settings refresh wires each delivered hook under the event the template registers it on, so a freshly materialized project passes. The check still guards a project not yet re-materialized, and asettings.jsona human de-registered. Skipped when.claude/hooks/is absent — as on the marketplace channel, where hooks ship in the plugin. - Layout module rules — every
[[module]]entry inscripts/layout.tomlnames a strategy the grading engine accepts (dir,first-segment-after:<prefix>,regex:<pattern>— compiling, with a capture group — or a named layout such asgradle/maven). Validated with the engine's own loader, so an upgrade surfaces a config problem here, never mid-grading. - Managed chapters —
AGENTS.mdcarries each harness-managed chapter (## Agent Usage (Mandatory),## Memory,## Writing Standards,## Scratch Directory,## Documentation Updates), present once and non-empty. These are stack-agnostic doctrine refreshed on every materialize; a missing or empty one is a legacy file the/materializemigration has not converted. - Harness stamp —
AGENTS.mdcarries a single, well-formed<!-- harness: YYYY-MM-DD -->stamp (the harness release date) on line 1. Present in every session's context, it lets downstream analysis attribute a session to the harness that produced it. Fails if the stamp is missing, duplicated, or malformed. - Gate vocabulary —
scripts/layout.toml[gate].verbscarries every verb the manifest's[gate] required_verbsnames: the engine-provided checks every stack'scode-quality-gateskill runs. The build-pass schema enumerates its verbs from the project's list, so a required check the project never declared cannot be recorded and drops out of the ledger unseen. The project's build verbs stay its own. Skipped when the optional[gate]table is absent. - Rules-file shadow — no
CLAUDE.md,.claude/CLAUDE.md, orCLAUDE.local.mdstands besideAGENTS.md. Claude Code reads such a file in place ofAGENTS.mdand gives no error, so the session starts without the project rules. A rootCLAUDE.mdwhose only content is the import line@AGENTS.mdpasses; one that adds content after the import warns, because Copilot CLI reads both files. The import is no exemption inCLAUDE.local.mdor under.claude/. A symlink ontoAGENTS.mdfails as a double read. ACLAUDE.mdin a directory above the project warns, whatever it holds: it displacesAGENTS.mdfor a session started on this machine and sits outside the project's tree. A root import stub in the project clears the warning. A declared workspace member that carriesCLAUDE.mdand noAGENTS.mdwarns by name; nothing writes to a member. A project settings file that setscc-plugin-agents-md@builtintofalseunderenabledPluginsfails too: it switches off the plugin Claude Code readsAGENTS.mdwith.settings.local.jsonoutrankssettings.json, so an entry there decides. The id before Claude Code v2.1.285,agents-md@builtin, is read too; the current id decides when both are set. A rootCLAUDE.mdholding@AGENTS.mdexcuses it, since the import loads the rules without the plugin.
Remedies
- Missing file — offer to materialize the matching template: fill
{{PROJECT_NAME}}and{{HARNESS_DATE}}, write the stack's<brief>.realization.mdinto the## Language Realizationsection where one exists. Keep the provenance first line. Materializing is the only remedy for absence — never an invisible fallback. - Existing file fails — report the finding and route the fix to the file's owning agent as a consented diff. The doctor never edits a roster file, and re-materializing over an existing file is forbidden (channel rule).
layout-gate-verbsfailure — the project's[gate].verbspredates a verb the manifest now requires. Add the named verb(s) toscripts/layout.toml; nothing else changes. Until then the gate skill runs the check and the build-pass append refuses to record it.rules-file-shadowfailure — each row names its own remedy. Where it names the harness upgrade, run it: materialize on the copy and manifest channels, the plugin's setup on the marketplace channel. The upgrade renames a legacy file, removes a symlink between the two names, or says what blocks it. ACLAUDE.mdbeside an authoredAGENTS.mdis merged into it by hand and deleted. ACLAUDE.local.mdis the user's own file, and no upgrade touches it: its content moves intoAGENTS.mdor~/.claude/CLAUDE.md, and the file is deleted. The warning for a file above the project is resolved by a rootCLAUDE.mdholding the one line@AGENTS.md. The project owner adds that stub; an agent proposes it and never creates it unasked. Moving the file out of the path resolves it on that machine. A member's warning is resolved by renaming the file in that repository. A switched-off reader is resolved by removing the settings entry, or by adding the import stub when the entry must stay.- New failures after a harness upgrade — that is the upgrade surfacing new expectations. Pair each finding with the shipped default and an offer to draft the project's own stance.
doc-budget/field-tables/req-acceptancefailures on an upgraded project — the docs predate the narrative format. Run thedoc-syncskill § Format Migration: it rebuildsprd.mdandsystem-design.mdin the current format from code, tests, and the existing docs, preserving every REQ-ID, then loops until the doctor is green.