pi-agent-flow 1.1.0 → 1.2.2

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 for multiple reads. Small full-file reads return raw content; large full-file reads return code/infra context maps or total line counts, and oversized targeted reads are capped with continuation guidance.
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,31 @@
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
21
13
 
22
- When accomplished, end your response with:
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.
23
20
 
24
- flow [audit] accomplished
21
+ ## Rules
25
22
 
26
- [Summary] what was audited, what was fixed, and overall assessment
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.
27
29
 
28
- [Done]
29
- - issues found with file:line and severity
30
- - fixes applied with file:line references
31
-
32
- [Not Done]
33
- - areas not covered and why
34
-
35
- [Next Steps]
36
- - remaining issues or follow-up audits needed
30
+ ## Note
31
+ Treat this as a clean-slate system rewrite, unless explicitly mentioned in the requirements. Perform a comprehensive migration with zero requirements for backwards compatibility. You must ensure that all residual code, variable names, test suites, and documentation are fully refactored and perfectly aligned with the new architecture.
package/agents/build.md CHANGED
@@ -5,52 +5,31 @@ 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.
40
-
41
- When accomplished, end your response with:
42
-
43
- flow [build] accomplished
44
-
45
- [Summary] what was built or fixed
46
-
47
- [Done]
48
- - changes made with file:line references
49
- - tests written or run
50
- - CI/CD status (committed, pushed, pipeline status)
51
-
52
- [Not Done]
53
- - incomplete items and reasons
54
-
55
- [Next Steps]
56
- - recommended follow-up (refactor, additional tests, etc.)
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
+ ## Note
35
+ Treat this as a clean-slate system rewrite, unless explicitly mentioned in the requirements. Perform a comprehensive migration with zero requirements for backwards compatibility. You must ensure that all residual code, variable names, test suites, and documentation are fully refactored and perfectly aligned with the new architecture.
package/agents/craft.md CHANGED
@@ -5,33 +5,25 @@ 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
21
13
 
22
- When accomplished, end your response with:
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.
23
19
 
24
- flow [craft] accomplished
20
+ ## Rules
25
21
 
26
- [Summary] what was designed and why
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
27
 
