Update an existing Spectra change — from a plan file or conversation context.
-
Locate the requirement source
a. Argument provided → treat as plan file reference (prepend .cursor/plans/ and append .md if needed)
- If the file exists → use it as the plan file source, proceed to Step 2
- If the file does NOT exist → report the error and stop
b. No argument, plan file detectable:
- Check conversation context for plan file path (plan mode system messages include the path like
.cursor/plans/<name>.md)
- If found and the file exists → use the AskUserQuestion tool to ask:
- Option 1: Use the plan file
- Option 2: Use conversation context
- If the user picks plan file → proceed to Step 2
- If the user picks conversation context → skip Step 2, go to Step 3
c. No argument, no plan file detectable:
- Check
.cursor/plans/ for recent files
- If recent files exist → list 5 most recent with the AskUserQuestion tool, include "Use conversation context" as an additional option
- If the user picks a file → proceed to Step 2
- If the user picks conversation context → skip Step 2, go to Step 3
d. Conversation context fallback (no plan files found at all):
- Use conversation context to update artifacts
- If conversation context is insufficient, use the AskUserQuestion tool to get more details
- Warn: "No plan file found. Using conversation context."
-
Parse the plan structure (skip if using conversation context)
Claude Code plan files typically contain:
- Title (
# ...) — the high-level goal
- Context section — background, motivation, current state
- Stages/Steps — numbered implementation stages with goals and file lists
- Files involved — list of files to modify/create
- Verification section — how to test the changes
Extract:
plan_title: from the H1 heading
plan_context: from the Context section
plan_stages: each numbered stage with its goal and file list
plan_files: all file paths mentioned
plan_verification: verification steps
-
Check for active changes (REQUIRED — ingest only updates existing changes)
spectra list --json
Also check for parked changes:
spectra list --parked --json
Parse both JSON outputs to get the full list of changes (active + parked). Parked changes should be annotated with "(parked)" in any selection list.
- If one change exists (active or parked) → use the AskUserQuestion tool to confirm updating it
- If multiple changes exist → use the AskUserQuestion tool to let user pick which one to update
- If no changes at all (neither active nor parked) → tell the user: "No active change found. Use
/spectra:propose first to create one." and stop
-
Select the change
After selecting the change, check if it is parked:
spectra list --parked --json
If the selected change appears in the parked array:
- Inform the user that this change is currently parked(暫存)
- Use AskUserQuestion tool to ask: continue (unpark) or cancel
- If continue: run
spectra unpark "<name>" then proceed
- If cancel: stop the workflow
If there is no AskUserQuestion tool available (non-Claude-Code environment):
Inform the user that this change is currently parked(暫存)and ask via plain text whether to unpark and continue, or cancel.
Wait for the user's response. If the user confirms, run spectra unpark "<name>" then proceed.
Read existing artifacts for context before updating.
-
Update artifacts
For each artifact, get instructions first:
spectra instructions <artifact-id> --change "<name>" --json
Use the template from instructions as the output structure. Apply context and rules as constraints but do NOT copy them into the file.
The instructions JSON includes locale — the language to write artifacts in. If present, you MUST write the artifact content in that language. Exception: spec files (specs/*/*.md) MUST always be written in English regardless of locale, because they use normative language (SHALL/MUST).
Plan-to-Artifact Mapping (when using a plan file):
| Plan Section | Artifact | How to Map |
|---|
| Title | Change name | Convert to kebab-case |
| Context | proposal: Why | Direct content transfer |
| Stages overview | proposal: What | Summarize all stages |
| Individual stages | tasks.md groups | One stage = one ## heading, sub-items = - [ ] |
| File paths | proposal: Impact | Affected code list |
| Verification steps | tasks.md | Final verification task group |
Context-to-Artifact Mapping (when using conversation context):
| Conversation Element | Artifact | How to Map |
|---|
| Goal / requirement | proposal: Why | Extract motivation from discussion |
| Discussed approach | proposal: What | Summarize agreed approach |
| Mentioned files | proposal: Impact | Affected code list |
| Discussion phases | tasks.md groups | One topic = one ## heading |
When updating an existing change:
- Merge new context into existing proposal (don't replace)
- Add new tasks from plan stages or conversation, preserve completed
[x] items
- Preserve existing
[P] markers on tasks that still qualify
- Do NOT remove existing content
Parallel task markers ([P]): When creating or updating the tasks artifact, first read .spectra.yaml. If parallel_tasks: true is set, add [P] markers to new tasks that can be executed in parallel. Format: - [ ] [P] Task description. A task qualifies for [P] if it targets different files from other pending tasks AND has no dependency on incomplete tasks in the same group. When parallel_tasks is not enabled, do NOT add [P] markers — but still preserve any existing [P] markers already in the file.
After creating each artifact, re-check status:
spectra status --change "<name>" --json
Continue until all applyRequires artifacts are complete. Show progress: "✓ Created "
-
Inline Self-Review (before CLI analysis)
After updating all artifacts, scan them manually. Fix issues inline, then proceed to the CLI analyzer.
Check 1: No Placeholders
These patterns are artifact failures — fix each one before proceeding:
- "TBD", "TODO", "FIXME", "implement later", "details to follow"
- Vague instructions: "Add appropriate error handling", "Handle edge cases", "Write tests for the above"
- Delegation by reference: "Similar to Task N" without repeating specifics
- Steps describing WHAT without HOW: "Implement the authentication flow" (what flow? what steps?)
- Empty template sections left unfilled
- Weasel quantities: "some", "various", "several" when a specific number or list is needed
Check 2: Internal Consistency
- Does every capability in the proposal have a corresponding spec?
- Does the design reference only capabilities from the proposal?
- Do tasks cover all design decisions, and nothing outside proposal scope?
- Are file paths consistent across proposal Impact, design, and tasks?
Check 3: Scope Check
- More than 15 pending tasks → consider decomposing into multiple changes
- Any single task would take more than 1 hour → split it
- Touches more than 3 unrelated subsystems → consider splitting
Check 4: Ambiguity Check
- Are success/failure conditions testable and specific?
- Are boundary conditions defined (empty input, max limits, error cases)?
- Could "the system" refer to multiple components? Be explicit.
Check 5: Preservation Check (ingest-specific)
- Are all completed tasks
[x] still present and unchanged?
- Were existing
[P] markers preserved on tasks that still qualify?
- Was existing content merged (not replaced)?