Skip to content

Spec mode: gated requirements/design/tasks artifacts per thread (#269) - #352

Merged
currentbits merged 8 commits into
mainfrom
coder/spec-driven-threads-gated-requirements-d-f0a746
Aug 17, 2026
Merged

currentbits merged 8 commits into
mainfrom
coder/spec-driven-threads-gated-requirements-d-f0a746

Conversation

@currentbits

Copy link
Copy Markdown
Owner

Optional spec mode for a thread: the agent writes requirements.md, then design.md, then tasks.md, and a human approves each artifact before the next stage opens. Closes the headline of #269.

Why

Kicking an agent straight at a vague prompt is where most bad runs start. A gate between "what are we building", "how", and "in what order" puts a human decision in front of each one, and keeps the answers as reviewable files rather than buried transcript. Artifacts land in <worktree>/.solenta/specs/<slug>/ so they diff, review, and merge like code — the shape #269 asked for.

What changed

  • Contract + stage machine — ThreadInfo.spec { slug, stage, awaitingApproval } (src/shared/ipc.ts); startSpec / submitSpec / reviewSpec / readSpecArtifact / specNoteFor in electron/services.js. reviewSpec never starts runs itself: it returns the next prompt for the caller to dispatch.
  • Runner — specNoteFor rides every dispatched prompt (CLI only, never the stored message) until the stage reaches build, telling the agent which artifact to write and to change nothing else.
  • MCP — spec_submit on the coder-threads server: the agent writes the artifact, submits, and stops. The gate is never inferred from the transcript.
  • IPC — threads:startSpec, threads:reviewSpec, threads:specArtifact plus preload passthroughs. Approving advances the stage and dispatches the follow-up run; "request changes" keeps the stage and hands the feedback back.
  • UI — SpecCard in the thread view: stage strip, the current artifact rendered as markdown, Approve / Request changes, and a "Spec mode" button for threads that have none.
  • Docs: a Spec mode section in docs/ARCHITECTURE.md.

Deliberately not in scope

tasks.md → dependency-wave dispatch to worker forks, the converge action, the bugfix root-cause variant, and the quick-spec skip — all still open on #269.

Known ceiling: the gate is procedural (the standing [Spec mode] prompt note plus the human's Approve click), not sandboxed. Nothing stops an agent that decides to edit source early; a can_use_tool deny in electron/runner.js is the upgrade if that shows up in practice. Marked with a ponytail: comment in services.js.

Testing

electron/test/spec-mode.test.js (stage machine, note, artifact read), spec-mcp.test.js (tool + project guard), spec-ipc.test.js (handlers + run dispatch), test/specCard.test.tsx (card and gate buttons). Full suites: core 38, renderer 838, electron 1005/1006, memory 151 — the one electron failure is the pre-existing web-integration reconnect baseline on main. Also exercised end to end against a real Store: the spec field survives reload, the note names the right file, approve advances requirements → design.

Built by three parallel grok workers off a shared contract commit, with disjoint file ownership.

  • PR created by the Claude Code agent

Willem and others added 8 commits August 17, 2026 19:59
Shared types and the services-level gate only; runner, MCP tool, IPC and UI
wiring land on top of this in parallel worker branches.

Co-Authored-By: Claude Opus 5 <[email protected]>
…prompt (#269)

Append specNoteFor after the hypothesis note in startRun so spec-mode
threads see the current stage without storing it as a user message.
Expose spec_submit on coder-threads (same project-gate as hypothesis_record)
and cover the handler in spec-mcp.test.js.
Handlers sit next to threads:setNotes. startSpec and reviewSpec
broadcast threads:changed; reviewSpec then dispatches the returned
prompt via runner.startRun. specArtifact is a read and does not
broadcast.
…into coder/spec-driven-threads-gated-requirements-d-f0a746
Add the thread-view spec card (stage strip, artifact markdown, approve /
request-changes gate) and a header Spec mode button. Wire startSpec,
reviewSpec, and specArtifact through useCoder the same way setNotes
updates thread state from the returned ThreadInfo.
…into coder/spec-driven-threads-gated-requirements-d-f0a746
The card lives in ThreadView, so its CSS belongs in ThreadView.module.css —
ThreadView was the only component reaching into App.module.css.

Co-Authored-By: Claude Opus 5 <[email protected]>
@currentbits
currentbits merged commit 3ec3d98 into main Aug 17, 2026
1 check failed
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@currentbits
currentbits deleted the coder/spec-driven-threads-gated-requirements-d-f0a746 branch October 3, 2026 16:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant