Browse the documentation
CAP-02: Docs freshness check
- ID:
CAP-02 - Title: Docs freshness check
- Lead:
docs - Touches:
seed,capillary,myosotis,aestivation,drosera,trellis,bloom - Horizon:
now - Milestone:
M2 - CLI phase:
none - Status:
proposed - Claim:
planned - Depends on:
CAP-01
Why
Hand-maintained ledgers and cross-repository capability specs inevitably drift as slice PRs land across eight repositories. Without automated freshness tests in both the hub (docs) and each standalone repository, broken spec paths, invalid status/claim pairs, cyclic or milestone-inverted dependencies, malformed tool IDs, or stale ledger.md tables can merge silently.
What it does
Enforces four deterministic freshness rules offline, without network access:
- Hub cross-repo check (
CAP-02.1,test/timeline.test.mjsindocs):- Reads the
docsrepository’sdocs/timeline/capabilities.json,docs/timeline/ledger.md,docs/capabilities/index.json, and lead specs alongside synced peer artifacts undersources/<repo>/docs/capabilities/(index.jsonand spec Markdown files). - Verifies JSON schema validity, exact 1-to-1
leadand symmetrictouchesalignment betweencapabilities.jsonand syncedindex.jsonfiles, slice"milestone"fields matching the capability’s earliest slice milestone (D14), full slice coverage onleadentries vs per-repo slices ontouchesentries (D14), acyclicdependsOngraph resolving bothCAP-NNandCAP-NN.kslice IDs against theleadentry with every dependency milestone less than or equal to the dependent’s milestone (D14), valid two-fieldstatus/claimpairs (D2), and resolution of everyleadrepo-relativespec,touches<repo>/<path>spec, andcontracts[]target (D14). - Compares deterministic
ledger.mdgeneration (fromcapabilities.jsonandleadentries, preserving# Capability ledgeron line 1 and existing columns) byte-for-byte against committeddocs/timeline/ledger.mdand fails on drift. - Fails closed if a synced source carries an unknown status/claim pair, invalid spec heading sequence, or malformed tool ID.
- Reads the
- Standalone repository self-tests (
CAP-02.2toCAP-02.8,test/capabilities.test.mjsin each peer repo):- Runs as part of
npm testinside each repository (seed,capillary,myosotis,aestivation,drosera,trellis,bloom) without requiring any peer checkout on disk. - Verifies local files on disk:
docs/capabilities/index.jsonschema and entry keys (including"milestone"on every slice), validstatus/claimpairs, existence of everyleadspecfile and every listedcontracts[]file inside the repository, existence and shape ofdocs/CHANGELOG.md(earlier-history line above## Unreleased, non-empty subsections only,(CAP-NN, <repo>#<n>)lines),docs/adr/README.md, and the 12-section order in local lead specs. - Checks only
leadspecpaths on disk; validates cross-repositorytouchesspecpaths syntactically (<repo>/docs/capabilities/CAP-NN-<slug>.mdnaming a known family repository) without reading outside the repository tree (D14).
- Runs as part of
- Sync-time
ledger.mdregeneration (CAP-02.9,docssync +docs/sync.md+ sync tests in one commit):- Extends
scripts/sync-sources.mjsalongsidedocs/sync.mdand sync tests in a single commit so sync runs regeneratedocs/timeline/ledger.mddeterministically (preserving# Capability ledgeron line 1,Hand-maintained until CAP-02 lands; generated afterward., and the pure function ofcapabilities.json+leadentries) whenever syncedsources/updates.
- Extends
- Grammar source (
D3) and build order (D14):- Enforces
seedtool-ID grammar (domain . [resource . [sub .]] verb, closed verb set, no forbidden vendor/infrastructure/persona segments) across alltoolIds[]arrays and spec### Tool IDstables. - Pending owner ruling
D3,CAP-02.1sources the grammar fromseedas a commit-pinneddevDependencyofdocs(one grammar, zero runtime dependencies), while peer self-tests run standalone without peer checkouts. - Build order (
D14): landCAP-02.2toCAP-02.8self-tests first, thenCAP-02.1(test/timeline.test.mjsindocs), thenCAP-02.9(sync regeneration withdocs/sync.mdand sync tests in one commit).
- Enforces
Contract touchpoints
docs/sync.md: syncedsources/<repo>/docs/capabilities/files andmanifest.jsondigests feedtest/timeline.test.mjs(CAP-02.1), andCAP-02.9updatesdocs/sync.mdalongside sync code and tests in one commit forledger.mdregeneration.docs/engineering-law.md: zero runtime dependencies, offline deterministicnpm test, and fail-closed unknown handling.
Tool IDs and events
Tool IDs
| Tool ID | Effect | Owner gate | Third-party egress | Summary |
|---|---|---|---|---|
| none | n/a | n/a | n/a | This capability defines no runtime tool IDs. |
Events
| Event | Emitted by | Payload summary |
|---|---|---|
| none | n/a | This capability emits no runtime events. |
Acceptance tests
hub-timeline-validates-repo-and-synced-sources(CAP-02.1):test/timeline.test.mjsvalidatescapabilities.json,docs/capabilities/index.json, and syncedsources/*/docs/capabilities/records together, resolving<repo>/<path>ontouchesentries andleadrepo-relative paths.hub-ledger-drift-fails-closed(CAP-02.1): modifyingcapabilities.jsonor syncedindex.jsonstatus without regeneratingdocs/timeline/ledger.mdcausestest/timeline.test.mjsto fail.slice-depends-on-resolves-against-lead(CAP-02.1): slice IDs independsOn(CAP-NN.k) resolve against the capability’sleadentry and fail if missing, cyclic, or milestone-inverted.repo-self-test-runs-without-siblings(CAP-02.2toCAP-02.8):test/capabilities.test.mjspasses in every peer repository with zero peer directories mounted, checking onlyleadspecpaths on disk and syntactic<repo>/<path>ontouches.invalid-status-claim-or-tool-id-rejected(CAP-02.1toCAP-02.8): an unpermittedstatus/claimpair, cyclicdependsOn, missingcontracts[]file, missing spec section, or invalid tool ID fails the test deterministically.sync-regenerates-ledger-in-same-run(CAP-02.9): sync updatesdocs/timeline/ledger.mddeterministically alongsidemanifest.jsonanddocs/sources-index.md, verified withdocs/sync.mdand sync tests in one commit.
Slices
Build order: CAP-02.2..CAP-02.8 -> CAP-02.1 -> CAP-02.9.
CAP-02.1(docs,M2,proposed): Hub timeline testtest/timeline.test.mjs.CAP-02.2(seed,M2,proposed): Self-testtest/capabilities.test.mjsinseed.CAP-02.3(capillary,M2,proposed): Self-testtest/capabilities.test.mjsincapillary.CAP-02.4(myosotis,M2,proposed): Self-testtest/capabilities.test.mjsinmyosotis.CAP-02.5(aestivation,M2,proposed): Self-testtest/capabilities.test.mjsinaestivation.CAP-02.6(drosera,M2,proposed): Self-testtest/capabilities.test.mjsindrosera.CAP-02.7(trellis,M2,proposed): Self-testtest/capabilities.test.mjsintrellis.CAP-02.8(bloom,M2,proposed): Self-testtest/capabilities.test.mjsinbloom.CAP-02.9(docs,M2,proposed): Sync regeneratesdocs/timeline/ledger.mdwithdocs/sync.mdand sync tests in the same commit.
Non-goals
- Reading peer repositories directly from disk during
npm test(cross-repo checks run indocsagainstsources/, while each peer runs standalone). - Auto-committing changes across peer repositories or bypassing PR review.
- Adding runtime dependencies to any repository (
CAP-02.1grammar sourcing viadevDependencyis governed byD3).
Family rules and conflicts
- Must respect zero runtime dependencies (
docs/engineering-law.md) and standalone repository CI isolation (test/capabilities.test.mjsnever reaches../seedor other peers on disk). - Must keep
docs/sources/strictly read-only during tests and ledger generation, and change sync code,docs/sync.md, and sync tests together inCAP-02.9.
Open owner decisions
D2(unratified / pending owner ruling): Two-field status (statuslifecycle plusclaimtruth label) with fixed pairings enforced byCAP-02.D3(unratified / pending owner ruling): Grammar source for the hub’sCAP-02.1test (review recommendation:seedas a commit-pinneddevDependencyofdocs, keeping one grammar and zero runtime dependencies).D14(unratified / pending owner ruling): Review conventions made under delegation:CAP-02nine-slice split (CAP-02.1hub test only,CAP-02.2toCAP-02.8self-tests,CAP-02.9sync ledger regeneration, build orderCAP-02.2..CAP-02.8->CAP-02.1->CAP-02.9), slice milestones, slice IDs independsOn, andleadvstouchesslice and spec rules.
Evidence
None yet (proposed, planned).
Changes
2026-11-23: InitialCAP-02specification drafted (CAP-01.1).2026-11-23: Review updates: splitCAP-02.1andCAP-02.9with build order, apply slice milestone, slice dependency, andleadvstouchesspec resolution rules, and alignD2,D3, andD14(CAP-01.1).