Wiki Maintenance — Update Discipline
<!-- uses:
- command: /add-wiki
- script: done.cjs
- skill: add--architecture-discovery
-->
Overview
Keeps {{addpath:wiki/}} accurate between full /add-wiki regenerations. Two triggers share this ONE discipline; only evidence collection (STEP 2) differs. Surgical edits, computed candidates before judgment, no-op is a valid outcome.
When to Use
add-doneSTEP 4.9, pre-merge — automatic, evidence = branch diff + feature context/add-wiki update— manual, evidence = tiered git-log chain from.meta.json
When NOT to Use
- No wiki exists yet → full generation (
/add-wiki), not this skill - Rewriting/regenerating a page wholesale →
/add-wikiowns full generation, this skill never does
WRITE BOUNDARY
Only three writers touch {{addpath:wiki/}}: /add-wiki (full gen), this skill's executions (surgical edits), the user. INSTRUCTIONS.md is NEVER machine-written — read-only steering, always. This skill never touches AGENTS.md (owned by /add-wiki STEP 6).
NO-OP IS A FIRST-CLASS OUTCOME
Nothing relevant changed and the wiki is accurate → edit nothing, report "wiki already current". Still advance .meta.json (STEP 8) — a verified-current run is information, not nothing.
The 9-Step Sequence
STEP 1 — GATE
{{addpath:wiki/index.md}} exists? IF NO → STOP. The caller (add-done or /add-wiki) handles the "run /add-wiki first" suggestion; this skill does not generate.
STEP 2 — EVIDENCE (trigger-specific)
add-done trigger:
CHANGED_FILESfromdone.cjs(the branch diff, already computed in STEP 1 of add-done)- Feature context:
about.md/ changelog just written in add-done STEP 4.5 — grounds impact in stated intent, not just file names
/add-wiki update trigger — tiered chain:
1. .meta.json has gitHead → git log <gitHead>..HEAD --name-status --oneline
+ git diff --name-status HEAD (uncommitted)
2. No gitHead, has updatedAt → git log --since <updatedAt> --name-status --oneline
3. Neither → last 20 commits (--max-count=20 --name-status)
+ explicit best-effort warning
+ suggest full /add-wiki if drift looks large
Cheap pre-check (manual trigger, before any analysis): gitHead == current HEAD AND worktree clean AND the Stack Conventions section is present (conventions.md has ## Stack Conventions; in a tiny wiki, index.md has ### Stack Conventions) → report "wiki already current". Still advance .meta.json only if gitHead differs from current HEAD — if identical, nothing to write; stop here. A missing Stack Conventions section is NOT "already current": go to the backfill in STEP 5.
STEP 3 — CANDIDATES (computed, not judged)
For each wiki page: candidate iff changed files ∩ frontmatter sources globs ≠ ∅. Deterministic, mechanical, runs BEFORE any model judgment — this is the corpus's sources frontmatter earning its keep.
STEP 4 — IMPACT PLAN (judged)
For each candidate + any page you believe is affected beyond the computed set: source change → page → edit needed → why. A page not tied to a relevant change is NOT edited — computed candidates seed the plan, judgment only extends it.
STEP 5 — SURGICAL EDITS (hard rules)
- Prefer replacing one stale sentence over adding new paragraphs. Preserve existing structure/wording when accurate.
- Only edit pages made inaccurate, incomplete, or misleading by the changes. Do not refresh every page.
- No formatting-only edits: no table reformatting, blank-line normalization, reordering, or wording polish unless the surrounding content is already changing for accuracy.
- Soft diff budget: <~5 changed source files → touch ≤1-2 pages. Avoid the hub unless navigation/product-level facts changed. Believing >3 pages need edits → re-examine the impact plan (STEP 4) before proceeding, don't just proceed.
- Canonical-home dedup: detail stays in its canonical page; other mentions stay brief or link-only.
- Renames/deletions (
R/Din evidence): remove or repoint obsolete claims and stalesourcesglobs. A page whose entire source area vanished is deleted and delisted from the hub. - Backlog promotion: changes touching a backlogged area → document it, remove the Backlog entry. Never let the backlog grow silently.
- Terminology (hub section) is a hard constraint: edits use canonical terms; new concepts may add a term (cap 15, hub-enforced).
- Page size caps apply: 300-line target, 500-line hard cap. Over cap on edit → split per
/add-wiki§5 rules, don't just keep appending. - Stack Conventions is a fixed section.
## Stack Conventions(### Stack Conventionsin a tiny wiki) keeps its seven rows. Edits change row cells in place and never drop or reorder a row. The section is exempt from the removal of obsolete claims above: a row is never removed. "No formatting-only edits" still applies. - A
decidedrow is never overwritten by detection. When code now contradicts it, Evidence getsdrift: <path:line>, Value and Source stay, and STEP 9 reports the drift. The row flips todetectedonly when code now provides evidence that matches the decision. - One-time Stack Conventions backfill (bounded exception to diff-driven edits). When
conventions.mdexists without## Stack Conventions— or, in a tiny wiki, the folded conventions section ofindex.mdlacks### Stack Conventions— add the section using{{skill:add--architecture-discovery/SKILL.md}}→ Stack Convention Signals, and bump that page's stamps (STEP 6). - The backfill runs on the
/add-wiki updatetrigger only; it never runs on add-done. - The scan is the Signals searches, repo-wide and read-only.
- Extend the page's frontmatter
sourceswith broad globs covering every new Evidence path, inside the ≤8-glob budget of the Wiki Page Contract, so the next update selects the page when that evidence changes. - Once the section exists, the next run finds it present and makes no change to it.
STEP 6 — STAMPS
Every EDITED page: bump frontmatter commit (current short sha) and generated (today). Untouched pages keep their stamps unchanged — that is the entire point of per-page provenance; touching stamps on untouched pages destroys the staleness signal.
STEP 7 — HUB SYNC
Pages added, removed, or description-changed → update index.md entries + Backlog. Re-verify link↔file bijection (excluding index.md, INSTRUCTIONS.md, non-.md files like .meta.json).
STEP 8 — META
Rewrite {{addpath:wiki/.meta.json}} at the END of EVERY completed run, including verified-current no-ops:
{"updatedAt":"<ISO-8601>","command":"update","gitHead":"<current short sha>"}
Advancing gitHead on a no-op keeps the staleness signal honest and lets the next run's cheap pre-check fire.
STEP 9 — REPORT
Pages edited / added / removed / promoted from backlog — or explicit "wiki already current". Also report the Stack Conventions backfill outcome (added, already present, or not applicable) and one line per decided row in drift (drift: <row key> — <path:line>). Any wiki-vs-code contradiction noticed mid-session (including ones surfaced by consumption commands reporting drift) is evidence for STEP 4/5 edits — treat it as input, not a side note to discard.
Common Rationalizations (BLOCKED)
| Excuse | Reality |
|--------|---------|
| "I'll refresh this page while I'm in there" | Formatting-only edits are forbidden unless content is already changing for accuracy. Leave it. |
| "3+ pages feel relevant, I'll just edit them" | Re-examine the impact plan first — over-budget edits usually mean the plan is wrong, not the budget. |
| "No gitHead, I'll skip evidence collection" | Fall through the tier chain (last 20 commits) with an explicit best-effort warning — never silently do nothing. |
| "Nothing changed, skip writing .meta.json" | Advance it anyway — that's what makes the next pre-check fire. |
| "This page's stamp looks old, I'll bump it too" | Untouched pages keep their stamps. Bumping without an edit is a lie about provenance. |
| "The hub mentions this fact, I'll update it for consistency" | Hub edits require navigation/product-level relevance, not incidental consistency. |