| name | wiki-maintain |
| description | Full wiki housekeeping pipeline: lint, then consolidate duplicates/stale atoms, then restructure taxonomy if needed. User confirms before each write phase. Not for routine read, capture, or ingest. |
| disable-model-invocation | true |
wiki-maintain
Default: run the full pipeline when user invokes /wiki-maintain (no sub-command).
Read ../_shared/disclosure.md and supporting/restructure-patterns.md when restructuring.
Optional arg: category filter or time hint for consolidate, e.g. /wiki-maintain skills.
Pipeline (always in order)
Do not stop after lint and ask which mode — run all phases below in one session.
Phase 1 — Lint (read-only)
- Run
scripts/run-maintain.sh or scripts/run-lint.sh (includes bound check). Stop if unbound.
- Run
scripts/run-maintain.sh "<optional filter>" or scripts/run-lint.sh then scripts/gather-consolidate.sh.
- Parse lint JSON; group issues by
kind.
- Briefly report issue count and top problems.
Phase 2 — Consolidate (plan → confirm → apply)
Always run this phase after lint (even if lint is clean).
- From gather output + lint,
wiki peek relevant atoms and recent raw/dialogs/ (peek only).
- Draft a consolidate plan:
- merge — same topic / redundant atoms → one atom
- deprecate — outdated entries (note in plan; no delete without confirm)
- profile — lines to add/remove in
profile.md
- fix — missing
summary / head / broken fields lint flagged (if trivial)
- If plan is empty: print
Consolidate: nothing to do. and continue to Phase 3.
- Otherwise show plan table to user — stop if declined.
- Apply confirmed edits; append
log.md (## [date] consolidate | summary); wiki refresh.
Phase 3 — Restructure (plan → confirm → apply)
Always evaluate after consolidate.
- From lint (
atom_orphan, atom_missing_category, duplicate/overlapping category/aspect values) and index.md taxonomy, draft a JSON mapping when renames/merges are warranted, e.g. {"日常":"个人","生活":"个人"}.
- If no mapping needed: print
Restructure: nothing to do. and go to Phase 4.
wiki plan-restructure --mapping '<json>' — show affected pages.
- User confirms — stop if declined.
wiki apply-restructure --mapping '<json>'
- Update
schema.md notes, index.md, append log.md, wiki refresh.
Phase 4 — Verify
wiki lint --fix-hints again.
- Summarize: lint before/after, consolidate changes, restructure changes.
Override modes (only if user names one)
| User says | Skip to |
|---|
| "只 lint" / "lint only" | Phase 1 + Phase 4 |
| "只合并" / "consolidate only" | Phase 2 |
| "只改分类" / "restructure only" | Phase 3 |
Stop
- Phase 4 summary delivered, or user declines a write phase (earlier phases already applied stand).