propose-observation
Scaffold an observation of what code does, without making a decision. Leave its claim body for human authorship.
- License 许可
- MIT
- 最近更新
- 2026-11-12
- Stars
- ★ 0
- Forks
- 0
01 前言 Front Matter
- name
- propose-observation
- metadata
- { "tags": "observations, scaffolding, bronze, adr-less", "bundles": "crux-docs", "triggers": "propose observation | record an observation | new OBS | observe this | record what the code does | this is observed not decided", "risk_level": "low", "routing_note": "Writes status: observed only; body is human-authored.", "requires_access": "write-tree" }
- description
- Scaffold an observation of what code does, without making a decision. Leave its claim body for human authorship.
03 SKILL.md 正文
Propose Observation
<!-- 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 scaffolding operation for an observation — a record of what the code already does, written by a human who read the code (see docs/AGENTS.md §17). An observation describes; it does not decide. This is the reconstructed on-ramp: the human read the code and wants the fact recorded. The mined on-ramp is transition-decision ratify --as observation, which writes the same record shape from a recover-decisions candidate.
Each call: allocates the next zero-padded OBS-NNNN from docs/manifest.yml, computes the record's anchor_id, drops a templated file under docs/observations/ with status: observed and provenance: reconstructed, adds the concern index row, bumps the docs/index.md rollup count, and logs the operation. The human writes the body — this skill provides the scaffolding only.
Three principles:
- Numbers are precious and forever. Once
observation.next_numberincrements, that number belongs to this record — even if the user later deletes the file. Never reuse. Never decrement. - This skill writes exactly one status:
observed. It cannot writeratified,rejected,retired, ordecided.transition-observationis the only single-record route to those states, and the batch sign-off (survey-signoff) is the only batch route. Both are human-invoked. - Scaffold, don't author. The body is the human's account of what the code does and where the evidence is. A pre-filled body is wrong-but-shipped content.
When to use
- User says: "propose observation", "record an observation", "new OBS", "observe this", "record what the code does", "this is observed not decided", "write down that the code does X".
- After a human read code and learned a fact nobody decided — the common case in an inherited codebase.
- When
propose-adris the wrong instrument because nobody made a decision: the code is the authority and the record describes it.
Do not use this skill for:
- Writing the body — the human authors it. Refuse to pre-fill the narrative.
- Transitioning a record's status — that is
transition-observation. Do NOT hand-edit the lifecycle frontmatter. - Recording a decision — that is
propose-adr. An observation that later earns an ADR moves todecidedthroughtransition-observation decide, withdecided_bynaming the ADR. - Recording a candidate the miner found — that is
transition-decision ratify --as observation, the mined on-ramp. Both ramps are human-invoked; no scan writes an observation file in any state. - Prescribing what must be true — that is an invariant (
recover-invariants/transition-invariant).
Inputs
--title "<declarative statement>"— required. Declarative present tense, stating what the code does, e.g. "The summaries projection hashes governs blocks directly". If omitted, prompt the user; confirm before allocation.--evidence <comma-list>— required. One or more repo-relativepath:line-rangereferences, e.g.src/auth/session.py:40-72. Each path must resolve on disk. Never a code excerpt.--anchor-kind <kind>and--anchor <canonical-anchor>— required. The structural anchor the record binds to: the kind names the anchor's class and the canonical anchor names it fully qualified, the same form the miner uses. The pair yields the record'sanchor_id(pipeline §3).--governs-domain <domain>and--governs-rule "<rule>"— required. The domain and the one-sentence rule the record'sgovernsentry carries.--governs-scope "<scope>"— optional; defaults to the evidence paths.--tags <comma-list>— optional.--related-invariants <comma-list>— optional.INV-NNNNids. Default empty.
The pipeline
Execute in order. Never reorder, never skip. Number allocation must be atomic.
0. Resolve per-repo configuration
Run python3 "${CRUX_PLUGIN_ROOT}/scripts/bionic-config.py" (compat: crux-config.py) from the repo root, or pass --repo-root <repo-root>. Confirm the returned repo_root is the repo you are operating in. On exit 1, STOP and surface the {"error": ...} payload — never fall back to defaults. Use the returned docs_dir wherever this skill says docs/ (per the docs/AGENTS.md §14 normative definition clause). When artifact_prefix is non-empty, the prefixed string (e.g. CRX-OBS-NNNN) IS ${ID} for every subsequent step — the filename, the frontmatter id:, the index row, wiki-links, and the operations log subject all carry it verbatim (§14.3); only the NNNN allocation is prefix-blind.
1. Read docs/manifest.yml
- Verify the file exists. If not, STOP —
init-docswas never run. - Verify
observationsis inconcerns_enabled. If not, STOP and tell the user how to enable the additive concern by editing a current schema-5 manifest and creating its documented surfaces, or by runninginit-docson a new tree. The concern needs noschema_versionbump;audit-docs --migratedoes not add it. - Parse YAML. Read
observation.next_number(an integer ≥ 1). - Hold this value as
${N}for the duration of this run.
2. Compute the id, slug, and path
${ID}=OBS-+ zero-padded 4-digit${N}(e.g.${N}=7 →OBS-0007), prefixed per §0.${SLUG}= kebab-case of${title}, ASCII only, truncated to 50 chars. Trim trailing hyphens after truncation (docs/AGENTS.md§9).- The slug grammar is the two grammars intersected:
^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$. The value is the filename stem AND the slug half of thegovernshandle, so it must satisfy both — a lowercase letter, then lowercase letters, digits and single hyphens. A title opening with a number kebab-cases to a digit-led slug such as3-way-merge: the filename grammar admits it, the handle anchor refuses it, and the summaries projection then fails closed for the whole tree. If the derived slug is empty or digit-led, STOP and ask the user for one this grammar admits. Never repair it silently. ${FILE}=docs/observations/${ID}-${SLUG}.md.- Collision scan: glob
docs/observations/*.mdand match each filename against the dual-form regex([A-Z][A-Z0-9]{1,9}-)?OBS-(\d{4}). Take the max over the digits capture across bare and prefixed spellings. If that max is ≥${N}, STOP with a BROKEN error — the manifest counter is desynced from the directory. Tell the user to runaudit-docsto reconcile. - Slug collision check (different number, same slug): STOP. The slug half of every live handle is unique across the whole resolver, and a retired slug is never reused either, because a citation of it must keep resolving to the rules that displaced it. Read
docs/adrs/summaries/resolver.jsonand refuse when${SLUG}is a key of itsslugsmap or of itsretired_slugsmap; when that file does not exist, read thegovernshandles underdocs/observations/*.mdanddocs/adrs/*.mddirectly. Name the holder and ask the user for a different slug. Proceeding writes a second live handle on a taken slug, and the projection then refuses to render for every record in the tree —summarize-adrsandcompile-doctrineboth stop, not this record alone. The batch sign-off refuses on the same conditions (docs/AGENTS.md§17.5), and the single-record ramp is not the lenient one.
3. Compute the anchor_id
Every observation carries an anchor_id, the reconstructed ramp included — it is what lets a re-mine recognize a fact already recorded and propose no duplicate candidate. The human names the anchor; the id hashes under the same function the mined ramp uses. Run from the plugin's scripts/ directory:
cd "${CRUX_PLUGIN_ROOT}/scripts" && CRUX_ANCHOR_KIND="${ANCHOR_KIND}" CRUX_ANCHOR="${ANCHOR}" python3 -c 'import os; from crux.arch.recover import candidate_id; print(candidate_id(os.environ["CRUX_ANCHOR_KIND"], os.environ["CRUX_ANCHOR"]))'
The anchor text reaches this command through the environment, never through the program string, and that is not a style choice. ${ANCHOR} is repo-derived for the api-contract, system-of-record, and cross-cutting-policy kinds — it is scanned content, not something the human typed. Substituted into a python3 -c program it is executable code: a crafted anchor closes the quote, runs anything under your permissions, and still prints a plausible 16-hex id, so the run looks ordinary. That single substitution voids the entire writer boundary, because every control in §17.2 is prose you follow and injected code writes status: ratified straight into a record. Passed through the environment the same text is inert data. crux/scripts/tests/test_skill_prose_safety.py fails any SKILL.md that interpolates a shell placeholder into an inline program string.
Hold the printed value as ${ANCHOR_ID}. Duplicate check: the uniqueness rule and the anchor_id shape are stated in docs/AGENTS.md §17.2/§17.3 (CHK-OBS-ANCHOR) and checked by check_observations.py; read them there rather than from memory. Apply the rule here before writing: if any record under docs/observations/ already carries this anchor_id in observed or ratified, STOP and name it — the fact is already recorded. A changed claim on the same anchor is a successor record, and the human ratifies the successor and retires its predecessor through transition-observation; it is never an edit of the existing record.
4. Read the observation template
- Read
${CRUX_PLUGIN_ROOT}/templates/OBS-template.md. The template carries the full frontmatter shape — substitute into it; do not re-author the field list from memory. - The canonical frontmatter contract — which fields exist, their types, and required/optional — lives in the tree's operational schema,
docs/AGENTS.md§17.1 "Canonical observation frontmatter schema" (the single source of truth). This skill does NOT restate the field list (it would drift); read §17.1. The three constraints §17.1 places on thegovernsentries — provenance agreement, the id-namespaced handle, and the unusedanchorsub-field — are enforced there; apply them by reading them, not from memory. - Substitute the values for the new record:
id→${ID},title→${title},status→observed,provenance→reconstructed,anchor_id→${ANCHOR_ID},evidence→ the passed references, thegovernsentry from the passed domain/rule/scope with its handle namespaced as${ID}/<rule-slug>,dateand the first-written date →${TODAY}, and the passed tags and related invariants (default[]). Every lifecycle date that §17.1 marks as set on a later transition isnull;decided_byisnull. For the exact field set, defer to §17.1 and the template — they are authoritative. - Substitute the body heading
# OBS-NNNN — <Title>→# ${ID} — ${title}. - Leave the body sections with their stub content from the template. The human fills them in. The body carries no code excerpt; a
path:line-rangeinevidenceis the pointer.
5. Write the file
- Write to
${FILE}exactly the substituted template. - If the write fails, STOP — do not increment the counter. The number stays unallocated.
6. Increment observation.next_number atomically
- Re-read
docs/manifest.ymlto confirmobservation.next_numberis still${N}. If it changed, another invocation raced us — STOP and tell the user to retry. - Set
observation.next_number = ${N} + 1. - Write
manifest.ymlback. Preserve all other keys and formatting.
Step 10 commits the counter bump with the record file it allocated, and only then runs the regenerators.
7. Add the row to docs/observations/index.md
- Insert the record's row at the top of the table body (newest first), in the column order the index header carries. The index visibly marks the status: an
observedrecord is survey debt and must be legible as such, never hidden. - If the index does not exist yet (first record), create it carrying the same header
init-docsseeds —| id | status | provenance | domain | evidence | anchor_id | related invariants |— and one row. One header, seeded in one place and extended here; a second spelling would make the concern index unreadable across trees. - Update the
_Last updated:_line to${TODAY}.
8. Update the docs/index.md rollup
- Bump the count:
## Observations (N)whereNis the number of files matchingOBS-*.mdunderdocs/observations/(count files, not the index). - If no
## Observationssection exists yet, create it after the## Invariantssection when one exists, else after## Briefs(seedocs/AGENTS.md§5). - Update the
_Last updated:_line to${TODAY}.
9. Record the observation operation
Write the entry through the log writer (docs/AGENTS.md §6),[^log-writer] using the observation op from the §6 canonical enum. 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 observation --subject '${ID}: created (observed)' --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}] observation | ${ID}: created (observed)
Body, 1–2 lines: the title, the file path, provenance: reconstructed, the anchor_id. Note the body is human-authored next.
A refused append keeps this skill's other writes and adds no entry: fix the cause it names, then rerun the append alone (§6). Step 10 runs the commit step of §6 over the result's commit_paths and restore_paths.
10. Commit, then regenerate the projections
While a tester's window is open, commit nothing and run no regenerator. The window runs from the tester's dispatch until the tester returns; outside a run there is none.
Commit this skill's own writes first: the record file, manifest.yml, observations/index.md, and docs/index.md, plus the append result's commit_paths, after git restore --staged --quiet on its restore_paths when that list is not empty (the commit step of §6). Run that step whatever the append's status, because a refused append can still have repaired the operations log. Never commit the counter bump without the file it allocated. Stage only these paths (git add -- <paths>) and commit only them (git commit -- <paths>), so no change already staged is included. If a regenerator still exits 2 with migration-input-not-committed, another uncommitted input is in the tree: stop and name it; never commit a file this skill did not write.
Then regenerate the summaries projection, then the doctrine projection, because the new record and the bump change their input hash. The commit comes first because, in a tree whose projections declare migration inputs, a regenerator refuses an uncommitted input with exit 2 (migration-input-not-committed).
uv run "${CRUX_PLUGIN_ROOT}/scripts/summarize-adrs.py" --repo-root <repo-root>
uv run "${CRUX_PLUGIN_ROOT}/scripts/compile-doctrine.py" --repo-root <repo-root>
Confirm --dry-run of each exits 0, then commit the regenerated projections so none stays uncommitted.
11. Hand off to the user
- Tell the user: observation id assigned, file path, status
observed,anchor_id. - Explicitly instruct: the body is yours to write — what the code does, where the evidence is, and why this is observed rather than decided. Do NOT change the frontmatter.
- Name
transition-observationas the only single-record route out ofobserved:ratifywhen the record describes the code,rejectwhen it does not. Namesurvey-signoffas the only batch route, for a human signing off many records under one receipt. A ratified record's claim is immutable from then on.
Verification checklist
- [ ]
docs/observations/${ID}-${SLUG}.mdexists. - [ ] Frontmatter parses as YAML and its keyset matches the template's, which matches
docs/AGENTS.md§17.1. - [ ]
id:matches the filename's${ID}. - [ ]
status: observedandprovenance: reconstructed— no other status was written. - [ ]
anchor_idequals the valuecandidate_idprinted in §3, and no other non-terminal record carries it. - [ ] Every
evidenceentry is apath:line-rangewhose path resolves; none is a code excerpt. - [ ] The
governsentry'sprovenanceequals the record's, and its handle is namespaced by${ID}. - [ ]
${SLUG}matches^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$and is a key of neither theslugsmap nor theretired_slugsmap indocs/adrs/summaries/resolver.json. - [ ] The body is the template stub — NOT pre-filled narrative.
- [ ]
docs/manifest.ymlobservation.next_numberis${N} + 1. - [ ]
docs/observations/index.mdhas the row at the top, visibly markedobserved. - [ ]
docs/index.md## Observations (N)count matches the actual file count;_Last updated:_is${TODAY}. - [ ] The current month's detail file
docs/log/YYYY-MM.mdhas a new## [${TODAY}] observation | ${ID}:entry at the top, written byoperation-log.py append. - [ ] The record, the counter bump and the index, docs-index and log writes are committed before any regenerator runs;
summarize-adrs.py --dry-runandcompile-doctrine.py --dry-runexit 0 afterwards, and the regenerated projections are committed. - [ ] No ADR was created or modified, and no existing observation was touched.
Red flags — STOP and reconsider
- About to write the file before incrementing
observation.next_number. Order matters: write first (so a failed write does not burn a number), then increment. - About to allocate a number the collision scan already found on disk. The manifest is out of sync with reality; refuse and tell the user to audit.
- About to write
status: ratifiedbecause the user said "this is definitely true". This skill writesobservedonly. Ratification is a separate human act throughtransition-observation, and a scan or a scaffold that ratifies is the failure the writer boundary exists to prevent. - About to proceed past a slug another record already holds because the number differs. The slug half of a handle is unique across the whole resolver, retired slugs included. A second live handle on one slug fails the summaries projection closed for every record in the tree, so
summarize-adrsandcompile-doctrinerefuse to regenerate anything. Refuse and take a different slug. - About to publish a digit-led slug because the filename reads fine.
OBS-0007-3-way-merge.mdis a legal filename andOBS-0007/3-way-mergeis not a legal handle; the projection fails closed for the whole tree on the handle. Ask for a slug that starts with a lowercase letter. - About to omit
anchor_idbecause "this record was not mined". Every record carries one. Without it a re-mine cannot recognize the fact and proposes a duplicate. - About to paste a code excerpt into
evidenceor the body. Evidence is apath:line-range, and the body carries no excerpt either. - About to edit an existing record whose
anchor_idmatches. A changed claim is a successor record; the existing one is retired through the gate, never rewritten. - About to list the frontmatter fields from memory because the template is missing. Refuse; tell the user to reinstall the plugin. §17.1 is the contract and the template carries it.
- About to use the
adr,invariant, orjournalop for the log entry. Scaffolding an observation is anobservationop. - About to substitute
${ANCHOR}(or any other repo-derived value) into apython3 -cprogram string because it reads more simply. That is arbitrary code execution from scanned repository content, and the run still prints a plausible id, so nothing looks wrong. Pass the value through the environment orargv. Step 3 carries the only correct spelling.
Rationalization table
| Excuse | Reality |
|---|---|
| "The user read the code and is sure — I'll write it ratified to save a step." | This skill writes observed and nothing else. ratified is reachable only by an explicit, per-record human transition. That is the safety property. |
"This wasn't mined, so anchor_id doesn't apply." |
Every record carries an anchor_id, reconstructed ones included. The human names the anchor and it hashes under the miner's function, so one identity spans both on-ramps. |
| "Another record has this slug, but the number is different, so the file is unique." | The filename is unique and the handle is not. The slug half of every live handle is unique across the resolver, and a retired slug stays reserved for the rules that displaced it. Two live handles on one slug fail the summaries projection closed for the whole tree. |
| "An observation was deleted last week — I'll reuse its number." | Numbers are never reused. Allocate the next from manifest.yml, full stop. |
| "I'll fill in the body from what the user told me." | The body is the human's account. Provide the scaffolding; let them write. |
| "This is really a decision — I'll write it as an observation anyway to skip the ADR." | An observation describes; an ADR decides. If the human decided it, propose-adr. If the human wants the observation to become a decision later, transition-observation decide links the two. |
| "The evidence is a one-line function — I'll quote it, it's clearer." | Never a code excerpt. A path:line-range is the pointer; the code is the authority and stays where it is. |
| "I'll skip the index row and the rollup — it's bookkeeping." | The index visibly carries survey debt, and audit-docs reads the rollup count. Update on every write. |
Common mistakes
- Off-by-one on
observation.next_number: afterOBS-0007is written, the manifest stores8. Increment after allocation. - Reading
manifest.ymlonce and writing back stale: re-read immediately before the increment write to catch races. - Scanning only the bare
OBS-NNNNfilenames in a prefixed tree: the dual-form regex covers both spellings; take the max across them. - Setting
provenance: recoveredon this ramp: the human reconstructed the fact from reading;recoveredis the mined ramp's value. - Setting a transition date on first write: only
dateand the first-written date are${TODAY}; every other lifecycle date isnulluntil its transition. - Slug ending in a hyphen after truncation — trim it.
- Updating the
docs/index.mdcount by incrementing the prior number: count the actual files.
See also
transition-observation— the human gate; the only single-record route toratified,rejected,retired, ordecided.survey-signoff— the human gate over a batch; the only batch route to those same states.transition-decision— the mined on-ramp (ratify --as observation) that writes the same record shape from arecover-decisionscandidate.recover-decisions— the miner whoseanchor_idfunction this skill reuses.propose-adr— the decision artifact; an observation that earns one moves todecided.audit-docs— the CHK-OBS rules (docs/AGENTS.md§17.3) that read what this skill writes.docs/AGENTS.md§17 — the observations-concern contract (§17.1 frontmatter schema, §17.2 lifecycle and writer boundary, §17.3 audit rules).- The observation-record decision this implements (see the ADR log).
- Template:
crux/templates/OBS-template.md.
[^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-brief
Publish or abandon a draft brief, updating lifecycle metadata and indexes without changing its body.