Skip to content

fix(sdd): plan-scoped workspace — per-plan artifact dirs, self-identifying ledger, end-of-plan cleanup - #1943

Merged
arittr merged 10 commits into
devfrom
sdd-plan-scoped-workspace
Jul 19, 2026
Merged

arittr merged 10 commits into
devfrom
sdd-plan-scoped-workspace

Conversation

@obra

@obra obra commented Jul 6, 2026

Copy link
Copy Markdown
Owner

Who is submitting this PR? (required)

Field Value
Your model + version Claude Fable 5 (claude-fable-5) as the coordinating session; an Opus SDD controller subagent executed the plan; Sonnet subagents served as implementers and as the 40 eval scenario agents; the final whole-branch review ran on Opus
Harness + version Claude Code 2.1.202 (CLI, macOS)
All plugins installed superpowers@claude-plugins-official 6.1.1 (the subject of this PR), agent-sdk-dev, code-simplifier, claude-code-setup, context7, frontend-design, gopls-lsp, linear, mcp-server-dev, plugin-dev (claude-plugins-official + claude-code-plugins), release-radar, elements-of-style, episodic-memory, superpowers-chrome, superpowers-developing-for-claude-code, superpowers-lab, claude-session-driver, github-triage, summarize-meetings, worldview-synthesis, primeradiant-ops
Human partner who reviewed this diff Jesse Vincent (obra, maintainer) — directed the work, adjudicated two eval STOP gates, and approved the design and the eval re-scope interactively; complete-diff review happens in this PR at his direction (see Human review below)

What problem are you trying to solve?

SDD's durable-progress workspace (.superpowers/sdd/, since v6.0.3) has no plan identity and no end-of-life. Every artifact is keyed by bare task number (progress.md, task-N-brief.md, task-N-report.md), and SKILL.md tells a starting controller to treat whatever ledger it finds as its own progress ("Tasks listed there as complete are DONE — do not re-dispatch them"). Nothing ever deletes the workspace.

Observed failures from a real multi-plan project (forensic record in docs/superpowers/specs/2026-07-06-sdd-plan-scoped-workspace.md, gathered from an actual repo where SDD ran plans P1→P2→P3 in one worktree between 2026-06-22 and 2026-07-05):

One honesty note on #1936's failure mode: our controlled baseline could not reproduce blind ledger adoption — 25/25 fresh Sonnet controllers across three framings (including a faithful post-compaction resume with the skill's "trust the ledger" line active) forensically cross-checked the stale ledger against git history and refused it, spending 6–13 tool calls per resume doing so. The fix therefore does not claim an error-rate reduction with current-generation controllers; it removes the structural collision surface entirely so correctness stops depending on controller vigilance (and on model tier), and the forensic disambiguation work disappears. Full evidence: docs/superpowers/specs/2026-07-06-sdd-plan-scoped-workspace-eval-results.md.

What does this PR change?

sdd-workspace now requires the plan file and resolves a per-plan directory (.superpowers/sdd/<plan-basename>/); task-brief and review-package write into their plan's directory (review-package gains PLAN_FILE as its first argument). SKILL.md's Durable Progress section scopes the ledger check to the plan's own workspace, requires the ledger's first line to name its plan, treats mismatched or flat-path ledgers as another plan's property, and deletes the workspace once the final whole-branch review is clean. The workspace test is rewritten for the plan-scoped layout (13 assertions, including negative cases and worktree isolation).

Is this change appropriate for the core library?

Yes. It changes core SDD infrastructure (skills/subagent-driven-development/) that every SDD user exercises, regardless of project type. No third-party services, no domain-specific behavior, no new dependencies.

What alternatives did you consider?

Does this PR contain multiple unrelated changes?

No. One problem. The spec, plan, and eval-results documents committed alongside the code are this change's design and evidence record; task-reviewer-prompt.md gets a one-line signature alignment for the same script change.

Existing PRs

All three PRs identified the same collision problem; none was mergeable as-is for the maintainer's requirements:

