Skip to content

core: move bounded mechanical hygiene repairs into an explicit CLI operation #1573

Open

Description

@schlessera

Context

Part of #838; follows the conservative CLI-code go in #842 / PR #1572 and docs/decisions/mechanical-hygiene.md. The measured subset scored 96/102 exact held-out outcomes with zero vetoes against 75/102 and 15 vetoes for the shipped skill. It does not implement a full Phase 3 replacement.

Existing anchors: Phase 3 at packages/core/skills/content-hygiene/SKILL.md:94; indexTableLag (packages/core/src/lib/hygiene.ts:522-564), replaceIfUnchanged (packages/core/src/lib/hygiene.ts:1108-1118), editFrontmatter (packages/core/src/lib/frontmatter-edit.ts:216-224) and renderRegistry (packages/core/src/lib/index-registry.ts:117-185). The reviewed corpus is evals/cases/842-*.json; the measured prototype is evals/842-mechanical-hygiene/run.ts. #842/#1572 is delivered: consume its landed decision, conservative support matrix, unchanged/manual cases and combined-patch limitation before implementing. Experimental correctness alone does not establish race, crash or scale safety.

Out of scope

Canonical/semantic conflicts, dispositions or review UI (#597), generated registries, Jev or any generative provider, broad wiki/alias support, fixing unsupported cases merely to raise the score, and automatic background enablement. No new generic repair seam.

Scope

One explicit providerless CLI operation to plan/preview and apply the supported date-only and literal Markdown-link Status repairs. Reuse surgical frontmatter edits, table detection/rendering and unchanged-source application; update the skill to delegate these two operations and log unhandled cases. Preserve the measured conservative ownership and exclusion boundaries.

Acceptance criteria

  • Plan both fields to max(created, updated, UTC mtime day) only for valid date-only updated < created input, preserving quotes/comments/body and refusing unsupported values.
  • Repair only supported hand-authored table rows where Status is the sole non-freshness divergence and detail Updated is newer; set row Status/Updated from detail and bump index updated only on actual change.
  • Never edit inbox, archived paths/status, hygiene logs, generated/registry regions, unknown/duplicate columns or targets, invalid fields or ambiguous/multiple-divergence rows. Unsupported wiki and mixed-row fixtures remain unchanged with an explicit manual reason; do not broaden the prototype grammar in this task.
  • When one index needs both date and table edits, compose both safely or visibly refuse the combined input; never overwrite an earlier planned patch. Add a decisive combined fixture. Use an explicit UTC clock input for index updated, tested at the pinned fixture date.
  • Provide explicit preview/dry-run and apply CLI modes with --json output listing proposals, applied paths and manual/refusal reasons. Dry-run never changes content; repeat apply produces no source or timestamp churn.
  • Re-read every consulted source, config eligibility and mtime before applying; refuse stale inputs visibly. Use existing source-byte write guards and preserve unrelated files/metadata. Keep Markdown authoritative and the existing CLI reconciliation/log ownership.
  • Skill no longer directly performs these supported date/table edits. Canonical judgment remains unchanged; unsupported mechanical cases are logged.
  • Product tests cover the full reviewed corpus: exact bytes for supported positives, explicit unchanged/manual output for unsupported positives and all negative boundaries. Include timezone-offset mtime inputs, stale source/detail edits, untouched files and repeat no-op. Prove the important guards by named mutations.

Verification

All tests keyless/offline using normal test configuration. Run typecheck, lint/leakage, focused tests and bun run check:pr --base origin/main; ready PR requires all selected hosted proof. No live model call is necessary.

Contract impact

Additive CLI machine surface: decide the smallest concrete command name/JSON envelope, update the authoritative integration-contract component in the same CONTRACT: commit and add a minor changeset. No breaking surface, default-on migration, new dependency or extension seam.

Choosing the smallest concrete additive CLI spelling and envelope is normal implementation within these boundaries, not an outstanding product choice. No semantic classifier, permission widening or automatic background repair is selected.

2026-10-24: removed the superseded 2026-10-11 dependency/readiness handoff, including its statement that the issue stays unpickable until the reviewed output is delivered (#842/#1572 is delivered and no blocker remains); folded its still-current points into Context and Contract impact. History is in the comment below.

Activity

  1. added
    type: feat
    area: core
    blocked
    on Oct 11, 2026
  2. added
    priority: p2
    agent-ready
    contract
    and removed
    blocked
    on Oct 11, 2026
  3. schlessera commented on Oct 24, 2026

    @schlessera
    OwnerAuthor

    2026-10-24: the body's "Dependency and readiness handoff — 2026-10-11" section was removed as superseded. For the record, it said: the native #838 parent matches the accepted deterministic-adoption outcome; #842/#1572 is delivered and its reviewed output is consumed before implementation; Phase 3 starts at packages/core/skills/content-hygiene/SKILL.md:94; the command spelling is normal implementation; p2 is wanted, unscheduled adoption; and the issue "remains unpickable until the reviewed output is delivered". That last restriction no longer applies: #842/#1572 is delivered, the blocker declarations were removed on 2026-10-12, and the issue carries no blocked label. The still-current points are folded into Context and Contract impact.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    agent-readyarea: corecontractpriority: p2type: feat

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions