4.1 KiB
4.1 KiB
Proposal: lifecycle-aware-doc-hygiene
Why
os-doc-hygiene monitors stale/bloated docs but cannot manage document
lifecycle: disposable artifacts (autoresearch runs, handoff files, served
plans) accumulate as clutter that distracts AI navigation and search. The
lifecycle-aware design is locked (wayfinder map #31, lifecycle-spec.md,
ADRs 0038–0041); this change implements it.
What Changes
- New
scripts/rulebook.pyloader: globalrulebook.json+ committed repo-root.dochygiene-rules.jsonoverride, add-only merge with source-then-specificity precedence,glob.translatedialect, skip-and-warn validation (unconfirmed rules never act), hard-fail on unparseable JSON/unknown schema_version. - Scanner gains a lifecycle signal class; directory-rule matches prune
the walk (which implements the explicit IGNORE surface:
graphify-out/**,.dochygiene/**— never inferred from.gitignore). - Report schema + clean applier gain
deleteandextract-then-deleteop types with the ADR-0039 autonomy tier matrix (tracked+clean = auto; dirty/untracked = confirm; classifier-judgedserved_when= always confirm), verified at runtime via git, never trusted from the rule. - Temporary tier: retain-recent-N (default 3) + max_age_days (default 3), age from git commit time falling back to mtime; retention unit = the rule's match entry (file or run directory).
- delete-once-served: deterministic
served_when_path(scanner-proven, may auto-delete) vs free-textserved_when(classifier-judged, forced confirm). - Determinism promotion (ADR-0041): global-only
conventions.jsoncatalog (v1: archive-bucket, status-frontmatter);:checkreports gain a promotion-candidates section. - New
:calibrateskill (the ONLY new skill): cluster-and-sample unmatched files → haiku glob nomination → strong-model batched judgment (confirm/reject/amend/consult) → human rule report (glob verbatim, matches, near-miss boundary, tier, plain-language why) → persistence (project rules on judge confirm; global writes human-gated) → retest loop (<2 new rules or <10% shrink, cap 3 rounds). - Extraction reuses existing knowledge routing (ADR route: repo-durable →
docs/ADR/CLAUDE.md; cross-repo → vault). No
propagate_ignore(ADR-0040). - Calibration pass #1 against cc-os per spec §9 (protected-set hard gate, 8-of-10 recall floor with 4 mandatory rows, seed hold-out — pass #1 only).
Capabilities
New Capabilities
lifecycle-rulebook: rulebook file format, locations, merge/precedence, glob dialect, validation, and scanner consumption (walk pruning + lifecycle signals + IGNORE surface).lifecycle-deletion: lifetime taxonomy semantics — temporary tier (retain-recent + age), delete-once-served (served_when_path vs served_when), autonomy tier matrix, true-git-deletion in a dedicated hygiene commit, extract-then-delete routing.determinism-promotion: conventions.json catalog and promotion-candidate nudging split across :check (names) and :calibrate (drafts).calibrate: the learn-new-rules protocol, rule-quality tests (class-not-path, prefer-narrower), and calibration-pass validation criteria.
Modified Capabilities
doc-check: scanner walks are pruned by directory rules; lifecycle signals enter classification; reports include promotion candidates.doc-clean: appliesdelete/extract-then-deleteops under the tier matrix with runtime git tracked/dirty verification.report-schema: new op typesdeleteandextract-then-delete, lifecycle signal fields, promotion-candidates section.
Impact
plugins/os-doc-hygiene/scripts/: newrulebook.py; changes toscanner.py,report_builder.py,validate_report.py,patch_applier.py.- New data files:
rulebook.json,conventions.json(plugin root). - New skill dir
skills/calibrate/SKILL.md(noname:frontmatter; naming per convention doc). Updates tocheck/cleanSKILL.md. - Tests: TDD (red-green) on every deterministic piece; existing suite (286) must stay green.
- Per-project surface: optional committed
.dochygiene-rules.json. - After source edits:
bin/refresh-plugins.