codex/skills/invariant-stewardship/SKILL.md
Use before local patching when bugs, regressions, malformed state, crashes, parser failures, migrations, cache drift, protocol problems, compatibility requests, tolerant readers, fallbacks, coercions, retries, catch-and-continue, or local workarounds may broaden accepted invalid state.
npx skillsauth add tkersey/dotfiles invariant-stewardshipInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Coding agents tend to fix local symptoms by adding local tolerance. Prefer global contract preservation: reduce invalid states, enforce the right boundary, and keep the long-term maintenance surface small.
Use invariant-ace for full invariant design. Use this skill as the fast preflight that decides whether the repair belongs at a producer, transition, boundary, migration, compatibility surface, or upstream owner.
Before changing code for a bug, regression, malformed state, crash, parser failure, migration problem, cache issue, protocol problem, or compatibility request, identify:
Prefer fixes that make invalid states impossible. Do not merely make the downstream consumer tolerate invalid internal state unless historical data, external input boundaries, or explicit product requirements make that necessary.
| State kind | Meaning | Preferred action | |---|---|---| | Valid domain state | State is part of the intended model | Support it directly and test the contract | | Invalid internal state | This repo produced impossible state | Fix the writer/transition; add invariant tests | | Historical persisted bad state | Old releases may already have written it | Prevent future writes; add narrow migration or repair path | | External untrusted input | User/service input may be malformed | Validate at the boundary; return clear errors | | Public API legacy input | Compatibility is a product/API promise | Add documented compatibility path with tests | | Upstream-owned state | Dependency/gateway/protocol produced it | Prefer upstream fix/report; local workaround only with explicit tradeoff | | Fixture-only state | Test setup created impossible production state | Fix the fixture; do not expand production behavior | | Race/partial-write state | Ordering or atomicity allowed intermediate state | Fix atomicity/ordering; avoid retrying everywhere | | Partially migrated state | Migration path can leave mixed versions | Make migration idempotent/narrow; preserve invariant after migration |
Every fallback, tolerant parser, compatibility branch, broad migration, catch-and-continue path, silent default, coercion, retry, debug scaffold, or “best effort” path is a design change.
Before adding one, answer:
Reject fixes whose main effect is to make invalid internal state easier to ignore.
A passing test is not enough. The test must encode the intended invariant, not merely prove the local symptom no longer crashes.
For bug fixes, tests should usually prove one of:
When this skill materially affects the route, leave an invariant receipt:
Invariant Receipt:
- observed failure:
- state classification:
- invariant:
- owner/boundary:
- rejected tolerance path:
- repair:
- proof:
tools
Invokes Apple's macOS 27 fm command-line tool from a local Mac to use the on-device system model or Private Cloud Compute, including instructions, image prompts, schema-constrained JSON, and noninteractive automation. Use when the user asks to run Apple Foundation Models through fm, compare system versus pcc, generate structured output, or automate fm without Swift or an app.
development
Compile historical Codex sessions into governed counterfactual evidence, evaluate an existing owner-applied candidate through blinded paired HCTP trials, and fold observable evidence into RUN, OBSERVE, or STOP. Use for `$hylo`, CRF extraction, counterfactual replay, source-governed direct or historical trials, sealed evidence, paired baseline/candidate evaluation, causal frontiers, or evidence-governed improvement.
testing
Ensure a `ledger` command is available on PATH; materialize, validate, record, replay, and project requested Actuating artifacts without taking semantic or execution authority; coordinate the shared Learnings/Synesthesia/Negative Ledger lifecycle checkpoint and repo-local source-memory reconciliation; address Universalist plans and receipts; and perform pure artifact validation.
testing
Classify and quotient review findings, failing tests, incidents, bug reports, migration failures, and other witnessed falsifiers against accepted intent and the current Construction. Author counterexample-set/v1 without selecting repairs, counting review credit, or granting mutation.