pi-agent-flow 1.1.0 → 1.2.0

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.
package/README.md CHANGED
@@ -42,21 +42,27 @@ pi install .
42
42
 
43
43
  ## Features
44
44
 
45
- - **Isolated context** — flows always receive your current session snapshot (or start clean when configured)
46
- - **Parallel execution** — batch independent flows into one call
45
+ - **Flow-state delegation** — six bundled specialist flows (`scout`, `debug`, `build`, `craft`, `audit`, `ideas`) plus custom flows via Markdown front-matter
46
+ - **Isolated forked context** — each flow runs as an isolated `pi` child process with a session snapshot (or clean slate when configured)
47
+ - **Parallel execution** — batch independent flows into one call with bounded concurrency
47
48
  - **Structured reports** — every flow returns `[Summary]`, `[Done]`, `[Not Done]`, `[Next Steps]`
48
49
  - **Depth guards** — configurable max delegation depth (default: `3`)
49
- - **Cycle prevention** — blocks recursive delegation chains
50
- - **Flow discovery** — reads definitions from `~/.pi/agent/agents/` and `.pi/agents/`
51
- - **TUI rendering** — rich collapsed/expanded display in interactive mode
52
- - **Post-flow hooks** — automatic advisory messages after successful flows (e.g., codereview)
53
- - **Smooth streaming metrics** — context token counters increment tick-by-tick during active streaming instead of jumping at boundaries
50
+ - **Cycle prevention** — blocks re-entering flows already in the ancestor stack
51
+ - **Model tiering & failover** — flows map to `lite` / `flash` / `full` tiers with primary + failover model chains
52
+ - **Unified batch tools** — `batch` (read/write/edit/delete) and `batch_read` replace separate file tools for cross-cutting work
53
+ - **Web tool** — built-in `web` search (Brave + DuckDuckGo) and page fetch with HTMLMarkdown conversion
54
+ - **Sliding system prompt** — lightweight routing reminder injected before each user message, stripped from child snapshots to avoid duplication
55
+ - **Session snapshot sanitization** — removes sliding prompts, reasoning/thinking artifacts, and non-inheritable content before forking
56
+ - **Project flow confirmation** — prompts before running project-local flows from `.pi/agents/` for security
57
+ - **Post-flow hooks** — automatic advisory messages suggesting follow-up flows (e.g., `build → audit`)
58
+ - **Rich TUI rendering** — collapsed activity-panel view with per-flow stats, plus expanded view with full reports and tool traces
59
+ - **Smooth streaming metrics** — token counters and smoothed TPS increment tick-by-tick during active streaming
54
60
 
55
61
  ---
56
62
 
57
63
  ## Why Flow Style?
58
64
 
59
- Flow-style delegation is designed for **context efficiency**. Instead of launching every sub-agent with the full, ever-growing conversation history, each flow receives only what it needs: your intent and (when appropriate) a session snapshot.
65
+ Flow-style delegation is designed for **context efficiency**. Instead of launching every sub-agent with the full, ever-growing conversation history, each flow receives only what it needs: your intent and (when appropriate) a sanitized session snapshot.
60
66
 
61
67
  This approach delivers four concrete benefits:
62
68
 
@@ -69,22 +75,42 @@ The result is faster, cheaper, and cleaner delegation: the main agent remains un
69
75
 
70
76
  ---
71
77
 
78
+ ## Bundled Flows
79
+
80
+ | Flow | Purpose | Tools | Tier |
81
+ |------|---------|-------|------|
82
+ | `[scout]` | Discover files, trace code paths, map architecture | `batch_read`, `bash`, `find`, `grep`, `ls` | `lite` |
83
+ | `[debug]` | Investigate logs, errors, stack traces, root causes | `batch`, `bash`, `find`, `grep`, `ls` | `lite` |
84
+ | `[build]` | Implement features, fix bugs, write tests, ship | `batch`, `bash`, `find`, `grep`, `ls` | `flash` |
85
+ | `[craft]` | Plan structure, break down requirements, design solutions | `batch`, `bash`, `find`, `grep`, `ls` | `full` |
86
+ | `[audit]` | Audit security, quality, correctness; fix issues autonomously | `batch`, `bash`, `find`, `grep`, `ls` | `flash` |
87
+ | `[ideas]` | Generate ideas and explore possibilities with inherited context | `batch`, `bash` | `full` |
88
+
89
+ > **Note:** All bundled flows have `maxDepth: 0`, meaning they do not delegate further by default. Custom flows can override this via front-matter.
90
+
91
+ > **Clean slate:** Set `inheritContext: false` in a custom flow's front-matter so it receives only the intent, ideal for unbiased creative work.
92
+
93
+ ---
94
+
72
95
  ## Flow Definitions
