@justjoshn/pi-pstack 0.15.36-pi.1 → 0.15.36-pi.12

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 (140) hide show
  1. package/CHANGELOG.md +94 -0
  2. package/README.md +29 -24
  3. package/agents/ci-watcher.md +28 -0
  4. package/agents/thermo-nuclear-code-quality-review.md +23 -0
  5. package/assets/logo.png +0 -0
  6. package/automations/benny/FOR_AGENTS.md +2 -1
  7. package/automations/benny/README.md +2 -2
  8. package/automations/benny/skills/setup-benny/SKILL.md +10 -9
  9. package/automations/benny/templates/reproduce-automation-prompt.md +1 -1
  10. package/automations/benny/templates/triage-automation-prompt.md +1 -1
  11. package/bin/pstack-routines-supervisor +9 -0
  12. package/docs/guide/01-setup.md +2 -2
  13. package/docs/guide/07-overnight.md +1 -1
  14. package/docs/guide/09-make-it-yours.md +1 -1
  15. package/docs/guide/10-recipes-and-pitfalls.md +1 -1
  16. package/docs/native-gaps.md +14 -8
  17. package/docs/parity-reverse-engineering.md +94 -0
  18. package/docs/parity-status.md +128 -0
  19. package/package.json +41 -6
  20. package/packaging/install-supervisor-unit.sh +164 -0
  21. package/packaging/launchd/com.pstack.routines-supervisor.plist.example +24 -0
  22. package/packaging/systemd/pstack-routines-supervisor.service.example +15 -0
  23. package/skills/architect/SKILL.md +1 -1
  24. package/skills/architect/references/runner-prompt.md +1 -1
  25. package/skills/arena/SKILL.md +4 -4
  26. package/skills/check-compiler-errors/SKILL.md +23 -0
  27. package/skills/create-skill/SKILL.md +515 -29
  28. package/skills/fix-ci/SKILL.md +29 -0
  29. package/skills/fix-merge-conflicts/SKILL.md +32 -0
  30. package/skills/get-pr-comments/SKILL.md +23 -0
  31. package/skills/how/SKILL.md +1 -1
  32. package/skills/ketchup/SKILL.md +2 -2
  33. package/skills/ketchup-video/SKILL.md +2 -2
  34. package/skills/loop-on-ci/SKILL.md +50 -0
  35. package/skills/make-bot-ui/SKILL.md +2 -2
  36. package/skills/make-pr-easy-to-review/SKILL.md +59 -0
  37. package/skills/new-branch-and-pr/SKILL.md +29 -0
  38. package/skills/no-inline-imports/SKILL.md +12 -0
  39. package/skills/poteto-help/SKILL.md +4 -4
  40. package/skills/poteto-mode/SKILL.md +2 -2
  41. package/skills/poteto-mode/playbooks/bug-fix.md +1 -1
  42. package/skills/poteto-mode/playbooks/feature.md +1 -1
  43. package/skills/poteto-mode/playbooks/hillclimb.md +1 -1
  44. package/skills/poteto-mode/playbooks/multi-phase-plan.md +2 -2
  45. package/skills/poteto-mode/playbooks/orchestrate.md +2 -2
  46. package/skills/poteto-mode/playbooks/perf-issue.md +1 -1
  47. package/skills/poteto-mode/playbooks/refactoring.md +1 -1
  48. package/skills/pr-review-canvas/SKILL.md +176 -0
  49. package/skills/pr-review-canvas/renderer.js +170 -0
  50. package/skills/pr-review-canvas/styles.css +96 -0
  51. package/skills/pr-review-canvas/template.html +18 -0
  52. package/skills/reflect/SKILL.md +2 -2
  53. package/skills/review-and-ship/SKILL.md +41 -0
  54. package/skills/run-smoke-tests/SKILL.md +42 -0
  55. package/skills/setup-pstack/SKILL.md +13 -13
  56. package/skills/statechart/scripts/test/cli.test.ts +1 -1
  57. package/skills/swarm/SKILL.md +2 -2
  58. package/skills/teach/SKILL.md +1 -1
  59. package/skills/thermo-nuclear-code-quality-review/SKILL.md +192 -0
  60. package/skills/typescript-exhaustive-switch/SKILL.md +10 -0
  61. package/skills/verify-this/SKILL.md +74 -0
  62. package/skills/weekly-review/SKILL.md +32 -0
  63. package/skills/what-did-i-get-done/SKILL.md +31 -0
  64. package/skills/why/SKILL.md +2 -2
  65. package/skills/workflow-from-chats/SKILL.md +50 -0
  66. package/src/ask.ts +24 -10
  67. package/src/child-env.ts +15 -2
  68. package/src/generate-image.ts +98 -0
  69. package/src/index.ts +28 -9
  70. package/src/loop.ts +74 -17
  71. package/src/mode.ts +89 -27
  72. package/src/paths.ts +18 -0
  73. package/src/pi-command.ts +12 -0
  74. package/src/plan.ts +285 -30
  75. package/src/rule.ts +4 -4
  76. package/src/sections.ts +27 -3
  77. package/src/subscriptions/durable-store.ts +531 -0
  78. package/src/subscriptions/durable-types.ts +69 -0
  79. package/src/subscriptions/ensure-supervisor.ts +67 -0
  80. package/src/subscriptions/index.ts +310 -282
  81. package/src/subscriptions/supervisor-main.ts +134 -0
  82. package/src/subscriptions/supervisor.ts +325 -0
  83. package/src/subscriptions/webhook.ts +82 -21
  84. package/src/task/agents.ts +39 -3
  85. package/src/task/card.ts +31 -0
  86. package/src/task/format.ts +17 -3
  87. package/src/task/models.ts +7 -0
  88. package/src/task/progress.ts +112 -0
  89. package/src/task/records.ts +7 -9
  90. package/src/task/registry.ts +9 -4
  91. package/src/task/runner.ts +116 -24
  92. package/src/task/stop.ts +3 -3
  93. package/src/task/tool.ts +158 -57
  94. package/src/task/worktree.ts +5 -3
  95. package/src/todo.ts +29 -4
  96. package/scripts/live-e2e.mjs +0 -257
  97. package/test/aliases.test.ts +0 -57
  98. package/test/ask.test.ts +0 -85
  99. package/test/autocomplete.test.ts +0 -39
  100. package/test/e2e/aliases.e2e.test.ts +0 -81
  101. package/test/e2e/ask.e2e.test.ts +0 -135
  102. package/test/e2e/harness.ts +0 -179
  103. package/test/e2e/host.e2e.test.ts +0 -193
  104. package/test/e2e/lifecycle.e2e.test.ts +0 -99
  105. package/test/e2e/mode.e2e.test.ts +0 -160
  106. package/test/e2e/package.e2e.test.ts +0 -67
  107. package/test/e2e/task.e2e.test.ts +0 -734
  108. package/test/e2e/todo.e2e.test.ts +0 -59
  109. package/test/fixtures/cursor-askquestion-calls.json +0 -806
  110. package/test/fixtures/fake-pi.mjs +0 -96
  111. package/test/fixtures/image-model.ts +0 -16
  112. package/test/fixtures/list-models.ts +0 -15
  113. package/test/fixtures/readonly-shell-exit.ts +0 -17
  114. package/test/fixtures/scripted-model.ts +0 -113
  115. package/test/loop.test.ts +0 -209
  116. package/test/mode.test.ts +0 -143
  117. package/test/plan.test.ts +0 -126
  118. package/test/readonly-shell-security.test.ts +0 -84
  119. package/test/readonly-shell.test.ts +0 -44
  120. package/test/records.test.ts +0 -143
  121. package/test/registry.test.ts +0 -18
  122. package/test/resources.test.ts +0 -162
  123. package/test/rule.test.ts +0 -92
  124. package/test/scripts.test.ts +0 -182
  125. package/test/sections.test.ts +0 -56
  126. package/test/subscriptions-cron.test.ts +0 -60
  127. package/test/subscriptions.test.ts +0 -598
  128. package/test/task-agents.test.ts +0 -49
  129. package/test/task-card.test.ts +0 -34
  130. package/test/task-fork.test.ts +0 -233
  131. package/test/task-format.test.ts +0 -65
  132. package/test/task-model.test.ts +0 -141
  133. package/test/task-runner.test.ts +0 -259
  134. package/test/task-schema.test.ts +0 -50
  135. package/test/task-status.test.ts +0 -155
  136. package/test/task-worktree.test.ts +0 -106
  137. package/test/todo.test.ts +0 -74
  138. package/test/visualize.test.ts +0 -152
  139. package/tsconfig.json +0 -5
  140. package/vitest.config.ts +0 -16
