Contracts
tool-surface-repair-contract.md
Contract — tool-surface repair honesty
<!-- round-trip: skip: illustrative CLI-behavior contract, not mission frontmatter -->
doctor tool-surfaces --tool gemini --fix (Seam A)
- GIVEN a stale
GEMINI.mdand NO.gemini/→ the block is refreshed; surface reportedrepaired. (was: exit 0, unchanged) - GIVEN a stale
LLXPRT.mdand NO.llxprt/→ refreshed (latent twin). - GIVEN a selected, stale, truly-unwritable surface → reported
failed(named), non-zero. Never silentnot_applicable. - GIVEN an unselected harness →
not_applicable(legitimate).
upgrade (Seam B, Windows-mode condition)
- GIVEN the freshly-created
.agents/skillsobserves mode ≠ 0o755 (Windows) →upgradeconverges in ONE run (all command + doctrine skills applied), exit 0; noCompleted command output changedraise. - Second
upgrade→ zero changes (idempotent). upgrade --dry-runafter convergence → zero repairs (no phantomchmod).
Invariants
- OUT-1 (parity): detect-applicable == repair-applicable for every supported selected surface.
- OUT-2 (host-aware, POSIX-safe): mode compared only where the host can represent it; POSIX correctness unchanged off-Windows.
- OUT-3 (honest failure): residual drift → non-zero/
failed, never exit-0 silent. - OUT-4 (single-pass): one invocation converges; a second is a clean no-op.