AGENT SKILL

write-plan

Turn a confirmed intent into implementation tasks. Use when an intent needs a plan; also the entry for a new feature or bug-fix request when loom-design is not installed.

License 许可
MIT
所属仓库
kouko/loom-plugins
最近更新
2026-11-15
Stars
★ 0
Forks
0

01 前言 Front Matter

name
write-plan
version
1.0.1
description
Turn a confirmed intent into implementation tasks. Use when an intent needs a plan; also the entry for a new feature or bug-fix request when loom-design is not installed.

02 资源文件 9

03 SKILL.md 正文

What this station does

Relative paths in this document are relative to this skill's own directory.

Turn one intent into docs/loom/<change-id>/plan.md: waved tasks with files, Acceptance ownership, positive and negative or boundary cases, and risk. Do not implement or ask the user to approve task splitting; decide and record why.

Decision boundary

Choose the simplest reversible implementation satisfying the confirmed specification. Split work into tasks and tests without inventing or reinterpreting product behaviour; return product gaps for clarification.

Workflow setup

With loom-design installed, capture-intent already confirmed the intent. Otherwise, run that confirmation yourself in step 3.

Use the installed checker's host-specific prefix:

Host Command prefix
Claude Code "${CLAUDE_PLUGIN_ROOT}/scripts/loom-python" --repair
Codex CLI, Antigravity CLI "<loom-code>/scripts/loom-python" --repair