This PR covers the union of what those attempt, plus ledger identity, the ownership guard, end-of-plan cleanup, and behavioral eval evidence, with no compatibility fallbacks. The maintainer plans to follow up on the three open PRs directly.

Environment tested

Harness (e.g. Claude Code, Cursor) Harness version Model Model version/ID
Claude Code (CLI, macOS 15 / Darwin 25.5) 2.1.202 Fable 5 (session), Opus (SDD controller + final review), Sonnet (implementers + all 40 eval scenario agents) claude-fable-5, claude-opus-4-8, claude-sonnet-5

New harness support (required if this PR adds a new harness)

Not applicable — no new harness.

Evaluation

  • Initial prompt: "you recently switch[ed] subagent driven development to use a ledger inside .superpowers/sdd — and we're finding that since that data isn't cleaned up, agents get confused on followup plans… dig into this and see if it makes sense," followed by "write up a spec and then use writing-plans to write the plan and then assign an opus subagent to run subagent driven development to push this all the way through to built and a basic eval, then open a PR."
  • Eval sessions after the change: 15 fresh Sonnet controller sessions (5 × S1-GREEN stale-foreign-workspace, 5 × S2-GREEN same-plan resume, 5 × S2 released-text control on the same truthful fixture), compaction-resume framing, hand-scored. Before the change: 25 RED sessions across three framings and two fixture iterations.
  • Outcomes:
Arm Text Result
S1 RED (stale foreign ledger) released v6.1.1 15/15 refused adoption — via 6–13 tool calls of cross-plan commit/plan forensics per resume (mean 9.0)
S1 GREEN this branch 5/5 correct, 0/5 needed commit-content forensics — resolution is structural ("a flat-path ledger is another plan's stray progress — not mine, left untouched")
S2 RED control (legit resume) released v6.1.1 5/5 resume at Task 3 (validates the fixture)
S2 GREEN (regression) this branch 5/5 resume at Task 3 — the ledger's compaction-recovery purpose is preserved

Raw tool-call counts did not drop (GREEN mean 9.6 vs RED 9.0, on a GREEN fixture that deliberately contains more stale litter); the change is in the kind of work — no rep needed to open commits and diff them against plan files. Two earlier fixture iterations were discarded by the plan's own STOP gates for measuring the wrong mechanism (fabricated hashes; stub implementations ruled "false records"); that history is documented in the results doc's Fixture iterations section.

Rigor

  • If this is a skills change: I used superpowers:writing-skills and completed adversarial pressure testing (paste results below)
  • This change was tested adversarially, not just on the happy path
  • I did not modify carefully-tuned content (Red Flags table, rationalizations, "human partner" language) without extensive evals showing the change is an improvement

Pressure-testing summary: 40 fresh-session scenario reps total (25 RED / 15 GREEN+control), every reply read and hand-scored, verbatim quotes preserved in the two committed evidence docs; the RED baseline falsified the original blind-adoption hypothesis and the eval was re-scoped with explicit maintainer sign-off (recorded in the spec) rather than reframed — per writing-skills, no failing baseline means no error-rate claim, so this PR doesn't make one. The Red Flags table entry and review-package invocations were updated mechanically for the new signatures; the rewritten Durable Progress section passed 5/5 GREEN on both scenarios with zero loophole iterations. Deterministic gates at the branch tip, re-run independently three times (implementer, Opus final reviewer, coordinating session): tests/claude-code/test-sdd-workspace.sh 13/13 PASS; tests/claude-code/test-subagent-driven-development-integration.sh exit 0; scripts/lint-shell.sh clean on all touched shell files. Known pre-existing failure, unchanged by this branch: tests/claude-code/test-subagent-driven-development.sh fails identically at the merge base c809093 (case-sensitive greps over live-model paraphrase) — flagged for a separate fix.

The final whole-branch review (Opus, adversarial, independently re-ran gates and byte-compared committed appendices against on-disk eval artifacts): ready to merge, 0 Critical, 0 Important, 4 Minor (all triaged defer/not-an-issue; the substantive one — an identity-less ledger inside a plan's own scoped directory falls between the guard's branches and fails safe toward a fresh start — is noted for a follow-up).