73
96
 
74
- Create `.md` files in `~/.pi/agent/agents/` or `.pi/agents/`:
97
+ Create `.md` files in `~/.pi/agent/agents/` (user-level) or `.pi/agents/` (project-level):
75
98
 
76
99
  ```markdown
77
100
  ---
78
- name: explore
79
- description: Discover files, trace code paths, map architecture
101
+ name: myflow
102
+ description: Short description of what this flow does
80
103
  tools: batch, bash
104
+ model: github-copilot/gpt-5.5
105
+ maxDepth: 1
106
+ inheritContext: true
81
107
  ---
82
108
 
83
- During this explore flow — your mission is discovery. Stay focused on your intent at all times.
109
+ During this myflow flow — your mission is ...
84
110
 
85
111
  When accomplished, end your response with:
86
112
 
87
- flow [explore] accomplished
113
+ flow [myflow] accomplished
88
114
 
89
115
  [Summary] what was investigated
90
116
 
@@ -92,54 +118,52 @@ flow [explore] accomplished
92
118
  - completed items
93
119
 
94
120
  [Not Done]
95
- - incomplete items
121
+ - incomplete items and reasons
96
122
 
97
123
  [Next Steps]
98
124
  - recommended follow-up
99
125
  ```
100
126
 
101
- ---
102
-
103
- ## Bundled Flows
127
+ ### Front-matter options
104
128
 
105
- | Flow | Purpose |
106
- |------|---------|
107
- | `[explore]` | Discover files, trace code paths, map architecture |
108
- | `[debug]` | Investigate logs, errors, stack traces, root causes |
109
- | `[code]` | Implement features, fix bugs, write tests |
110
- | `[architect]` | Plan structure, break down requirements, design solutions |
111
- | `[review]` | Audit security, quality, correctness |
112
- | `[brainstorm]` | Generate ideas and explore possibilities with a clean slate |
113
-
114
- > **Note:** Some flows — like `[brainstorm]` — start with a **clean slate** and do not inherit the current session context. They receive only the intent, making them ideal for unbiased, creative thinking.
129
+ | Field | Type | Description |
130
+ |-------|------|-------------|
131
+ | `name` | `string` | Flow identifier (lowercase, required) |
132
+ | `description` | `string` | Short summary (required) |
133
+ | `tools` | `string[]` | Tools available to this flow |
134
+ | `model` | `string` | Override the model for this flow |
135
+ | `thinking` | `string` | Thinking budget (e.g., `"low"`, `"medium"`, `"high"`) |
136
+ | `maxDepth` | `number` | How many more delegation levels this flow may spawn |
137
+ | `inheritContext` | `boolean` | Whether to fork parent session snapshot (`true`) or start clean (`false`) |
115
138
 
116
139
  ---
117
140
 
118
141
  ## Post-Flow Hooks
119
142
 
120
- When certain flows complete successfully, the system can inject advisory messages suggesting follow-up flows. This keeps the agent on the optimal path without requiring the user to manually chain flows.
143
+ When certain flows complete successfully, the system injects advisory messages suggesting follow-up flows. This keeps the agent on the optimal path without requiring the user to manually chain flows.
121
144
 
122
145
  ### Built-in Hooks
123
146
 
124
147
  | Hook | Trigger | Advice |
125
148
  |------|---------|--------|