<loom-code> (this plugin's root) is ${CLAUDE_PLUGIN_ROOT} on Claude Code; on any other host it is the directory two levels above this SKILL.md. Commands below show Claude Code; on any other host substitute <loom-code> for ${CLAUDE_PLUGIN_ROOT}. ${CLAUDE_PLUGIN_ROOT} is substituted by Claude Code. PLUGIN_ROOT is provided to Codex plugin hook commands; it is not a general skill-shell variable. Antigravity CLI, OpenCode: map tool/agent names via ../../references/antigravity-tools.md, ../../references/opencode-tools.md.

Branch before the first commit. Before this station's first commit (intent confirmation, needs-design: fix, skipped-by-instruction line or plan), make HEAD the change's branch:

git switch -c <type>/<change-id>

Pick <type> from feat, fix, docs, refactor, test, chore or ci. If already on this change's branch, reuse it. Another worktree has that branch: work there. Else on the trunk, create it, or if it already exists, switch to it with git switch <type>/<change-id>; never -C or reset. On an unrelated branch or detached HEAD, do not commit: resolve that first, preserve existing work, no reset, no discard, no git switch. Resolve it with a new worktree: git worktree add <path> <type>/<change-id> if it exists, else git worktree add -b <type>/<change-id> <path> <trunk> — on any move to another worktree, move every uncommitted file this change produced (intent draft, PRINCIPLES.md edit) there, to commit on the change branch.

At entry, omit the prose steps the user told you to skip in plain words (spec, plan, implementer, tdd, acceptance-test). Words that ask to skip independent acceptance testing — "acceptance testing", or the step formerly called "blind run" — mean the acceptance-test step. Automatic narrow-change simplification belongs to finalization and attestation validation. The default is the full flow: skip a step only when the user tells you to in plain words, then tell the user in one line which step is skipped and continue. When you honour such a skip, append one line skipped-by-instruction: <step> <YYYY-MM-DD> to the plan's ## Risks section, or the intent's ## Constraints section when plan is absent or skipped, and commit it before dependent checks.

Artifact vocabulary

Use the confirmed intent when spec or plan is skipped. Skipped spec waives step 4's creation, carried-detail routing, review and behavior-confirmation checks; use intent Acceptance directly. Record instructions before intake. Skipped plan waives step 5's document, plan check, plan review and plan-dependent configuration prompts. Run intake for confirmed-intent and non-skipped checks; hand Build intent and retained spec paths, omitted steps and bounded implementation scope. Resolve open questions in intent; never create a substitute plan.

kind: product changes what a user reads, types, or sees happen; kind: engineering covers internal work, tooling, tests, and docs. <change-id> is <start-date YYYY-MM-DD>-<title-in-kebab-case>.

Station summary

station artifact who decides checker checkpoint
capture-intent intent — docs/loom/intent/<change-id>.md; PRINCIPLES.md and DESIGN.md at the repo root are side outputs of the tools it calls user — decision point ① intent.schema, intent.product-no-identifiers, intent.needs-design-reason, intent.needs-design-recompute N/A
write-spec spec — docs/loom/<change-id>/spec.md user — decision point ②, product only; agent declares pre-build risk intake.confirmed, standing.product-principles-reject required: one independent spec+adversarial reviewer, no independent acceptance testing; not-required: none
write-plan plan — docs/loom/<change-id>/plan.md agent-decided (runs ① itself when loom-design is absent) intake.confirmed, intake.confirmed-behavior, intake.spec-ready, intake.test-case-pair a fresh plan-lens reviewer checks for a simpler shape before Build; invokes the required spec review only when it authored the spec
build diff — commits on the change branch agent-decided task and integration tests; at the end of Build, an independent adversary's committed adversarial programs and the complete package suite, which must pass before hand-off no formal review during Build; one closing review follows completed functional work
closing-review generated docs/loom/<change-id>/attestation.json, plus an acceptance test report when needed fresh-context reviewers; reviewer count comes from the installed Review policy reviewers see only content that passed Build's checks; finalize-review executes the package suite and adversarial programs again on committed content branch end, or again only after functional content changes
ship diff / PR — the pushed change branch and its pull request automatic for canonical intent authorization; one user decision for a legacy intent; merge is separate push.contextual-body and publish.preconditions; the verification status is disclosed, not a refusal; no functional replay before push; publication-only fixes reuse matching evidence
maintain intent — a fresh docs/loom/intent/<change-id>.md agent (dedupe is mechanical) intent.schema, intent.needs-design-reason, intent.needs-design-recompute, intent.product-no-identifiers on a new intent before hand-off to write-plan

What you will be asked, in plain words

If asked, give this complete decision-point list. Codex's plugin-install authorisation (step 0b) permits execution; it is not a work decision.

  1. At ①, restate intent; merge unresolved outcome or authorization questions ② skips, any unanswered second-vendor: ask choice, and the required principles interview. A direct user request naming an outside agent and unambiguous target runs without a second question; disclose before execution.
  2. At ②, only for a product spec you write: confirm visible behaviour, carried details, unresolved product outcome or authorization questions not asked at ①. Ask nothing about plan structure; record agent decisions with reasons.
  3. At ③, the user accepts or rejects the report per Acceptance line.

second-vendor: suggest only emits a non-blocking notice after the plan exists.


Step 0 — Check the contract version

"${CLAUDE_PLUGIN_ROOT}/scripts/loom-python" --repair --script checked_readonly.py contract --require 2.1

Continue only for accepted JSON with exit 0, status: passed and data.compatible: true. The consumer validates the observation before emitting it; do not parse success prose or add --json. Only an accepted blocked result whose diagnostics includes rule_id: contract.requires establishes the existing outdated-contract response: report that diagnostic, identify the plugin it says needs updating (loom-code or the consuming plugin), and stop. Valid error.kind: usage|internal results, invalid observations and launcher/startup failures stop this prerequisite with their own diagnostics; do not label them version incompatibility, retry automatically or fall back to text. See the shared CLI result guide for fields and boundaries. After accepting the core observation, present applicable suggested_next only when it is a nonblank string, as advisory content; otherwise retain the original diagnostic. This optional advice changes neither the prerequisite nor authority and permits no automatic execution, retry or text fallback.

Step 0b — Codex only: installed hook check

Read references/codex-first-contact.md. Confirm the injected checker lists push.contextual-body. No repository-local scaffold, copied checker, probe remote, or firing ledger is created.

Step 1 — Find the intent

The intent lives at docs/loom/intent/<change-id>.md. Look there first; if the user named a change, match the slug.

If an intent exists, read it and go to step 2.

If none exists, there are two cases:

  • loom-design is installed → this is not your station. Tell the user the change starts at capture-intent, and stop.
  • loom-design is not installed → read references/no-intent-interview.md and follow it.

<!-- gate: write-plan.no-plan-without-confirmed-intent --> No plan is written without a confirmed intent. If status: is not confirmed <date> by the end of step 3, you stop; you do not draft a plan "provisionally" and you do not confirm on the user's behalf. The checker enforces the same rule at step 4 (intake.confirmed), so a plan written early cannot be shipped anyway. <!-- /gate -->

Step 2 — Standing documents

"${CLAUDE_PLUGIN_ROOT}/scripts/loom-python" --repair standing docs/loom/intent/<change-id>.md

Run this on every change, before decision point ①. Print its WARN lines to the user verbatim — do not summarise them, do not add to them, and do not act on them. standing.warn and standing.silence are notices; they never block.

One outcome does block, standing.product-principles-reject: kind: product in a repo with no ratified PRINCIPLES.md (ratified = the file carries a ratified-by: <name> <date> line and a ## Non-negotiables section with at least three items). Then, if loom-design is not installed, you run the interview in contract/templates/PRINCIPLES-interview.md — inside the same conversation as step 3, not as a separate stop. Open with the line that template gives you, ask its questions until the answers are clear, write PRINCIPLES.md, and restate it together with the intent in step 3. When the user says yes, write the ratified-by: line. If loom-design is installed, hand this to its product-principles tool instead.

Step 3 — Decision point ①: restate and confirm

When status: is already confirmed, skip confirmation: Branch before the first commit, then run "${CLAUDE_PLUGIN_ROOT}/scripts/loom-python" --repair intent docs/loom/intent/<change-id>.md until it exits 0. Fix needs-design: with one new commit quoting the changed line verbatim in its body.

Otherwise read references/confirm-intent.md and follow it fully before step 4, in the single message it describes, ending with the intent's confirmation commit. Step 5 writes the question list kept per that reference.

Step 4 — Does this need a spec?

Read the intent's needs-design: line. It is yes when either holds:

  • (a) the change touches a surface the user reads or types into — a GUI, a TUI, CLI arguments and output, an external API, or a file artifact a user or external system depends on — and no DESIGN.md or ui-flows document already covers that surface; or
  • (b) the behaviour is multi-state or multi-object, and there is no spec for it.

Otherwise it is no. The same rule applies to every kind.

You do not get the last word on no: the checker recomputes it (intent.needs-design-recompute) against this repo's declared interface-surface globs, and a diff that touches one of them while the intent says no is blocked.

no — go to step 5.

When a task's rationale outgrows its Risk line, a carried-details list is non-empty, or this station already wrote docs/loom/<change-id>/spec.md, read references/self-written-spec.md and follow it.

yes, and docs/loom/<change-id>/spec.md already exists — when this station wrote that spec (loom-design absent), read references/self-written-spec.md and finish what it still requires; then go to the intake check below.

yes, spec missing, loom-design installed — hand the change to its write-spec station and stop.

yes, spec missing, loom-design not installed — read references/self-written-spec.md and follow it.

The intake check — both branches, every time

Run this before writing a plan:

"${CLAUDE_PLUGIN_ROOT}/scripts/loom-python" --repair intake write-plan <change-id>

Use the exit code and text together: exit 0 means the applicable intake checks passed; exit 1 returns BLOCK <rule>: <reason> failures. An intake.confirmed blocker stops before later checks; later rule failures complete the applicable path without passing. Other output is informational. Exit 2 means an invocation or observation error. Recover and rerun errors; malformed output or any nonzero exit never establishes readiness. A crash alone cannot establish how many checks ran. Preserve blockers and rerun after inputs change. This read-only snapshot neither advances the station nor waives confirmation, review or acceptance. It checks intake.confirmed, intake.spec-ready, and intake.confirmed-behavior. With needs-design: no, only intent readiness blocks before the plan, plus intake.confirmed-behavior for a kind: product spec.

Step 5 — Write the plan

Write docs/loom/<change-id>/plan.md from contract/templates/plan.md.

Task size. Each task owns coherent Acceptance lines, one module boundary, declared dependencies, positive plus negative/boundary cases. Split unrelated behaviour; scenarios stay in the spec; never size by time. Tasks changing non-test code: Files marks the entry other modules call; case-ids name behaviour seen there; logic beyond that entry's reach is its own module, tested at its entry.

Architecture. Read root ARCHITECTURE.md before the Task DAG when it carries ratified-by: <name> <date>; unratified drafts are advisory. Place added or moved files by its rules and cite each rule id in the task's Risk line (FP-2). To break a rule, run loom-design architecture-design in re-design mode with the user before Build; list ARCHITECTURE.md and its guard in Files. An implementer never changes a rule alone. With no ARCHITECTURE.md, this check does not apply.

A task that removes or materially rewrites a function, recognizer, or rule that already has tests names the existing test file on its Risk line and states whether the change preserves, widens, or narrows what those tests cover. Read current tests as the coverage spec before touching protected code; preserve every exercised case. Passing tests alone cannot establish this when coverage was dropped.

Shape.

  • Group tasks into waves as dependency and integration boundaries. Waves do not schedule formal review; after all tasks and package tests pass, Build transitions once to the closing branch-end review.
  • Unless implementer is skipped by the user's plain-words instruction, implementer dispatch is mandatory for every implementation task. Scheduling multiple implementers concurrently is optional.
  • Task ids are W<n>-<nn> and remain stable once written so hand-offs can refer to dependencies without ambiguity.
  • Dependencies go on the task line as after: <ids>. Independent tasks in one wave may run concurrently, but disjoint files alone do not prove independence: shared symbols, mirrored code/docs, and producer/consumer pairs stay sequential.
  • Each non-memory task line carries acceptance: <numbers> naming the intent Acceptance lines it owns. Each referenced number appears in the task's Test line as A<n> positive: <case-id>; negative: <case-id> or with boundary: instead. Empty cases, nonexistent references, and Acceptance lines owned by no task are blocked by intake.test-case-pair. Files limited to docs/release-classed (low-risk docs outside protected parts, change/evidence stores, or plugin-root release metadata) exempt Test pair requirement; otherwise it applies.
  • Each task carries three one-line fields -- Files, Test and Risk -- whose content kinds and word caps are set by the plan row of the artifact charter (contract/manifest.yaml, artifacts.plan.charter, rendered by "${CLAUDE_PLUGIN_ROOT}/scripts/loom-python" --repair charter). In Test, first locate existing cases and their paths. Reuse sufficient coverage; planned case-ids do not require new permanent functions or files. Before adding or extending a permanent case, name the distinct defect or untested behaviour it detects. Keep this within the existing field caps and pair grammar; changed executable behaviour still needs a real RED before its fix. Run "${CLAUDE_PLUGIN_ROOT}/scripts/loom-python" --repair plan docs/loom/<change-id>/plan.md before the plan commit. Keep the plan useful when implementation changes; no separate plan-history ledger is required.

Sections.

Write plan.md, Current State Evidence and every evidence note in English. Questions asked copies the user's words verbatim; the decision point ① restatement stays in the user's language.

  • When needs-design: no, the plan opens with Current State Evidence — Forward, Reverse, Error, Data, Boundary, each with a path and an anchor. With a spec, that section lives there instead, the plan cites the spec, and each task's Risk line points at the spec's Design decision by REQ id rather than restating the reasoning.
  • A Questions asked section carrying the list you kept from step 3 and every question you asked at decision point ② in step 4 — one line per question, <decision point> — <type> — <text>. The intent's ## Open questions must be exactly - none before Build; unresolved choices go back to intent work.
  • A closing Risks section for risks that span the whole plan. When there is no spec, this section is also where the answers to outcome or authorization questions live: one user-decided — <what they chose and why> line each, because with no spec there is no ## Design decision to hold them. If a previously skipped plan's intent Constraints carries - user-decided — second-vendor selection-confirmed: <vendor>, copy the unbulleted machine line into Risks before review. Risks is authoritative when it has a selection; otherwise review falls back to intent Constraints.

Simplicity check. After the draft exists, follow references/plan-simplicity.md. Planned filenames cannot establish that the completed change will be narrow.

Then run both commands before committing it:

"${CLAUDE_PLUGIN_ROOT}/scripts/loom-python" --repair plan docs/loom/<change-id>/plan.md
"${CLAUDE_PLUGIN_ROOT}/scripts/loom-python" --repair intake write-plan <change-id>

The second run is when intake.test-case-pair can inspect the completed Task DAG and block missing ownership, empty case pairs, or unresolved intent questions. A pre-plan intake pass cannot substitute for this readiness run. Apply the same exit-code and text interpretation from the intake check above.

Resolve second-vendor: suggest

Run this after the plan's Risk lines exist and both checks pass. Load references/second-vendor-ask-and-docs-lint.md. Probe only the eligible other-vendor CLIs described there, then pass one JSON object on stdin with exactly these keys: contract_version (integer 1), configured_mode, host_vendor, usable_vendors, risk_evidence (anchored risk evidence), response (pending | decline | accept), response_vendor (only with accept), review_started (whether Closing Review has started), and fixed_vendor (only in fixed mode), to:

"${CLAUDE_PLUGIN_ROOT}/scripts/loom-python" --repair --script second_vendor_policy.py

Treat the JSON result as the decision: render its notice_kind, notice_vendor, and recommendation_reasons; do not repeat risk mapping. The reference owns notice timing and the no-listener boundary.

Forks you decided yourself. Every one gets a one-line reason on its task: what you chose and why. Check existing decisions, project evidence, tests, and applicable external sources; decide the technical choice and record the reason as agent-decided. Disclose material user consequences even when no question is needed. A late unresolved user outcome or missing authorization is asked when needed; continue independent work while awaiting the answer. List agent decisions so the acceptance test report can show them at decision point ③.

When an unresolved factual premise could change that choice, consider loom-code:engineering-research, including for a small capability/version check. Reference the retained record and return its evidence or uncertainty to this plan. Research is optional, preserves this station and its authorization, and does not turn routine lookups into a prerequisite or advance a user decision point.

<!-- gate: write-plan.post-decision-conservative-default --> After the decision point, classes (b), (c) and (e) have no free default. For those three classes in references/one-way-door.md — money or a standing obligation, a limit on what the user can do later, and any irreversible action on the user's existing data — when authorization is missing, take a zero-obligation, reversible option that touches no existing data if it meets the user's outcome. Record it as agent-decided — not authorised, took the conservative option. Choosing a committing option without authorization is never allowed. If no viable conservative option meets the user outcome, ask for the missing preference or authorization.

Step 6 — Commit and hand off

Commit the plan (Branch before the first commit) with the message docs(loom): plan <change-id>. Then hand the change to the build station — loom-code:build — which dispatches one implementer per task, runs task and integration tests, and calls the closing-review station once at branch end. When the plan is committed and required checks pass, call loom-code:build in the same turn. A progress report naming Build does not complete the hand-off. A failed check or unresolved user decision blocks dependent work; continue independent work while resolving it.

04 同仓库更多 Skills