|
| 1 | +--- |
| 2 | +paths: |
| 3 | + - "scripts/**" |
| 4 | + - "tests/**" |
| 5 | + - "sources.md" |
| 6 | + - "skills/generate-strata-docs/**" |
| 7 | + - "docs/**" |
| 8 | + - "docs/.verification/**" |
| 9 | + - "docs/.curation/**" |
| 10 | +--- |
| 11 | + |
| 12 | +# Architecture |
| 13 | + |
| 14 | +Reference for the documentation pipeline, auto-loaded by Claude Code when you edit the scripts, the |
| 15 | +`generate-strata-docs` skill, the manifest, or anything under `docs/`. Always-on orientation and the |
| 16 | +command list live in `AGENTS.md`. |
| 17 | + |
| 18 | +**The manifest drives everything.** `sources.md` is a markdown table (one row per source: `id`, |
| 19 | +`type`, `repo`, `ref`, `subpaths`, `notes`). A source's `type` selects a profile in |
| 20 | +`skills/generate-strata-docs/references/profiles/<type>.md` telling the documenter how to treat that |
| 21 | +repo. `lint_manifest` rejects a `type` with no matching profile, so a new source type needs both a |
| 22 | +manifest row and a profile file. |
| 23 | + |
| 24 | +**Skill orchestration:** |
| 25 | + |
| 26 | +``` |
| 27 | +Setup (clone to .sources/) → Run 1 DOCUMENT → build graph |
| 28 | + → Run 2 VERIFY→ADJUDICATE→FIX (per doc) → rebuild graph → CURATE → report |
| 29 | +``` |
| 30 | + |
| 31 | +- **Run 1** (`workflows/run-1-document.mjs`): one `general-purpose` agent per source in parallel, |
| 32 | + each reading `skills/generate-strata-docs/references/agents/source-doc.md` + its profile + the |
| 33 | + registries, then writing docs to `docs/sources/<id>/` and a distillation log to |
| 34 | + `.logs/<id>.distillation.md`. |
| 35 | +- **Run 2** (`workflows/run-2-verify-fix.mjs`): per doc, a bounded verify → adjudicate → fix loop |
| 36 | + (`max_rounds`, default 2); residual findings mark the doc `verified: needs-review`, audit trail in |
| 37 | + `docs/.verification/`. Agent role specs live under `skills/generate-strata-docs/references/agents/`. |
| 38 | +- The skill commits to `Workflow` with no fallback: if unavailable it stops and escalates. Subagents |
| 39 | + never talk to the user. |
| 40 | +- **full** mode documents every source; **update** mode only new + changed (`scripts/source_delta.py`), |
| 41 | + detecting drift by the clone's resolved SHA vs the `source_ref.ref` in existing docs and throttling |
| 42 | + re-documentation until a drifted source's docs are a week old. |
| 43 | + |
| 44 | +**Frontmatter is the single source of truth for the graph.** Every doc under `docs/sources/<id>/` |
| 45 | +starts with YAML frontmatter (contract: |
| 46 | +`skills/generate-strata-docs/references/doc-frontmatter-schema.md`). `build_graph.py` derives |
| 47 | +`docs/INDEX.md` and `docs/graph.json` purely from it; never edit those two by hand. |
| 48 | + |
| 49 | +Two cross-link axes, both resolved through registries (fenced kebab-case key lists the linter parses): |
| 50 | + |
| 51 | +- **Feature axis** (`skills/generate-strata-docs/references/feature-keys.md`): an `sdk` doc owns a |
| 52 | + key via `feature_keys`; an `example` doc uses it via `demonstrates`. The builder resolves each |
| 53 | + `demonstrates` to the owning SDK doc and emits an `example-of` edge. |
| 54 | +- **Platform axis** (`skills/generate-strata-docs/references/platform-components.md`): a doc owns a |
| 55 | + component id via `component_keys`; `platform-cli` docs declare `manages`, app/infra docs declare |
| 56 | + `integrates_with`, both resolved to the owning doc. |
| 57 | + |
| 58 | +`lint_docs` hard-fails on any `feature_keys`/`demonstrates`/`component_keys`/`manages`/ |
| 59 | +`integrates_with` value not in its registry. Add the key to the registry before writing any doc that |
| 60 | +references it. |
| 61 | + |
| 62 | +**"Never silently drop" invariant.** The pipeline surfaces every gap rather than hiding it. When |
| 63 | +editing the graph builder, linter, or delta classifier, emit a visible record rather than discarding: |
| 64 | + |
| 65 | +- Clone failure: source recorded **skipped**, not dropped. |
| 66 | +- Registry-valid key with no owning doc: `build_graph` prints a `GAP:` line. |
| 67 | +- Unresolved findings: doc marked `verified: needs-review`. |
| 68 | +- Source removed from `sources.md` with docs still present: `source_delta` reports **orphaned**. |
| 69 | +- Drifted source documented under a week ago: `source_delta` reports **throttled**. |
| 70 | + |
| 71 | +## Conventions |
| 72 | + |
| 73 | +- `docs/.verification/` and `docs/.curation/` are audit trail. Keep them. |
| 74 | +- `scripts/frontmatter.py` is the shared YAML parser for linter and graph builder. Change it in one |
| 75 | + place. |
| 76 | +- The design spec and plan live in `docs/superpowers/{specs,plans}/`; section references like `§3.3` |
| 77 | + in code and the skill point back to that spec. |
0 commit comments