126
- | `codereview` | A `[code]` flow succeeds | *"Consider running a [review] flow to audit the changes…"* |
127
- | `debug → code` | A `[debug]` flow succeeds | *"The root cause has been identified. Consider running a [code] flow to implement the fix."* |
149
+ | `buildaudit` | A `[build]` flow succeeds | *"Consider running an [audit] flow to audit the changes…"* |
150
+ | `debug → build` | A `[debug]` flow succeeds | *"The root cause has been identified. Consider running a [build] flow to implement the fix."* |
151
+ | `audit → scout` | An `[audit]` flow succeeds | *"Audit complete. Consider running a [scout] flow to trace the audit findings across the codebase."* |
128
152
 
129
153
  Hooks are smart: if the agent already included the suggested flow in the same batch, the advisory is suppressed to avoid redundancy.
130
154
 
131
155
  ### Extending
132
156
 
133
- Hooks are registered via `registerHook()` in `hooks.ts`. Each hook defines a trigger (flow type + success requirement) and an action that returns advisory text. The hook system mirrors the flow discovery pattern, making it easy to add domain-specific hints.
157
+ Hooks are registered via `registerHook()` in `hooks.ts`. Each hook defines a trigger (flow type + success requirement) and an action that returns advisory text.
134
158
 
135
- Example — a custom `explorearchitect` hook:
159
+ Example — a custom `scoutcraft` hook:
136
160
 
137
161
  ```ts
138
162
  registerHook({
139
- name: "my/explore-to-architect",
140
- trigger: { flowTypes: ["explore"], onlyOnSuccess: true },
163
+ name: "my/scout-to-craft",
164
+ trigger: { flowTypes: ["scout"], onlyOnSuccess: true },
141
165
  action: (ctx) => ({
142
- content: "Consider running an [architect] flow to design a solution.",
166
+ content: "Consider running a [craft] flow to design a solution.",
143
167
  priority: 10,
144
168
  }),
145
169
  });
@@ -152,7 +176,7 @@ registerHook({
152
176
  ### Single flow
153
177
 
154
178
  ```json
155
- { "flow": [{ "type": "explore", "intent": "Find all authentication-related code", "aim": "Find auth code" }] }
179
+ { "flow": [{ "type": "scout", "intent": "Find all authentication-related code and trace JWT validation", "aim": "Find auth code and trace JWT" }] }
156
180
  ```
157
181
 
158
182
  ### Batch multiple flows
@@ -160,35 +184,125 @@ registerHook({
160
184
  ```json
161
185
  {
162
186
  "flow": [
163
- { "type": "explore", "intent": "Find auth code" },
164
- { "type": "review", "intent": "Audit auth module" }
187
+ { "type": "scout", "intent": "Find auth code", "aim": "Find auth code" },
188
+ { "type": "audit", "intent": "Audit auth module", "aim": "Audit auth module" }
189
+ ]
190
+ }
191
+ ```
192
+
193
+ ### Override working directory for a flow
194
+
195
+ ```json
196
+ {
197
+ "flow": [
198
+ { "type": "scout", "intent": "Map packages/ui", "aim": "Map UI package", "cwd": "packages/ui" }
165
199
  ]
166
200
  }