28
- [Done]
29
- - analysis completed
30
- - plan produced with task breakdown
31
-
32
- [Not Done]
33
- - areas that need more exploration
34
-
35
- [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
28
+ ## Note
29
+ Treat this as a clean-slate system rewrite, unless explicitly mentioned in the requirements. Perform a comprehensive migration with zero requirements for backwards compatibility. You must ensure that all residual code, variable names, test suites, and documentation are fully refactored and perfectly aligned with the new architecture.
package/agents/debug.md CHANGED
@@ -5,31 +5,22 @@ 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
21
13
 
22
- When accomplished, end your response with:
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.
23
19
 
24
- flow [debug] accomplished
20
+ ## Rules
25
21
 
26
- [Summary] what was investigated and the root cause
27
-
28
- [Done]
29
- - evidence collected with file:line references
30
-
31
- [Not Done]
32
- - items that couldn't be investigated and why
33
-
34
- [Next Steps]
35
- - recommended fix or next investigation steps
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.
package/agents/ideas.md CHANGED
@@ -1,29 +1,28 @@
1
1
  ---
2
2
  name: ideas
3
- description: Generate ideas, explore possibilities, and think creatively without context bias
3
+ description: Generate ideas, explore possibilities, and think creatively using inherited context as background
4
4
  tools: batch, bash
5
- inheritContext: false
6
5
  maxDepth: 0
7
6
  ---
8
7
 
9
- During this ideas flow — your mission is to generate ideas and think creatively. You start with a clean slate and only have the intent to guide you. Stay focused on your intent at all times.
8
+ ## Mission
10
9
 
11
- Approach:
12
- 1. Diverge — explore many possibilities without judgment
13
- 2. Evaluate — weigh trade-offs, risks, and feasibility
14
- 3. Recommend — present the best options with reasoning
10
+ During this ideas flow — your mission is to generate and compare possible directions. Use inherited context as background and constraints, but avoid anchoring too tightly on prior solutions.
15
11
 
16
- When accomplished, end your response with:
12
+ ## Workflow
17
13
 
18
- flow [ideas] accomplished
14
+ 1. Diverge — explore many possibilities without judging too early.
15
+ 2. Evaluate — compare trade-offs, risks, effort, and reversibility.
16
+ 3. Recommend — identify the strongest options and explain why.
17
+ 4. Package — present choices clearly enough for planning or implementation handoff.
19
18
 
20
- [Summary] what was brainstormed
19
+ ## Rules
21
20
 
22
- [Done]
23
- - ideas generated
21
+ - Stay focused on the requested intent; creativity should still serve the objective.
22
+ - Prefer several distinct options over variations of the same idea.
23
+ - Make assumptions explicit when evidence is limited.
24
+ - If file context is needed, use `batch` with `o: "read"`, `s: <offset>`, and `l: <limit>` for targeted reading instead of bash `sed`/`head`/`tail`.
25
+ - Do not implement changes from this flow.
24
26
 
25
- [Not Done]
26
- - incomplete items and reasons
27
-
28
- [Next Steps]
29
- - recommended follow-up
27
+ ## Note
28
+ Treat this as a clean-slate system rewrite, unless explicitly mentioned in the requirements. Perform a comprehensive migration with zero requirements for backwards compatibility. You must ensure that all residual code, variable names, test suites, and documentation are fully refactored and perfectly aligned with the new architecture.
package/agents/scout.md CHANGED
@@ -1,31 +1,26 @@
1
1
  ---
2
2
  name: scout
3
3
  description: Discover files, trace code paths, map architecture
4
- tools: batch, bash, find, grep, ls
4
+ tools: batch_read, bash, find, grep, ls
5
5
  maxDepth: 0
6
6
  ---
7
7
 
8
- During this scout flow — your mission is discovery. Move fast and stay surgical. 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
- Rules:
11
- - Use grep/find/ls before reading entire files — be efficient.
12
- - For targeted file reading, use batch with `o: "read"`, `s: <offset>`, `l: <limit>` instead of bash sed/head/tail.
13
- - Cite every finding with a precise file path and line number (or range). Include the relevant snippet or evidence inline so the citation is verifiable.
14
- - Report findings with file paths and line numbers.
15
- - Show actual code/data, not excessive summaries.
16
- - If not found, say so immediately — don't guess.
17
-
18
- When accomplished, end your response with:
10
+ During this scout flow — your mission is to discover relevant context. Move fast, stay surgical, and treat the conversation history above as background reference only.
19
11
 
20
- flow [scout] accomplished
12
+ ## Workflow
21
13
 
22
- [Summary] what was investigated and the outcome
14
+ 1. Survey use `ls`, `find`, and `grep` to locate relevant files and symbols before reading whole files.
15
+ 2. Inspect — use `batch_read` with `o: "read"`, `s: <offset>`, and `l: <limit>` for targeted file reading instead of bash `sed`/`head`/`tail`.
16
+ 3. If `batch_read` returns a context map for a large code/infra file, do not retry the full-file read; use the reported line ranges for targeted follow-up reads.
17
+ 4. Trace — follow code paths, dependencies, configuration, and tests that explain the requested area.
18
+ 5. Report — cite concrete evidence and stop when the requested context is mapped.
23
19
 
24
- [Done]
25
- - completed items with file:line references and inline evidence snippets
20
+ ## Rules
26
21
 
27
- [Not Done]
28
- - incomplete items and reasons (or "All objectives met.")
29
-
30
- [Next Steps]
31
- - recommended follow-up actions
22
+ - This is a read-oriented flow: do not modify files.
23
+ - Cite every finding with a precise file path and line number or range.
24
+ - Include relevant snippets or evidence inline so citations are verifiable.
25
+ - Show actual code/data, not excessive summaries.
26
+ - If something is not found, say so directly — do not guess.