Implement tasks from an OpenSpec change. Input: Optionally specify a change name. If…
- User
Implement tasks from an OpenSpec change.
Input: Optionally specify a change name. If omitted, check if it can be inferred from conversation context. If vague or ambiguous you MUST prompt for available changes.
Steps
-
Select the change
If a name is provided, use it. Otherwise:
- Infer from conversation context if the user mentioned a change
- Auto-select if only one active change exists
- If ambiguous, run
openspec list --jsonto get available changes and use the AskUserQuestion tool to let the user select
Always announce: "Using change: " and how to override (e.g.,
/opsx-apply <other>). -
Check status to understand the schema
openspec status --change "<name>" --jsonParse the JSON to understand:
schemaName: The workflow being used (e.g., "spec-driven")- Which artifact contains the tasks (typically "tasks" for spec-driven, check status for others)
-
Get apply instructions
openspec instructions apply --change "<name>" --jsonThis returns:
- Context file paths (varies by schema - could be proposal/specs/design/tasks or spec/tests/implementation/docs)
- Progress (total, complete, remaining)
- Task list with status
- Dynamic instruction based on current state
Handle states:
- If
state: "blocked"(missing artifacts): show message, suggest using openspec-continue-change - If
state: "all_done": congratulate, suggest archive - Otherwise: proceed to implementation
-
Read context files
Read the files listed in
contextFilesfrom the apply instructions output. The files depend on the schema being used:- spec-driven: proposal, specs, design, tasks
- Other schemas: follow the contextFiles from CLI output
-
Show current progress
Display:
- Schema being used
- Progress: "N/M tasks complete"
- Remaining tasks overview
- Dynamic instruction from CLI
-
Assistant
There are two active changes. Which one should I implement?
Assistant
Using change: add-diff-intelligence-layer (override with
/opsx-apply <other>)Assistant
Change: add-diff-intelligence-layer Schema: spec-driven Progress: 0/12 tasks complete
Reading context files...
Assistant
Let me read the LLM service and related files to understand the current implementation:
Assistant
Let me also check the prsSlice and the existing tests to understand the patterns:
Assistant
Let me check existing tests for patterns:
Assistant
Implementing: add-diff-intelligence-layer (schema: spec-driven)
Progress: 0/12 tasks complete
Working on task 1.1: Define citation-related types for assistant claims and references in
src/types/index.ts.Assistant
Working on task 1.2: Extend
src/services/llm.tssummary/chat prompt instructions for diff-grounded references.Assistant
Working on task 1.3: Implement robust parsing/normalization utilities for citation payloads.
Assistant
Working on task 2.1: Add citation-aware assistant payload fields in chat/summary state handling.
Assistant
Working on task 2.2: Implement citation-to-diff resolver logic. The resolver is already in
src/services/citations.ts. Now I need to add the state for file focus/navigation.Assistant
Working on task 2.3: Add unresolved-reference handling path that opens file context and surfaces a clear non-blocking indicator.
Assistant
Working on task 3.1: Render citation chips and uncited/low-confidence indicators in
src/components/ChatWindow.tsx.Assistant
Working on task 3.2: Render citation chips in summary panels in
src/components/PRViewer.tsxand wire click behavior to Files tab navigation.Assistant
Task 3.3 is already implemented as part of task 3.2 - the file highlight/focus behavior is handled by the
highlightedprop onFileItemand thefocusedFileIndexstate.Assistant
Working on task 4.1: Add unit tests for citation parser and resolver edge cases.
Assistant
Working on task 4.3: Running lint, build, and tests.
Assistant
Let me fix the lint errors.
Assistant
Let me fix the TypeScript errors.
Assistant
Let me fix the citation parser. The regex pattern seems to have issues.
Assistant
Implementation Complete
Change: add-diff-intelligence-layer Schema: spec-driven Progress: 12/12 tasks complete ✓
Completed This Session
- 1.1 Define citation-related types
- 1.2 Extend LLM prompts for diff-grounded references
- 1.3 Implement citation parsing utilities
- 2.1 Add citation fields to chat/summary state
- 2.2 Implement citation-to-diff resolver
- 2.3 Add unresolved-reference handling
- 3.1 Render citation chips in ChatWindow
- 3.2 Render citation chips in PRViewer summary
- 3.3 Add file highlight/focus behavior
- User
Assistant
From the conversation context, we just implemented
add-diff-intelligence-layer. I'll verify that change.Assistant
All 12 tasks complete. Now reading artifacts and running targeted codebase searches.
Assistant
- User
Fix W1,2,3
Assistant
Let me read the relevant code before making changes.
Assistant
Good. Now I have everything I need. Three focused fixes:
Assistant
W2 — accumulate streamed content locally:
Assistant
Also remove the now-unused
messagesfrom theuseCallbackdependency array (it was only needed for the stale lookup):Assistant
W3 — replace duplicate inline regex with
normalizeCitationPayload:Assistant
Now also remove the
DiffCitationimport sincegetSummaryCitationswas the only consumer that declared the local array type:Assistant
Still used in
CitationChipPropsandSummaryPanelprops — keep the import.Assistant
W1 — pass
focusedLineintoDiffView, highlight the matching line, and scroll it into view:Assistant
Now pass
focusedLinethroughFileItemand wire it up fromfocusedFileLinein the Redux state:Assistant
Now read the file-list render site to update the
FileItemcall:Assistant
Now clean up the unused
voidsuppressions in the DiffView line-walker (they were a workaround during drafting):Assistant
Now verify lint and tests pass:
Assistant
All three warnings fixed. 140/140 tests pass, lint clean, types check.
What changed:
W2 (
ChatWindow.tsx:246) — streamed chunks now accumulate into a localfullContentstring alongside eachappendStreamingContentdispatch. AfterfinalizeStreamingMessage, that string is passed directly tonormalizeCitationPayload, eliminating the stale-closure read from themessagesarray.W3 (
PRViewer.tsx) —getSummaryCitationsand its hand-rolled regex loop are gone. Replaced with auseMemothat delegates tonormalizeCitationPayload— the same canonical parser used everywhere else, including the#L-prefix stripping fix.W1 (
PRViewer.tsx) —DiffViewnow acceptsfocusedLine?: number | null. It walks hunk headers to find which rendered row corresponds to that line number, applies a yellow ring highlight, and scrolls it into view viascrollIntoView({ behavior: 'smooth', block: 'center' })in auseEffect.FileItemthreadsfocusedLinedown, and the files list passesfocusedFileLinefrom Redux (which was already stored but previously unused).- User
Assistant
Two changes exist and neither is unambiguously implied by the current conversation — we fixed
add-diff-intelligence-layerbut you haven't said which to verify.Assistant
Now audit the implementation against each requirement and design decision:
Assistant
- User
fix w1
Assistant
The fix is a one-liner: extract the parse+dispatch into a local helper and call it from both paths.
Assistant
Now declare
fullContentbefore thetryso the abort branch can see it, and definedispatchCitations:Assistant
Fixed. The change in
ChatWindow.tsx:fullContentanddispatchCitationsare now hoisted above thetryblock so both the normal completion path and the abort-catch path can calldispatchCitations(fullContent).- Previously an aborted stream would call
finalizeStreamingMessagebut skip citation parsing entirely — any uncited content in the partial response would silently omit theUncitedIndicator.
- User
Commit the current changes
Assistant
GPG/SSH signing is enabled but the agent doesn't have the key available. Trying with the SSH agent:
Assistant
The SSH agent has no loaded keys. The signing key is configured but not available in the agent session. You'll need to either load the key or disable signing for this commit:
ssh-add ~/.ssh/<your-key> git commit -m "..."Or to commit without signing this one time:
git commit --no-gpg-sign -m "..."Would you like me to commit with
--no-gpg-sign, or would you prefer to load the SSH key first?
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.