@johnnygreco/pizza-pi 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (27) hide show
  1. package/LICENSE +191 -0
  2. package/README.md +82 -0
  3. package/extensions/context.ts +578 -0
  4. package/extensions/control.ts +1782 -0
  5. package/extensions/loop.ts +454 -0
  6. package/extensions/pizza-ui.ts +93 -0
  7. package/extensions/todos.ts +2066 -0
  8. package/node_modules/pi-interactive-subagents/.pi/settings.json +13 -0
  9. package/node_modules/pi-interactive-subagents/.pi/skills/release/SKILL.md +133 -0
  10. package/node_modules/pi-interactive-subagents/LICENSE +21 -0
  11. package/node_modules/pi-interactive-subagents/README.md +362 -0
  12. package/node_modules/pi-interactive-subagents/agents/planner.md +270 -0
  13. package/node_modules/pi-interactive-subagents/agents/reviewer.md +153 -0
  14. package/node_modules/pi-interactive-subagents/agents/scout.md +103 -0
  15. package/node_modules/pi-interactive-subagents/agents/spec.md +339 -0
  16. package/node_modules/pi-interactive-subagents/agents/visual-tester.md +202 -0
  17. package/node_modules/pi-interactive-subagents/agents/worker.md +104 -0
  18. package/node_modules/pi-interactive-subagents/package.json +34 -0
  19. package/node_modules/pi-interactive-subagents/pi-extension/session-artifacts/index.ts +252 -0
  20. package/node_modules/pi-interactive-subagents/pi-extension/subagents/cmux.ts +647 -0
  21. package/node_modules/pi-interactive-subagents/pi-extension/subagents/index.ts +1343 -0
  22. package/node_modules/pi-interactive-subagents/pi-extension/subagents/plan-skill.md +225 -0
  23. package/node_modules/pi-interactive-subagents/pi-extension/subagents/session.ts +124 -0
  24. package/node_modules/pi-interactive-subagents/pi-extension/subagents/subagent-done.ts +166 -0
  25. package/package.json +62 -0
  26. package/prompts/.gitkeep +0 -0
  27. package/skills/.gitkeep +0 -0
