transition-brief
Publish or abandon a draft brief, updating lifecycle metadata and indexes without changing its body.
- License 许可
- MIT
- 最近更新
- 2026-11-12
- Stars
- ★ 0
- Forks
- 0
01 前言 Front Matter
- name
- transition-brief
- metadata
- { "tags": "briefs, state-machine, transitions, lifecycle", "bundles": "crux-docs", "triggers": "publish brief | abandon brief | close out a brief | mark brief published | mark brief abandoned | transition BRIEF-<slug>", "risk_level": "low", "routing_note": "Transitions a brief `draft → published | abandoned`; mutates only frontmatter, never the body; updates the rollup + writes a `brief` op.", "requires_access": "write-tree" }
- description
- Publish or abandon a draft brief, updating lifecycle metadata and indexes without changing its body.
- disable-model-invocation
- true
03 SKILL.md 正文
Transition Brief
<!-- 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 status state machine for briefs — the pre-decision exploration documents propose-brief scaffolds. This skill closes the lifecycle that propose-brief opens: a brief is born draft, and it ends either published (the exploration is preserved as a standing reference) or abandoned (the exploration was dropped without becoming a decision). Two named transitions — publish and abandon — each enforcing the single allowed transition out of draft.
Why a dedicated skill: propose-brief opens the lifecycle but nothing else closes it, and without a closer the only path to publish/abandon would be hand-editing frontmatter — which the docs schema otherwise forbids. This skill is the sanctioned closer, mirroring transition-adr for ADRs. docs/AGENTS.md §6's brief op names transition-brief as a second writer.
Core principle: the state machine is the contract, and the body is frozen. A brief's body is human-authored (per docs/AGENTS.md §2 ownership); this skill mutates ONLY the status and updated_at frontmatter between the --- fences and rewrites the body byte-for-byte. Every transition that isn't explicitly allowed is refused with a clear error.
draft ──publish──▶ published
│
└──abandon──▶ abandoned
Allowed transitions, exhaustively:
| From | Op | To | Notes |
|---|---|---|---|
| draft | publish | published | The exploration stands as a reference. |
| draft | abandon | abandoned | Exploration dropped; body kept for the historical record. |
Everything else is REFUSED with an error message naming the disallowed transition. There is no path out of published or abandoned, and no path into draft (that's propose-brief's job, at creation only).
When to use
- User says: "publish brief", "abandon brief", "close out a brief", "mark BRIEF-<slug> published", "mark BRIEF-<slug> abandoned", "transition BRIEF-<slug>".
- After an exploration concludes — either it stands as a standing reference (
publish) or it was dropped without becoming a decision (abandon). - As the natural follow-on when
propose-briefhands adraftbrief to a human who later finishes the exploration.
Do not use this skill for:
- Creating a new brief (that's
propose-brief). - Editing a brief's body — refuse, even if asked. The body is human-authored; this skill only flips frontmatter status.
- "Un-publishing" or "un-abandoning" a brief. The state machine is forward-only out of
draft; a re-opened exploration is a new brief. - Transitioning an ADR (that's
transition-adr). - Promoting a brief to a decision — that's
propose-adr(cite the brief with--related-briefs BRIEF-<slug>); publishing a brief is not the same as deciding.
Inputs
Subcommand form: transition-brief <op> <slug> where:
<op>: one ofpublish | abandon.<slug>: the brief slug being transitioned (e.g.,caching-strategy), with or without theBRIEF-prefix and.mdsuffix; normalize to the bare slug.
The pipeline
Execute in order. Read the brief before any write. Validation (steps 1–2) visibly precedes the side-effecting writes (steps 3–5).
1. Resolve and validate the brief
- Normalize
<slug>: strip any leadingBRIEF-and trailing.md, lowercase nothing else (the slug is already lowercase by construction). - Validate the slug:
<slug>MUST match^[a-z0-9-]+$. If it does not, STOP with a BROKEN error naming the offending slug. ${FILE}=docs/briefs/BRIEF-${slug}.md. Locate it.- If zero matches, STOP with a BROKEN error ("no brief
BRIEF-${slug}.mdunderdocs/briefs/"). - If more than one path resolves (e.g. a glob collision), STOP with a BROKEN error.
- If zero matches, STOP with a BROKEN error ("no brief
- Path-escape guard: resolve
${FILE}and confirm the resolved path stays UNDERdocs/briefs/. If the slug — even one that passed the regex — produces a resolved path that escapesdocs/briefs/(path traversal), STOP with a BROKEN error. (^[a-z0-9-]+$already excludes/and.; the resolved-path check is the belt-and-suspenders defense.) - Read the file. Parse the frontmatter. Read the current
status:field.
2. Validate the status transition
Look up (current_status, op) in the allowed-transitions table above.
(draft, publish)→ allowed, destinationpublished.(draft, abandon)→ allowed, destinationabandoned.- Any other pair → REFUSE with a clear message naming the current status and the requested op, e.g.:
- For
(published, *)or(abandoned, *): "BRIEF-${slug} is already${current_status}; the briefs lifecycle is forward-only out ofdraft. A re-opened exploration is a new brief (propose-brief)." - For an attempt to set
draft(e.g. published→draft): "Cannot transition a brief back todraft. The state machine only allowsdraft→publishedanddraft→abandoned. Scaffold a new brief withpropose-briefif you need a fresh exploration."
- For
If the target brief is already in the requested destination state, refuse with "BRIEF-${slug} is already ${current_status}; no-op refused." Do not write anything.
3. Mutate ONLY the status + updated_at frontmatter
${TODAY} = today's date (YYYY-MM-DD).
- Read the file as bytes. Identify the frontmatter block — the content between the opening
---and the closing---fences. - Within the frontmatter block, mutate ONLY:
status: ${new_status}(publishedorabandoned).updated_at: ${TODAY}.
- Rewrite the body byte-for-byte. Read everything after the closing
---fence and rewrite it identically — never reformat, re-wrap, or touch a single line outside the frontmatter block. - Preserve frontmatter key order, comments, quote style, and trailing-newline conventions. Do NOT touch
created_at,title,slug,type,authors,tags,related_adrs,related_research, or any other field. - Write
${FILE}back. If the write fails, STOP — no index or operations log changes.
4. Update docs/index.md brief rollup
- Under the
## Briefs (N)section, find the existing row for this brief and update it to:- [[briefs/BRIEF-${slug}]] — \${new_status}` — `updated_at: ${TODAY}``
- The
(N)count is unchanged (the brief still exists; only its status changed) — but verify it still matches the actualdocs/briefs/BRIEF-*.mdfile count. - Update the
_Last updated:_line to${TODAY}.
5. Record the brief operation
Write the entry through the log writer (docs/AGENTS.md §6),[^log-writer] using the brief op (§6 names transition-brief as that op's second writer). Write the body below to a file outside the tree, then run:
uv run "${CRUX_PLUGIN_ROOT}/scripts/operation-log.py" append --repo-root <repo-root> \
--op brief --subject 'BRIEF-${slug}: ${old_status} → ${new_status}' --date ${TODAY} --body-file <path>
The entry it writes at the top of the current month's detail file docs/log/YYYY-MM.md:
## [${TODAY}] brief | BRIEF-${slug}: ${old_status} → ${new_status}
Transitioned BRIEF-${slug} from `${old_status}` to `${new_status}`. Body unchanged.
The body is the transition format BRIEF-<slug>: <old-status> → <new-status>. Keep it terse — the operations log is for grep, not reading.
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.
6. Hand off to the user
- Confirm the new status and the file path.
- Remind: the body of the brief was not touched; only the
status/updated_atfrontmatter changed. - For
published, optionally note that an ADR can now cite this brief viapropose-adr --related-briefs BRIEF-${slug}. Forabandoned, note the body is preserved for the historical record.
Verification checklist
- [ ]
<slug>matched^[a-z0-9-]+$and${FILE}resolved underdocs/briefs/(no path-escape). - [ ] The transition was one of
draft → publishedordraft → abandoned; any other was refused. - [ ] Brief frontmatter
status:equals the new state (publishedorabandoned). - [ ] Brief frontmatter
updated_at:equals${TODAY}. - [ ]
created_atand every other frontmatter field are unchanged. - [ ] Brief body bytes are byte-identical to pre-write (nothing outside the frontmatter block changed).
- [ ]
docs/index.md## Briefs (N)row for this brief shows the new status andupdated_at: ${TODAY}; the(N)count is unchanged and still matches the file count. - [ ]
docs/index.md_Last updated:_is${TODAY}. - [ ] The current month's detail file
docs/log/YYYY-MM.mdhas a new## [${TODAY}] brief | BRIEF-${slug}: ${old_status} → ${new_status}entry at the top, written byoperation-log.py append. - [ ] No ADR and no other brief was created or modified.
Red flags — STOP and reconsider
- About to write a transition that isn't in the allowed table (
draft → published,draft → abandoned). REFUSE with the error message — including any attempt to move intodraft(e.g. published→draft) or out of a terminal state. - About to touch any line outside the frontmatter block. The brief body is human-authored and frozen here — read the body bytes between the closing
---fence and EOF and rewrite them identically. Editing, re-wrapping, or "cleaning up" the body is forbidden, even if asked. - About to mutate any frontmatter field other than
statusandupdated_at. Touch nothing else — notcreated_at, nottitle, nottags. - About to act on a slug that doesn't match
^[a-z0-9-]+$, or whose resolved path escapesdocs/briefs/. STOP with a BROKEN error — never follow a path-traversal slug. - About to "no-op" silently when the brief is already in the destination state. Refuse with a clear message — the user thought a transition was needed; tell them it wasn't.
- About to rewrite the frontmatter with reformatted YAML (different key order, different quote style). Preserve byte layout outside the two keys you're explicitly mutating.
- About to bump the
## Briefs (N)count. The file count didn't change on a status transition. Don't bump. - About to use the
journalop (or any op other thanbrief) for the log entry. Thebriefop is canonical for bothpropose-brief(scaffold) andtransition-brief(transition).
Rationalization table
| Excuse | Reality |
|---|---|
| "The brief body has a typo — while I'm flipping status I'll fix it." | The body is frozen here. This skill touches ONLY status/updated_at. Body edits are the human's; refuse. |
"The user wants to re-open a published brief as draft — close enough to a transition." |
The state machine is forward-only out of draft. A re-opened exploration is a new brief (propose-brief). Refuse the backward move. |
| "Publishing the brief means it became a decision — I'll also write the ADR." | Publishing ≠ deciding. transition-brief closes the brief lifecycle; recording the decision is propose-adr (cite the brief with --related-briefs). Two skills. |
| "The slug has a slash in it pointing at a sibling dir — I'll resolve it anyway." | A slug with / fails ^[a-z0-9-]+$ and/or escapes docs/briefs/. STOP with a BROKEN error; never follow a traversal path. |
"BRIEF-foo is already abandoned; I'll just confirm and exit silently." |
Silent no-op is indistinguishable from success. Refuse explicitly so the user notices their model is wrong. |
| "I'll re-emit the frontmatter through a YAML library to tidy it." | A lossy YAML round-trip reorders keys and changes quoting — diff noise that destroys git-blame and risks the body. Parse-then-mutate-then-byte-merge only the two keys. |
"I'll log this under journal since there's narrative." |
Brief transitions are a brief op, not a journal op (per docs/AGENTS.md §6). |
Common mistakes
- Touching the body. The single most important invariant: mutate ONLY the frontmatter
status/updated_at; rewrite the body byte-for-byte. Mirrorstransition-adr's body-freeze. - Forgetting to update
updated_atalong withstatus. Both move on every transition;created_atnever does. - Bumping the
## Briefs (N)count on a status transition — the file count is unchanged; only the row's status/date update. - Allowing a backward or terminal-state transition — only
draft → publishedanddraft → abandonedare legal. - Updating only the index, not the file — the file's frontmatter is source of truth; the
docs/index.mdrollup mirrors it. Write the file first. - Using the wrong log op — it's
brief, notjournal, with bodyBRIEF-<slug>: <old-status> → <new-status>. - Skipping the slug/path validation — a slug must match
^[a-z0-9-]+$and resolve underdocs/briefs/before any read or write.
See also
propose-brief— scaffolds thedraftbrief this skill closes out (the lifecycle opener).transition-adr— the symmetric ADR state machine this skill mirrors (body-freeze, frontmatter-only mutation, clear refusals).propose-adr— the decision artifact that may cite a published brief (--related-briefs BRIEF-<slug>).audit-docs— enforces brief↔ADR consistency; CHK-ADR-11 cross-checks brief draft-states.docs/AGENTS.md§2 (ownership — briefs are human-authored), §4 (briefs write rules), §5 (index brief rollup format), §6 (brieflog op), §7.A (SKILL.md frontmatter contract), §9 (slug rule), §10 (skill-invocation table).
[^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-invariant
Ratify, reject, or retire an invariant on human direction. Update lifecycle metadata without changing the invariant's body.
transition-decision
Apply a human ratify, reject, or defer verdict to a recovered decision candidate; ratification creates a Proposed ADR or observation.
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.