transition-invariant
Ratify, reject, or retire an invariant on human direction. Update lifecycle metadata without changing the invariant's body.
- License 许可
- MIT
- 最近更新
- 2026-11-12
- Stars
- ★ 0
- Forks
- 0
01 前言 Front Matter
- name
- transition-invariant
- metadata
- { "tags": "invariants, state-machine, ratification, human-gate", "bundles": "crux-docs", "triggers": "ratify invariant INV-NNNN | reject invariant INV-NNNN | retire invariant INV-NNNN | transition invariant", "risk_level": "low", "requires_access": "write-tree" }
- description
- Ratify, reject, or retire an invariant on human direction. Update lifecycle metadata without changing the invariant's body.
- disable-model-invocation
- true
03 SKILL.md 正文
Transition Invariant
<!-- BEGIN GENERATED: runtime-compat -->
Runtime compatibility
This skill is portable across Claude Code, Codex, OpenCode, and OMP (Oh My Pi). This section overrides platform-specific labels below.
- Before running a command that uses
CRUX_PLUGIN_ROOT, set it to the installed plugin root. In Claude Code, use the value ofCLAUDE_PLUGIN_ROOT. In Codex, OpenCode, and OMP, derive it from the absolute path of this selectedSKILL.md: the plugin root is the parent of itsskills/directory (in OMPbash,skill://<name>resolves to the skill directory). In a source checkout, use the checkoutcrux/directory. - For project-local skills, use
.claude/skillsin Claude Code,.agents/skillsin Codex,.opencode/skillsin OpenCode (which also reads the singular.opencode/skill), and.omp/skillsin OMP. SetCRUX_LOCAL_SKILLS_DIRto that path before following any command below that uses it. - Translate Claude Code tool labels such as
Agent,Read,Write,Bash,WebSearch, andWebFetchto the matching capability in the current session. Codex names its own capabilities; OpenCode uses the lowercase formssubagent,read,edit,shell,websearch, andwebfetch, whereeditcovers bothEditandWrite; OMP usestask,read,edit,write,bash,grep,glob,find,todo, andweb_search(wherereadalso handles URLs andskill://URIs). Do not attempt to invoke the Claude Code labels as literal commands on another host. - Install the generated role agents before delegating:
install-codex-agentsin Codex,install-opencode-agentsin OpenCode,install-omp-agentsin OMP. Codex names themcrux_architect,crux_brainstormer,crux_commander,crux_dev_lead,crux_developer,crux_historian,crux_librarian,crux_night_gardener,crux_reviewer, andcrux_wayfinder; OpenCode and OMP use the bare role namesarchitect,brainstormer,commander,dev-lead,developer,historian,librarian,night-gardener,reviewer, andwayfinder(in OMP,scoutmay also be used for reconnaissance alongsidewayfinder). If a required role or capability is unavailable, report that truthfully instead of claiming it ran. - Argument placeholders such as
$adrand$bookbind only in Claude Code. On a host without argument binding they are unset — take the value from the user's phrase. The "Fields OpenCode ignores" section ofOPENCODE_GUIDE.mdnames the invocation-control fields OpenCode ignores. <!-- END GENERATED: runtime-compat -->
Overview
The ratification state machine for invariant pins — the human gate of the machine-proposes/human-disposes model (see docs/AGENTS.md §15.3). recover-invariants proposes pins as ratification: observed; only this skill, driven by a human, disposes of them. It is the invariants-concern sibling of transition-adr: it operates ONLY on the ratification frontmatter of an existing ledger page (and the reconciliation mapping when a check binding changes), and it never touches a pin's identity, class, provenance, or the why body.
Core principle: the state machine is the contract, and recovery cannot self-ratify. Every transition that isn't explicitly allowed is refused with a clear error.
observed ──ratify──▶ ratified ──retire──▶ retired
│
└──reject──▶ rejected
Allowed transitions, exhaustively:
| From | Op | To | Notes |
|---|---|---|---|
| observed | ratify | ratified | A human affirms this is a real intended invariant. |
| observed | reject | rejected | A human judges the recovered candidate is not an intended invariant. |
| ratified | retire | retired | Explicit retirement — a pin you silently stop enforcing "becomes a lie in the suite." |
Everything else is REFUSED with an error naming the current ratification and the requested op. There is no path back into observed (that is recover-invariants' entry state only), and no rejected/retired → anything.
When to use
- User says: "ratify invariant INV-NNNN", "reject invariant INV-NNNN", "retire invariant INV-NNNN", "transition invariant INV-NNNN", "accept this recovered invariant".
- Immediately after a human review of
observedpins produced byrecover-invariants.
Do not use this skill for:
- Creating a pin or emitting candidate checks — that's
recover-invariants(machine). - Editing a pin's
class,provenance, identity, or the why body — refuse. Recovery + human authoring own those; this skill flips ratification only. - Auto-ratifying on the machine's behalf.
ratifiedis reachable ONLY by explicit human instruction; a batch/auto "ratify all observed" is refused. - Transitioning an ADR (that's
transition-adr) or a brief (that'stransition-brief).
Inputs
Subcommand form: transition-invariant <op> <id> where <op> ∈ ratify | reject | retire and <id> is the pin id (e.g. INV-0007), with or without an artifact prefix (§14.3).
The pipeline
0. Resolve per-repo configuration
Run python3 "${CRUX_PLUGIN_ROOT}/scripts/bionic-config.py" (compat: crux-config.py) from the repo root; use the resolved docs_dir wherever this skill says docs/, and accept prefixed ids. On exit 1, STOP and surface the error.
1. Resolve the pin
- Locate the ledger page
<docs_dir>/invariants/<slug>.mdwhose frontmatteridequals<id>(glob the concern dir; match onid, not filename guesswork). Zero or multiple matches → STOP with a BROKEN error. - Read the page. Parse frontmatter. Read the current
ratification.
2. Validate the transition
Look up (current_ratification, op) in the allowed table. If absent → REFUSE with a clear message. Specific refusals:
(observed, retire)→ "Only aratifiedinvariant can be retired; anobservedcandidate is rejected, not retired."(ratified, ratify)/ already in destination → "INV-NNNN is already${current}; no-op refused."- any
rejected/retiredsource → "The ratification lifecycle is forward-only out ofobserved/ratified; a revived invariant is a new pin (recover-invariantsor human authoring)."
3. Mutate ONLY the ratification frontmatter
${TODAY} = today's date.
- Set
ratification: <new_state>on the ledger page. - Do NOT touch
id,class,provenance,verification,related_adrs,related_briefs,checks, or the body. Read the body bytes between the closing---and EOF and rewrite them identically. - Preserve frontmatter key order + formatting outside the one mutated key.
4. Reconciliation consistency (audited write)
- The reconciliation manifest (
docs/AGENTS.md§15.4) maps checks → pins and holdslast_result. This skill does not changelast_result, but onreject/retireit MUST leave the reconciliation consistent: arejected/retiredpin's checks are no longer durable-trusted. Do not delete checks (recovery/human owns the suite), but ensureaudit-docswill not read arejected/retiredpin as a live ratified one — the ledgerratificationis the source of truth (§15.1), so the frontmatter change in §3 is sufficient; verify no reconciliation entry contradicts it (a check still mapped to the pin is fine; the pin's ratification governs the audit rules). - This is the bidirectional/audited half mirroring
transition-adr's supersession write: ledger + reconciliation must not disagree. If they would, STOP and surface (never leave drift).
5. Update indexes
<docs_dir>/invariants/index.md: update the pin's row (new ratification). The index visibly marks non-ratifiedpins (observed/rejected/retired are not hidden — survey-debt must be legible).docs/index.md: the## Invariants (N)count is unchanged on a transition (the pin still exists); update_Last updated:.
6. Record the invariant operation
Write the entry through the log writer (docs/AGENTS.md §6).[^log-writer] Write the body (pin id, class, the transition, one line) to a file outside the tree, then run:
uv run "${CRUX_PLUGIN_ROOT}/scripts/operation-log.py" append --repo-root <repo-root> \
--op invariant --subject 'INV-NNNN: <old> → <new>' --date YYYY-MM-DD --body-file <path>
The entry it writes at the top of the current month's detail file docs/log/YYYY-MM.md:
## [YYYY-MM-DD] invariant | INV-NNNN: <old> → <new>
The invariant op is a first-class member of the docs/AGENTS.md §6 op enum (both the current-writer and historical-reader regexes) — emit it directly. A refused append keeps this skill's other writes and adds no entry: fix the cause it names, then rerun the append alone (§6). Then run the commit step of §6 over the result's commit_paths and restore_paths.
7. Hand off
Confirm the new ratification + file path. Remind: recovery cannot reach ratified — this human act is the only path. For ratify, note the pin now participates in CHK-INV-DECORATION/FAILING (it must have a resolvable, passing check or it becomes a detectable defect). For retire, note the pin is explicitly no longer enforced.
Verification checklist
- [ ] Exactly one pin resolved by
id. - [ ] The transition was one of the three allowed; any other refused with a clear message.
- [ ] Ledger
ratificationequals the new state; no other frontmatter field or body byte changed. - [ ] Reconciliation and ledger do not disagree after the write.
- [ ]
<docs_dir>/invariants/index.mdrow updated; the pin remains visibly marked if non-ratified. - [ ]
docs/index.md## Invariants (N)count unchanged;_Last updated:bumped. - [ ] The current month's detail file
docs/log/YYYY-MM.mdhas the transition entry at the top, written byoperation-log.py append. - [ ] No pin was ratified without an explicit human instruction (no auto/batch ratify).
Red flags — STOP and reconsider
- About to ratify without explicit human instruction (e.g. "ratify all observed"). The whole safety invariant is that ratification is a human, per-pin act. Refuse batch/auto ratify.
- About to edit a pin's
class,provenance,checks, or why body. This skill flips ONLYratification. - About to move a pin back to
observed, or out ofrejected/retired. Forward-only; a revived invariant is a new pin. - About to leave the reconciliation disagreeing with the ledger. Ledger wins; keep them consistent or STOP.
- About to delete checks from
<docs_dir>/invariants/checks/on a reject/retire. Not this skill's job — the ledger ratification governs the audit; the suite is owned by recovery/human authoring.
Rationalization table
| Excuse | Reality |
|---|---|
| "The candidate is obviously a real invariant — I'll ratify it as part of recovery." | Recovery NEVER ratifies. ratified is reachable only by an explicit human transition. That is the safety invariant. |
| "I'll retire this observed pin nobody wants." | observed candidates are rejected, not retired. Retirement is for a previously-ratified pin you're explicitly ceasing to enforce. |
| "While flipping ratification I'll fix the pin's class." | This skill mutates only ratification. Class/provenance/body corrections are recovery/human-authoring's job. |
| "The reconciliation disagrees but the ledger looks right — I'll ship it." | Ledger wins, but you must not LEAVE drift. Reconcile or STOP; an audited write is both-or-neither. |
See also
recover-invariants— the machine that proposesobservedpins this skill disposes of.transition-adr— the ADR state machine this mirrors (frontmatter-only mutation, clear refusals, audited write).audit-docs— the CHK-INV rules (docs/AGENTS.md§15.5) that read the ratification this skill sets.docs/AGENTS.md§15 — the invariants-concern contract (ledger schema, axes, reconciliation, audit rules).
[^log-writer]: rule:log-entries-go-through-the-log-writer, rule:no-writer-writes-the-legacy-log-file
04 同仓库更多 Skills
whiteboarding
Explore an idea through docs-informed dialogue before committing to a design. Capture the exploration for later filing as a brief.
verify-code-docs
Check generated code documentation against source and report drift without regenerating it.
transition-observation
Apply a human disposition to an observation's lifecycle state without changing its claim or body.
transition-decision
Apply a human ratify, reject, or defer verdict to a recovered decision candidate; ratification creates a Proposed ADR or observation.
transition-brief
Publish or abandon a draft brief, updating lifecycle metadata and indexes without changing its body.
transition-adr
Accept, deprecate, supersede, or retract an existing ADR, or promote in-run guidance on the owner's instruction ("promote ADR-NNNN: rules N"). Update status and relationships without changing its narrative body.