repositories / pi-ext

pi-ext

bugabingas pi extensions

owned by bugabinga

feat(superpowers): add worktree isolation for subagents

1a08651409eeffbc3c1b50fa24970b0a88bf310b

Oliver Jan Krylow <oliver@bugabinga.net> ·

unsigned

Browse filesCompare with HEAD

- detectRepo: detect jj, git-standard, git-bare layouts
- createIsolate: git worktree or jj workspace per task
- cleanupIsolate: auto-remove on abort
- --share flag to opt out of isolation
- isolation is default; fallback to in-place on failure
- 5 new harness tests for detection and isolation
- add accent frontmatter to all workflow prompts
- update status display format with icons

Changed files (18)

extensions/superpowers/README.md

Modified
23 23 /superpowers # toggle workflow discipline
24 24 /superpowers on
25 25 /superpowers off
26 -/superpowers run <agent> [args]
26 +/superpowers run <agent> [args] [--share]
27 27 /superpowers open <id>
28 28 /superpowers branch <id>
29 29 /superpowers return <summary>
46 46 # visual brainstorming companion
47 47 /superpowers visual start
48 -/superpowers visual status
48 +/superpowers status
49 49 /superpowers visual stop
52 -Agents are normal Pi prompt templates:
52 +## Prompt frontmatter
54 -```text
55 -.pi/prompts/*.md
56 -~/.pi/agent/prompts/*.md
57 -```
59 -Use the same file either way:
61 -```text
62 -/review ...
63 -/superpowers run review ...
64 -```
66 -Supported frontmatter:
54 +Agents are normal Pi prompt templates (`prompts/*.md`). Supported frontmatter:
68 56 ```yaml
69 -tools: [read, grep]
57 +description: Run a focused code review
58 +argument-hint: "<file|directory|diff|scope>"
59 +tools: [read, bash, grep, find, ls]
70 60 extensions: ["*", "-superpowers"]
71 -thinking: off
61 +thinking: medium
72 62 model: provider/model
63 +accent: syntaxKeyword
75 -Bundled workflow skills + prompt entrypoints:
66 +| Field | Purpose |
67 +|---|---|
68 +| `description` | Shown in autocomplete and status |
69 +| `argument-hint` | Autocomplete hint for arguments |
70 +| `tools` | Tool allowlist for the subagent |
71 +| `extensions` | Extension filter (`*` = all, `-name` = exclude) |
72 +| `thinking` | Thinking level: `off`, `minimal`, `low`, `medium`, `high`, `xhigh` |
73 +| `model` | Override model: `provider/id` |
74 +| `accent` | Theme color for footer/widget/status rendering (see below) |
76 +### `accent` — workflow color
78 +Controls the visual identity of a worker in the footer, widget, and status output.
79 +Value is a `ThemeColor` name from Pi's theme system. The color resolves to whatever
80 +the active theme defines for that semantic role, so it adapts to light/dark themes automatically.
82 +**Recommended accents per workflow:**
84 +| Workflow | Accent | Visual feel |
85 +|---|---|---|
86 +| `brainstorming` | `accent` | purple — creative |
87 +| `writing-plans` | `dim` | quiet — preparation |
88 +| `executing-plans` | `success` | green — building |
89 +| `test-driven-development` | `syntaxString` | green tint — test-first |
90 +| `systematic-debugging` | `warning` | yellow — caution |
91 +| `requesting-code-review` | `syntaxKeyword` | amber — critical eye |
92 +| `receiving-code-review` | `syntaxFunction` | blue — integration |
93 +| `verification-before-completion` | `toolTitle` | cyan — verification |
94 +| `dispatching-parallel-agents` | `syntaxVariable` | distinct — multi-agent |
95 +| `using-git-worktrees` | `muted` | gray — infrastructure |
96 +| `writing-skills` | `syntaxFunction` | blue — meta-work |
98 +**Full `ThemeColor` palette** (51 names, all valid for `accent`):
100 +```text
101 +# Semantic roles — the useful ones for accent
102 +accent # primary brand color (purple in most themes)
103 +success # positive / done
104 +warning # caution / attention
105 +error # failure / blocker
106 +muted # secondary / quiet
107 +dim # lowest prominence
108 +text # default text color
110 +# Syntax highlighting — good for workflow identity
111 +syntaxKeyword # amber/orange — keywords, review, attention
112 +syntaxFunction # blue — functions, integration
113 +syntaxVariable # teal — variables, parallel
114 +syntaxString # green — strings, tests
115 +syntaxNumber # numeric literals
116 +syntaxType # type names
117 +syntaxOperator # operators
118 +syntaxPunctuation # brackets, commas
119 +syntaxComment # comments
121 +# Markdown rendering
122 +mdHeading # heading color
123 +mdLink # link color
124 +mdCode # inline code
125 +mdCodeBlock # code block text
126 +mdCodeBlockBorder # code block border
127 +mdListBullet # bullet points
129 +# Tool output
130 +toolTitle # tool name color (cyan-ish)
131 +toolOutput # tool result text
132 +toolDiffAdded # diff + lines
133 +toolDiffRemoved # diff - lines
134 +toolDiffContext # diff context lines
136 +# Thinking levels
137 +thinkingText # assistant thinking text
138 +thinkingOff # off state
139 +thinkingMinimal # minimal
140 +thinkingLow # low
141 +thinkingMedium # medium
142 +thinkingHigh # high
143 +thinkingXhigh # extra-high
145 +# Message types
146 +userMessageText # user message
147 +customMessageText # extension/custom message
148 +customMessageLabel # custom message label
150 +# Borders
151 +border # default border
152 +borderAccent # accent border
153 +borderMuted # muted border
155 +# Other
156 +bashMode # bash mode indicator
157 +selectedBg # (ThemeBg, not ThemeColor — for backgrounds)
158 +```
160 +Without an `accent` field, workers default to the extension's accent color (amber `syntaxKeyword` for review, etc.).
162 +## Bundled workflows
77 164 ```text
78 165 /using-superpowers
91 178 /writing-skills
94 -`skills/*/SKILL.md` holds the methodology. `prompts/*.md` are normal Pi slash prompt wrappers around those skills.
181 +`skills/*/SKILL.md` holds the methodology. `prompts/*.md` are normal Pi slash prompt wrappers with the full skill inlined — no runtime skill discovery needed.
96 183 Same prompts work as background workers:
100 187 /superpowers run requesting-code-review current diff
190 +## Worktree isolation
192 +By default, `/superpowers run` and workflow aliases create an isolated worktree/workspace for the subagent. This prevents filesystem collisions between concurrent tasks and keeps the parent working copy clean.
194 +| Repo type | Isolation mechanism | Path |
195 +|---|---|---|
196 +| Git standard checkout | `git worktree add` | `.git/wt-<id>` |
197 +| Git bare (co/wt layout) | `git worktree add` | `<root>/<id>` |
198 +| Jujutsu (jj) | `jj workspace add` | `.jj/workspaces/<id>` |
199 +| No repo detected | in-place fallback | — |
201 +Use `--share` to run the subagent in the current working copy instead:
203 +```text
204 +/superpowers run implement fix-bug --share
205 +```
207 +Isolation is skipped when:
208 +- `--share` is passed explicitly
209 +- No supported repo is detected
210 +- Worktree/workspace creation fails (falls back to in-place with a notice)
212 +On abort, isolated worktrees are cleaned up automatically. On successful completion, they are left for inspection — remove them manually or with `git worktree remove` / `jj workspace forget`.
214 +## Status display
216 +The footer and widget use compact, scannable formatting:
218 +**Footer** (status bar):
219 +```text
220 +on # strict mode active
221 +on 1↑ # 1 worker running
222 +on eye # visual brainstorming active
223 +1↑ # worker running, strict mode off
224 +```
226 +**Widget** (above editor, when workers run):
227 +```text
228 +2 workers running
229 +▶ sp-5 review 12s · 5 tools
230 +▶ sp-6 debug 1m3s · 8 tools
231 +```
233 +**Status icons:**
234 +```text
235 +▶ running ✓ done ⊘ aborted ✗ error ⤴ branched
236 +```
238 +**Agent short names:**
239 +```text
240 +review fix design plan exec debug verify tdd parallel git skill finish sp sub
241 +```
243 +`/superpowers status` lists all tasks. `/superpowers status <id>` shows full details.
245 +## State
103 247 Runtime state lives in the platform state dir, per project:
105 249 ```text
108 252 Windows: %LOCALAPPDATA%\\pi\\superpowers\\<project-hash>\\
255 +Contents:
257 +```text
258 +tasks.json # all tasks (running, done, aborted, error, branched)
259 +runs.jsonl # append-only audit log: one JSON line per completed task
260 +sessions/ # subagent session files
261 +visual/ # visual brainstorming state (ephemeral)
262 +```
264 +Stale tasks (orphaned when the parent Pi session dies) are reaped on next session start.
111 266 Project/VCS state is only written by workflows that intentionally create docs/specs, e.g. `docs/superpowers/specs/...`.
113 -`status` is optimized for tmux supervision: summaries include id, state,
114 -elapsed time, agent name, tool count, and first result line. `status <id>` shows
115 -prompt, parent/child sessions, and latest result without opening an editor.
117 -## Shape
119 -From `/tmp/pi-superpowers-proto/DESIGN.md`:
268 +## Architecture
121 270 ```text
122 271 run = background SDK agent
128 277 No Pi subprocesses. Uses Pi SDK sessions/resource loading directly.
279 +No Pi subprocesses. Uses Pi SDK sessions/resource loading directly.