167
201
  ```
168
202
 
169
203
  ---
170
204
 
205
+ ## Tools
206
+
207
+ ### `flow` — delegate to flow states
208
+
209
+ The core delegation tool. Accepts an array of flow tasks and runs them in parallel.
210
+
211
+ ### `batch` / `batch_read` — unified file operations
212
+
213
+ When **tool optimization** is enabled (default), the separate `read` / `write` / `edit` tools are replaced by:
214
+
215
+ - **`batch`** — sequential read, write, edit, and delete operations in one call. Edits use fuzzy matching and preserve line endings.
216
+ - **`batch_read`** — read-only variant without truncation caps, ideal for reading multiple files or large sections.
217
+
218
+ ### `web` — search and fetch
219
+
220
+ Built-in web operations (no API keys required):
221
+
222
+ - **Search** — queries Brave and DuckDuckGo HTML endpoints, returns top results with titles, URLs, and snippets.
223
+ - **Fetch** — downloads a page, converts HTML to Markdown via JSDOM + Turndown, saves to a temp file in the session directory, and returns a preview. Falls back through direct fetch → `r.jina.ai` → `curl`.
224
+
225
+ ---
226
+
171
227
  ## Configuration
172
228
 
173
- ### Flags (passed to parent pi process)
229
+ ### Flow model strategies
230
+
231
+ Use `flowModelConfigs` in your Pi settings to define tiered model strategies. Each tier (`lite`, `flash`, `full`) can specify a `primary` model and an optional `failover` array.
232
+
233
+ ```json
234
+ {
235
+ "flowModelConfig": "balance",
236
+ "flowModelConfigs": {
237
+ "performance": {
238
+ "lite": { "primary": "github-copilot/gpt-5.4-mini", "failover": ["github-copilot/gpt-5.5"] },
239
+ "flash": { "primary": "github-copilot/gpt-5.5" },
240
+ "full": { "primary": "github-copilot/gpt-5.5" }
241
+ },
242
+ "balance": {
243
+ "lite": { "primary": "github-copilot/gpt-5.4-mini" },
244
+ "flash": { "primary": "github-copilot/gpt-5.5", "failover": ["github-copilot/gpt-5.4-mini"] },
245
+ "full": { "primary": "github-copilot/gpt-5.5" }
246
+ },
247
+ "quality": {
248
+ "lite": { "primary": "github-copilot/gpt-5.5" },
249
+ "flash": { "primary": "github-copilot/gpt-5.5" },
250
+ "full": { "primary": "github-copilot/gpt-5.5-large", "failover": ["github-copilot/gpt-5.5"] }
251
+ }
252
+ }
253
+ }
254
+ ```
255
+
256
+ - `performance` — favors speed and lower-cost models.
257
+ - `balance` — best default mix of quality and cost.
258
+ - `quality` — prefers the strongest models first.
259
+
260
+ Settings are merged: project `.pi/settings.json` overrides global `~/.pi/agent/settings.json`.
261
+
262
+ ### Flags
174
263
 
175
264
  | Flag | Description | Default |
176
265
  |------|-------------|---------|
177
266
  | `--flow-max-depth [n]` | Maximum delegation depth | `3` |
178
267
  | `--flow-prevent-cycles` | Block cyclic delegation | `true` |
179
268
  | `--no-flow-prevent-cycles` | Disable cycle prevention | — |
180
- | `--flow-lite-model [model]` | Model for lite-tier flows (`explore`, `debug`) | — |
181
- | `--flow-flash-model [model]` | Model for flash-tier flows (`code`, `review`) | — |
182
- | `--flow-full-model [model]` | Model for full-tier flows (`brainstorm`, `architect`) | — |
269
+ | `--flow-model-config [name]` | Select a named model strategy | `balance` |
270
+ | `--flow-lite-model [model]` | Override the lite-tier model | — |
271
+ | `--flow-flash-model [model]` | Override the flash-tier model | — |
272
+ | `--flow-full-model [model]` | Override the full-tier model | — |
273
+ | `--tool-optimize` | Use unified `batch`/`batch_read` instead of separate read/write/edit | `true` |
274
+ | `--no-tool-optimize` | Disable tool optimization; use legacy read/write/edit tools | — |
183
275
 
184
- ### Environment variables (propagated to child processes)
276
+ ### Environment variables
185
277
 
186
278
  | Variable | Description |
187
279
  |----------|-------------|
188
- | `PI_FLOW_DEPTH` | Current depth |
280
+ | `PI_FLOW_DEPTH` | Current delegation depth |
189
281
  | `PI_FLOW_MAX_DEPTH` | Max allowed depth |
190
282
  | `PI_FLOW_STACK` | JSON array of ancestor flow names |
191
283
  | `PI_FLOW_PREVENT_CYCLES` | `"1"` or `"0"` |
284
+ | `PI_FLOW_TOOL_OPTIMIZE` | `"1"` or `"0"` (overrides default tool optimization) |
285
+ | `PI_FLOW_TIMEOUT_MS` | Per-flow timeout in milliseconds (default: 10 minutes) |
286
+
287
+ ---
288
+
289
+ ## Local Development
290
+
291
+ To test local changes with the `pi` CLI before publishing:
292
+
293
+ ```shell
294
+ # From the pi-agent-flow repo directory
295
+ npm link
296
+ ```
297
+
298
+ This creates a global symlink. The `pi` CLI loads the package via `"npm:pi-agent-flow"` in `~/.pi/agent/settings.json`, so changes are picked up immediately — restart `pi` after editing.
299
+
300
+ To restore the published version:
301
+
302
+ ```shell
303
+ npm uninstall -g pi-agent-flow
304
+ npm install -g pi-agent-flow
305
+ ```
192
306
 
193
307
  ---
194
308
 
package/agents/audit.md CHANGED
@@ -1,36 +1,56 @@
1
1
  ---
2
2
  name: audit
3
- description: Audit security, quality, correctness
3
+ description: Audit security, quality, correctness, and apply fixes
4
4
  tools: batch, bash, find, grep, ls
5
5
  maxDepth: 0
6
6
  ---
7
7
 
8
- During this audit flow — your mission is to audit and fix. Be adversarial: look for what others miss, but stay honest. The conversation history above provides background context; treat it as reference only and do not let it distract from your objective.
8
+ ## Mission
9
9
 
10
- Focus Areas:
11
- - Security — injection, auth bypass, exposed secrets
12
- - Bugs — logic errors, race conditions, null handling
13
- - SOLID — god classes, tight coupling, unclear responsibilities
14
- - Performance — unnecessary loops, memory leaks, blocking calls
10
+ During this audit flow — your mission is to verify and remediate quality, security, and correctness issues. Be adversarial, look for what others miss, fix safe issues directly, and treat the conversation history above as background reference only.
15
11
 
16
- Rules:
17
- - Be specific — cite exact file paths and line numbers
18
- - If code is clean, say so don't invent issues
19
- - Fix issues autonomously apply changes directly via available tools; do not leave them unaddressed
20
- - If a fix is unsafe or requires broader redesign, flag it with severity and recommend [craft] in [Next Steps]
12
+ ## Workflow
13
+
14
+ 1. Scope identify the files, behavior, or change set to audit.
15
+ 2. Inspect review security, correctness, maintainability, and performance risks. Use `batch` with `o: "read"`, `s: <offset>`, and `l: <limit>` for targeted file reading instead of bash `sed`/`head`/`tail`.
16
+ 3. Classify assign severity and explain the impact of each issue found.
17
+ 4. Fix — apply safe, localized fixes directly with available tools.
18
+ 5. Verify — run relevant tests or checks after fixes when practical.
19
+ 6. Report — distinguish fixed issues from remaining risks.
20
+
21
+ ## Rules
22
+
23
+ - Be specific: cite exact file paths and line numbers.
24
+ - If code is clean, say so; do not invent issues.
25
+ - Fix issues autonomously when the fix is safe and localized.
26
+ - Do not apply risky rewrites or broad redesigns from audit; flag them with severity instead.
27
+ - If a fix requires broader redesign, recommend [craft] in [Next Steps].
28
+ - If root cause is unclear, recommend [debug] rather than guessing.
29
+
30
+ ## Handoff Guidance
31
+
32
+ - Recommend [build] when remaining issues have clear implementation fixes.
33
+ - Recommend [debug] when failures or risks need root-cause investigation.
34
+ - Recommend [craft] when remediation requires redesign or architectural decisions.
35
+ - Recommend [scout] when more repository context is needed for a confident audit.
36
+ - Recommend [ideas] when several remediation strategies need comparison.
37
+
38
+ ## Output Format
21
39
 
22
40
  When accomplished, end your response with:
23
41
 
24
42
  flow [audit] accomplished
25
43
 
26
- [Summary] what was audited, what was fixed, and overall assessment
44
+ [Summary]
45
+ - What was audited, what was fixed, and the overall assessment in 2–4 concise sentences.
27
46
 
28
47
  [Done]
29
- - issues found with file:line and severity
30
- - fixes applied with file:line references
48
+ - Issues found with file:line references, severity, and impact.
49
+ - Fixes applied with file:line references.
50
+ - Tests or checks run, including command results.
31
51
 
32
52
  [Not Done]
33
- - areas not covered and why
53
+ - Areas not covered, unfixed risks, unsafe fixes deferred, or verification skipped.
34
54
 
35
55
  [Next Steps]
36
- - remaining issues or follow-up audits needed
56
+ - Specific remaining issues, follow-up audits, or recommended next flow.
package/agents/build.md CHANGED
@@ -5,52 +5,56 @@ tools: batch, bash, find, grep, ls
5
5
  maxDepth: 0
6
6
  ---
7
7
 
8
- During this build flow — your mission is to build and ship. Be a craftsman: verify first, then ship. The conversation history above provides background context; treat it as reference only and do not let it distract from your objective.
9
-
10
- Core Principles:
11
- - SOLID: Single Responsibility, Open/Closed
12
- - DRY: Don't repeat yourself
13
- - KISS: Keep it simple
14
-
15
- Branch Strategy:
16
- - Run `git branch --show-current` to detect the current branch.
17
- - If on `main` or `master`, create a new branch named after the mission context (e.g., `feat/add-login`, `fix/resolve-crash`) before making any changes.
18
- - If already on a feature/fix branch, continue working on it — no new branch needed.
19
-
20
- Workflow:
21
- 1. Analyzeread existing code for context
22
- - For targeted file reading, use batch with `o: "read"`, `s: <offset>`, `l: <limit>` instead of bash sed/head/tail.
23
- 2. Plan — step-by-step approach before modifying
24
- 3. Test — write a failing test that proves the bug or validates the feature (red)
25
- 4. Execute implement changes following core principles (green)
26
- 5. Refactor clean up only if the change is working (optional)
27
- 6. Verify run tests and any relevant checks before considering done
28
- 7. Ship commit, push, monitor CI/CD pipeline, diagnose and fix failures until green
29
- 8. Finalize all tests pass, CI/CD green, implementation verified
30
-
31
- Shipping Guidelines:
32
- - Commit with a clear, conventional message (feat:, fix:, refactor:, etc.)
33
- - Push to the target branch after local verification passes
34
- - Monitor CI/CD pipeline status after pushing
35
- - If CI/CD fails: diagnose the failure, fix it, commit, push, and repeat until green
36
- - Only report back if there are serious conflicts or issues you cannot resolve autonomously
37
- - You own the full ship cycle: implement test commit push → monitor CI → fix if needed
38
-
39
- If you hit an unexpected error or need to trace execution, delegate to [debug] rather than guessing.
8
+ ## Mission
9
+
10
+ During this build flow — your mission is to implement and verify changes. Be a craftsman: verify first, then ship, and treat the conversation history above as background reference only.
11
+
12
+ ## Workflow
13
+
14
+ 1. Analyze — read existing code for context. Use `batch` with `o: "read"`, `s: <offset>`, and `l: <limit>` for targeted file reading instead of bash `sed`/`head`/`tail`.
15
+ 2. Plan — outline the step-by-step approach before modifying files.
16
+ 3. Test write or identify a failing test that proves the bug or validates the feature when practical.
17
+ 4. Execute implement changes following core principles.
18
+ 5. Refactor clean up only if the change is working.
19
+ 6. Verify — run tests and relevant checks before considering the work done.
20
+ 7. Ship — commit, push, monitor CI/CD, and fix failures until green when shipping is in scope.
21
+ 8. Finalizeconfirm implementation, tests, and CI/CD status.
22
+
23
+ ## Rules
24
+
25
+ - Follow SOLID, DRY, and KISS.
26
+ - Run `git branch --show-current` before making changes.
27
+ - If on `main` or `master`, create a new branch named after the mission context before modifying files.
28
+ - If already on a feature/fix branch, continue on it.
29
+ - Commit with a clear conventional message such as `feat:`, `fix:`, or `refactor:` when committing is in scope.
30
+ - Push only after local verification passes when shipping is in scope.
31
+ - If CI/CD fails, diagnose, fix, commit, push, and repeat until green.
32
+ - If an unexpected error or trace is needed, recommend [debug] rather than guessing.
33
+
34
+ ## Handoff Guidance
35
+
36
+ - Recommend [audit] after implementation is complete and needs verification or remediation review.
37
+ - Recommend [debug] when tests fail, behavior is unexplained, or root cause is unclear.
38
+ - Recommend [craft] when implementation exposes a design or architecture decision.
39
+ - Recommend [scout] when more repository context is needed before editing.
40
+ - Recommend [ideas] when multiple implementation directions remain plausible.
41
+
42
+ ## Output Format
40
43
 
41
44
  When accomplished, end your response with:
42
45
 
43
46
  flow [build] accomplished
44
47
 
45
- [Summary] what was built or fixed
48
+ [Summary]
49
+ - What was built or fixed and current verification status in 2–4 concise sentences.
46
50
 
47
51
  [Done]
48
- - changes made with file:line references
49
- - tests written or run
50
- - CI/CD status (committed, pushed, pipeline status)
52
+ - Changes made with file:line references.
53
+ - Tests written or run, including command results.
54
+ - Commit, push, and CI/CD status when applicable.
51
55
 
52
56
  [Not Done]
53
- - incomplete items and reasons
57
+ - Incomplete items, blockers, skipped verification, or reasons work was deferred.
54
58
 
55
59
  [Next Steps]
56
- - recommended follow-up (refactor, additional tests, etc.)
60
+ - Specific recommended follow-up actions or next flow.
package/agents/craft.md CHANGED
@@ -5,33 +5,49 @@ tools: batch, bash, find, grep, ls
5
5
  maxDepth: 0
6
6
  ---
7
7
 
8
- During this craft flow — your mission is to design. Be conservative: prefer existing patterns and proven conventions over novelty. The conversation history above provides background context; treat it as reference only and do not let it distract from your objective.
8
+ ## Mission
9
9
 
10
- Workflow:
11
- 1. Understand — what problem, what constraints, what exists (delegate to [debug] if you need to investigate failures)
12
- 2. Explore — find patterns, map dependencies (delegate to [scout] if you need to survey a large codebase)
13
- 3. Design — simplest solution that works, prefer existing patterns (delegate to [ideas] if you need fresh ideas)
14
- 4. Plan — concrete ordered tasks, identify parallel vs sequential (delegate to [build] for implementation handoff)
15
- 5. Review — read-only design audit before committing to build (delegate to [audit] for a final sanity check)
10
+ During this craft flow — your mission is to design a clear plan. Be conservative: prefer existing patterns and proven conventions over novelty, and treat the conversation history above as background reference only.
16
11
 
17
- Principles:
18
- - SOLID, DRY, KISS
19
- - Design for 10x, build for 1x
20
- - No tech debt do it right or don't
12
+ ## Workflow
13
+
14
+ 1. Understand define the problem, constraints, existing behavior, and success criteria.
15
+ 2. Explore map relevant patterns and dependencies. Use `batch` with `o: "read"`, `s: <offset>`, and `l: <limit>` for targeted file reading instead of bash `sed`/`head`/`tail`.
16
+ 3. Design — choose the simplest solution that works and fits existing patterns.
17
+ 4. Plan — produce concrete ordered tasks and identify parallel vs sequential work.
18
+ 5. Review — check risks, edge cases, test strategy, and handoff path before build.
19
+
20
+ ## Rules
21
+
22
+ - Follow SOLID, DRY, and KISS.
23
+ - Design for 10x, build for 1x.
24
+ - Avoid tech debt; choose a maintainable approach or explain the trade-off.
25
+ - Prefer explicit assumptions and constraints over hidden decisions.
26
+ - Do not implement changes from this flow unless explicitly requested.
27
+
28
+ ## Handoff Guidance
29
+
30
+ - Recommend [build] when the plan is ready to implement.
31
+ - Recommend [scout] when more codebase discovery is needed.
32
+ - Recommend [ideas] when the direction is still uncertain or needs alternatives.
33
+ - Recommend [debug] when design depends on unexplained failures or root cause analysis.
34
+ - Recommend [audit] when the design or completed work needs quality, security, or correctness review.
35
+
36
+ ## Output Format
21
37
 
22
38
  When accomplished, end your response with:
23
39
 
24
40
  flow [craft] accomplished
25
41
 
26
- [Summary] what was designed and why
42
+ [Summary]
43
+ - What was designed, why it fits, and major trade-offs in 2–4 concise sentences.
27
44
 
28
45
  [Done]
29
- - analysis completed
30
- - plan produced with task breakdown
46
+ - Analysis completed with key evidence or constraints.
47
+ - Plan produced with ordered task breakdown and test strategy.
31
48
 
32
49
  [Not Done]
33
- - areas that need more exploration
50
+ - Areas needing more exploration, decisions not made, or unresolved risks.
34
51
 
35
52
  [Next Steps]
36
- - implementation tasks in order, with suggested flow types
37
- - available flows: [scout] for discovery, [ideas] for ideation, [build] for build-and-ship, [debug] for investigation, [audit] for read-only audit
53
+ - Specific implementation tasks in order and recommended next flow.
package/agents/debug.md CHANGED
@@ -5,31 +5,48 @@ tools: batch, bash, find, grep, ls
5
5
  maxDepth: 0
6
6
  ---
7
7
 
8
- During this debug flow — your mission is investigation. Be forensic: every claim must be backed by evidence. The conversation history above provides background context; treat it as reference only and do not let it distract from your objective.
8
+ ## Mission
9
9
 
10
- Workflow:
11
- 1. Collect evidence — logs, error messages, stack traces
12
- 2. Trace the call chain — follow execution path
13
- 3. Check recent changes — git log, git diff
14
- 4. Identify root cause — be specific about what's broken and why
10
+ During this debug flow — your mission is to investigate root cause. Be forensic: every claim must be backed by evidence, and treat the conversation history above as background reference only.
15
11
 
16
- Rules:
17
- - Never guess. Every conclusion must be backed by evidence.
18
- - Read logs before reading code symptoms point to cause.
19
- - For targeted file reading, use batch with `o: "read"`, `s: <offset>`, `l: <limit>` instead of bash sed/head/tail.
20
- - Don't suggest fixes until root cause is confirmed.
12
+ ## Workflow
13
+
14
+ 1. Collect evidence — logs, error messages, stack traces, failing tests, and reproduction steps.
15
+ 2. Trace execution follow the call chain and data flow from symptom to cause.
16
+ 3. Check changes inspect recent diffs, configuration, dependencies, and environment differences.
17
+ 4. Identify root cause — state exactly what is broken and why.
18
+ 5. Recommend fix — propose the smallest safe correction only after evidence confirms the cause.
19
+
20
+ ## Rules
21
+
22
+ - Never guess; every conclusion must cite evidence.
23
+ - Read logs and symptoms before reading broad code areas.
24
+ - Use `batch` with `o: "read"`, `s: <offset>`, and `l: <limit>` for targeted file reading instead of bash `sed`/`head`/`tail`.
25
+ - Do not suggest fixes until root cause is confirmed.
26
+ - Do not implement changes from this flow unless explicitly requested.
27
+
28
+ ## Handoff Guidance
29
+
30
+ - Recommend [build] when root cause is known and the fix is clear.
31
+ - Recommend [scout] when broader repository discovery is needed.
32
+ - Recommend [craft] when the fix requires redesign or architectural trade-offs.
33
+ - Recommend [audit] when the suspected issue needs security, quality, or correctness review.
34
+ - Recommend [ideas] when several remediation strategies are plausible.
35
+
36
+ ## Output Format
21
37
 
22
38
  When accomplished, end your response with:
23
39
 
24
40
  flow [debug] accomplished
25
41
 
26
- [Summary] what was investigated and the root cause
42
+ [Summary]
43
+ - What was investigated and the confirmed or likely root cause in 2–4 concise sentences.
27
44
 
28
45
  [Done]
29
- - evidence collected with file:line references
46
+ - Evidence collected with file:line references, command output, logs, or reproduction details.
30
47
 
31
48
  [Not Done]
32
- - items that couldn't be investigated and why
49
+ - Items that could not be investigated, missing evidence, or remaining uncertainty.
33
50
 
34
51
  [Next Steps]
35
- - recommended fix or next investigation steps
52
+ - Specific recommended fix, follow-up investigation, or next flow.