Sync module docs with knowledge graph. Use when architecture docs drift.
Close the coherence loop between code and architecture docs. Compare knowledge graph truth against module doc frontmatter, update drifted fields, and optionally refresh narrative sections.
When to use: After stories that changed code structure, during /rai-story-close, after discovery refresh.
When to skip: Stories that only changed tests/docs/non-code. No graph available.
Inputs: Knowledge graph (.raise/rai/memory/index.json), module docs ().
governance/architecture/modules/*.mdrai graph build
Read .raise/rai/personal/last-diff.json for changed modules. If no diff or no affected_modules, check all modules.
rai graph context mod-{name} --format json
Compare doc-declared vs code-truth:
| Doc field | Graph truth | Comparison |
|---|---|---|
depends_on | code_imports | Sort both, compare sets |
depended_by | Reverse lookup from other modules | Computed |
public_api | code_exports | Sort both, compare sets |
components | code_components | Direct number |
Fields the skill MUST NOT touch: purpose, constraints, status, entry_points, name, type.
Present drift report:
### mod-memory
depends_on: [config] → [config, schemas] (added: schemas)
components: 30 → 34
Ask: "Apply frontmatter updates to N modules? [y/n/selective]"
Apply changes to YAML frontmatter only — preserve all other content and field ordering.
Trigger A (full review): New/removed modules, major dependency changes (>2), significant API changes (>5).
Trigger B (targeted scan): For any frontmatter change, scan prose for stale hardcoded values (old counts, removed dependency names, removed API names). These are mechanical text fixes.
Present proposed changes as diff. HITL approval before writing.
If any changes applied:
rai graph build
Present summary: modules checked, frontmatter updated, narrative updated, graph rebuilt.
| Item | Destination |
|---|---|
| Updated frontmatter | governance/architecture/modules/*.md |
| Narrative changes | governance/architecture/modules/*.md (with HITL) |
| Summary | Displayed |
governance/architecture/modules/*.md.raise/rai/memory/index.jsonrai graph context mod-{name} --format json