@loneexile/omp-superpowers 6.4.2-omp.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (84) hide show
  1. package/.pi/extensions/superpowers.ts +123 -0
  2. package/CHANGELOG.md +28 -0
  3. package/LICENSE +21 -0
  4. package/README.md +187 -0
  5. package/agents/sdd-escalation-implementer.md +18 -0
  6. package/agents/sdd-final-reviewer.md +23 -0
  7. package/agents/sdd-implementer.md +23 -0
  8. package/agents/sdd-rereviewer.md +69 -0
  9. package/agents/sdd-reviewer.md +83 -0
  10. package/package.json +40 -0
  11. package/skills/brainstorming/SKILL.md +285 -0
  12. package/skills/brainstorming/scripts/frame-template.html +213 -0
  13. package/skills/brainstorming/scripts/helper.js +167 -0
  14. package/skills/brainstorming/scripts/server.cjs +723 -0
  15. package/skills/brainstorming/scripts/start-server.sh +209 -0
  16. package/skills/brainstorming/scripts/stop-server.sh +120 -0
  17. package/skills/brainstorming/spec-document-reviewer-prompt.md +49 -0
  18. package/skills/brainstorming/visual-companion.md +299 -0
  19. package/skills/diagnosing-superpowers/SKILL.md +120 -0
  20. package/skills/diagnosing-superpowers/prompts/analyst-common.md +38 -0
  21. package/skills/diagnosing-superpowers/prompts/cost-and-time.md +28 -0
  22. package/skills/diagnosing-superpowers/prompts/plan-adherence.md +29 -0
  23. package/skills/diagnosing-superpowers/prompts/quality-evidence.md +26 -0
  24. package/skills/diagnosing-superpowers/prompts/repeated-work.md +30 -0
  25. package/skills/diagnosing-superpowers/prompts/request-conflicts.md +20 -0
  26. package/skills/diagnosing-superpowers/prompts/scrub-audit.md +33 -0
  27. package/skills/diagnosing-superpowers/prompts/scrub.md +29 -0
  28. package/skills/diagnosing-superpowers/prompts/similar-session.md +38 -0
  29. package/skills/diagnosing-superpowers/prompts/skill-timeline.md +30 -0
  30. package/skills/diagnosing-superpowers/prompts/stumbles.md +28 -0
  31. package/skills/diagnosing-superpowers/references/context-safety.md +22 -0
  32. package/skills/diagnosing-superpowers/references/github-issues.md +47 -0
  33. package/skills/diagnosing-superpowers/references/redaction-policy.md +34 -0
  34. package/skills/diagnosing-superpowers/references/session-discovery.md +31 -0
  35. package/skills/diagnosing-superpowers/templates/bundle-README.md +77 -0
  36. package/skills/diagnosing-superpowers/templates/case.md +64 -0
  37. package/skills/diagnosing-superpowers/templates/issue.md +51 -0
  38. package/skills/diagnosing-superpowers/templates/report.md +82 -0
  39. package/skills/dispatching-parallel-agents/SKILL.md +167 -0
  40. package/skills/executing-plans/SKILL.md +373 -0
  41. package/skills/executing-plans/scripts/task-done +52 -0
  42. package/skills/executing-plans/scripts/task-start +28 -0
  43. package/skills/finishing-a-development-branch/SKILL.md +225 -0
  44. package/skills/receiving-code-review/SKILL.md +205 -0
  45. package/skills/requesting-code-review/SKILL.md +95 -0
  46. package/skills/requesting-code-review/code-reviewer.md +198 -0
  47. package/skills/subagent-driven-development/SKILL.md +681 -0
  48. package/skills/subagent-driven-development/implementer-prompt.md +157 -0
  49. package/skills/subagent-driven-development/re-review-prompt.md +110 -0
  50. package/skills/subagent-driven-development/scripts/review-package +53 -0
  51. package/skills/subagent-driven-development/scripts/sdd-workspace +82 -0
  52. package/skills/subagent-driven-development/scripts/task-brief +43 -0
  53. package/skills/subagent-driven-development/task-reviewer-prompt.md +205 -0
  54. package/skills/systematic-debugging/CREATION-LOG.md +119 -0
  55. package/skills/systematic-debugging/SKILL.md +283 -0
  56. package/skills/systematic-debugging/condition-based-waiting-example.ts +158 -0
  57. package/skills/systematic-debugging/condition-based-waiting.md +115 -0
  58. package/skills/systematic-debugging/defense-in-depth.md +122 -0
  59. package/skills/systematic-debugging/find-polluter.sh +72 -0
  60. package/skills/systematic-debugging/root-cause-tracing.md +169 -0
  61. package/skills/systematic-debugging/test-academic.md +14 -0
  62. package/skills/systematic-debugging/test-pressure-1.md +58 -0
  63. package/skills/systematic-debugging/test-pressure-2.md +68 -0
  64. package/skills/systematic-debugging/test-pressure-3.md +69 -0
  65. package/skills/test-driven-development/SKILL.md +330 -0
  66. package/skills/test-driven-development/writing-good-tests.md +198 -0
  67. package/skills/using-git-worktrees/SKILL.md +194 -0
  68. package/skills/using-superpowers/SKILL.md +65 -0
  69. package/skills/using-superpowers/references/antigravity-tools.md +23 -0
  70. package/skills/using-superpowers/references/claude-code-tools.md +29 -0
  71. package/skills/using-superpowers/references/codex-tools.md +108 -0
  72. package/skills/using-superpowers/references/gemini-tools.md +63 -0
  73. package/skills/using-superpowers/references/hermes-tools.md +56 -0
  74. package/skills/using-superpowers/references/muse-tools.md +35 -0
  75. package/skills/using-superpowers/references/pi-tools.md +41 -0
  76. package/skills/verification-before-completion/SKILL.md +120 -0
  77. package/skills/writing-plans/SKILL.md +204 -0
  78. package/skills/writing-skills/SKILL.md +681 -0
  79. package/skills/writing-skills/anthropic-best-practices.md +1150 -0
  80. package/skills/writing-skills/examples/CLAUDE_MD_TESTING.md +189 -0
  81. package/skills/writing-skills/graphviz-conventions.dot +172 -0
  82. package/skills/writing-skills/persuasion-principles.md +187 -0
  83. package/skills/writing-skills/render-graphs.js +169 -0
  84. package/skills/writing-skills/testing-skills-with-subagents.md +384 -0