Release-note lines for the next release: (a) review-package now takes PLAN_FILE as its first argument — old invocations fail loudly; (b) an SDD plan in flight across the upgrade (flat-path ledger) is deliberately treated as another plan's progress and starts fresh — safe direction, by design.

Human review

  • A human has reviewed the COMPLETE proposed diff before submission

Stated plainly rather than checked: Jesse (the maintainer) commissioned this change, made the two load-bearing decisions mid-flight (design direction; eval re-scope after the RED baseline falsified the hypothesis), and directed that the PR be opened for his review — this PR is his complete-diff review venue for work done in his own checkout. Nothing here has been merged; nothing lands without his review.

obra added 10 commits July 6, 2026 11:06
The .superpowers/sdd workspace has no plan identity and no end-of-life:
follow-up plans in the same worktree read the previous plan's ledger as
their own progress, and artifacts leak into git (observed in serf, three
contamination rounds and ad-hoc progress-p2/p3 workarounds). Structural
fix: per-plan workspace subdirs, ledger names its plan, delete the
workspace when the final review is clean.
Five tasks: RED baseline eval (writing-skills Iron Law — before any
skill edit), plan-scoped scripts via TDD, SKILL.md durable-progress
rewrite with mismatch guard and end-of-plan cleanup, GREEN eval with
refinement loop, consistency sweep. Eval = 5 fresh sonnet subagents per
scenario per arm, hand-scored.
Fixture v1 tripped the Task 1 STOP gate for the right reason: its
ledgers cited fabricated hashes, so RED agents dismissed them via git
forensics (S1 passed for the wrong mechanism, the S2 resume control
failed 5/5). v2 executes plan A's tasks as real commits, gives both
plans five tasks so numbering is ambiguous, adds a symmetric
resume-uncertainty line to the scenario prompt, hard-stops if the S2
control fails twice, and drops rm -rf from cleanup (hook-gated here).
…EEN measures cost

Three RED rounds (25 reps, three framings incl. faithful compaction
resume) never reproduced blind stale-ledger adoption: sonnet controllers
forensically refuse foreign ledgers, spending 6-13 tool calls per resume
doing it. Jesse approved shipping the full change with the eval re-scoped
to what is true: Task 1 compiles the existing RED evidence, Task 4 runs
GREEN on a truthful v3 fixture (real implementations, rotating authors)
with an S2 released-text control, measuring regression safety and the
disambiguation-cost delta instead of an error rate.
… claims narrowed

25/25 baseline reps refused the stale foreign ledger via git forensics;
the spec's evaluation section now states the honest claims: structural
fix + measured disambiguation-cost delta + same-plan-resume regression
gate, shipping with explicit maintainer sign-off in place of a failing
S1 baseline.
…r plan

sdd-workspace now requires the plan file and resolves
.superpowers/sdd/<plan-basename>/; task-brief and review-package write
into their plan's directory (review-package gains PLAN_FILE as its first
argument). Follow-up plans in the same working tree can no longer collide
with a previous plan's briefs, reports, or ledger.
…space dies at plan end

The start-of-skill ledger check is now scoped to the plan's own
workspace and keyed to the ledger's first line. Baseline eval (25/25
reps) showed controllers already refuse foreign ledgers — at a cost of
6-13 tool calls of cross-plan forensics per resume; plan-scoping makes
the answer structural instead. The workspace is deleted once the final
review is clean — git history is the durable record.
arittr added a commit to prime-radiant-inc/superpowers-evals that referenced this pull request Jul 16, 2026
Two permanent full-tier scenarios pinning the reject-foreign/trust-own
ledger discrimination that obra/superpowers#1943 builds, mirroring the
PR's S1/S2 eval design. Hybrid checks: behavior-neutral core + layout-
pinned mechanics.

Co-Authored-By: Claude Fable 5 <[email protected]>

@arittr arittr left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@arittr
arittr merged commit 30ff376 into dev Jul 19, 2026
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.

2 participants