@@ -0,0 +1,13 @@
1
+ {
2
+ "packages": [
3
+ {
4
+ "source": "git:github.com/HazAT/pi-interactive-subagents",
5
+ "extensions": [],
6
+ "skills": []
7
+ }
8
+ ],
9
+ "extensions": [
10
+ "../pi-extension/subagents/index.ts",
11
+ "../pi-extension/session-artifacts/index.ts"
12
+ ]
13
+ }
@@ -0,0 +1,133 @@
1
+ ---
2
+ name: release
3
+ description: Create a GitHub release with changelog. Use when asked to "release", "cut a release", "publish version", "bump version", "create release".
4
+ ---
5
+
6
+ # Release
7
+
8
+ Create a versioned GitHub release with an auto-generated changelog from commits since the last release.
9
+
10
+ ## Step 1: Determine Version
11
+
12
+ Check the current version and latest git tag:
13
+
14
+ ```bash
15
+ cat package.json | grep '"version"'
16
+ git tag -l --sort=-v:refname | head -5
17
+ ```
18
+
19
+ If the user provided a version, use it. Otherwise ask:
20
+
21
+ > What version? (current is X.Y.Z — patch/minor/major, or exact version)
22
+
23
+ Resolve semver:
24
+ - `patch` → X.Y.(Z+1)
25
+ - `minor` → X.(Y+1).0
26
+ - `major` → (X+1).0.0
27
+ - Exact version string → use as-is
28
+
29
+ ## Step 2: Generate Changelog
30
+
31
+ Get commits since the last tag (or all commits if no tags exist):
32
+
33
+ ```bash
34
+ # If tags exist:
35
+ git log $(git tag -l --sort=-v:refname | head -1)..HEAD --pretty=format:"- %s" --no-merges
36
+
37
+ # If no tags:
38
+ git log --pretty=format:"- %s" --no-merges
39
+ ```
40
+
41
+ Group commits by type using conventional commit prefixes:
42
+
43
+ | Prefix | Section |
44
+ |--------|---------|
45
+ | `feat` | ✨ Features |
46
+ | `fix` | 🐛 Bug Fixes |
47
+ | `refactor` | ♻️ Refactoring |
48
+ | `docs` | 📝 Documentation |
49
+ | `chore`, `test`, `perf`, `ci` | 🔧 Other Changes |
50
+ | No prefix | 🔧 Other Changes |
51
+
52
+ Format as markdown. Omit empty sections. Strip the `type(scope):` prefix from each line for readability.
53
+
54
+ **Always start the changelog with this install block** (hardcoded):
55
+
56
+ ````markdown
57
+ Install:
58
+
59
+ ```bash
60
+ pi install git:github.com/HazAT/pi-interactive-subagents@v<VERSION>
61
+ ```
62
+
63
+ Or latest:
64
+
65
+ ```bash
66
+ pi install git:github.com/HazAT/pi-interactive-subagents
67
+ ```
68
+ ````
69
+
70
+ Then add the grouped commit sections below it.
71
+
72
+ Example output:
73
+
74
+ ```markdown
75
+ ## ✨ Features
76
+
77
+ - Add live subagent status widget
78
+ - Make subagent tool async — return immediately, steer on completion
79
+
80
+ ## 🐛 Bug Fixes
81
+
82
+ - Fix session file collision with 3+ concurrent agents
83
+ - Truncate widget lines to terminal width
84
+ ```
85
+
86
+ ## Step 3: Update package.json
87
+
88
+ Bump the version in `package.json`:
89
+
90
+ ```bash
91
+ # Read, update, write back — don't use npm version (it may auto-commit)
92
+ ```
93
+
94
+ Use a precise edit to change only the version field.
95
+
96
+ ## Step 4: Commit, Tag, Push
97
+
98
+ ```bash
99
+ git add package.json
100
+ git commit -m "chore(release): v<VERSION>"
101
+ git tag v<VERSION>
102
+ git push && git push --tags
103
+ ```
104
+
105
+ ## Step 5: Create GitHub Release
106
+
107
+ ```bash
108
+ gh release create v<VERSION> --title "v<VERSION>" --notes "<CHANGELOG>"
109
+ ```
110
+
111
+ Pass the generated changelog as the `--notes` value. Use a temp file if the changelog is long:
112
+
113
+ ```bash
114
+ echo "<CHANGELOG>" > /tmp/release-notes.md
115
+ gh release create v<VERSION> --title "v<VERSION>" --notes-file /tmp/release-notes.md
116
+ rm /tmp/release-notes.md
117
+ ```
118
+
119
+ ## Step 6: Verify
120
+
121
+ Confirm the release was created:
122
+
123
+ ```bash
124
+ gh release view v<VERSION>
125
+ ```
126
+
127
+ Print a summary:
128
+
129
+ ```
130
+ ✅ Released v<VERSION>
131
+ Tag: v<VERSION>
132
+ URL: https://github.com/<owner>/<repo>/releases/tag/v<VERSION>
133
+ ```
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 HazAT
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,362 @@
1
+ # pi-interactive-subagents
2
+
3
+ Async subagents for [pi](https://github.com/badlogic/pi-mono) — spawn, orchestrate, and manage sub-agent sessions in multiplexer panes. **Fully non-blocking** — the main agent keeps working while subagents run in the background.
4
+
5
+ https://github.com/user-attachments/assets/30adb156-cfb4-4c47-84ca-dd4aa80cba9f
6
+
7
+ ## How It Works
8
+
9
+ Call `subagent()` and it **returns immediately**. The sub-agent runs in its own terminal pane. A live widget above the input shows all running agents with elapsed time and progress. When a sub-agent finishes, its result is **steered back** into the main session as an async notification — triggering a new turn so the agent can process it.
10
+
11
+ ```
12
+ ╭─ Subagents ──────────────────────── 2 running ─╮
13
+ │ 00:23 Scout: Auth (scout) 8 msgs (5.1KB) │
14
+ │ 00:45 Scout: DB (scout) 12 msgs (9.3KB) │
15
+ ╰─────────────────────────────────────────────────╯
16
+ ```
17
+
18
+ For parallel execution, just call `subagent` multiple times — they all run concurrently:
19
+
20
+ ```typescript
21
+ subagent({ name: "Scout: Auth", agent: "scout", task: "Analyze auth module" });
22
+ subagent({ name: "Scout: DB", agent: "scout", task: "Map database schema" });
23
+ // Both return immediately, results steer back independently
24
+ ```
25
+
26
+ ## Install
27
+
28
+ ```bash
29
+ pi install git:github.com/HazAT/pi-interactive-subagents
30
+ ```
31
+
32
+ Supported multiplexers:
33
+
34
+ - [cmux](https://github.com/manaflow-ai/cmux)
35
+ - [tmux](https://github.com/tmux/tmux)
36
+ - [zellij](https://zellij.dev)
37
+ - [WezTerm](https://wezfurlong.org/wezterm/) (terminal emulator with built-in multiplexing)
38
+
39
+ Start pi inside one of them:
40
+
41
+ ```bash
42
+ cmux pi
43
+ # or
44
+ tmux new -A -s pi 'pi'
45
+ # or
46
+ zellij --session pi # then run: pi
47
+ # or
48
+ # just run pi inside WezTerm — no wrapper needed
49
+ ```
50
+
51
+ Optional: set `PI_SUBAGENT_MUX=cmux|tmux|zellij|wezterm` to force a specific backend.
52
+
53
+ ## What's Included
54
+
55
+ ### Extensions
56
+
57
+ **Subagents** — 4 tools + 3 commands:
58
+
59
+ | Tool | Description |
60
+ | ----------------- | ------------------------------------------------------------------------------- |
61
+ | `subagent` | Spawn a sub-agent in a dedicated multiplexer pane (async — returns immediately) |
62
+ | `subagents_list` | List available agent definitions |
63
+ | `set_tab_title` | Update tab/window title to show progress |
64
+ | `subagent_resume` | Resume a previous sub-agent session (async) |
65
+
66
+ | Command | Description |
67
+ | -------------------------- | ------------------------------------ |
68
+ | `/plan` | Start a full planning workflow |
69
+ | `/iterate` | Fork into a subagent for quick fixes |
70
+ | `/subagent <agent> <task>` | Spawn a named agent directly |
71
+
72
+ **Session Artifacts** — 2 tools for session-scoped file storage:
73
+
74
+ | Tool | Description |
75
+ | ---------------- | --------------------------------------------------------- |
76
+ | `write_artifact` | Write plans, context, notes to a session-scoped directory |
77
+ | `read_artifact` | Read artifacts from current or previous sessions |
78
+
79
+ ### Bundled Agents
80
+
81
+ | Agent | Model | Role |
82
+ | ----------------- | ---------------------- | ---------------------------------------------------------------------------------------- |
83
+ | **planner** | Opus (medium thinking) | Brainstorming — clarifies requirements, explores approaches, writes plans, creates todos |
84
+ | **scout** | Haiku | Fast codebase reconnaissance — maps files, patterns, conventions |
85
+ | **worker** | Sonnet | Implements tasks from todos — writes code, runs tests, makes polished commits |
86
+ | **reviewer** | Opus (medium thinking) | Reviews code for bugs, security issues, correctness |
87
+ | **visual-tester** | Sonnet | Visual QA via Chrome CDP — screenshots, responsive testing, interaction testing |
88
+
89
+ Agent discovery follows priority: **project-local** (`.pi/agents/`) > **global** (`~/.pi/agent/agents/`) > **package-bundled**. Override any bundled agent by placing your own version in the higher-priority location.
90
+
91
+ ---
92
+
93
+ ## Async Subagent Flow
94
+
95
+ ```
96
+ 1. Agent calls subagent() → returns immediately ("started")
97
+ 2. Sub-agent runs in mux pane → widget shows live progress
98
+ 3. User keeps chatting → main session fully interactive
99
+ 4. Sub-agent finishes → result steered back as interrupt
100
+ 5. Main agent processes result → continues with new context
101
+ ```
102
+
103
+ Multiple subagents run concurrently — each steers its result back independently as it finishes. The live widget above the input tracks all running agents:
104
+
105
+ ```
106
+ ╭─ Subagents ──────────────────────── 3 running ─╮
107
+ │ 01:23 Scout: Auth (scout) 15 msgs (12KB) │
108
+ │ 00:45 Researcher (researcher) 8 msgs (6KB) │
109
+ │ 00:12 Scout: DB (scout) starting… │
110
+ ╰─────────────────────────────────────────────────╯
111
+ ```
112
+
113
+ Completion messages render with a colored background and are expandable with `Ctrl+O` to show the full summary and session file path.
114
+
115
+ ---
116
+
117
+ ## Spawning Subagents
118
+
119
+ ```typescript
120
+ // Named agent with defaults from agent definition
121
+ subagent({ name: "Scout", agent: "scout", task: "Analyze the codebase..." });
122
+
123
+ // Fork — sub-agent gets full conversation context
124
+ subagent({ name: "Iterate", fork: true, task: "Fix the bug where..." });
125
+
126
+ // Override agent defaults
127
+ subagent({
128
+ name: "Worker",
129
+ agent: "worker",
130
+ model: "anthropic/claude-haiku-4-5",
131
+ task: "Quick fix...",
132
+ });
133
+
134
+ // Custom working directory
135
+ subagent({ name: "Designer", agent: "game-designer", cwd: "agents/game-designer", task: "..." });
136
+ ```
137
+
138
+ ### Parameters
139
+
140
+ | Parameter | Type | Default | Description |
141
+ | -------------- | ------- | -------- | ----------------------------------------------------------------------- |
142
+ | `name` | string | required | Display name (shown in widget and pane title) |
143
+ | `task` | string | required | Task prompt for the sub-agent |
144
+ | `agent` | string | — | Load defaults from agent definition |
145
+ | `fork` | boolean | `false` | Copy current session for full context |
146
+ | `model` | string | — | Override agent's default model |
147
+ | `systemPrompt` | string | — | Append to system prompt |
148
+ | `skills` | string | — | Comma-separated skill names |
149
+ | `tools` | string | — | Comma-separated tool names |
150
+ | `cwd` | string | — | Working directory for the sub-agent (see [Role Folders](#role-folders)) |
151
+
152
+ ---
153
+
154
+ ## The `/plan` Workflow
155
+
156
+ The `/plan` command orchestrates a full planning-to-implementation pipeline.
157
+
158
+ ```
159
+ /plan Add a dark mode toggle to the settings page
160
+ ```
161
+
162
+ ```
163
+ Phase 1: Investigation → Quick codebase scan
164
+ Phase 2: Planning → Interactive planner subagent (user collaborates)
165
+ Phase 3: Review Plan → Confirm todos, adjust if needed
166
+ Phase 4: Execute → Scout + sequential workers implement todos
167
+ Phase 5: Review → Reviewer subagent checks all changes
168
+ ```
169
+
170
+ Tab/window titles update to show current phase:
171
+
172
+ ```
173
+ 🔍 Investigating: dark mode → 💬 Planning: dark mode
174
+ → 🔨 Executing: 1/3 → 🔎 Reviewing → ✅ Done
175
+ ```
176
+
177
+ ---
178
+
179
+ ## The `/iterate` Workflow
180
+
181
+ For quick, focused work without polluting the main session's context.
182
+
183
+ ```
184
+ /iterate Fix the off-by-one error in the pagination logic
185
+ ```
186
+
187
+ This forks the current session into a subagent with full conversation context. Make the fix, verify it, and exit to return. The main session gets a summary of what was done.
188
+
189
+ ---
190
+
191
+ ## Custom Agents
192
+
193
+ Place a `.md` file in `.pi/agents/` (project) or `~/.pi/agent/agents/` (global):
194
+
195
+ ```markdown
196
+ ---
197
+ name: my-agent
198
+ description: Does something specific
199
+ model: anthropic/claude-sonnet-4-6
200
+ thinking: minimal
201
+ tools: read, bash, edit, write
202
+ spawning: false
203
+ ---
204
+
205
+ # My Agent
206
+
207
+ You are a specialized agent that does X...
208
+ ```
209
+
210
+ ### Frontmatter Reference
211
+
212
+ | Field | Type | Description |
213
+ | ------------- | ------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
214
+ | `name` | string | Agent name (used in `agent: "my-agent"`) |
215
+ | `description` | string | Shown in `subagents_list` output |
216
+ | `model` | string | Default model (e.g. `anthropic/claude-sonnet-4-6`) |
217
+ | `thinking` | string | Thinking level: `minimal`, `medium`, `high` |
218
+ | `tools` | string | Comma-separated **native pi tools only**: `read`, `bash`, `edit`, `write`, `grep`, `find`, `ls` |
219
+ | `skills` | string | Comma-separated skill names to auto-load |
220
+ | `spawning` | boolean | Set `false` to deny all subagent-spawning tools |
221
+ | `deny-tools` | string | Comma-separated extension tool names to deny |
222
+ | `auto-exit` | boolean | Auto-shutdown when the agent finishes its turn — no `subagent_done` call needed. If the user sends any input, auto-exit is permanently disabled and the user takes over the session. Recommended for autonomous agents (scout, worker); not for interactive ones (planner). |
223
+ | `cwd` | string | Default working directory (absolute or relative to project root) |
224
+
225
+ ---
226
+
227
+ ### `auto-exit`
228
+
229
+ When set to `true`, the agent session shuts down automatically as soon as the agent finishes its turn — no explicit `subagent_done` call is needed.
230
+
231
+ **Behavior:**
232
+
233
+ - The session closes after the agent's final message (on the `agent_end` event)
234
+ - If the user sends **any input** before the agent finishes, auto-exit is permanently disabled for that session — the user takes over interactively
235
+ - The modeHint injected into the agent's task is adjusted accordingly: autonomous agents see "Complete your task autonomously." rather than instructions to call `subagent_done`
236
+
237
+ **When to use:**
238
+
239
+ - ✅ Autonomous agents (scout, worker, reviewer) that run to completion
240
+ - ❌ Interactive agents (planner, iterate) where the user drives the session
241
+
242
+ ```yaml
243
+ ---
244
+ name: scout
245
+ auto-exit: true
246
+ ---
247
+ ```
248
+
249
+ ---
250
+
251
+ ## Tool Access Control
252
+
253
+ By default, every sub-agent can spawn further sub-agents. Control this with frontmatter:
254
+
255
+ ### `spawning: false`
256
+
257
+ Denies all spawning tools (`subagent`, `subagents_list`, `subagent_resume`):
258
+
259
+ ```yaml
260
+ ---
261
+ name: worker
262
+ spawning: false
263
+ ---
264
+ ```
265
+
266
+ ### `deny-tools`
267
+
268
+ Fine-grained control over individual extension tools:
269
+
270
+ ```yaml
271
+ ---
272
+ name: focused-agent
273
+ deny-tools: subagent, set_tab_title
274
+ ---
275
+ ```
276
+
277
+ ### Recommended Configuration
278
+
279
+ | Agent | `spawning` | Rationale |
280
+ | ---------- | ----------- | -------------------------------------------- |
281
+ | planner | _(default)_ | Legitimately spawns scouts for investigation |
282
+ | worker | `false` | Should implement tasks, not delegate |
283
+ | researcher | `false` | Should research, not spawn |
284
+ | reviewer | `false` | Should review, not spawn |
285
+ | scout | `false` | Should gather context, not spawn |
286
+
287
+ ---
288
+
289
+ ## Role Folders
290
+
291
+ The `cwd` parameter lets sub-agents start in a specific directory with its own configuration:
292
+
293
+ ```
294
+ project/
295
+ ├── agents/
296
+ │ ├── game-designer/
297
+ │ │ └── CLAUDE.md ← "You are a game designer..."
298
+ │ ├── sre/
299
+ │ │ ├── CLAUDE.md ← "You are an SRE specialist..."
300
+ │ │ └── .pi/skills/ ← SRE-specific skills
301
+ │ └── narrative/
302
+ │ └── CLAUDE.md ← "You are a narrative designer..."
303
+ ```
304
+
305
+ ```typescript
306
+ subagent({ name: "Game Designer", cwd: "agents/game-designer", task: "Design the combat system" });
307
+ subagent({ name: "SRE", cwd: "agents/sre", task: "Review deployment pipeline" });
308
+ ```
309
+
310
+ Set a default `cwd` in agent frontmatter:
311
+
312
+ ```yaml
313
+ ---
314
+ name: game-designer
315
+ cwd: ./agents/game-designer
316
+ spawning: false
317
+ ---
318
+ ```
319
+
320
+ ---
321
+
322
+ ## Tools Widget
323
+
324
+ Every sub-agent session displays a compact tools widget showing available and denied tools. Toggle with `Ctrl+J`:
325
+
326
+ ```
327
+ [scout] — 12 tools · 4 denied (Ctrl+J) ← collapsed
328
+ [scout] — 12 available (Ctrl+J to collapse) ← expanded
329
+ read, bash, edit, write, todo, ...
330
+ denied: subagent, subagents_list, ...
331
+ ```
332
+
333
+ ---
334
+
335
+ ## Requirements
336
+
337
+ - [pi](https://github.com/badlogic/pi-mono) — the coding agent
338
+ - One supported multiplexer:
339
+ - [cmux](https://github.com/manaflow-ai/cmux)
340
+ - [tmux](https://github.com/tmux/tmux)
341
+ - [zellij](https://zellij.dev)
342
+ - [WezTerm](https://wezfurlong.org/wezterm/)
343
+
344
+ ```bash
345
+ cmux pi
346
+ # or
347
+ tmux new -A -s pi 'pi'
348
+ # or
349
+ zellij --session pi # then run: pi
350
+ # or
351
+ # just run pi inside WezTerm
352
+ ```
353
+
354
+ Optional backend override:
355
+
356
+ ```bash
357
+ export PI_SUBAGENT_MUX=cmux # or tmux, zellij, wezterm
358
+ ```
359
+
360
+ ## License
361
+
362
+ MIT