extensions/superpowers/__tests__/harness.test.ts

Modified
133 133 ["done", "error"].includes(tasks()["sp-1"]?.status),
135 135 expect(tasks()["sp-1"].agent).toBe("systematic-debugging");
136 - expect(tasks()["sp-1"].prompt).toContain("Use the `systematic-debugging` skill");
136 + expect(tasks()["sp-1"].prompt).toContain("No fix before root-cause evidence");
137 137 expect(tasks()["sp-1"].prompt).toContain("flaky test");
200 200 expect(tasks()["sp-10"].agent).toBe("echo");
203 + it("reaps stale running tasks on session_start", async () => {
204 + t = await createTestSession({ extensions: [extPath()] });
205 + mkdirSync(path.dirname(tasksPath()), { recursive: true });
206 + writeFileSync(
207 + tasksPath(),
208 + JSON.stringify({
209 + "sp-1": {
210 + id: "sp-1",
211 + agent: "old",
212 + prompt: "stale",
213 + status: "running",
214 + startedAt: "2026-01-01T00:00:00.000Z",
215 + updatedAt: "2026-01-01T00:00:01.000Z",
216 + log: ["start"],
217 + },
218 + "sp-2": {
219 + id: "sp-2",
220 + agent: "old",
221 + prompt: "done",
222 + status: "done",
223 + startedAt: "2026-01-01T00:00:00.000Z",
224 + updatedAt: "2026-01-01T00:00:01.000Z",
225 + log: ["start", "done"],
226 + },
227 + }),
228 + "utf8",
229 + );
230 + await t.session.extensionRunner.emit({
231 + type: "session_start",
232 + reason: "resume",
233 + });
234 + expect(tasks()["sp-1"].status).toBe("aborted");
235 + expect(tasks()["sp-2"].status).toBe("done");
236 + expect(tasks()["sp-1"].log.at(-1)).toContain("reaped");
237 + });
203 239 it("opens persisted task logs in the Pi editor and reports detailed status", async () => {
204 240 t = await createTestSession({ extensions: [extPath()] });
205 241 mkdirSync(path.dirname(tasksPath()), { recursive: true });
234 270 "checkpoint",
236 272 await command().handler("status sp-7", ctx());
237 - expect(notices().at(-1)).toContain("sp-7 done 3s demo — DONE");
273 + expect(notices().at(-1)).toContain("✓ sp-7 done · demo · 3s — DONE");
238 274 expect(notices().at(-1)).toContain("prompt:\ndemo prompt");
395 431 "/superpowers branch requires persisted parent session",
435 + it("detects no repo in plain directory", async () => {
436 + t = await createTestSession({ extensions: [extPath()] });
437 + expect(__test.detectRepo(t.cwd)).toBeNull();
438 + });
440 + it("detects jj repo", async () => {
441 + t = await createTestSession({ extensions: [extPath()] });
442 + mkdirSync(path.join(t.cwd, ".jj"), { recursive: true });
443 + expect(__test.detectRepo(t.cwd)).toBe("jj");
444 + });
446 + it("detects git standard checkout", async () => {
447 + t = await createTestSession({ extensions: [extPath()] });
448 + // Initialize a git repo in the test cwd
449 + const { execSync } = await import("node:child_process");
450 + execSync("git init", { cwd: t.cwd });
451 + execSync("git config user.email test@test.com", { cwd: t.cwd });
452 + execSync("git config user.name Test", { cwd: t.cwd });
453 + writeFileSync(path.join(t.cwd, "file.txt"), "hello");
454 + execSync("git add .", { cwd: t.cwd });
455 + execSync("git commit -m init", { cwd: t.cwd });
456 + const repo = __test.detectRepo(t.cwd);
457 + expect(repo).not.toBeNull();
458 + expect(repo).toHaveProperty("type", "git");
459 + expect(repo).toHaveProperty("layout", "standard");
460 + });
462 + it("creates and cleans up git worktree isolate", async () => {
463 + t = await createTestSession({ extensions: [extPath()] });
464 + const { execSync } = await import("node:child_process");
465 + execSync("git init", { cwd: t.cwd });
466 + execSync("git config user.email test@test.com", { cwd: t.cwd });
467 + execSync("git config user.name Test", { cwd: t.cwd });
468 + writeFileSync(path.join(t.cwd, "file.txt"), "hello");
469 + execSync("git add .", { cwd: t.cwd });
470 + execSync("git commit -m init", { cwd: t.cwd });
471 + const repo = __test.detectRepo(t.cwd);
472 + expect(repo).not.toBeNull();
473 + const piMock = {
474 + exec: async (_cmd: string, _args: string[]) => {
475 + execSync([_cmd, ..._args].join(" "), { cwd: t.cwd });
476 + },
477 + } as any;
478 + const isolate = await __test.createIsolate(t.cwd, "sp-test", repo!, piMock);
479 + expect(isolate.type).toBe("git-standard");
480 + expect(existsSync(isolate.path)).toBe(true);
481 + const task = { isolate, log: [] as string[] } as any;
482 + await __test.cleanupIsolate(task, piMock);
483 + expect(existsSync(isolate.path)).toBe(false);
484 + });
486 + it("skips isolate when --share is passed", async () => {
487 + t = await createTestSession({ extensions: [extPath()] });
488 + const { execSync } = await import("node:child_process");
489 + execSync("git init", { cwd: t.cwd });
490 + execSync("git config user.email test@test.com", { cwd: t.cwd });
491 + execSync("git config user.name Test", { cwd: t.cwd });
492 + writeFileSync(path.join(t.cwd, "file.txt"), "hello");
493 + execSync("git add .", { cwd: t.cwd });
494 + execSync("git commit -m init", { cwd: t.cwd });
495 + mkdirSync(path.join(t.cwd, ".pi/prompts"), { recursive: true });
496 + writeFileSync(
497 + path.join(t.cwd, ".pi/prompts/echo.md"),
498 + "Echo $ARGUMENTS",
499 + "utf8",
500 + );
501 + await command().handler("run echo smoke --share", ctx());
502 + await waitFor(
503 + () =>
504 + existsSync(tasksPath()) &&
505 + ["done", "error"].includes(tasks()["sp-1"]?.status),
506 + );
507 + expect(tasks()["sp-1"].isolate).toBeUndefined();
508 + await sleep(200);
509 + });

extensions/superpowers/__tests__/helpers.test.ts

Modified
48 48 expect(existsSync(skill)).toBe(true);
49 49 const promptText = readFileSync(prompt, "utf8");
50 50 expect(promptText).toContain("argument-hint:");
51 - expect(promptText).toContain(`Use the \`${name}\` skill`);
51 + expect(promptText).toContain("Target:");
52 52 expect(readFileSync(skill, "utf8")).toContain(`name: ${name}`);
227 227 log: ["start", "2026-01-01T00:00:10.000Z aborted by user"],
229 229 expect(__test.summaryLine(abortedTask)).toBe(
230 - "sp-10 aborted 10s inline — 2026-01-01T00:00:10.000Z aborted by user",
230 + "⊘ sp-10 · inline · 10s — 2026-01-01T00:00:10.000Z aborted by user",
233 233 const task = {
242 242 result: "DONE\nextra detail",
244 244 expect(__test.summaryLine(task)).toBe(
245 - "sp-9 done 1m5s inline tools:1 — DONE",
245 + "✓ sp-9 · inline · 1m5s · 1 tools — DONE",
247 247 const detail = __test.taskDetails(task);
248 248 expect(detail).toContain("prompt:\ndo work");

extensions/superpowers/index.ts

Modified
5 5 readdirSync,
6 6 readFileSync,
7 7 writeFileSync,
8 + appendFileSync,
9 + rmdirSync,
8 10 } from "node:fs";
11 +import { execSync } from "node:child_process";
9 12 import os from "node:os";
10 13 import path from "node:path";
11 14 import { fileURLToPath } from "node:url";
39 42 Superpowers active. Strict mode.
41 -For every non-trivial coding task:
42 -1. Pick the earliest applicable lifecycle workflow: brainstorming → writing-plans → executing-plans/test-driven-development/systematic-debugging → requesting-code-review/receiving-code-review → verification-before-completion.
43 -2. Use brainstorming first for vague goals, UX/UI work, architecture choices, new features, or broad refactors. Do not use writing-plans unless an approved design/spec already exists.
44 -3. Load/follow that skill before acting. Do not skip to implementation when brainstorming/planning/debugging applies.
45 -4. Say which workflow you are using in one short line.
44 +Before every non-trivial coding task:
45 +1. STATE YOUR WORKFLOW: print "Workflow: <skill-name>" on its own line before any other output. Pick from: brainstorming, writing-plans, executing-plans, test-driven-development, systematic-debugging, requesting-code-review, receiving-code-review, verification-before-completion, dispatching-parallel-agents, using-git-worktrees, writing-skills.
46 +2. Pick the earliest applicable lifecycle: brainstorming → writing-plans → executing-plans/TDD/debug → review → verification.
47 +3. Use brainstorming first for vague goals, UX/UI work, architecture choices, new features, or broad refactors. Do not use writing-plans unless an approved design/spec already exists.
48 +4. Load/follow that skill before acting. Do not skip to implementation.
46 49 5. Prefer simplicity/minimalism/brutalism. No legacy/compat/edge-case bloat unless explicitly required.
47 50 6. Before claiming done/fixed/shipped, run verification and cite evidence.
48 -7. For isolated or parallel worker tasks, use or suggest /superpowers run <prompt> <args>.
51 +7. For isolated or parallel worker tasks, use /superpowers run <prompt> <args>.
50 53 const COMMANDS = [
51 54 "run",
90 93 extensions?: string[];
91 94 thinking?: string;
92 95 model?: string;
96 + accent?: string;
97 +};
98 +type IsolateInfo = {
99 + type: "git-standard" | "git-bare" | "jj";
100 + path: string;
101 + branch?: string;
102 + workspaceName?: string;
103 + gitDir?: string;
104 + root?: string;
94 106 type Task = {
95 107 id: string;
102 114 childSession?: string;
103 115 log: string[];
104 116 result?: string;
117 + accent?: string;
118 + isolate?: IsolateInfo;
106 120 type Runtime = {
107 121 cwd: string;
165 179 all[task.id] = task;
166 180 writeFileSync(tasksFile(cwd), `${JSON.stringify(all, null, "\t")}\n`);
182 +function logRun(cwd: string, task: Task) {
183 + const entry = {
184 + id: task.id,
185 + agent: task.agent,
186 + status: task.status,
187 + startedAt: task.startedAt,
188 + updatedAt: task.updatedAt,
189 + tools: toolCount(task),
190 + result: firstLine(task.result ?? ""),
191 + };
192 + try {
193 + appendFileSync(
194 + path.join(dir(cwd), "runs.jsonl"),
195 + `${JSON.stringify(entry)}\n`,
196 + );
197 + } catch {
198 + /* best effort */
168 201 function append(ctx: ExtensionContext, entry: Entry) {
169 - (
170 - ctx.sessionManager as unknown as {
171 - appendCustomEntry(t: string, d: unknown): string;
172 - }
173 - ).appendCustomEntry(ID, entry);
202 + try {
204 + ctx.sessionManager as unknown as {
205 + appendCustomEntry(t: string, d: unknown): string;
207 + ).appendCustomEntry(ID, entry);
208 + } catch {
209 + /* session may have been disposed */
175 212 function notify(
176 213 ctx: ExtensionContext,
194 231 function uiStatusText(cwd: string) {
195 232 const { running, errors } = statusCounts(cwd);
196 233 if (!active && !running && !errors && !visual) return undefined;
197 - return [
198 - active ? "sp on" : "sp",
199 - running ? `${running} run` : "",
200 - errors ? `${errors} err` : "",
201 - visual ? "visual" : "",
202 - ]
203 - .filter(Boolean)
204 - .join(" · ");
234 + const parts: string[] = [];
235 + if (active) parts.push("on");
236 + if (running) parts.push(`${running}↑`);
237 + if (errors) parts.push(`${errors}✗`);
238 + if (visual) parts.push("eye");
239 + return parts.join(" ");
206 241 function publishStatus(ctx: ExtensionContext) {
207 242 if (!ctx.hasUI) return;
208 243 const message = uiStatusText(ctx.cwd);
209 244 if (hasFooter() && api) {
210 245 (ctx.ui as any).setStatus?.(STATUS_ID, undefined);
246 + const runningTask = Object.values(readTasks(ctx.cwd)).find((t) => t.status === "running");
247 + const footerColor = runningTask
248 + ? taskAccent(runningTask.agent, runningTask.accent)
249 + : (active ? "accent" : "muted") as ThemeColor;
211 250 api.events.emit(
212 251 "footer:segment",
213 252 message
215 254 ...FOOTER_SEGMENT,
216 255 text: message,
217 256 variants: [message.replace(/^sp /, "")],
218 - color: (active ? "accent" : "muted") as ThemeColor,
257 + color: footerColor,
220 259 : { id: STATUS_ID, text: undefined },
224 263 api?.events.emit("footer:segment", { id: STATUS_ID, text: undefined });
225 264 (ctx.ui as any).setStatus?.(STATUS_ID, message);
266 +const STATUS_ICONS: Record<Status, string> = {
267 + running: "▶",
268 + done: "✓",
269 + error: "✗",
270 + aborted: "⊘",
271 + branched: "⤴",
273 +const AGENT_SHORT: Record<string, string> = {
274 + "requesting-code-review": "review",
275 + "receiving-code-review": "fix",
276 + "brainstorming": "design",
277 + "writing-plans": "plan",
278 + "executing-plans": "exec",
279 + "dispatching-parallel-agents": "parallel",
280 + "systematic-debugging": "debug",
281 + "verification-before-completion": "verify",
282 + "using-git-worktrees": "git",
283 + "writing-skills": "skill",
284 + "test-driven-development": "tdd",
285 + "finishing-a-development-branch": "finish",
286 + "using-superpowers": "sp",
287 + "subagent-driven-development": "sub",
289 +const ALIAS_ACCENT: Record<string, ThemeColor> = {
290 + design: "accent",
291 + plan: "dim",
292 + execute: "success",
293 + parallel: "syntaxVariable",
294 + review: "syntaxKeyword",
295 + deslop: "syntaxKeyword",
296 + compress: "syntaxKeyword",
297 + debug: "warning",
298 + verify: "toolTitle",
299 + git: "muted",
300 + meta: "syntaxFunction",
301 + tdd: "syntaxString",
302 + finish: "dim",
304 +function taskAccent(agent: string, explicit?: string): ThemeColor {
305 + if (explicit && THEMED_COLORS.has(explicit)) return explicit as ThemeColor;
306 + return ALIAS_ACCENT[AGENT_SHORT[agent] ?? agent] ?? "accent";
308 +const THEMED_COLORS: Set<string> = new Set([
309 + "accent", "border", "borderAccent", "borderMuted", "success", "error",
310 + "warning", "muted", "dim", "text", "thinkingText", "userMessageText",
311 + "customMessageText", "customMessageLabel", "toolTitle", "toolOutput",
312 + "mdHeading", "mdLink", "mdLinkUrl", "mdCode", "mdCodeBlock",
313 + "mdCodeBlockBorder", "mdQuote", "mdQuoteBorder", "mdHr", "mdListBullet",
314 + "toolDiffAdded", "toolDiffRemoved", "toolDiffContext", "syntaxComment",
315 + "syntaxKeyword", "syntaxFunction", "syntaxVariable", "syntaxString",
316 + "syntaxNumber", "syntaxType", "syntaxOperator", "syntaxPunctuation",
317 + "thinkingOff", "thinkingMinimal", "thinkingLow", "thinkingMedium",
318 + "thinkingHigh", "thinkingXhigh", "bashMode",
319 +]);
320 +function elapsedLive(start: string) {
321 + const a = Date.parse(start);
322 + if (!Number.isFinite(a)) return "?";
323 + const sec = Math.max(0, Math.round((Date.now() - a) / 1000));
324 + return sec < 60 ? `${sec}s` : `${Math.floor(sec / 60)}m${sec % 60}s`;
227 326 function compactTaskLine(t: Task) {
228 - return `${t.id} ${t.agent} ${elapsed(t.startedAt, t.updatedAt)}${toolCount(t) ? ` · ${toolCount(t)} tools` : ""}`;
327 + const icon = STATUS_ICONS[t.status] ?? "·";
328 + const name = AGENT_SHORT[t.agent] ?? t.agent;
329 + const time = t.status === "running" ? elapsedLive(t.startedAt) : elapsed(t.startedAt, t.updatedAt);
330 + const tools = toolCount(t);
331 + return `${icon} ${t.id} ${name} ${time}${tools ? ` · ${tools} tools` : ""}`;
230 333 function firstLine(s: string | undefined) {
231 334 return (s ?? "").split("\n")[0]?.trim() ?? "";
241 344 return t.log.filter((l) => / tool \S+/.test(l)).length;
243 346 function summaryLine(t: Task) {
244 - const tail = firstLine(t.result ?? t.log.at(-1));
347 + const icon = STATUS_ICONS[t.status] ?? "·";
348 + const name = AGENT_SHORT[t.agent] ?? t.agent;
349 + const time = t.status === "running" ? elapsedLive(t.startedAt) : elapsed(t.startedAt, t.updatedAt);
245 350 const tools = toolCount(t);
246 - return `${t.id} ${t.status} ${elapsed(t.startedAt, t.updatedAt)} ${t.agent}${tools ? ` tools:${tools}` : ""}${tail ? ` — ${tail}` : ""}`;
351 + const tail = firstLine(t.result ?? t.log.at(-1));
352 + const parts = [`${icon} ${t.id}`, name, time];
353 + if (tools) parts.push(`${tools} tools`);
354 + const header = parts.join(" · ");
355 + return tail ? `${header} — ${tail}` : header;
248 357 function taskDetails(t: Task) {
358 + const icon = STATUS_ICONS[t.status] ?? "·";
359 + const time = t.status === "running" ? elapsedLive(t.startedAt) : elapsed(t.startedAt, t.updatedAt);
360 + const tools = toolCount(t);
361 + const name = AGENT_SHORT[t.agent] ?? t.agent;
362 + const tail = firstLine(t.result ?? t.log.at(-1));
363 + const header = [`${icon} ${t.id} ${t.status}`, name, time];
364 + if (tools) header.push(`${tools} tools`);
249 365 return [
250 - summaryLine(t),
366 + header.join(" · ") + (tail ? ` — ${tail}` : ""),
367 + `agent: ${t.agent}`,
251 368 `started: ${t.startedAt}`,
252 369 `updated: ${t.updatedAt}`,
253 370 `parent: ${t.parentSession ?? "none"}`,
261 378 ].join("\n");
263 380 function widget(ctx: ExtensionContext) {
264 - publishStatus(ctx);
265 - if (!ctx.hasUI) return;
266 - const running = Object.values(readTasks(ctx.cwd))
267 - .filter((t) => t.status === "running")
268 - .slice(-3);
269 - (ctx.ui as any).setWidget?.(
270 - WIDGET,
271 - running.length
272 - ? [`superpowers · ${running.length} running`, ...running.map(compactTaskLine)]
273 - : undefined,
274 - );
381 + try {
382 + publishStatus(ctx);
383 + if (!ctx.hasUI) return;
384 + const running = Object.values(readTasks(ctx.cwd))
385 + .filter((t) => t.status === "running")
386 + .slice(-3);
387 + if (!running.length) {
388 + (ctx.ui as any).setWidget?.(WIDGET, undefined);
389 + return;
391 + const th = ctx.ui.theme;
392 + const lines = [
393 + th.fg("dim", `${running.length} worker${running.length > 1 ? "s" : ""} running`),
394 + ...running.map((t) => th.fg(taskAccent(t.agent, t.accent), compactTaskLine(t))),
395 + ];
396 + (ctx.ui as any).setWidget?.(WIDGET, lines);
397 + } catch {
398 + /* ctx may be stale after session disposal */
277 402 function parseList(raw: string): string[] | undefined {
305 430 extensions: meta.extensions && parseList(meta.extensions),
306 431 thinking: meta.thinking?.replace(/^['"]|['"]$/g, ""),
307 432 model: meta.model?.replace(/^['"]|['"]$/g, ""),
433 + accent: meta.accent?.replace(/^['"]|['"]$/g, ""),
376 502 function modelFrom(s: string | undefined, fallback: ExtensionContext["model"]) {
377 503 const [provider, ...id] = s?.split("/") ?? [];
378 - return provider && id.length
379 - ? getModel(provider, id.join("/"))
380 - : (fallback ?? getModel("openai", "gpt-4o"));
504 + if (provider && id.length) {
505 + const m = getModel(provider, id.join("/"));
506 + if (m && m.provider && m.id) return m;
508 + return fallback ?? getModel("openai", "gpt-4o");
382 510 function extName(p: string) {
383 511 return path.basename(p) === "index.ts"
530 +function reapStale(cwd: string) {
531 + const tasks = readTasks(cwd);
532 + let reaped = 0;
533 + for (const t of Object.values(tasks)) {
534 + if (t.status === "running" && !live.has(t.id)) {
535 + t.status = "aborted";
536 + t.updatedAt = now();
537 + t.log.push(`${t.updatedAt} reaped (parent session gone)`);
538 + writeTask(cwd, t);
539 + reaped++;
542 + return reaped;
402 545 function stopPeers(keepId: string) {
403 546 for (const [id, r] of live) {
404 547 if (id === keepId) continue;
553 +// ── Repo detection ──────────────────────────────────────────────────────────
555 +type GitLayout = { type: "git"; layout: "standard" | "bare"; gitDir: string; root: string };
557 +type RepoType = "jj" | GitLayout;
559 +function detectRepo(cwd: string): RepoType | null {
560 + // Prefer jj when colocated
561 + if (existsSync(path.join(cwd, ".jj"))) return "jj";
562 + try {
563 + const commonDir = execSync("git rev-parse --path-format=absolute --git-common-dir", {
564 + cwd,
565 + encoding: "utf8",
566 + stdio: ["pipe", "pipe", "ignore"],
567 + }).trim();
568 + const isBare =
569 + execSync("git config --bool core.bare", {
570 + cwd: commonDir,
571 + encoding: "utf8",
572 + stdio: ["pipe", "pipe", "ignore"],
573 + })
574 + .trim()
575 + .toLowerCase() === "true";
576 + if (isBare) {
577 + return { type: "git", layout: "bare", gitDir: commonDir, root: path.dirname(commonDir) };
579 + return { type: "git", layout: "standard", gitDir: commonDir, root: path.dirname(commonDir) };
580 + } catch {
581 + return null;
585 +// ── Worktree / workspace creation ───────────────────────────────────────────
587 +async function createIsolate(
588 + cwd: string,
589 + id: string,
590 + repo: RepoType,
591 + pi: ExtensionAPI,
592 +): Promise<IsolateInfo> {
593 + if (repo === "jj") {
594 + const wsDir = path.join(cwd, ".jj", "workspaces", id);
595 + mkdirSync(path.dirname(wsDir), { recursive: true });
596 + await pi.exec("jj", ["workspace", "add", "--name", id, wsDir]);
597 + return { type: "jj", path: wsDir, workspaceName: id };
599 + // git
600 + const branch = `superpowers-${id}`;
601 + if (repo.layout === "bare") {
602 + const wtPath = path.join(repo.root, id);
603 + await pi.exec("git", ["-C", repo.gitDir, "worktree", "add", "-b", branch, wtPath, "HEAD"]);
604 + return { type: "git-bare", path: wtPath, branch, gitDir: repo.gitDir, root: repo.root };
606 + // standard checkout
607 + const wtPath = path.join(cwd, ".git", `wt-${id}`);
608 + await pi.exec("git", ["worktree", "add", "-b", branch, wtPath, "HEAD"]);
609 + return { type: "git-standard", path: wtPath, branch };
612 +async function cleanupIsolate(task: Task, pi: ExtensionAPI) {
613 + if (!task.isolate) return;
614 + const { isolate } = task;
615 + try {
616 + if (isolate.type === "jj") {
617 + await pi.exec("jj", ["workspace", "forget", isolate.workspaceName!]);
618 + rmdirSync(isolate.path, { recursive: true });
619 + } else if (isolate.type === "git-bare") {
620 + await pi.exec("git", ["-C", isolate.gitDir!, "worktree", "remove", "--force", isolate.path]);
621 + await pi.exec("git", ["-C", isolate.gitDir!, "branch", "-D", isolate.branch!]);
622 + } else {
623 + await pi.exec("git", ["worktree", "remove", "--force", isolate.path]);
624 + await pi.exec("git", ["branch", "-D", isolate.branch!]);
626 + } catch {
627 + /* best effort cleanup */
410 631 async function startAgent(
411 632 name: string,
412 633 loaded: { prompt: string; options: Options },
413 634 ctx: ExtensionCommandContext,
414 635 pi: ExtensionAPI,
636 + share = false,
416 - const cwd = ctx.cwd;
638 + let cwd = ctx.cwd;
417 639 const parentSession = ctx.sessionManager.getSessionFile();
418 640 const model = ctx.model;
419 641 const modelRegistry = ctx.modelRegistry;
430 652 updatedAt: now(),
431 653 parentSession,
432 654 log: [`${now()} start ${name}`],
655 + accent: loaded.options.accent,
657 + // detect repo and optionally create isolated worktree
658 + const repo = share ? null : detectRepo(cwd);
659 + if (repo) {
660 + try {
661 + const isolate = await createIsolate(cwd, id, repo, pi);
662 + task.isolate = isolate;
663 + cwd = isolate.path;
664 + task.log.push(`${now()} isolate ${isolate.type} ${isolate.path}`);
665 + } catch (err) {
666 + task.log.push(`${now()} isolate-fallback ${(err as Error).message}`);
434 669 live.set(id, { cwd, task });
435 670 writeTask(cwd, task);
436 671 append(ctx, { kind: "task", task });
473 708 await loader.reload();
474 709 const tools = resolveNames(loaded.options.tools, availableTools);
710 + const requested = loaded.options.model;
711 + const agentModel = modelFrom(requested, model);
712 + if (requested) {
713 + const [provider, ...id] = requested.split("/");
714 + const direct = provider && id.length ? getModel(provider, id.join("/")) : null;
715 + if (!direct || !direct.provider) {
716 + notify(ctx, `warn: model "${requested}" not found, using fallback`, "warning");
475 719 const created = await createAgentSession({
477 721 agentDir,
478 - model: modelFrom(loaded.options.model, model),
722 + model: agentModel,
479 723 modelRegistry,
480 724 thinkingLevel: (loaded.options.thinking ?? thinking) as never,
481 725 settingsManager,
524 768 } finally {
525 769 session?.dispose();
526 770 live.delete(id);
771 + if (task.status !== "done") {
772 + await cleanupIsolate(task, pi);
527 774 writeTask(cwd, task);
775 + logRun(cwd, task);
528 776 if (gen === generation) {
529 777 append(ctx, { kind: "task", task });
530 778 widget(ctx);
539 787 ctx: ExtensionCommandContext,
540 788 pi: ExtensionAPI,
542 - const loaded = loadAgent(ctx.cwd, name, args);
790 + const share = args.includes("--share");
791 + const cleanArgs = args.replace(/--share/g, "").trim();
792 + const loaded = loadAgent(ctx.cwd, name, cleanArgs);
543 793 if (!loaded) return notify(ctx, `agent not found: ${name}`, "error");
544 - return startAgent(name, loaded, ctx, pi);
794 + return startAgent(name, loaded, ctx, pi, share);
547 797 async function inlineAgent(
556 806 { prompt, options: { tools: ["*"], thinking: "off" } },
809 + false,
751 1002 notify(
754 - "Superpowers",
755 - "mode: /superpowers | on | off | status [id]",
756 - "workers: run <agent> [args] | agent <prompt> | open/branch/abort <id> | return <summary>",
757 - "workflows: design | plan | execute | debug | review | verify | parallel | git | meta",
758 - "browser: visual start | visual status | visual events | visual stop",
1005 + "⚡ superpowers",
1006 + "toggle: /superpowers | on | off",
1007 + "status: /superpowers status [id]",
1008 + "workers: run <agent> [--share] | agent <prompt> | abort <id> | open <id>",
1009 + "session: branch <id> | return <summary>",
1010 + "workflows: design | plan | execute | debug | review | deslop | compress | verify | parallel | git | meta",
1011 + "visual: start | status | events | stop",
759 1012 ].join("\n"),
780 1033 .map((id) => Number(id.slice(3)))
781 1034 .filter(Number.isFinite);
782 1035 next = Math.max(next, 1 + Math.max(0, ...ids));
1036 + reapStale(ctx.cwd);
783 1037 widget(ctx);
785 1039 pi.on("session_shutdown", async () => {
858 1112 hashProjectRoot,
859 1113 tasksFile,
1115 + detectRepo,
1116 + createIsolate,
1117 + cleanupIsolate,

extensions/superpowers/prompts/brainstorming.md

Modified
3 3 ---
4 4 description: Run enhanced Superpowers brainstorming: context, questions, options, section approval, spec, self-review, handoff to planning.
5 5 argument-hint: "<goal-or-feature>"
6 6 tools: [read, write, bash, grep, find, ls]
7 7 thinking: medium
8 +accent: accent
8 9 ---
9 -Use the `brainstorming` skill. Apply it to:
12 +# Brainstorming
14 +Design before code. No exceptions for “simple” work.
16 +## Hard gate
18 +Do not implement, scaffold, edit production code, or invoke implementation workflows until:
20 +1. design was presented,
21 +2. user approved it,
22 +3. spec was written,
23 +4. spec self-review passed,
24 +5. user approved the written spec.
26 +Tiny tasks may have tiny designs. They still need approval.
28 +## Flow
30 +1. Explore project context.
31 + - read relevant docs/files
32 + - inspect current structure
33 + - note constraints and existing patterns
34 + - inspect recent commits if useful
35 +2. If visual questions are likely, offer visual companion in its own message.
36 +3. Ask clarifying questions one at a time.
37 +4. Propose 2-3 approaches with tradeoffs.
38 +5. Recommend one.
39 +6. Present design in small sections.
40 +7. Ask approval after each section.
41 +8. Write spec to `docs/superpowers/specs/YYYY-MM-DD-<topic>-design.md` unless project rules say otherwise.
42 +9. Self-review spec; fix placeholders, contradictions, ambiguity, overscope.
43 +10. Commit the spec when project workflow uses git and project rules allow it.
44 +11. Ask user to review spec file.
45 +12. After approval, hand off only to `writing-plans`.
47 +## Question rules
49 +- One question per message.
50 +- Multiple choice preferred.
51 +- Ask only blocking questions.
52 +- If request is too large, decompose first; brainstorm one subproject.
54 +## Design sections
56 +Scale section length to complexity. Cover only relevant sections:
58 +- goal and non-goals
59 +- UX/API behavior
60 +- architecture/components
61 +- data flow/state
62 +- component boundaries: single responsibility, clear interfaces, independent tests
63 +- errors/failure modes
64 +- testing/proof
65 +- migration/rollout, only if truly needed
67 +## Spec self-review
69 +Before user review, check:
71 +- `TODO`, `TBD`, placeholders
72 +- contradictions
73 +- unclear ownership or boundaries
74 +- requirements that can be interpreted two ways
75 +- scope too large for one implementation plan
76 +- missing verification strategy
78 +Fix inline before asking user.
80 +## Output checkpoints
82 +```text
83 +BRAINSTORM_CONTEXT
84 +- existing patterns: ...
85 +- constraints: ...
86 +- visual companion: useful | not useful
87 +```
89 +```text
90 +BRAINSTORM_OPTIONS
91 +- recommendation: ...
92 +- options:
93 + 1. ... tradeoff ...
94 + 2. ... tradeoff ...
95 +```
97 +```text
98 +DESIGN_SECTION n/N — <name>
99 +...
100 +Approve / edit?
101 +```
103 +```text
104 +SPEC_READY
105 +- path: docs/superpowers/specs/YYYY-MM-DD-<topic>-design.md
106 +- self-review: passed
107 +- next after approval: /writing-plans <path>
108 +```
110 +## Anti-patterns
112 +- Coding during brainstorming.
113 +- Dumping a giant spec without section approval.
114 +- Asking five questions at once.
115 +- “This is too simple for design.”
116 +- Generic scalable/flexible fluff.
117 +- Unrelated refactors while touching existing code.
118 +- Writing a spec full of hedges instead of decisions.
120 +## Visual companion
122 +Use only when seeing beats reading: mockups, layouts, palettes, diagrams, side-by-side UX choices.
124 +This is an active decision aid, not a reporting dashboard. Every visual screen must either ask a question, present selectable options, or show a mockup/diagram the user is meant to judge. Do not use it for progress updates, implementation summaries, final reports, or proof-of-work slides.
126 +Offer in its own message:
128 +```text
129 +Some of this may be easier to judge visually. I can open a local browser companion for mockups/diagrams/options. Use it?
130 +```
132 +If user accepts:
134 +1. Ask user to run `/superpowers visual start` if not already live.
135 +2. Use returned `content` dir.
136 +3. Write one fresh `.html` fragment per decision screen.
137 +4. Each screen must include a clear prompt/question and obvious clickable choices when choice is useful.
138 +5. Use `data-choice="..."` on clickable options; the browser records those clicks automatically.
139 +6. Tell user the URL and the exact decision you need from the screen.
140 +7. Ask user to click/select if useful and answer in terminal.
141 +8. Wait for a terminal answer or browser event before implementing from a visual decision screen.
142 +9. Read the events file path announced by `/superpowers visual start` directly when interpreting browser feedback.
143 +10. After the visual decision is resolved, push a waiting screen saying `Continuing in terminal…` before returning to text-only discussion.
144 +11. At the end of the visual phase, ask whether to leave the browser companion open for inspection or stop it with `/superpowers visual stop`.
146 +Visual state is ephemeral platform state, not project files. Specs/design docs remain project files when approved.
148 +Target:
11 150 $ARGUMENTS

extensions/superpowers/prompts/dispatching-parallel-agents.md

Modified
3 3 ---
4 4 description: Run the dispatching-parallel-agents Superpowers workflow.
5 5 argument-hint: "<work-to-split>"
6 6 tools: [read, grep, find, ls]
7 7 thinking: medium
8 +accent: syntaxVariable
8 9 ---
9 -Use the `dispatching-parallel-agents` skill. Apply it to:
12 +# Dispatching Parallel Agents
14 +Parallel only when independent. One worker per independent problem domain.
16 +## Independence test
18 +Tasks are parallelizable if:
20 +- no task needs another task's output
21 +- no two tasks edit same file/region
22 +- failures can be understood separately
24 +If not, run sequentially.
26 +## Worker prompt must include
28 +- shared context
29 +- exact scope
30 +- allowed files
31 +- forbidden files/actions
32 +- verification command
33 +- required return format
34 +- enough context so worker does not need session history
36 +## Output
38 +```text
39 +DISPATCH_PLAN
40 +- shared context: ...
41 +- workers:
42 + - /superpowers run <prompt> ...
43 +- merge order: ...
44 +- conflicts: ...
45 +- final verify: ...
46 +```
48 +After workers return: read summaries, inspect changed files, check conflicts, run final verification.
50 +## Law
52 +Benchmark prompts must stay fair/profile-neutral. Do not steer toward a tool just to make an extension look good.
54 +Target:
11 56 $ARGUMENTS

extensions/superpowers/prompts/executing-plans.md

Modified
3 3 ---
4 4 description: Run the executing-plans Superpowers workflow.
5 5 argument-hint: "<plan-or-task>"
6 6 tools: [read, write, edit, bash, grep, find, ls]
7 7 thinking: medium
8 +accent: success
8 9 ---
9 -Use the `executing-plans` skill. Apply it to:
12 +# Executing Plans
14 +Implement plan. Do not improvise silently.
16 +## Loop
18 +1. Read the whole plan.
19 +2. Review it critically for gaps, contradictions, missing files/commands.
20 +3. Inspect current state.
21 +4. Run baseline check if cheap.
22 +5. Execute 1-3 plan steps exactly.
23 +6. Run listed verification.
24 +7. Record changed files and evidence.
25 +8. Stop if verification fails.
26 +9. If plan is wrong, report exact mismatch and minimal correction.
28 +## Output per batch
30 +```text
31 +BATCH_DONE
32 +- tasks: ...
33 +- changed: ...
34 +- verify: command → result
35 +- next: ...
36 +```
38 +## Forbidden
40 +- Big-bang edits.
41 +- Claiming “done” without `verification-before-completion`.
42 +- Changing scope because it “seemed useful”.
43 +- Starting implementation on `main`/`master` without explicit user consent.
44 +- Guessing through blockers instead of asking.
46 +Target:
11 48 $ARGUMENTS

extensions/superpowers/prompts/finishing-a-development-branch.md

Modified
3 3 ---
4 4 description: Run the finishing-a-development-branch Superpowers workflow.
5 5 argument-hint: "<branch-or-worktree>"
6 6 tools: [read, write, edit, bash, grep, find, ls]
7 7 thinking: medium
8 +accent: dim
8 9 ---
9 -Use the `finishing-a-development-branch` skill. Apply it to:
12 +# Finishing a Development Branch
14 +Finish cleanly.
16 +## Steps
18 +1. Inspect `git status`, diff, recent commits, branch, and worktree state.
19 +2. Run full verification before offering completion choices.
20 +3. If tests fail, stop and report failures.
21 +4. Summarize changes and evidence.
22 +5. Present options exactly:
23 + - merge locally
24 + - push/open PR
25 + - keep branch/worktree
26 + - discard
27 +6. Cleanup only after explicit choice.
28 +7. For discard, require typed confirmation.
29 +8. Remove only worktrees this workflow owns; never delete harness-owned workspace.
31 +## Output
33 +```text
34 +BRANCH_FINISH
35 +- branch: ...
36 +- status: clean | dirty
37 +- changes: ...
38 +- verify: ...
39 +- risks: ...
40 +- options: merge | PR | keep | discard
41 +```
43 +Target:
11 45 $ARGUMENTS

extensions/superpowers/prompts/receiving-code-review.md

Modified
3 3 ---
4 4 description: Run the receiving-code-review Superpowers workflow.
5 5 argument-hint: "<review-findings>"
6 6 tools: [read, write, edit, bash, grep, find, ls]
7 7 thinking: medium
8 +accent: syntaxFunction
8 9 ---
9 -Use the `receiving-code-review` skill. Apply it to:
12 +# Receiving Code Review
14 +Address review without churn.
16 +## Process
18 +1. Read all feedback before reacting.
19 +2. Restate or clarify unclear findings before implementing anything.
20 +3. Verify each finding against the codebase.
21 +4. List findings by severity.
22 +5. Fix BLOCKER and MAJOR first, one item at a time.
23 +6. Reject invalid findings only with evidence.
24 +7. Do not touch unrelated code.
25 +8. Add tests when behavior changes.
26 +9. Rerun verification.
28 +## Output
30 +```text
31 +REVIEW_RESPONSE
32 +- fixed: ...
33 +- rejected: finding → evidence
34 +- changed: ...
35 +- tests: ...
36 +- remaining: none | ...
37 +```
39 +## Anti-patterns
41 +- Performative agreement before checking: “absolutely right”, “great point”.
42 +- Blindly implementing external review without codebase verification.
43 +- Rewriting whole module to fix one finding.
44 +- “Addressed” without commit/file/test evidence.
45 +- Adding unused “professional” features instead of applying YAGNI.
47 +Target:
11 49 $ARGUMENTS

extensions/superpowers/prompts/requesting-code-review.md

Modified
3 3 ---
4 4 description: Run strict Superpowers review: correctness, proof, deslop, compression, security, perf, UX, docs.
5 5 argument-hint: "<file|directory|diff|scope>"
6 6 tools: [read, bash, grep, find, ls]
7 7 thinking: medium
8 +accent: syntaxKeyword
8 9 ---
9 -Use the `requesting-code-review` skill. Apply it to:
12 +# Requesting Code Review
14 +Review only. Do not edit.
16 +No politeness tax. No generic praise. Findings need evidence.
18 +## Inputs
20 +Establish:
22 +- target files/diff/plan
23 +- base/head commit range when available
24 +- user objective
25 +- relevant project rules
26 +- tests or proof expected
28 +If target is ambiguous, inspect likely changed files and state scope.
30 +## Pass 1 — Correctness Gate
32 +Check:
34 +- requested behavior implemented
35 +- logic errors, race/order bugs, off-by-one, bad state transitions
36 +- error paths and failure modes
37 +- API/CLI/UI contract drift
38 +- docs match behavior
40 +## Pass 2 — Test/Proof Gate
42 +Check:
44 +- tests prove behavior, not implementation trivia
45 +- failing paths covered when important
46 +- manual/UI proof exists when requested
47 +- benchmark/profiling exists for perf claims
48 +- no completion claim without evidence
50 +## Pass 3 — Deslop Gate
52 +Find LLM slop:
54 +- plausible but unverified APIs or assumptions
55 +- needless traits/classes/wrappers/pass-through layers
56 +- generic soup, global state, vague config
57 +- duplicated near-identical code with renamed variables
58 +- stringly typed domains where enum/newtype/validated shape fits
59 +- `unwrap`/`expect`/panic/swallowed errors/vague catch-all errors
60 +- missing docs/tests for public behavior or risky failure paths
61 +- insecure input/path/shell/env handling
63 +## Pass 4 — Compression Gate
65 +Find design compression opportunities:
67 +- repeated command handlers, parsers, errors, tests, data shapes
68 +- boilerplate that should become a helper/table/enum/data-driven path
69 +- overbroad abstractions hiding simple control flow
70 +- under-abstracted repeated logic likely to drift
71 +- dead layers, needless adapters, repeated conversions
73 +Compression is not code golf. Prefer one good abstraction over many clever ones.
75 +## Pass 5 — Handmade UX/Style Gate
77 +Check:
79 +- direct code, small functions, explicit state
80 +- no legacy/compat sludge unless required
81 +- no edge-case theater
82 +- readable names and boring control flow
83 +- UI is usable, high-contrast, keyboard-friendly, not ugly
84 +- performance avoids obvious allocations/O(n²)/N+1/process churn
86 +## Severity
88 +- BLOCKER: incorrect, unsafe, untested critical path, violates spec, or fake completion.
89 +- MAJOR: likely bug, bad API, serious slop, duplicated design risk, missing important proof.
90 +- MINOR: cleanup, naming, small simplification.
91 +- NOTE: observation, no action required.
93 +## Output
95 +```text
96 +REVIEW
97 +- verdict: pass | fail
98 +- scope: ...
99 +- blockers:
100 + - file:line — issue — required fix
101 +- major:
102 + - ...
103 +- minor:
104 + - ...
105 +- slop:
106 + - pattern — evidence — severity
107 +- compression:
108 + - repeated shape — proposed simpler shape — risk
109 +- tests/proof:
110 + - present: ...
111 + - missing: ...
112 +- required fixes: ...
113 +- verify: ...
114 +```
116 +## Follow-up
118 +- Critical/BLOCKER and MAJOR findings must be fixed or explicitly rejected with evidence before proceeding.
119 +- If findings exist: use `receiving-code-review`.
120 +- If fixes are large: write a plan first.
121 +- If review passes: run `verification-before-completion` before claiming shipped.
123 +Target:
11 125 $ARGUMENTS

extensions/superpowers/prompts/subagent-driven-development.md

Modified
3 3 ---
4 4 description: Run the subagent-driven-development Superpowers workflow.
5 5 argument-hint: "<approved-plan>"
6 6 tools: [read, write, edit, bash, grep, find, ls]
7 7 thinking: medium
8 +accent: syntaxVariable
8 9 ---
9 -Use the `subagent-driven-development` skill. Apply it to:
12 +# Subagent-Driven Development
14 +Workers implement. Parent owns quality. Continue task-by-task without “should I continue?” check-ins unless blocked.
16 +## Process
18 +1. Require approved spec/plan. If absent, use `brainstorming` or `writing-plans`.
19 +2. Extract each task with full text and needed context.
20 +3. Create one worker prompt per bounded task. Do not make worker read the whole plan if the task text can be provided.
21 +4. Run worker with `/superpowers run <prompt> ...`.
22 +5. Inspect result with `/superpowers status <id>` or `/superpowers open <id>`.
23 +6. Handle worker state: done → review; needs-context → provide context; blocked → change prompt/model/scope or escalate.
24 +7. Review twice, in order:
25 + - spec compliance
26 + - code quality/simplicity
27 +8. Fix concrete issues and re-review before next task.
28 +9. Run final verification.
30 +## Review gates
32 +- Spec miss → send back/fix before next task.
33 +- Overbuilt code → simplify.
34 +- No tests/evidence → incomplete.
35 +- Multiple implementation workers editing overlapping files → forbidden.
37 +## Return format
39 +```text
40 +SDD_DONE
41 +- workers: ...
42 +- accepted: ...
43 +- rejected/fixed: ...
44 +- tests: ...
45 +- evidence: ...
46 +```
48 +Target:
11 50 $ARGUMENTS

extensions/superpowers/prompts/systematic-debugging.md

Modified
3 3 ---
4 4 description: Run the systematic-debugging Superpowers workflow.
5 5 argument-hint: "<bug-description-or-error>"
6 6 tools: [read, write, edit, bash, grep, find, ls]
7 7 thinking: medium
8 +accent: warning
8 9 ---
9 -Use the `systematic-debugging` skill. Apply it to:
12 +# Systematic Debugging
14 +No fix before root-cause evidence.
16 +## Phases
18 +1. Reproduce: exact command/input and observed failure. If not reproducible, gather more data; do not guess.
19 +2. Read errors fully; check recent changes and relevant config/env.
20 +3. Pattern analysis: find working examples and compare exact differences.
21 +4. Trace: follow data/control flow to root cause.
22 +5. Hypothesis: one cause, one prediction, one test.
23 +6. Fix: smallest root-cause change, preferably after a failing regression test.
24 +7. Verify: original failure + nearby regression.
26 +## Three-strike rule
28 +After 3 failed fixes, stop. Request architecture/design review.
30 +## Output
32 +```text
33 +DEBUG_DONE
34 +- repro: ...
35 +- evidence: ...
36 +- root cause: ...
37 +- fix: ...
38 +- verify: ...
39 +- failed attempts: N
40 +```
42 +## Forbidden
44 +- Guess-and-patch.
45 +- “Maybe race condition” without trace.
46 +- Multiple changes at once while testing a hypothesis.
47 +- Broad rewrites before root cause.
49 +Target:
11 51 $ARGUMENTS

extensions/superpowers/prompts/test-driven-development.md

Modified
3 3 ---
4 4 description: Run the test-driven-development Superpowers workflow.
5 5 argument-hint: "<behavior-or-bug>"
6 6 tools: [read, write, edit, bash, grep, find, ls]
7 7 thinking: medium
8 +accent: syntaxString
8 9 ---
9 -Use the `test-driven-development` skill. Apply it to:
12 +# Test-Driven Development
14 +RED first. No production code without a failing test first.
16 +If production code was written first, delete it and restart from RED. Do not keep it as reference.
18 +## Loop
20 +1. Write smallest failing test.
21 +2. Run it. Confirm failure is expected.
22 +3. Implement smallest passing code.
23 +4. Run focused test. Green.
24 +5. Refactor only to simplify.
25 +6. Run focused test again.
26 +7. Run relevant full suite.
28 +## Stop if
30 +- Test passes before implementation → bad test.
31 +- Failure is unrelated → fix test/setup first.
32 +- Implementation grows abstractions → cut it down.
33 +- User explicitly forbids tests → state risk and use manual proof.
34 +- Test needs heavy mocks → simplify API/design first.
36 +## Output
38 +```text
39 +TDD_DONE
40 +- red: command + expected failure
41 +- green: command + pass
42 +- refactor: yes/no
43 +- full verify: ...
44 +- files: ...
45 +```
47 +Target:
11 49 $ARGUMENTS

extensions/superpowers/prompts/using-git-worktrees.md

Modified
3 3 ---
4 4 description: Run the using-git-worktrees Superpowers workflow.
5 5 argument-hint: "<task-or-branch-name>"
6 6 tools: [read, write, edit, bash, grep, find, ls]
7 7 thinking: medium
8 +accent: muted
8 9 ---
9 -Use the `using-git-worktrees` skill. Apply it to:
12 +# Using Git Worktrees
14 +Protect trunk. Isolate risk.
16 +## Before creating
18 +First detect existing isolation:
20 +```bash
21 +git rev-parse --git-dir
22 +git rev-parse --git-common-dir
23 +git rev-parse --show-superproject-working-tree 2>/dev/null
24 +```
26 +If already in a linked worktree and not a submodule, do not create another.
28 +Record:
30 +- current branch
31 +- HEAD
32 +- remote/upstream
33 +- dirty status
34 +- likely trunk (`main`, `master`, `trunk`, `develop`)
36 +If current worktree is dirty, do not hide it. Ask or choose a safe path.
38 +## Process
40 +1. Prefer host/native worktree tools if available.
41 +2. Pick branch name from task.
42 +3. Create worktree outside current directory.
43 +4. If using project-local `.worktrees/` or `worktrees/`, verify path is gitignored first.
44 +5. Run setup/baseline tests there.
45 +6. Do implementation only in worktree.
46 +7. Finish with `finishing-a-development-branch`.
48 +## Output
50 +```text
51 +WORKTREE_READY
52 +- trunk: ...
53 +- branch: ...
54 +- path: ...
55 +- baseline: command → result
56 +```
58 +Target:
11 60 $ARGUMENTS

extensions/superpowers/prompts/using-superpowers.md

Modified
3 3 ---
4 4 description: Run the using-superpowers Superpowers workflow.
5 5 argument-hint: "[task-or-question]"
6 6 tools: [read, grep, find, ls]
7 7 thinking: off
8 +accent: accent
8 9 ---
9 -Use the `using-superpowers` skill. Apply it to:
12 +# Using Superpowers
14 +Superpowers = process discipline. Not vibes.
16 +## Rule
18 +Before non-trivial work, choose and follow one workflow skill:
20 +| Situation | Skill |
21 +|---|---|
22 +| fuzzy feature/design | `brainstorming` |
23 +| approved design → tasks | `writing-plans` |
24 +| plan exists → implement | `executing-plans` |
25 +| independent subtasks | `dispatching-parallel-agents` |
26 +| worker + review loop | `subagent-driven-development` |
27 +| code change with testable behavior | `test-driven-development` |
28 +| bug/regression/flake | `systematic-debugging` |
29 +| before saying done | `verification-before-completion` |
30 +| isolated branch needed | `using-git-worktrees` |
31 +| branch is complete | `finishing-a-development-branch` |
32 +| creating/revising skills | `writing-skills` |
34 +Load the selected skill before acting. If multiple skills apply, use the earliest lifecycle gate: brainstorming → writing-plans → execution/TDD/debug → review → verification → finishing.
36 +## Local style
38 +- Simplicity/minimalism/brutalism.
39 +- Evidence > claims.
40 +- Exact files/commands > summaries.
41 +- No legacy/compat/edge-case bloat unless required.
42 +- User instructions override skills unless unsafe/impossible.
44 +## Red flags
46 +Stop and load a workflow if you are about to:
48 +- implement a fuzzy request without design approval
49 +- fix a bug without root-cause evidence
50 +- claim done without fresh verification
51 +- accept worker/reviewer output without checking evidence
53 +## Superpowers workers
55 +Use normal prompt templates:
57 +```text
58 +/<prompt> ...
59 +/superpowers run <prompt> ...
60 +```
62 +Use workers for isolated investigation/implementation. Parent integrates.
64 +Target:
11 66 $ARGUMENTS

extensions/superpowers/prompts/verification-before-completion.md

Modified
3 3 ---
4 4 description: Run the verification-before-completion Superpowers workflow.
5 5 argument-hint: "<work-to-verify>"
6 6 tools: [read, write, edit, bash, grep, find, ls]
7 7 thinking: off
8 +accent: toolTitle
8 9 ---
9 -Use the `verification-before-completion` skill. Apply it to:
12 +# Verification Before Completion
14 +No fresh proof → not done. Evidence before claims.
16 +## Checklist
18 +- Changed files match scope.
19 +- Relevant tests/build/lint were run fresh.
20 +- Full output/exit code was read, not assumed.
21 +- Manual/UI requirements were actually exercised.
22 +- Artifacts exist and are executable/readable when required.
23 +- Docs match behavior.
24 +- No stray debug processes/files unless intentional.
26 +## Output
28 +```text
29 +VERIFIED
30 +- verdict: complete | incomplete
31 +- commands: ...
32 +- evidence: ...
33 +- changed: ...
34 +- remaining: none | ...
35 +```
37 +## Forbidden
39 +- “Should work.”
40 +- “Looks good.”
41 +- Passing unit tests when manual criterion was required.
42 +- Redefining success smaller.
43 +- Trusting worker/agent success without checking diff and evidence.
44 +- Regression test claimed without red-green proof when applicable.
46 +Target:
11 48 $ARGUMENTS

extensions/superpowers/prompts/writing-plans.md

Modified
3 3 ---
4 4 description: Run the writing-plans Superpowers workflow.
5 5 argument-hint: "<approved-design-or-scope>"
6 6 tools: [read, grep, find, ls]
7 7 thinking: medium
8 +accent: dim
8 9 ---
9 -Use the `writing-plans` skill. Apply it to:
12 +# Writing Plans
14 +Plan for a fast careless implementer with zero project context.
16 +Save plans to `docs/superpowers/plans/YYYY-MM-DD-<feature>.md` unless project rules say otherwise.
18 +## Task requirements
20 +Each task must include:
22 +- exact files
23 +- concrete edit/action
24 +- complete code or command for the step
25 +- expected result/output
26 +- verification command
27 +- commit step when project workflow uses git
28 +- rollback/failure note if risky
30 +## Shape
32 +```text
33 +PLAN
34 +- scope: ...
35 +- invariants: ...
36 +- tasks:
37 + 1. files: ...
38 + action: ...
39 + verify: ...
40 +- checkpoints: ...
41 +- acceptance: ...
42 +```
44 +## Rules
46 +- 2-10 minute tasks.
47 +- Tests before behavior when possible.
48 +- Every batch leaves repo working.
49 +- Mark unknown decisions `[?]`; stop before passing them.
50 +- No `TODO`/`TBD`/`similar to task N`/`write tests for above` placeholders.
51 +- No “refactor architecture” without file-level detail.
52 +- Self-review plan against spec: coverage, placeholders, type/name consistency.
53 +- End by offering `subagent-driven-development` or `executing-plans`.
55 +Target:
11 57 $ARGUMENTS

extensions/superpowers/prompts/writing-skills.md

Modified
3 3 ---
4 4 description: Run the writing-skills Superpowers workflow.
5 5 argument-hint: "<skill-name-or-purpose>"
6 6 tools: [read, write, edit, bash, grep, find, ls]
7 7 thinking: medium
8 +accent: syntaxFunction
8 9 ---
9 -Use the `writing-skills` skill. Apply it to:
12 +# Writing Skills
14 +Skills are operational memory. Keep them sharp.
16 +## Required shape
18 +```text
19 +skills/<name>/SKILL.md
20 +```
22 +Frontmatter:
24 +```yaml
25 +name: lowercase-hyphen-name
26 +description: Use when <specific trigger>. Does <specific outcome>.
27 +```
29 +## Body rules
31 +- Short enough to load.
32 +- Concrete steps.
33 +- Anti-patterns included.
34 +- Examples only when useful.
35 +- Link deeper refs instead of dumping.
36 +- Local style, not upstream prose.
38 +## Test
40 +Use TDD for skills: first write a case where current behavior would not load/follow the skill, then update the skill until it passes.
42 +Create trigger cases:
44 +- should use skill
45 +- should not use skill
46 +- ambiguous case
48 +## Description rules
50 +- Include concrete trigger keywords.
51 +- Do not put the whole workflow in the description.
52 +- Avoid vague descriptions like “useful for development”.
53 +- If reference material is long, put it in separate files and link it.
55 +## Output
57 +```text
58 +SKILL_DONE
59 +- path: ...
60 +- trigger: ...
61 +- body: ...
62 +- tests: ...
63 +```
65 +Target:
11 67 $ARGUMENTS