@@ -0,0 +1,176 @@
1
+ ---
2
+ name: pr-review-canvas
3
+ disable-model-invocation: true
4
+ description: Generate an interactive PR review walkthrough as an HTML page. Fetches PR data via gh API, categorizes files into core vs mechanical changes, adds reviewer annotations, and renders diffs with moved-code detection. Use when the user pastes a GitHub PR URL and asks for a review, walkthrough, or summary, or says "review this PR".
5
+ ---
6
+
7
+ # PR Review Canvas
8
+
9
+ Generate an interactive HTML review of a GitHub PR that reads like a peer walking you through what matters.
10
+
11
+ ## Workflow
12
+
13
+ ### 1. Fetch PR data
14
+
15
+ Run these `gh api` calls in parallel:
16
+
17
+ ```bash
18
+ gh api repos/{owner}/{repo}/pulls/{number} --jq '{title, body, user: .user.login, state, additions, deletions, changed_files, base: .base.ref, head: .head.ref}'
19
+ gh api repos/{owner}/{repo}/pulls/{number}/files --paginate --jq '.[] | {filename, status, additions, deletions, patch}'
20
+ gh api repos/{owner}/{repo}/pulls/{number}/comments --jq '.[] | {user: .user.login, body, path, line}'
21
+ ```
22
+
23
+ ### 2. Analyze the PR and write the body HTML
24
+
25
+ Read the diffs, understand the PR, and write the `<body>` content directly as HTML. You have full creative freedom -- the goal is to explain the PR clearly to a reviewer. Use whatever structure best fits the PR.
26
+
27
+ **Typical structure** (adapt as needed):
28
+ - Header with title, PR number, author, stats
29
+ - Summary box explaining what the PR does in plain English
30
+ - Core file sections with annotations and diffs
31
+ - Mechanical/boilerplate files collapsed by default
32
+ - Review checklist at the bottom
33
+
34
+ **But you can also add:**
35
+ - **Pseudocode summaries** for verbose code -- show the algorithm in plain English or short pseudocode, with the real diff collapsed below (use a `.bp-section` card labeled "Show full implementation"). Great when 150 lines of retry/backoff/error-handling code is really just "fetch with exponential backoff and circuit breaker."
36
+ - Diagrams (inline SVG, mermaid via CDN, ASCII art in `<pre>`)
37
+ - Flowcharts showing before/after control flow
38
+ - Tables comparing old vs new behavior
39
+ - Callout boxes for warnings, questions, or gotchas
40
+ - Interactive widgets if they help
41
+ - Anything else that makes the review clearer
42
+
43
+ **Pseudocode pattern example:**
44
+ ```html
45
+ <div class="file-card">
46
+ <div class="file-hdr" onclick="toggle(this)">
47
+ <span class="fname">retryClient.ts</span>
48
+ <div class="fstats"><span class="pill add">+173</span><span class="pill del">&minus;11</span><span class="chev open">&#9654;</span></div>
49
+ </div>
50
+ <div class="file-body open">
51
+ <div class="file-note">
52
+ <strong>What this does in plain English:</strong>
53
+ <pre style="margin-top:8px;color:var(--text);font-size:12px;line-height:1.6;">
54
+ fetch(url):
55
+ if circuit breaker is open → fail fast
56
+ retry up to N times:
57
+ try fetch with timeout
58
+ on success → close circuit breaker, return
59
+ on retryable error → wait (exponential backoff + jitter)
60
+ on non-retryable error → throw
61
+ circuit breaker records failure</pre>
62
+ </div>
63
+ <div class="bp-section" style="margin:0;border:0;border-radius:0;">
64
+ <div class="bp-hdr" onclick="toggleBP(this)">
65
+ <span>Show full implementation (+173 lines)</span><span class="chev">&#9654;</span>
66
+ </div>
67
+ <div class="bp-body"><div data-diff="retryClient"></div></div>
68
+ </div>
69
+ </div>
70
+ </div>
71
+ ```
72
+
73
+ ### 3. Available CSS classes and JS utilities
74
+
75
+ Read [styles.css](styles.css) and [renderer.js](renderer.js) from this skill directory. These give you a prebuilt dark-themed toolkit. Inject them into [template.html](template.html) verbatim.
76
+
77
+ **CSS classes you can use:**
78
+
79
+ | Class | Purpose |
80
+ |-------|---------|
81
+ | `.header`, `.header h1`, `.header-meta` | Page header |
82
+ | `.pill.add`, `.pill.del`, `.pill.files` | Stat badges (+N, -N, N files) |
83
+ | `.content` | Centered content wrapper (max 900px) |
84
+ | `.summary` | Summary/TL;DR box |
85
+ | `.section-title` | Section heading with bottom border |
86
+ | `.ic` | Inline code reference (mono, blue, dark bg) |
87
+ | `.file-card`, `.file-hdr`, `.file-body` | Collapsible file card (use `onclick="toggle(this)"` on `.file-hdr`) |
88
+ | `.file-note` | Sticky reviewer annotation inside a file card |
89
+ | `.bp-section`, `.bp-hdr`, `.bp-body` | Collapsed boilerplate card (use `onclick="toggleBP(this)"`) |
90
+ | `.bp-note` | Note inside a boilerplate card |
91
+ | `.verdict` | Review checklist box |
92
+
93
+ **JS functions available:**
94
+
95
+ | Function | Usage |
96
+ |----------|-------|
97
+ | `toggle(hdrElement)` | Toggle a `.file-body` open/closed |
98
+ | `toggleBP(hdrElement)` | Toggle a `.bp-body` open/closed |
99
+ | `renderDiff(target, diffInput)` | Render a unified diff. `target` can be a DOM element, string ID, or CSS selector. `diffInput` can be a raw patch string OR an array of lines -- both work. Automatically filters imports, collapses whitespace-only changes, detects moved code (blue/purple tint). |
100
+ | `esc(string)` | HTML-escape a string |
101
+
102
+ **Rendering diffs -- use `data-diff` attributes with auto-discovery.**
103
+ Put `<div data-diff="KEY"></div>` placeholders in your body HTML wherever you want a diff rendered. The renderer finds them automatically after DOM load and fills them from the `<script id="pr-diffs-json" type="application/json">` element in `template.html`.
104
+
105
+ **CRITICAL: Patch strings can contain `</script>` in addition to newlines, backslashes, and quotes.** Even `json.dumps(...)` is not enough if you paste raw output into executable `<script>` because HTML parsing can terminate the tag early. Never manually embed patch strings in JS/JSON. Instead, use this safe approach:
106
+
107
+ 1. During the fetch step, save patches to a JSON file using `jq` (which handles escaping correctly):
108
+ ```bash
109
+ gh api repos/{owner}/{repo}/pulls/{number}/files --paginate \
110
+ --jq '[.[] | {key: (.filename | gsub("[^a-zA-Z0-9]"; "_")), value: (.patch // "")}] | from_entries' \
111
+ > /tmp/pr-patches-{number}.json
112
+ ```
113
+
114
+ 2. During assembly, use Python to safely inject the JSON into `template.html`:
115
+ ```bash
116
+ python3 <<'PY'
117
+ import json
118
+ from pathlib import Path
119
+
120
+ patches = json.loads(Path('/tmp/pr-patches-{number}.json').read_text())
121
+ html = Path('/tmp/pr-review-{number}-body.html').read_text()
122
+ css = Path('styles.css').read_text()
123
+ js = Path('renderer.js').read_text()
124
+ tmpl = Path('template.html').read_text()
125
+
126
+ # Prevent literal </script> from terminating HTML script tags early.
127
+ safe_json = json.dumps(patches).replace('<', '\\u003c').replace('>', '\\u003e').replace('&', '\\u0026')
128
+
129
+ out = (
130
+ tmpl.replace('/* INJECT_CSS */', css)
131
+ .replace('/* INJECT_JS */', js)
132
+ .replace('<!-- INJECT_BODY -->', html)
133
+ .replace('{"__PR_DIFFS_PLACEHOLDER__":true}', safe_json)
134
+ )
135
+
136
+ Path('/tmp/pr-review-{number}.html').write_text(out)
137
+ PY
138
+ ```
139
+
140
+ This guarantees valid JSON and script-safe HTML embedding. The agent writes body HTML to a temp file, then Python assembles everything safely.
141
+
142
+ The diff data keys should match the `data-diff` attribute values in the HTML:
143
+ ```html
144
+ <div data-diff="path_to_file_ts"></div>
145
+ ```
146
+
147
+ Since renderer.js loads in `<head>`, you can also call `renderDiff(target, lines)` directly from inline `<script>` tags if needed for custom use cases. The function accepts a DOM element, ID string, or CSS selector as `target`, and a string or array as `lines`.
148
+
149
+ **You're not limited to these.** Add your own inline `<style>` blocks, `<script>` blocks, SVGs, diagrams, or anything else. The prebuilt pieces save time but don't constrain you.
150
+
151
+ ### 4. Assemble and serve
152
+
153
+ 1. Write your body HTML (everything that goes inside `<body>`) to `/tmp/pr-review-{number}-body.html`
154
+ 2. Save patches to `/tmp/pr-patches-{number}.json` using the `jq` command from step 3 above
155
+ 3. Run the Python assembly script from step 3 above (reads styles.css, renderer.js, template.html from this skill directory, injects body + patches safely, writes final HTML)
156
+ 4. Start a local server on a fixed port:
157
+ ```bash
158
+ cd /tmp && python3 -m http.server 8432 --bind 127.0.0.1
159
+ ```
160
+ Run this backgrounded, then navigate the in-app browser to `http://127.0.0.1:8432/pr-review-{number}.html`.
161
+
162
+ **Why a fixed port and `cd /tmp`:** Background shells have no TTY, so Python buffers its startup message ("Serving HTTP on...") indefinitely — using port 0 means you can never read which port was chosen. And `--directory /tmp` works but `cd /tmp` is more robust across Python versions. If port 8432 is taken, try 8433, 8434, etc.
163
+
164
+ ### Diff features (handled automatically by renderer.js)
165
+
166
+ - Filters out import-only lines
167
+ - Collapses whitespace-only changes into context lines
168
+ - Detects moved code blocks (3+ consecutive lines deleted in one place and added identically elsewhere) -- renders in blue/purple instead of red/green
169
+ - Near-matches (moved + small edit) get a different purple tint
170
+
171
+ ### Style notes
172
+
173
+ - Dark theme: `#1a1a1a` background, Inter body font, IBM Plex Mono for code
174
+ - Use `var(--warning)` for orange, `var(--success)` for green, `var(--danger)` for red, `var(--accent)` for blue
175
+ - Sticky file headers (`position: sticky; top: 0`) and notes (`top: 35px`) pin while scrolling
176
+ - Core files expanded by default (`.file-body.open`), mechanical files collapsed
@@ -0,0 +1,170 @@
1
+ function toggle(hdr) {
2
+ var b = hdr.nextElementSibling, c = hdr.querySelector('.chev');
3
+ b.classList.toggle('open'); c.classList.toggle('open');
4
+ }
5
+ function toggleBP(hdr) {
6
+ var b = hdr.nextElementSibling, c = hdr.querySelector('.chev');
7
+ b.classList.toggle('open'); c.classList.toggle('open');
8
+ }
9
+
10
+ function isImport(line) {
11
+ var s = line.replace(/^[+ -]/, '').trim();
12
+ return s.startsWith('import ') || s.startsWith('import{') || s.startsWith('} from ');
13
+ }
14
+
15
+ function isWhitespaceOnly(del, add) {
16
+ return del.replace(/^-/, '').replace(/\s/g, '') === add.replace(/^\+/, '').replace(/\s/g, '');
17
+ }
18
+
19
+ function esc(s) {
20
+ return s.replace(/&/g, '&amp;').replace(/</g, '&lt;').replace(/>/g, '&gt;');
21
+ }
22
+
23
+ function normWs(s) {
24
+ return s.replace(/\s+/g, ' ').trim();
25
+ }
26
+
27
+ function toLines(input) {
28
+ if (!input) return [];
29
+ if (Array.isArray(input)) return input;
30
+ if (typeof input === 'string') return input.split('\n');
31
+ return [];
32
+ }
33
+
34
+ function loadPrDiffs() {
35
+ var el = document.getElementById('pr-diffs-json');
36
+ if (!el) return null;
37
+ try {
38
+ return JSON.parse(el.textContent || '');
39
+ } catch (err) {
40
+ console.error('Failed to parse PR diff JSON payload', err);
41
+ return null;
42
+ }
43
+ }
44
+
45
+ function detectMoves(dels, adds) {
46
+ var TH = 3;
47
+ var md = {}, ma = {};
48
+ for (var di = 0; di < dels.length; di++) {
49
+ if (md[di]) continue;
50
+ var db = [di];
51
+ for (var d2 = di+1; d2 < dels.length && d2-di < 40; d2++) {
52
+ if (dels[d2].consecutive && !md[d2]) db.push(d2); else break;
53
+ }
54
+ if (db.length < TH) continue;
55
+ var dn = db.map(function(i){ return normWs(dels[i].code); });
56
+ for (var ai = 0; ai < adds.length; ai++) {
57
+ if (ma[ai]) continue;
58
+ var ab = [ai];
59
+ for (var a2 = ai+1; a2 < adds.length && a2-ai < 40; a2++) {
60
+ if (adds[a2].consecutive && !ma[a2]) ab.push(a2); else break;
61
+ }
62
+ if (ab.length < TH) continue;
63
+ var an = ab.map(function(i){ return normWs(adds[i].code); });
64
+ var ml = Math.min(dn.length, an.length), mc = 0;
65
+ for (var m = 0; m < ml; m++) { if (dn[m] === an[m]) mc++; }
66
+ if (mc >= TH && mc >= ml * 0.7) {
67
+ for (var k = 0; k < ml; k++) {
68
+ md[db[k]] = { exact: dn[k] === an[k] };
69
+ ma[ab[k]] = { exact: dn[k] === an[k] };
70
+ }
71
+ break;
72
+ }
73
+ }
74
+ }
75
+ return { movedDels: md, movedAdds: ma };
76
+ }
77
+
78
+ /**
79
+ * renderDiff(target, diffInput)
80
+ * target: DOM element, string ID, or CSS selector
81
+ * diffInput: array of diff lines, OR a single string (will be split on \n)
82
+ */
83
+ function renderDiff(target, diffInput) {
84
+ var el;
85
+ if (typeof target === 'string') {
86
+ el = document.getElementById(target) || document.querySelector(target);
87
+ } else {
88
+ el = target;
89
+ }
90
+ if (!el) return;
91
+
92
+ var lines = toLines(diffInput);
93
+ if (!lines.length) { el.innerHTML = '<div style="padding:12px;color:#777;font-size:12px;">No diff data</div>'; return; }
94
+
95
+ var filtered = lines.filter(function(l) {
96
+ if (l.startsWith('--- ') || l.startsWith('+++ ') || l.startsWith('@@') || l.startsWith('diff ')) return true;
97
+ return !isImport(l);
98
+ });
99
+
100
+ var wsOut = [];
101
+ for (var wi = 0; wi < filtered.length; wi++) {
102
+ if (filtered[wi].startsWith('-')) {
103
+ var dr = [filtered[wi]], wj = wi+1;
104
+ while (wj < filtered.length && filtered[wj].startsWith('-')) { dr.push(filtered[wj]); wj++; }
105
+ var ar = [], wk = wj;
106
+ while (wk < filtered.length && filtered[wk].startsWith('+')) { ar.push(filtered[wk]); wk++; }
107
+ if (dr.length === ar.length && dr.length > 0) {
108
+ var allWs = true;
109
+ for (var wc = 0; wc < dr.length; wc++) { if (!isWhitespaceOnly(dr[wc], ar[wc])) { allWs = false; break; } }
110
+ if (allWs) { for (var wx = 0; wx < ar.length; wx++) wsOut.push(' ' + ar[wx].slice(1)); wi = wk-1; continue; }
111
+ }
112
+ }
113
+ wsOut.push(filtered[wi]);
114
+ }
115
+
116
+ var dels = [], adds = [], parsed = [];
117
+ var oL = 0, nL = 0, pD = false, pA = false;
118
+ for (var pi = 0; pi < wsOut.length; pi++) {
119
+ var line = wsOut[pi];
120
+ if (line.startsWith('--- ') || line.startsWith('+++ ') || line.startsWith('diff ')) continue;
121
+ if (line.startsWith('@@')) {
122
+ var hm = line.match(/@@ -(\d+)(?:,\d+)? \+(\d+)/);
123
+ if (hm) { oL = parseInt(hm[1]); nL = parseInt(hm[2]); }
124
+ parsed.push({ type: 'hunk', text: line }); pD = false; pA = false; continue;
125
+ }
126
+ if (line.startsWith('+')) {
127
+ var ae = { type:'add', code:line.slice(1), newLine:nL, consecutive:pA, idx:parsed.length };
128
+ adds.push(ae); parsed.push(ae); nL++; pA = true; pD = false;
129
+ } else if (line.startsWith('-')) {
130
+ var de = { type:'del', code:line.slice(1), oldLine:oL, consecutive:pD, idx:parsed.length };
131
+ dels.push(de); parsed.push(de); oL++; pD = true; pA = false;
132
+ } else {
133
+ var c = line.startsWith(' ') ? line.slice(1) : line;
134
+ parsed.push({ type:'ctx', code:c, oldLine:oL, newLine:nL }); oL++; nL++; pD = false; pA = false;
135
+ }
136
+ }
137
+
138
+ var mv = detectMoves(dels, adds);
139
+ var rows = [];
140
+ for (var ri = 0; ri < parsed.length; ri++) {
141
+ var p = parsed[ri];
142
+ if (p.type === 'hunk') {
143
+ rows.push('<tr class="diff-hunk"><td class="diff-ln"></td><td class="diff-ln"></td><td class="diff-code">' + esc(p.text) + '</td></tr>');
144
+ } else if (p.type === 'add') {
145
+ var ai2 = -1; for (var fa=0;fa<adds.length;fa++) if(adds[fa].idx===p.idx){ai2=fa;break;}
146
+ var cls = (mv.movedAdds[ai2]) ? (mv.movedAdds[ai2].exact ? 'diff-moved-add' : 'diff-moved-add-edited') : 'diff-add';
147
+ rows.push('<tr class="'+cls+'"><td class="diff-ln"></td><td class="diff-ln">'+p.newLine+'</td><td class="diff-code">'+esc(p.code)+'</td></tr>');
148
+ } else if (p.type === 'del') {
149
+ var di2 = -1; for(var fd=0;fd<dels.length;fd++) if(dels[fd].idx===p.idx){di2=fd;break;}
150
+ var cls2 = (mv.movedDels[di2]) ? (mv.movedDels[di2].exact ? 'diff-moved-del' : 'diff-moved-del-edited') : 'diff-del';
151
+ rows.push('<tr class="'+cls2+'"><td class="diff-ln">'+p.oldLine+'</td><td class="diff-ln"></td><td class="diff-code">'+esc(p.code)+'</td></tr>');
152
+ } else {
153
+ rows.push('<tr class="diff-ctx"><td class="diff-ln">'+p.oldLine+'</td><td class="diff-ln">'+p.newLine+'</td><td class="diff-code">'+esc(p.code)+'</td></tr>');
154
+ }
155
+ }
156
+ el.innerHTML = '<table class="diff-table"><tbody>' + rows.join('') + '</tbody></table>';
157
+ }
158
+
159
+ /* Auto-discovery: after DOM loads, find all [data-diff] elements and render diffs from pr-diffs-json. */
160
+ document.addEventListener('DOMContentLoaded', function() {
161
+ var prDiffs = loadPrDiffs();
162
+ if (!prDiffs) return;
163
+ var els = document.querySelectorAll('[data-diff]');
164
+ for (var i = 0; i < els.length; i++) {
165
+ var key = els[i].getAttribute('data-diff');
166
+ if (key && Object.prototype.hasOwnProperty.call(prDiffs, key)) {
167
+ renderDiff(els[i], prDiffs[key]);
168
+ }
169
+ }
170
+ });
@@ -0,0 +1,96 @@
1
+ :root {
2
+ --bg: #1a1a1a;
3
+ --surface: #222;
4
+ --surface-raised: #2a2a2a;
5
+ --border: #333;
6
+ --text: #bbb;
7
+ --text-muted: #777;
8
+ --text-bright: #e5e5e5;
9
+ --accent: #7aa2f7;
10
+ --warning: #e0a458;
11
+ --success: #73b87e;
12
+ --danger: #e06060;
13
+ }
14
+ * { margin: 0; padding: 0; box-sizing: border-box; }
15
+ body {
16
+ background: var(--bg);
17
+ color: var(--text);
18
+ font-family: 'Inter', -apple-system, sans-serif;
19
+ font-size: 13px;
20
+ line-height: 1.5;
21
+ }
22
+ .header {
23
+ border-bottom: 1px solid var(--border);
24
+ padding: 24px 32px 20px;
25
+ }
26
+ .header h1 { font-size: 20px; font-weight: 600; color: var(--text-bright); margin-bottom: 4px; }
27
+ .header-meta { font-size: 12px; color: var(--text-muted); display: flex; gap: 16px; align-items: center; margin-top: 8px; }
28
+ .pill { display: inline-flex; padding: 1px 8px; border-radius: 10px; font-family: 'IBM Plex Mono', monospace; font-size: 11px; font-weight: 500; }
29
+ .pill.add { background: #73b87e22; color: var(--success); }
30
+ .pill.del { background: #e0606022; color: var(--danger); }
31
+ .pill.files { background: #7aa2f722; color: var(--accent); }
32
+ .content { max-width: 900px; margin: 0 auto; padding: 24px 20px 60px; }
33
+ .summary { background: var(--surface); border: 1px solid var(--border); border-radius: 6px; padding: 16px 20px; margin-bottom: 28px; font-size: 13px; line-height: 1.6; }
34
+ .summary strong { color: var(--text-bright); }
35
+ .summary ul { margin-top: 8px; padding-left: 18px; }
36
+ .summary li { margin-bottom: 4px; }
37
+ .section-title { font-size: 14px; font-weight: 600; color: var(--text-bright); margin: 28px 0 12px; padding-bottom: 6px; border-bottom: 1px solid var(--border); }
38
+ .ic { font-family: 'IBM Plex Mono', monospace; font-size: 11px; background: var(--surface-raised); padding: 1px 5px; border-radius: 3px; color: var(--accent); }
39
+
40
+ .file-card { background: var(--surface); border: 1px solid var(--border); border-radius: 6px; margin-bottom: 12px; }
41
+ .file-hdr {
42
+ display: flex; align-items: center; justify-content: space-between;
43
+ padding: 8px 14px; background: var(--surface-raised); border-bottom: 1px solid var(--border);
44
+ cursor: pointer; user-select: none; position: sticky; top: 0; z-index: 12; border-radius: 6px 6px 0 0;
45
+ }
46
+ .file-hdr:hover { background: #303030; }
47
+ .file-hdr .fname { font-family: 'IBM Plex Mono', monospace; font-size: 12px; color: var(--accent); }
48
+ .file-hdr .fstats { display: flex; gap: 6px; align-items: center; }
49
+ .file-hdr .chev { color: var(--text-muted); transition: transform 0.15s; font-size: 11px; margin-left: 10px; }
50
+ .file-hdr .chev.open { transform: rotate(90deg); }
51
+ .file-body { display: none; }
52
+ .file-body.open { display: block; }
53
+ .file-note {
54
+ padding: 10px 14px; font-size: 13px; color: var(--text); line-height: 1.55;
55
+ border-bottom: 1px solid var(--border); background: var(--surface);
56
+ position: sticky; top: 35px; z-index: 11;
57
+ }
58
+ .file-note strong { color: var(--text-bright); }
59
+ .file-note ul { margin-top: 6px; padding-left: 18px; }
60
+ .file-note li { margin-bottom: 3px; }
61
+
62
+ .bp-section { background: var(--surface); border: 1px solid var(--border); border-radius: 6px; margin-bottom: 8px; }
63
+ .bp-hdr { display: flex; align-items: center; justify-content: space-between; padding: 8px 14px; cursor: pointer; user-select: none; font-size: 12px; color: var(--text-muted); }
64
+ .bp-hdr:hover { background: var(--surface-raised); }
65
+ .bp-hdr .chev { color: var(--text-muted); transition: transform 0.15s; font-size: 11px; }
66
+ .bp-hdr .chev.open { transform: rotate(90deg); }
67
+ .bp-body { display: none; border-top: 1px solid var(--border); }
68
+ .bp-body.open { display: block; }
69
+ .bp-note { padding: 8px 14px; font-size: 12px; color: var(--text-muted); line-height: 1.5; border-bottom: 1px solid var(--border); background: var(--bg); }
70
+
71
+ .diff-table { width: 100%; border-collapse: collapse; font-family: 'IBM Plex Mono', monospace; font-size: 12px; line-height: 20px; table-layout: fixed; tab-size: 4; }
72
+ .diff-table td { vertical-align: top; white-space: pre; }
73
+ .diff-ln { width: 40px; min-width: 40px; max-width: 40px; text-align: right; padding: 0 6px 0 0; color: #555; background: var(--surface); user-select: none; }
74
+ .diff-code { padding: 0 12px; color: var(--text); background: var(--bg); overflow-x: auto; }
75
+ tr.diff-add .diff-ln { color: #5a8a5a; background: #1a2a1a; }
76
+ tr.diff-add .diff-code { background: #1a2a1a; color: #c8e6c8; }
77
+ tr.diff-del .diff-ln { color: #8a5a5a; background: #2a1a1a; }
78
+ tr.diff-del .diff-code { background: #2a1a1a; color: #e6c8c8; }
79
+ tr.diff-ctx .diff-ln { background: var(--surface); }
80
+ tr.diff-ctx .diff-code { background: var(--bg); color: var(--text-muted); }
81
+ tr.diff-hunk td { background: var(--surface-raised); color: var(--text-muted); font-size: 11px; padding: 3px 12px; border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }
82
+ tr.diff-hunk .diff-ln { background: var(--surface-raised); }
83
+ tr.diff-moved-del .diff-ln { color: #6a6a8a; background: #1a1a2a; }
84
+ tr.diff-moved-del .diff-code { background: #1a1a2a; color: #a8a8d0; }
85
+ tr.diff-moved-add .diff-ln { color: #6a6a8a; background: #1a1a2a; }
86
+ tr.diff-moved-add .diff-code { background: #1a1a2a; color: #a8a8d0; }
87
+ tr.diff-moved-del-edited .diff-ln { color: #7a6a8a; background: #221a2a; }
88
+ tr.diff-moved-del-edited .diff-code { background: #221a2a; color: #c0a8d0; }
89
+ tr.diff-moved-add-edited .diff-ln { color: #7a6a8a; background: #221a2a; }
90
+ tr.diff-moved-add-edited .diff-code { background: #221a2a; color: #c0a8d0; }
91
+
92
+ .verdict { background: var(--surface); border: 1px solid var(--border); border-radius: 6px; padding: 16px 20px; margin-top: 28px; }
93
+ .verdict h3 { font-size: 14px; font-weight: 600; color: var(--text-bright); margin-bottom: 8px; }
94
+ .verdict ul { padding-left: 18px; }
95
+ .verdict li { font-size: 13px; margin-bottom: 6px; line-height: 1.5; }
96
+ .verdict li strong { color: var(--text-bright); }
@@ -0,0 +1,18 @@
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="UTF-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
+ <link href="https://fonts.googleapis.com/css2?family=IBM+Plex+Mono:wght@400;500;600&family=Inter:wght@400;500;600;700&display=swap" rel="stylesheet">
7
+ <style>
8
+ /* INJECT_CSS */
9
+ </style>
10
+ <script>
11
+ /* INJECT_JS */
12
+ </script>
13
+ </head>
14
+ <body>
15
+ <!-- INJECT_BODY -->
16
+ <script id="pr-diffs-json" type="application/json" data-pr-diffs>{"__PR_DIFFS_PLACEHOLDER__":true}</script>
17
+ </body>
18
+ </html>
@@ -24,12 +24,12 @@ That covers this workspace's Pi session files (`<sessions>/*.jsonl`) and subagen
24
24
 
25
25
  One message, three `Task` calls, `subagent_type: generalPurpose`, `readonly` unset (`readonly: false`). Reviewers need MCP access to look up the tickets, chat threads, and observability traces the transcript references, and readonly strips MCPs.
26
26
 
27
- Each reviewer and the synthesizer name a role line in the model rule (`~/.pi/agent/pstack/pstack-models.md`) and a default. Set `model` to that line's value, or to the default if the rule or the line is missing. Leave `model` unset when the value is `auto` or `inherit-parent`. If the Task tool rejects a slug, use the default and say so. If it rejects the default, use the closest valid slug of the same family from its error message. Pick each subagent's reasoning level (the `:<level>` suffix), and fast or standard speed when the model has a `-fast` variant, for the job, per the Subagents section of the **poteto-mode** skill.
27
+ Each reviewer and the synthesizer name a role line in the model rule at the path the system prompt names and a default. Set `model` to that line's value, or to the default if the rule or the line is missing. Leave `model` unset when the value is `auto` or `inherit-parent`. If the Task tool rejects a slug, use the default and say so. If it rejects the default, use the closest valid slug of the same family from its error message. Pick each subagent's reasoning level (the `:<level>` suffix), and fast or standard speed when the model has a `-fast` variant, for the job, per the Subagents section of the **poteto-mode** skill.
28
28
 
29
29
  | Lens | Role line | Default `model` | Prompt template |
30
30
  |---|---|---|---|
31
31
  | Judgment | `reflect judgment, divergent, synthesizer` | `claude-opus-5-5:xhigh` | `references/judgment-reviewer.md` |
32
- | Tooling | `reflect tooling` | `grok-4.7:xhigh` | `references/tooling-reviewer.md` |
32
+ | Tooling | `reflect tooling` | `grok-4.7[effort=xhigh,fast=true]` | `references/tooling-reviewer.md` |
33
33
  | Divergent | `reflect judgment, divergent, synthesizer` | `claude-opus-5-5:xhigh` | `references/divergent-reviewer.md` |
34
34
 
35
35
  Pass each template verbatim, substituting the transcript path or digest where marked. Reviewers return findings in the `Task` response body.
@@ -0,0 +1,41 @@
1
+ ---
2
+ name: review-and-ship
3
+ description: Review the current branch for bugs, intent fit, and test coverage; run or write tests; commit focused work; open or update a PR.
4
+ ---
5
+
6
+ # Review and ship
7
+
8
+ ## Trigger
9
+
10
+ Reviewing changes before shipping. Close key issues, verify behavior, and open or update a PR.
11
+
12
+ ## Workflow
13
+
14
+ 1. Gather context: diff against base branch, uncommitted changes, recent commits, changed files, and user intent from recent relevant chats if useful.
15
+ 2. Run targeted tests for changed behavior. If no focused tests exist, decide whether to add them or document the gap.
16
+ 3. Review for correctness, regressions, security, and intent fit. Use parallel subagents for larger diffs.
17
+ 4. Fix critical issues before finalizing and re-run affected tests.
18
+ 5. Commit selective files with a concise message.
19
+ 6. Push branch and open or update a PR.
20
+
21
+ ## Suggested Checks
22
+
23
+ ```bash
24
+ git fetch origin main
25
+ git diff origin/main...HEAD
26
+ git status
27
+ gh pr checks --json name,bucket,state,workflow,link
28
+ ```
29
+
30
+ ## Guardrails
31
+
32
+ - Prioritize correctness, security, and regressions over style-only comments.
33
+ - Keep commits focused and avoid unrelated file changes.
34
+ - If pre-commit checks fail, fix the issues rather than bypassing hooks.
35
+ - Use `gh pr checks` instead of GitHub Actions-only commands when judging PR readiness.
36
+
37
+ ## Output
38
+
39
+ - Findings summary (critical, warning, note)
40
+ - Tests run and outcomes
41
+ - PR URL
@@ -0,0 +1,42 @@
1
+ ---
2
+ name: run-smoke-tests
3
+ description: Run Playwright smoke tests, debug failures, and verify fixes
4
+ ---
5
+
6
+ # Run smoke tests
7
+
8
+ ## Trigger
9
+
10
+ Need end-to-end smoke verification before or after changes.
11
+
12
+ ## Workflow
13
+
14
+ 1. Build prerequisites for the target app.
15
+ 2. Run the relevant smoke suite or a focused test file.
16
+ 3. If failing, inspect traces/logs and isolate the root cause.
17
+ 4. Apply a minimal fix and rerun until stable.
18
+
19
+ ## Example Commands
20
+
21
+ ```bash
22
+ # Run full smoke suite
23
+ npm run smoketest
24
+
25
+ # Run a specific smoke test file
26
+ npm run smoketest -- path/to/test.spec.ts
27
+
28
+ # Faster iteration when build artifacts are ready
29
+ npm run smoketest-no-compile -- path/to/test.spec.ts
30
+ ```
31
+
32
+ ## Guardrails
33
+
34
+ - Prefer deterministic waits and assertions over brittle timeouts.
35
+ - Re-run passing fixes to reduce flaky false positives.
36
+ - Quarantine tests only when explicitly requested and documented.
37
+
38
+ ## Output
39
+
40
+ - Test results summary
41
+ - Root cause and fix
42
+ - Remaining flake risk (if any)
@@ -26,7 +26,7 @@ The default role-to-model mapping is the rule shape shown in step 5 below. If th
26
26
  - `medium — high reasoning`
27
27
  - `small — medium reasoning`
28
28
 
29
- **(b) Apply it.** Build the working table from the skill defaults, and on a re-run keep any role you changed by family, list, or alias (`inherit-parent`, `auto`). `unlimited`, `large`, `medium`, and `small` set the effort token of every real model spec, panel entries included, to `max`, `xhigh`, `high`, or `medium`. The effort token is the `:<level>` suffix, or `effort=<level>` inside `[...]` (a `fast=true` there is speed, not effort), on the ladder `max` > `xhigh` > `high` > `medium` > `low`. If the result is not a detected model at that level (Task rejects a level the model does not list), use the same family's detected model at the highest effort at or below the target, else mark the role as needing a choice. `inherit-parent` and `auto` do not change. So `unlimited` turns `claude-opus-5-5:xhigh` into `claude-opus-5-5:max`. Grok tops out at `xhigh`, so under `unlimited` the fallback puts Grok at `xhigh` and keeps `grok-4.7:xhigh` as it is. `large` keeps both defaults. `small` turns them into `claude-opus-5-5:medium` and `grok-4.7:medium`.
29
+ **(b) Apply it.** Build the working table from the skill defaults, and on a re-run keep any role you changed by family, list, or alias (`inherit-parent`, `auto`). `unlimited`, `large`, `medium`, and `small` set the effort token of every real model spec, panel entries included, to `max`, `xhigh`, `high`, or `medium`. The effort token is the `:<level>` suffix, or `effort=<level>` inside `[...]` (a `fast=true` there is speed, not effort), on the ladder `max` > `xhigh` > `high` > `medium` > `low`. If the result is not a detected model at that level (Task rejects a level the model does not list), use the same family's detected model at the highest effort at or below the target, else mark the role as needing a choice. `inherit-parent` and `auto` do not change. So `unlimited` turns `claude-opus-5-5:xhigh` into `claude-opus-5-5:max`. Grok tops out at `xhigh`, so under `unlimited` the fallback puts Grok at `xhigh` and keeps `grok-4.7[effort=xhigh,fast=true]` as it is. `large` keeps both defaults. `small` turns them into `claude-opus-5-5:medium` and `grok-4.7[effort=medium,fast=true]`.
30
30
 
31
31
  **(c) Show the roles and confirm.** Show every role with its model, marking any real model spec not in the detected set as needing a choice. Also list each line step 2 dropped. Ask whether to accept as-is or change specific roles, offering the detected models plus `inherit-parent` and `auto` (both mean: this role runs on the parent chat model, which is how a role follows the chat model when the user switches it) as the options. Prefer AskQuestion over free text. For panel roles (arena runners, architect runners, interrogate reviewers) the value is a list, and one subagent runs per entry, alias entries included, so the list length sets the count. `arena cross-judge pool` is also a list, but Arena runs one judge. It tries only values from a family other than the parent's, in list order, so order it by preference. An `inherit-parent` or `auto` value never judges. `swarm workers` is the default model for every worker unless a race or comparison assigns another model per arm.
32
32
 
@@ -42,23 +42,23 @@ Write the model rule at the path the system prompt names, as plain Markdown with
42
42
  # pstack model configuration. One line per role. Delete a line to fall back to the skill default.
43
43
  # `inherit-parent` or `auto` as a value: the role runs on the parent chat model (omit Task `model`). Alias entries in a panel list still count toward its fan-out.
44
44
  # budget: large (xhigh)
45
- feature, refactoring: grok-4.7:xhigh
46
- bug-fix: grok-4.7:xhigh
47
- perf-issue: grok-4.7:xhigh
48
- hillclimb: grok-4.7:xhigh
45
+ feature, refactoring: grok-4.7[effort=xhigh,fast=true]
46
+ bug-fix: grok-4.7[effort=xhigh,fast=true]
47
+ perf-issue: grok-4.7[effort=xhigh,fast=true]
48
+ hillclimb: grok-4.7[effort=xhigh,fast=true]
49
49
  judgment and prose: claude-opus-5-5:xhigh
50
50
  hardest tasks: claude-opus-5-5:xhigh
51
- how explorer: grok-4.7:xhigh
51
+ how explorer: grok-4.7[effort=xhigh,fast=true]
52
52
  how explainer: claude-opus-5-5:xhigh
53
- why investigators: grok-4.7:xhigh
53
+ why investigators: grok-4.7[effort=xhigh,fast=true]
54
54
  why synthesizer: claude-opus-5-5:xhigh
55
- reflect tooling: grok-4.7:xhigh
55
+ reflect tooling: grok-4.7[effort=xhigh,fast=true]
56
56
  reflect judgment, divergent, synthesizer: claude-opus-5-5:xhigh
57
- arena runners: claude-opus-5-5:xhigh, grok-4.7:xhigh
58
- arena cross-judge pool: claude-opus-5-5:xhigh, grok-4.7:xhigh
59
- swarm workers: grok-4.7:xhigh
60
- architect runners: claude-opus-5-5:xhigh, grok-4.7:xhigh
61
- interrogate reviewers: claude-opus-5-5:xhigh, grok-4.7:xhigh
57
+ arena runners: claude-opus-5-5:xhigh, grok-4.7[effort=xhigh,fast=true]
58
+ arena cross-judge pool: claude-opus-5-5:xhigh, grok-4.7[effort=xhigh,fast=true]
59
+ swarm workers: grok-4.7[effort=xhigh,fast=true]
60
+ architect runners: claude-opus-5-5:xhigh, grok-4.7[effort=xhigh,fast=true]
61
+ interrogate reviewers: claude-opus-5-5:xhigh, grok-4.7[effort=xhigh,fast=true]
62
62
  ```
63
63
 
64
64
  ### 6. Confirm
@@ -113,7 +113,7 @@ const launcherTools = () => {
113
113
  };
114
114
 
115
115
  const linkedLauncher = () => {
116
- const links = fs.mkdtempSync(path.join(os.tmpdir(), "statechart-links-"));
116
+ const links = fs.realpathSync(fs.mkdtempSync(path.join(os.tmpdir(), "statechart-links-")));
117
117
  const [first, second] = [path.join(links, "a"), path.join(links, "b")];
118
118
  fs.mkdirSync(first);
119
119
  fs.mkdirSync(second);
@@ -19,12 +19,12 @@ Open a todolist with one entry per phase before launching anything.
19
19
 
20
20
  1. State the done predicate and the artifact or report the swarm must return.
21
21
  2. Choose the shape. Partition into slices, race N workers on identical briefs, or mix both. For a race or mixed shape, declare `first pass`, `rank all`, or `best-of` before spawning.
22
- 3. Pick the worker model from the `swarm workers` line in `~/.pi/agent/pstack/pstack-models.md`. If the rule or that line is missing, use `grok-4.7:xhigh`. For `auto` or `inherit-parent`, omit `model` so the workers run on the parent model. If the Task tool rejects a slug, use the default and say so. If it rejects the default, use the closest valid slug of the same family from its error message. For a model race, name each arm's model up front. Pick each subagent's reasoning level (the `:<level>` suffix), and fast or standard speed when the model has a `-fast` variant, for the job, per the Subagents section of the **poteto-mode** skill.
22
+ 3. Pick the worker model from the `swarm workers` line in the model rule at the path the system prompt names. If the rule or that line is missing, use `grok-4.7[effort=xhigh,fast=true]`. For `auto` or `inherit-parent`, omit `model` so the workers run on the parent model. If the Task tool rejects a slug, use the default and say so. If it rejects the default, use the closest valid slug of the same family from its error message. For a model race, name each arm's model up front. Pick each subagent's reasoning level (the `:<level>` suffix), and fast or standard speed when the model has a `-fast` variant, for the job, per the Subagents section of the **poteto-mode** skill.
23
23
  4. Give each worker its own writable output when it writes. When workers verify or measure commits, each brief names the exact SHAs. A measurement brief also names the method (sample count, what one sample is, order). The worker records both in its result.
24
24
 
25
25
  ## Phase B: Fan out
26
26
 
27
- Spawn all N workers in one message with `subagent_type: generalPurpose`, `environment: "cloud"`, `run_in_background: true`, and the step 3 model, left unset for `auto` or `inherit-parent`. Use `environment: "local"` only when the worker needs access to something on the user's computer.
27
+ Spawn all N workers in one message with `subagent_type: generalPurpose`, `environment: "cloud"`, `run_in_background: true`, and the step 3 model, left unset for `auto` or `inherit-parent`. Both environments run on the user's computer. `cloud` gives each worker a separate git worktree, not a VM or a credential boundary. Use `environment: "local"` only when the worker needs the existing checkout or its uncommitted state. For concurrent runtime lanes, each brief must assign distinct ports, output directories, and writable cache paths. If the task requires stronger machine isolation, report that requirement as unavailable rather than claiming a worktree provides it.
28
28
 
29
29
  When a worker must start from a non-default pushed branch, pass `cloud_base_branch`.
30
30