@@ -0,0 +1,157 @@
1
+ # Implementer Subagent Prompt Template
2
+
3
+ Use this template when dispatching an implementer subagent.
4
+
5
+ ```
6
+ { context: "<one line: plan name, branch, and the global constraints that bind every task>",
7
+ tasks: [ {
8
+ name: "ImplTaskN",
9
+ agent: "sdd-implementer", # REQUIRED — carries model, thinking level, tools.
10
+ # Fix round 3 / a ruled strongest-tier exception:
11
+ # "sdd-escalation-implementer". Never plain "task".
12
+ task: |
13
+ You are implementing Task N: [task name]
14
+
15
+ ## Task Description
16
+
17
+ Read your task brief first: [BRIEF_FILE]
18
+ It contains the full task text from the plan.
19
+
20
+ ## Context
21
+
22
+ [Scene-setting: where this fits, dependencies, architectural context]
23
+
24
+ ## Before You Begin
25
+
26
+ If you have questions about:
27
+ - The requirements or acceptance criteria
28
+ - The approach or implementation strategy
29
+ - Dependencies or assumptions
30
+ - Anything unclear in the task description
31
+
32
+ **Ask them now.** Raise any concerns before starting work.
33
+
34
+ ## Your Job
35
+
36
+ Once you're clear on requirements:
37
+ 1. Implement exactly what the task specifies
38
+ 2. Write tests (following TDD if task says to)
39
+ 3. Verify implementation works
40
+ 4. Commit your work
41
+ 5. Self-review (see below)
42
+ 6. Report back
43
+
44
+ Work from: [directory]
45
+
46
+ **While you work:** If you encounter something unexpected or unclear, **ask questions**.
47
+ It's always OK to pause and clarify. Don't guess or make assumptions.
48
+
49
+ While iterating, run the focused test for what you're changing; run the
50
+ full suite once before committing, not after every edit.
51
+
52
+ ## You Do Not Dispatch Subagents
53
+
54
+ Do all of this task's work yourself. Never spawn a subagent to
55
+ implement part of the task, and above all never spawn a reviewer to
56
+ check your work. Self-review (below) means reading your own diff.
57
+ Review is the controller's job: after you report, it dispatches a
58
+ fresh reviewer against your diff. A reviewer you spawn duplicates
59
+ that review at full cost, and its approval counts for nothing in
60
+ the process. If you catch yourself thinking "an independent review
61
+ would strengthen my report" — that review is already scheduled.
62
+ Report instead.
63
+
64
+ ## Code Organization
65
+
66
+ You reason best about code you can hold in context at once, and your edits are more
67
+ reliable when files are focused. Keep this in mind:
68
+ - Follow the file structure defined in the plan
69
+ - Each file should have one clear responsibility with a well-defined interface
70
+ - If a file you're creating is growing beyond the plan's intent, stop and report
71
+ it as DONE_WITH_CONCERNS — don't split files on your own without plan guidance
72
+ - If an existing file you're modifying is already large or tangled, work carefully
73
+ and note it as a concern in your report
74
+ - In existing codebases, follow established patterns. Improve code you're touching
75
+ the way a good developer would, but don't restructure things outside your task.
76
+
77
+ ## When You're in Over Your Head
78
+
79
+ It is always OK to stop and say "this is too hard for me." Bad work is worse than
80
+ no work. You will not be penalized for escalating.
81
+
82
+ **STOP and escalate when:**
83
+ - The task requires architectural decisions with multiple valid approaches
84
+ - You need to understand code beyond what was provided and can't find clarity
85
+ - You feel uncertain about whether your approach is correct
86
+ - The task involves restructuring existing code in ways the plan didn't anticipate
87
+ - You've been reading file after file trying to understand the system without progress
88
+
89
+ **How to escalate:** Report back with status BLOCKED or NEEDS_CONTEXT. Describe
90
+ specifically what you're stuck on, what you've tried, and what kind of help you need.
91
+ The controller can provide more context, re-dispatch with a more capable model,
92
+ or break the task into smaller pieces.
93
+
94
+ ## Before Reporting Back: Self-Review
95
+
96
+ Review your work with fresh eyes. Ask yourself:
97
+
98
+ **Completeness:**
99
+ - Did I fully implement everything in the spec?
100
+ - Did I miss any requirements?
101
+ - Are there edge cases I didn't handle?
102
+
103
+ **Quality:**
104
+ - Is this my best work?
105
+ - Are names clear and accurate (match what things do, not how they work)?
106
+ - Is the code clean and maintainable?
107
+
108
+ **Discipline:**
109
+ - Did I avoid overbuilding (YAGNI)?
110
+ - Did I only build what was requested?
111
+ - Did I follow existing patterns in the codebase?
112
+
113
+ **Testing:**
114
+ - Do tests actually verify behavior (not just mock behavior)?
115
+ - Did I follow TDD if required?
116
+ - Are tests comprehensive?
117
+ - Is the test output pristine (no stray warnings or noise)?
118
+
119
+ If you find issues during self-review, fix them now before reporting.
120
+
121
+ ## After Review Findings
122
+
123
+ If the task review finds issues, you will be resumed with the findings.
124
+ Fix them, re-run the tests that cover the amended code, and append a fix
125
+ report to your report file: what you changed, the covering tests you
126
+ ran, the command, and the output. Reviewers will not re-run tests for
127
+ you — your report is the test evidence. Then reply with the same short
128
+ status contract as your first report.
129
+
130
+ ## Report Format
131
+
132
+ Write your full report to [REPORT_FILE]:
133
+ - What you implemented (or what you attempted, if blocked)
134
+ - What you tested and test results
135
+ - **TDD Evidence** (if TDD was required for this task):
136
+ - RED: command run, relevant failing output before implementation, and why the failure was expected
137
+ - GREEN: command run and relevant passing output after implementation
138
+ - Files changed
139
+ - Self-review findings (if any)
140
+ - Any issues or concerns
141
+
142
+ Then report back with ONLY (≤12 lines — the detail lives in the
143
+ report file):
144
+ - **Status:** DONE | DONE_WITH_CONCERNS | BLOCKED | NEEDS_CONTEXT
145
+ - Commits created (short SHA + subject)
146
+ - One-line test summary (e.g. "14/14 passing, output pristine")
147
+ - Your concerns, if any
148
+ - The report file path
149
+
150
+ If BLOCKED or NEEDS_CONTEXT, put the specifics in the final message
151
+ itself — the controller acts on it directly.
152
+
153
+ Use DONE_WITH_CONCERNS if you completed the work but have doubts about correctness.
154
+ Use BLOCKED if you cannot complete the task. Use NEEDS_CONTEXT if you need
155
+ information that wasn't provided. Never silently produce work you're unsure about.
156
+ } ] }
157
+ ```
@@ -0,0 +1,110 @@
1
+ # Scoped Re-Review Prompt Template
2
+
3
+ Use this template when dispatching a re-review after a fix round. The
4
+ re-reviewer verifies the findings were addressed and checks the fix diff for
5
+ new breakage. It is not a fresh review — the full review already happened.
6
+
7
+ **Purpose:** Verify each finding from the previous review was addressed, and
8
+ that the fix itself broke nothing.
9
+
10
+ ```
11
+ { context: "<one line: plan name, branch, read-only re-review of one fix round>",
12
+ tasks: [ {
13
+ name: "ReReviewTaskNRoundR",
14
+ agent: "sdd-rereviewer", # REQUIRED — the cheap seat: low thinking,
15
+ # read/grep only (no file writes, no shell), four-call budget.
16
+ task: |
17
+ You are re-reviewing one task's fix round. A previous review produced
18
+ findings; an implementer has attempted to fix them. Your job is to
19
+ verdict each finding and inspect the fix diff — nothing else.
20
+
21
+ ## The Task
22
+
23
+ Read the task brief: [BRIEF_FILE]
24
+
25
+ ## The Findings Under Verification
26
+
27
+ [FINDINGS]
28
+
29
+ ## The Fix
30
+
31
+ Read the implementer's report (fix reports are appended at the end):
32
+ [REPORT_FILE]
33
+
34
+ **Fix base:** [FIX_BASE_SHA] (the head the previous review saw)
35
+ **Head:** [HEAD_SHA]
36
+ **Diff file:** [DIFF_FILE]
37
+
38
+ Read the diff file once — it contains the fix commits, a stat summary,
39
+ and the fix diff with surrounding context. You have no shell; if the
40
+ diff file is missing, report that as a gap and stop.
41
+
42
+ Your review is read-only on this checkout. Do not mutate the working
43
+ tree, the index, HEAD, or branch state in any way.
44
+
45
+ ## You Do Not Dispatch Subagents
46
+
47
+ Do all of this review yourself. Never spawn a subagent to review part
48
+ of the diff, and never spawn another reviewer for a second opinion.
49
+ This process already provides every review seat the work gets; a
50
+ reviewer you spawn duplicates one of them at full cost, and its
51
+ verdict counts for nothing. If the diff feels too large for one
52
+ pass, review it in passes yourself and say so in your report.
53
+
54
+ ## Scope
55
+
56
+ Your scope is the findings list and the fix diff. Verdict every finding.
57
+ Inspect the fix diff for new problems the fix itself introduced. Do NOT
58
+ re-review code the fix did not touch: if you notice an issue entirely
59
+ outside the fix diff, report it in `out_of_scope[]` — it does not
60
+ block this task and does not extend the loop. A broad whole-branch
61
+ review happens after all tasks are complete.
62
+
63
+ ## Tests
64
+
65
+ The implementer re-ran the tests covering the amended code and appended
66
+ the results to the report file. Treat the report as unverified claims:
67
+ confirm the fix report names the covering tests and shows their output,
68
+ and verify the claims against the diff. You have no shell: if reading
69
+ the code raises a specific doubt that no existing run answers, name the
70
+ focused test you would run in that finding's evidence and verdict on
71
+ what the diff shows.
72
+
73
+ ## Output
74
+
75
+ Your result is structured (the agent's `output:` schema), not prose.
76
+ Yield:
77
+
78
+ - `finding_verdicts[]`, one per finding in The Findings Under
79
+ Verification, in order: `{finding: the one-liner, status: ADDRESSED |
80
+ NOT_ADDRESSED, evidence: file:line}`. "Attempted" is not addressed:
81
+ the specific defect must no longer exist.
82
+ - `new_breakage[]`: only what the fix itself broke or introduced —
83
+ `{severity: Critical|Important|Minor, location: file:line, body}`.
84
+ Empty when clean.
85
+ - `out_of_scope[]`: issues entirely outside the fix diff. Non-blocking;
86
+ the controller ledgers these for the final review.
87
+ - `round_verdict`: `all_addressed` (every finding ADDRESSED and no new
88
+ Critical/Important breakage) | `findings_open` | `package_gap`.
89
+ - `package_gap`: ONLY when you could not read the diff package at the
90
+ path given. Then yield exactly: `round_verdict: package_gap`,
91
+ `finding_verdicts: []`, `package_gap` = the path and the error — and
92
+ nothing else. Never verdict findings against a package you did not
93
+ read; the controller regenerates the package and re-dispatches.
94
+ } ] }
95
+ ```
96
+
97
+ **Placeholders:**
98
+ - `agent: sdd-rereviewer` — REQUIRED (see SKILL.md Agent Selection); a
99
+ scoped re-review is verdict-only work over a small diff
100
+ - `[BRIEF_FILE]` — the task brief file (same file the implementer worked from)
101
+ - `[FINDINGS]` — the Critical/Important findings and spec gaps from the
102
+ previous review, copied verbatim, one per bullet
103
+ - `[REPORT_FILE]` — the implementer's report file (fix reports appended)
104
+ - `[FIX_BASE_SHA]` — the head the previous review saw
105
+ - `[HEAD_SHA]` — current commit
106
+ - `[DIFF_FILE]` — the path `bash scripts/review-package PLAN_FILE FIX_BASE HEAD` printed
107
+
108
+ **Re-reviewer returns** (structured): `finding_verdicts[]` (ADDRESSED /
109
+ NOT_ADDRESSED with file:line), `new_breakage[]` for the fix diff only,
110
+ `out_of_scope[]`, and `round_verdict`.
@@ -0,0 +1,53 @@
1
+ #!/usr/bin/env bash
2
+ # Generate a review package: commit list, stat summary, and the net
3
+ # diff with extended context, written to a file the reviewer reads in one
4
+ # call. Using the recorded per-task BASE (not HEAD~1) keeps multi-commit
5
+ # tasks intact.
6
+ #
7
+ # Usage: review-package PLAN_FILE BASE HEAD [OUTFILE]
8
+ # Default OUTFILE: <repo-root>/.superpowers/sdd/<plan-basename>/review-<base7>..<head7>.diff
9
+ # (named per range, so a re-review after fixes gets a distinct fresh file).
10
+ set -euo pipefail
11
+
12
+ if [ $# -lt 3 ] || [ $# -gt 4 ]; then
13
+ echo "usage: review-package PLAN_FILE BASE HEAD [OUTFILE]" >&2
14
+ exit 2
15
+ fi
16
+
17
+ plan=$1
18
+ base=$2
19
+ head=$3
20
+ [ -f "$plan" ] || { echo "no such plan file: $plan" >&2; exit 2; }
21
+
22
+ git rev-parse --verify --quiet "$base" >/dev/null || { echo "bad BASE: $base" >&2; exit 2; }
23
+ git rev-parse --verify --quiet "$head" >/dev/null || { echo "bad HEAD: $head" >&2; exit 2; }
24
+
25
+ # Range guards (exit 3): a wrong-branch HEAD yields a range that is empty or
26
+ # not rooted at BASE; either would silently produce a bogus review package.
27
+ git merge-base --is-ancestor "$base" "$head" || { echo "HEAD is not a descendant of BASE: ${base}..${head}" >&2; exit 3; }
28
+ [ "$(git rev-list --count "${base}..${head}")" -gt 0 ] || { echo "empty commit range: ${base}..${head}" >&2; exit 3; }
29
+
30
+ if [ $# -eq 4 ]; then
31
+ out=$4
32
+ else
33
+ # Invoke via bash rather than direct exec: some extractors (Python zipfile)
34
+ # strip Unix exec bits when unpacking marketplace packages (#2040).
35
+ dir=$("${BASH:-bash}" "$(cd "$(dirname "$0")" && pwd)/sdd-workspace" "$plan")
36
+ out="$dir/review-$(git rev-parse --short "$base")..$(git rev-parse --short "$head").diff"
37
+ fi
38
+
39
+ {
40
+ echo "# Review package: ${base}..${head}"
41
+ echo
42
+ echo "## Commits"
43
+ git log --oneline "${base}..${head}"
44
+ echo
45
+ echo "## Files changed"
46
+ git diff --stat "${base}..${head}"
47
+ echo
48
+ echo "## Diff"
49
+ git diff -U10 "${base}..${head}"
50
+ } > "$out"
51
+
52
+ commits=$(git rev-list --count "${base}..${head}")
53
+ echo "wrote ${out}: ${commits} commit(s), $(wc -c < "$out" | tr -d ' ') bytes"
@@ -0,0 +1,82 @@
1
+ #!/usr/bin/env bash
2
+ # Resolve and ensure the working-tree directory SDD uses for one plan's
3
+ # short-lived artifacts: task briefs, implementer reports, review packages,
4
+ # and the progress ledger. Print the plan directory's absolute path.
5
+ #
6
+ # One directory per plan (.superpowers/sdd/<plan-basename>/) so a follow-up
7
+ # plan in the same working tree can never read or overwrite another plan's
8
+ # artifacts. A stale ledger misread as current progress makes controllers
9
+ # skip whole task sequences — plan-scoping removes that failure structurally.
10
+ #
11
+ # Basename slugs collide when two plans share a filename (docs/alpha/plan.md
12
+ # vs docs/beta/plan.md), so each workspace records its owning plan's path in
13
+ # a plan-path marker (repo-relative in-repo, absolute outside). A workspace
14
+ # owned by a different plan is skipped and the slug disambiguated with the
15
+ # plan's parent-directory name, then a counter. A workspace with no marker
16
+ # predates the marker scheme and is adopted for the current plan so in-flight
17
+ # workspaces keep resolving — which means the first collision on such a
18
+ # legacy workspace adopts instead of detecting; acceptable, marker-less
19
+ # workspaces age out as plans finish.
20
+ #
21
+ # The workspace lives in the working tree (not under .git/) because Claude Code
22
+ # treats .git/ as a protected path and denies agent writes there — which blocks
23
+ # an implementer subagent from writing its report file. A self-ignoring
24
+ # .gitignore at .superpowers/sdd/ keeps every plan's workspace out of
25
+ # `git status` and out of accidental commits without modifying any tracked file.
26
+ #
27
+ # Single source of truth for the workspace location, so task-brief and
28
+ # review-package cannot drift to different directories.
29
+ #
30
+ # Usage: sdd-workspace PLAN_FILE
31
+ set -euo pipefail
32
+
33
+ if [ $# -ne 1 ]; then
34
+ echo "usage: sdd-workspace PLAN_FILE" >&2
35
+ exit 2
36
+ fi
37
+
38
+ plan=$1
39
+ [ -f "$plan" ] || { echo "no such plan file: $plan" >&2; exit 2; }
40
+
41
+ slug=$(basename "$plan" .md)
42
+ [ -n "$slug" ] && [ "$slug" != "." ] && [ "$slug" != ".." ] \
43
+ || { echo "cannot derive a workspace name from: $plan" >&2; exit 2; }
44
+
45
+ root=$(git rev-parse --show-toplevel)
46
+ base="$root/.superpowers/sdd"
47
+
48
+ # Normalize the plan path (physical directory, so relative/absolute/../
49
+ # spellings of one plan compare equal) and express it as the marker value:
50
+ # repo-relative when the plan lives under the repo root, absolute otherwise.
51
+ plan_dir=$(CDPATH= cd -- "$(dirname "$plan")" && pwd -P)
52
+ plan_abs="$plan_dir/$(basename "$plan")"
53
+ case "$plan_abs" in
54
+ "$root"/*) plan_id=${plan_abs#"$root"/} ;;
55
+ *) plan_id=$plan_abs ;;
56
+ esac
57
+
58
+ # True when the workspace at $1 is (or becomes) this plan's: an existing
59
+ # marker must name this plan; a missing marker means a new workspace or a
60
+ # pre-marker legacy one, and either way the plan claims it by writing one.
61
+ owns() {
62
+ if [ -e "$1/plan-path" ]; then
63
+ [ "$(cat "$1/plan-path")" = "$plan_id" ]
64
+ else
65
+ mkdir -p "$1"
66
+ printf '%s\n' "$plan_id" > "$1/plan-path"
67
+ fi
68
+ }
69
+
70
+ dir="$base/$slug"
71
+ if ! owns "$dir"; then
72
+ parent=$(basename "$plan_dir")
73
+ dir="$base/$slug-$parent"
74
+ if ! owns "$dir"; then
75
+ n=2
76
+ while ! owns "$base/$slug-$parent-$n"; do n=$((n + 1)); done
77
+ dir="$base/$slug-$parent-$n"
78
+ fi
79
+ fi
80
+
81
+ printf '*\n' > "$base/.gitignore"
82
+ CDPATH= cd -- "$dir" && pwd
@@ -0,0 +1,43 @@
1
+ #!/usr/bin/env bash
2
+ # Extract one task's full text from an implementation plan into a file the
3
+ # implementer reads in one call, so the task text never has to be pasted
4
+ # through the controller's context.
5
+ #
6
+ # Usage: task-brief PLAN_FILE TASK_NUMBER [OUTFILE]
7
+ # Default OUTFILE: <repo-root>/.superpowers/sdd/<plan-basename>/task-<N>-brief.md
8
+ # (per plan and per worktree; concurrent runs of the SAME plan in the same
9
+ # working tree share it).
10
+ set -euo pipefail
11
+
12
+ if [ $# -lt 2 ] || [ $# -gt 3 ]; then
13
+ echo "usage: task-brief PLAN_FILE TASK_NUMBER [OUTFILE]" >&2
14
+ exit 2
15
+ fi
16
+
17
+ plan=$1
18
+ n=$2
19
+ [ -f "$plan" ] || { echo "no such plan file: $plan" >&2; exit 2; }
20
+
21
+ if [ $# -eq 3 ]; then
22
+ out=$3
23
+ else
24
+ # Invoke via bash rather than direct exec: some extractors (Python zipfile)
25
+ # strip Unix exec bits when unpacking marketplace packages (#2040).
26
+ dir=$("${BASH:-bash}" "$(cd "$(dirname "$0")" && pwd)/sdd-workspace" "$plan")
27
+ out="$dir/task-${n}-brief.md"
28
+ fi
29
+
30
+ awk -v n="$n" '
31
+ /^```/ { infence = !infence }
32
+ !infence && /^#+[ \t]+Task[ \t]+[0-9]+/ {
33
+ intask = ($0 ~ ("^#+[ \t]+Task[ \t]+" n "([^0-9]|$)"))
34
+ }
35
+ intask { print }
36
+ ' "$plan" > "$out"
37
+
38
+ if [ ! -s "$out" ]; then
39
+ echo "task ${n} not found in ${plan} (no heading matching 'Task ${n}')" >&2
40
+ exit 3
41
+ fi
42
+
43
+ echo "wrote ${out}: $(wc -l < "$out" | tr -d ' ') lines"
@@ -0,0 +1,205 @@
1
+ # Task Reviewer Prompt Template
2
+
3
+ Use this template when dispatching a task reviewer subagent. The reviewer
4
+ reads the task's diff once and returns two verdicts: spec compliance and
5
+ code quality.
6
+
7
+ **Purpose:** Verify one task's implementation matches its requirements (nothing
8
+ more, nothing less) and is well-built (clean, tested, maintainable)
9
+
10
+ ```
11
+ { context: "<one line: plan name, branch, read-only task review>",
12
+ tasks: [ {
13
+ name: "ReviewTaskN",
14
+ agent: "sdd-reviewer", # REQUIRED — read/grep/glob only, no shell: the
15
+ # review package IS its view of the change.
16
+ task: |
17
+ You are reviewing one task's implementation: first whether it matches its
18
+ requirements, then whether it is well-built. This is a task-scoped gate,
19
+ not a merge review — a broad whole-branch review happens separately after
20
+ all tasks are complete.
21
+
22
+ ## What Was Requested
23
+
24
+ Read the task brief: [BRIEF_FILE]
25
+
26
+ Global constraints from the spec/design that bind this task:
27
+ [GLOBAL_CONSTRAINTS]
28
+
29
+ ## What the Implementer Claims They Built
30
+
31
+ Read the implementer's report: [REPORT_FILE]
32
+
33
+ ## Diff Under Review
34
+
35
+ **Base:** [BASE_SHA]
36
+ **Head:** [HEAD_SHA]
37
+ **Diff file:** [DIFF_FILE]
38
+
39
+ Read the diff file once — it contains the commit list, a stat summary,
40
+ and the full diff with surrounding context, and it is your view of the
41
+ change. The diff's context lines ARE the changed files: do not Read a
42
+ changed file separately unless a hunk you must judge is cut off
43
+ mid-function — and say so in your report. You have no shell; if the
44
+ diff file is missing, report that as a gap and stop — do not
45
+ reconstruct the diff from files.
46
+ Do not crawl the broader codebase. Inspect code outside the diff only
47
+ to evaluate a concrete risk you can name — one focused check per named
48
+ risk, and name both the risk and what you checked in your report.
49
+ Cross-cutting changes are legitimate named risks: if the diff changes
50
+ lock ordering, a function or API contract, or shared mutable state,
51
+ checking the call sites is the right method.
52
+
53
+ Your review is read-only on this checkout. Do not mutate the working
54
+ tree, the index, HEAD, or branch state in any way.
55
+
56
+ ## You Do Not Dispatch Subagents
57
+
58
+ Do all of this review yourself. Never spawn a subagent to review part
59
+ of the diff, and never spawn another reviewer for a second opinion.
60
+ This process already provides every review seat the work gets; a
61
+ reviewer you spawn duplicates one of them at full cost, and its
62
+ verdict counts for nothing. If the diff feels too large for one
63
+ pass, review it in passes yourself and say so in your report.
64
+
65
+ ## Do Not Trust the Report
66
+
67
+ Treat the implementer's report as unverified claims about the code. It
68
+ may be incomplete, inaccurate, or optimistic. Verify the claims against
69
+ the diff. Design rationales in the report are claims too: "left it per
70
+ YAGNI," "kept it simple deliberately," or any other justification is the
71
+ implementer grading their own work. Judge the code on its merits — a
72
+ stated rationale never downgrades a finding's severity.
73
+
74
+ ## Tests
75
+
76
+ The implementer already ran the tests and reported results with TDD
77
+ evidence for exactly this code. You have no shell and cannot re-run
78
+ anything: verify their claims against the diff. If reading the code
79
+ raises a specific doubt that no existing run answers, name the focused
80
+ test you would run in that finding's body and verdict on what the diff
81
+ shows. If heavy validation seems warranted, recommend it in a finding
82
+ for the controller to run.
83
+
84
+ Warnings or other noise in the implementer's reported test output are
85
+ findings — test output should be pristine.
86
+
87
+ Evidence you cannot see is not evidence that doesn't exist. If the
88
+ report or its test evidence looks truncated, or you cannot locate the
89
+ results it claims, re-read the file at its stated path — and if it is
90
+ genuinely missing or garbled, report that as a gap for the controller.
91
+ Re-running the suite to regenerate what you failed to read is not
92
+ verification; illegibility of the evidence is not invalidation of it.
93
+
94
+ ## Part 1: Spec Compliance
95
+
96
+ Compare the diff against What Was Requested:
97
+
98
+ - **Missing:** requirements they skipped, missed, or claimed without
99
+ implementing
100
+ - **Extra:** features that weren't requested, over-engineering, unneeded
101
+ "nice to haves"
102
+ - **Misunderstood:** right feature built the wrong way, wrong problem
103
+ solved
104
+
105
+ If the brief lists several files each with its own change (a batched
106
+ dispatch), check the diff against that list file by file: every listed
107
+ file must have its corresponding hunk. A listed file the diff never
108
+ touches is a Missing finding, no matter how clean the rest of the
109
+ batch looks.
110
+
111
+ If a requirement cannot be verified from this diff alone (it lives in
112
+ unchanged code or spans tasks), report it in `cannot_verify[]` instead
113
+ of broadening your search.
114
+
115
+ ## Part 2: Code Quality
116
+
117
+ **Code quality:**
118
+ - Clean separation of concerns?
119
+ - Proper error handling?
120
+ - DRY without premature abstraction?
121
+ - Edge cases handled?
122
+
123
+ **Tests:**
124
+ - Do the new and changed tests verify real behavior, not mocks?
125
+ - Are the task's edge cases covered?
126
+
127
+ **Structure:**
128
+ - Does each file have one clear responsibility with a well-defined interface?
129
+ - Are units decomposed so they can be understood and tested independently?
130
+ - Is the implementation following the file structure from the plan?
131
+ - Did this change create new files that are already large, or
132
+ significantly grow existing files? (Don't flag pre-existing file
133
+ sizes — focus on what this change contributed.)
134
+
135
+ Your report should point at evidence: file:line references for every
136
+ finding and for any check you would otherwise answer with a bare
137
+ "yes." A tight report that cites lines gives the controller everything
138
+ it needs.
139
+
140
+ Your result is structured (the agent's `output:` schema), not prose:
141
+ every entry is a verdict, a finding with file:line, or a check you
142
+ ran — no preamble, no process narration.
143
+
144
+ ## Calibration
145
+
146
+ Categorize issues by actual severity. Not everything is Critical.
147
+ Important means this task cannot be trusted until it is fixed: incorrect
148
+ or fragile behavior, a missed requirement, or maintainability damage you
149
+ would block a merge over — verbatim duplication of a logic block,
150
+ swallowed errors, tests that assert nothing. "Coverage could be broader"
151
+ and polish suggestions are Minor.
152
+ If the plan or brief explicitly mandates something this rubric calls a
153
+ defect (a test that asserts nothing, verbatim duplication of a logic
154
+ block), that IS a finding — report it as Important, labeled
155
+ plan-mandated. The plan's authorship does not grade its own work; the
156
+ human decides.
157
+ Acknowledge what was done well before listing issues — accurate praise
158
+ helps the implementer trust the rest of the feedback.
159
+
160
+ ## Output
161
+
162
+ Yield the structured result:
163
+
164
+ - `spec_compliance`: `compliant` | `issues` | `package_gap`
165
+ - `spec_issues[]`: what's missing / extra / misunderstood, each with
166
+ file:line
167
+ - `cannot_verify[]`: requirements you could not verify from the diff
168
+ alone, and what the controller should check — alongside the verdict
169
+ for everything you could verify
170
+ - `strengths[]`: what's well done, specifically
171
+ - `findings[]`: `{severity: Critical|Important|Minor, location:
172
+ file:line, body: what's wrong / why it matters / how to fix,
173
+ plan_mandated: true|false}`
174
+ - `task_quality`: `approved` | `needs_fixes` | `package_gap`
175
+ - `reasoning`: 1-2 sentence technical assessment
176
+ - `package_gap`: ONLY when you could not read the diff package at the
177
+ path given. Then yield exactly: `spec_compliance: package_gap`,
178
+ `task_quality: package_gap`, `reasoning` = what you tried,
179
+ `package_gap` = the path and the error — and nothing else. Never
180
+ substitute a real-looking verdict for a package you did not read;
181
+ the controller regenerates the package and re-dispatches.
182
+ } ] }
183
+ ```
184
+
185
+ **Placeholders:**
186
+ - `agent: sdd-reviewer` — REQUIRED (see SKILL.md Agent Selection)
187
+ - `[BRIEF_FILE]` — REQUIRED: the task brief file (`bash scripts/task-brief PLAN N`
188
+ prints the path; same file the implementer worked from)
189
+ - `[GLOBAL_CONSTRAINTS]` — the binding requirements copied verbatim from
190
+ the plan's Global Constraints section or the spec: exact values, formats,
191
+ and stated relationships between components (not process rules — those
192
+ are already in this template)
193
+ - `[REPORT_FILE]` — REQUIRED: the file the implementer wrote its detailed
194
+ report to
195
+ - `[BASE_SHA]` — commit before this task
196
+ - `[HEAD_SHA]` — current commit
197
+ - `[DIFF_FILE]` — REQUIRED: the path the controller wrote the review
198
+ package to (`bash scripts/review-package PLAN_FILE BASE HEAD` prints the unique
199
+ path it wrote; the package never enters the controller's context)
200
+
201
+ **Reviewer returns** (structured): `spec_compliance`, `spec_issues[]`,
202
+ `cannot_verify[]`, `strengths[]`, `findings[]` (Critical/Important/Minor with
203
+ file:line), `task_quality`, `reasoning`. The loop triggers on
204
+ `spec_compliance: issues`, any Critical/Important finding, or a
205
+ `cannot_verify` item the controller confirms as a real gap.