codex/skills/invariant-ace/SKILL.md
Turn should-never-happen into cannot-happen with authority-gated invariant design: owned inductive invariants, counterexample traces, source-of-truth proof, transition preservation, exception authority, witness parity, enforcement boundary, and verification. Use for invariants, impossible states, validation sprawl, cache/index drift, idempotency/versioning, retries/duplicates/out-of-order events, races, loop correctness, policy exceptions, generator/validator parity, descriptor identity, witness drift, fixture preconditions, or invariant-first hardening. Not for generic refactors, architecture essays, or implementation without an invariant gate.
npx skillsauth add tkersey/dotfiles invariant-aceInstall 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.
Turn "should never happen" into "cannot happen" with minimal, high-leverage changes: name the real state owner, define owned inductive predicates, prove a counterexample trace, choose the strongest cheap enforcement boundary, and attach verification that can falsify the invariant and the proposed enforcement.
This skill is discriminative, not decorative. An invariant proposal is a claim to adjudicate, not a mandate to add checks. A property may be true, useful, or reviewer-sounding and still be the wrong invariant, wrong owner, wrong scope, wrong phase, wrong witness, or wrong boundary.
Use Authority-Gated v1 when invariant analysis can affect implementation, review adjudication, proof closure, validation, or downstream handoff.
Authority-Gated v1 requires:
Compact mode is allowed only for exploratory invariant sketches, and it must block implementation handoff unless the Invariant Gate passes.
Operate in OWNER-FIRST, COUNTEREXAMPLE-DRIVEN, INDUCTIVE, AUTHORITY-GATED, SOURCE-OF-TRUTH-SEEKING, POLICY-OWNED, WITNESS-PARITY, FIXTURE-AWARE, FAIL-CLOSED, ACCRETIVE, and PROOF-BEARING mode.
enforce-now.validate-only, proof-only, defer, no-change, or blocked invariant rows into implementation.enforce-now; clear the veto or stay non-permissive.For consequential invariant work, use custom Codex authority agents. They solve both bandwidth and authority: independent lanes gather evidence in parallel, and each lane owns a decision dimension.
Required lanes when an invariant can become implementation work or block closure:
| Role | Owns |
|---|---|
| inv-counterexample-authority | concrete bad trace, reachability, falsifier |
| inv-owner-scope-authority | state owner, scope, source of truth, same-objective fit |
| inv-induction-authority | transition set and preservation/induction closure |
| inv-boundary-authority | enforcement boundary and why local/stronger/weaker cuts are wrong |
| inv-witness-parity-authority | generator/validator/projection/certificate/fixture/witness parity |
| inv-verification-authority | proof signal tied to each predicate |
| inv-skeptic-authority | strongest no-invariant/no-enforce countercase |
Authority rules:
enforce-now requires all required authority lanes clear and the skeptic lane defeated.enforce-now.blocked unless a same-schema root-equivalent packet is emitted.See references/authority-fanout.md and references/CODEX_SUBAGENTS.md.
Before declaring an invariant, record:
artifact_state_id:
branch:
base:
head:
diff_digest:
proof_state:
direction_state_id:
source:
source_ref:
same_objective:
non_goals:
compatibility_posture:
Then ask:
Classify each candidate:
accepted: owned, inductive, enforceable, currently material, and cleared by authority lanes.candidate: plausible but missing route-changing evidence.downgraded: useful property, but it is a pre/postcondition, liveness goal, derived check, test-only guard, or non-material convention.rejected: wrong owner, wrong scope, wrong identity rule, ungrounded, duplicate boundary, or direction-conflicting.unresolved: material uncertainty; validation or artifact search required.blocked: missing artifact state, direction state, authority packet, identity proof, or verification path prevents safe routing.Allowed routes:
enforce-now: implement/handoff allowed only after gate passes.validate-only: add proof/probe/test before mutation.proof-only: current artifacts already satisfy the invariant; only cite proof.defer: real invariant but wrong owner/timing/scope.no-change: reject/downgrade; no implementation work.blocked: fail closed.Emit these sections, in order, for consequential runs:
Review BasisCandidate Invariant InventoryCounterexample LedgerInvariant LedgerOwner and Scope LedgerTransition / Induction MatrixEnforcement Boundary DecisionPolicy / Exception LedgerWitness and Fixture Parity LedgerVerification PlanAuthority Packet ReceiptsAuthority Clearance MatrixAuthority Veto LedgerAccepted InvariantsValidate OnlyProof OnlyDefer / No ChangeChange AgendaAcceptance Skew AuditAll-Invariant Accepted Justification when every substantive candidate is accepted or enforce-nowInvariant GateAce Bottom Line- candidate_count:
- accepted_count:
- validate_only_count:
- proof_only_count:
- defer_or_no_change_count:
- blocked_count:
- candidate_ids:
- accepted_ids:
- validate_only_ids:
- proof_only_ids:
- defer_or_no_change_ids:
- blocked_ids:
- missing_candidate_ids:
- duplicate_candidate_ids:
| id | predicate | owner | scope | holds when | source of truth | acceptance status | enforcement boundary | verification signal | evidence ref | route | |---|---|---|---|---|---|---|---|---|---|---|
| id | counterexample | owner/scope | induction | boundary | witness/parity | verification | skeptic | authority status | packet refs | |---|---|---|---|---|---|---|---|---|---|
Allowed clearance values: clear, veto, unresolved, not-needed, not-in-scope. Skeptic values: defeated, veto, unresolved, not-needed. Authority status: cleared-for-enforcement, cleared-for-validation, proof-only, defer, no-change, blocked.
| id | veto source | veto class | veto claim | evidence ref | required to clear | final route | |---|---|---|---|---|---|---|
Veto classes include: no-counterexample, wrong-owner, wrong-scope, not-inductive, wrong-boundary, policy-bypass, identity-drift, witness-missing, fixture-precondition-mismatch, duplicate-boundary, validation-needed, proof-only, direction-conflicting, missing-packet.
| id | route | change | proof or validation required | next | owner | |---|---|---|---|---|---|
The Change Agenda must be an exact projection of route in the Invariant Ledger. It must not use broad words like all when explicit IDs are required.
Required fields:
artifact_state_coverage: pass / failcandidate_inventory_coverage: pass / failcounterexample_coverage: pass / failowner_scope_coverage: pass / failinduction_coverage: pass / failboundary_decision_coverage: pass / failpolicy_exception_coverage: pass / failwitness_fixture_parity_coverage: pass / failverification_coverage: pass / failauthority_packet_coverage: pass / failauthority_clearance_coverage: pass / failauthority_veto_coverage: pass / failchange_agenda_consistency: pass / failacceptance_skew_audit: pass / failinvariant_gate_complete: pass / failimplementation_handoff_allowed: yes / novalidation_handoff_allowed: yes / noproof_only_handoff_allowed: yes / noinvariant_gate_complete may be pass only when all preceding required gate fields pass. implementation_handoff_allowed: yes requires at least one enforce-now row whose authority status is cleared-for-enforcement and no unresolved veto exists for that ID.
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.