pi-agent-flow 2.0.1 → 2.0.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 +126 -489
- package/agents/audit.md +4 -2
- package/agents/build.md +3 -2
- package/agents/craft.md +3 -3
- package/agents/debug.md +4 -3
- package/agents/ideas.md +5 -4
- package/agents/scout.md +3 -1
- package/dist/batch/apply-patch.d.ts +60 -0
- package/dist/batch/apply-patch.d.ts.map +1 -0
- package/dist/batch/apply-patch.js +477 -0
- package/dist/batch/apply-patch.js.map +1 -0
- package/dist/batch/batch-bash.d.ts +0 -6
- package/dist/batch/batch-bash.d.ts.map +1 -1
- package/dist/batch/batch-bash.js +25 -10
- package/dist/batch/batch-bash.js.map +1 -1
- package/dist/batch/constants.d.ts +33 -4
- package/dist/batch/constants.d.ts.map +1 -1
- package/dist/batch/constants.js +26 -4
- package/dist/batch/constants.js.map +1 -1
- package/dist/batch/execute.d.ts +8 -2
- package/dist/batch/execute.d.ts.map +1 -1
- package/dist/batch/execute.js +221 -66
- package/dist/batch/execute.js.map +1 -1
- package/dist/batch/fuzzy-edit.d.ts +4 -1
- package/dist/batch/fuzzy-edit.d.ts.map +1 -1
- package/dist/batch/fuzzy-edit.js +7 -2
- package/dist/batch/fuzzy-edit.js.map +1 -1
- package/dist/batch/index.d.ts +3 -15
- package/dist/batch/index.d.ts.map +1 -1
- package/dist/batch/index.js +48 -78
- package/dist/batch/index.js.map +1 -1
- package/dist/batch/render.d.ts.map +1 -1
- package/dist/batch/render.js +30 -7
- package/dist/batch/render.js.map +1 -1
- package/dist/batch/summary.d.ts.map +1 -1
- package/dist/batch/summary.js +4 -0
- package/dist/batch/summary.js.map +1 -1
- package/dist/core/depth.d.ts +3 -3
- package/dist/core/depth.d.ts.map +1 -1
- package/dist/core/depth.js +5 -5
- package/dist/core/depth.js.map +1 -1
- package/dist/core/executor.d.ts +3 -3
- package/dist/core/executor.d.ts.map +1 -1
- package/dist/core/executor.js +2 -2
- package/dist/core/executor.js.map +1 -1
- package/dist/core/flow.d.ts +10 -3
- package/dist/core/flow.d.ts.map +1 -1
- package/dist/core/flow.js +76 -33
- package/dist/core/flow.js.map +1 -1
- package/dist/core/{delegation.d.ts → transition.d.ts} +8 -8
- package/dist/core/{delegation.d.ts.map → transition.d.ts.map} +1 -1
- package/dist/core/{delegation.js → transition.js} +12 -12
- package/dist/core/{delegation.js.map → transition.js.map} +1 -1
- package/dist/flow/auto-warp.d.ts +1 -1
- package/dist/flow/auto-warp.js +1 -1
- package/dist/flow/continuation.js +2 -2
- package/dist/flow/continuation.js.map +1 -1
- package/dist/flow/index.d.ts +2 -2
- package/dist/flow/index.d.ts.map +1 -1
- package/dist/flow/index.js +3 -3
- package/dist/flow/index.js.map +1 -1
- package/dist/flow/loop-command.d.ts.map +1 -1
- package/dist/flow/loop-command.js +3 -0
- package/dist/flow/loop-command.js.map +1 -1
- package/dist/flow/settings-command.d.ts.map +1 -1
- package/dist/flow/settings-command.js +4 -1
- package/dist/flow/settings-command.js.map +1 -1
- package/dist/flow/warp.d.ts +15 -0
- package/dist/flow/warp.d.ts.map +1 -0
- package/dist/flow/warp.js +207 -0
- package/dist/flow/warp.js.map +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +168 -21
- package/dist/index.js.map +1 -1
- package/dist/snapshot/runner-events.d.ts +5 -0
- package/dist/snapshot/runner-events.d.ts.map +1 -1
- package/dist/snapshot/runner-events.js +89 -15
- package/dist/snapshot/runner-events.js.map +1 -1
- package/dist/snapshot/snapshot.d.ts.map +1 -1
- package/dist/snapshot/snapshot.js +51 -18
- package/dist/snapshot/snapshot.js.map +1 -1
- package/dist/steering/flow-prompt.d.ts +2 -2
- package/dist/steering/flow-prompt.d.ts.map +1 -1
- package/dist/steering/flow-prompt.js +4 -4
- package/dist/steering/flow-prompt.js.map +1 -1
- package/dist/steering/sliding-prompt.js +6 -6
- package/dist/steering/sliding-prompt.js.map +1 -1
- package/dist/steering/tool-utils.d.ts +31 -8
- package/dist/steering/tool-utils.d.ts.map +1 -1
- package/dist/steering/tool-utils.js +63 -30
- package/dist/steering/tool-utils.js.map +1 -1
- package/dist/tools/ask-user.d.ts +0 -17
- package/dist/tools/ask-user.d.ts.map +1 -1
- package/dist/tools/ask-user.js +13 -37
- package/dist/tools/ask-user.js.map +1 -1
- package/dist/tools/timed-bash.d.ts +1 -1
- package/dist/tools/timed-bash.d.ts.map +1 -1
- package/dist/tools/timed-bash.js +10 -8
- package/dist/tools/timed-bash.js.map +1 -1
- package/dist/tools/web-tool.d.ts.map +1 -1
- package/dist/tools/web-tool.js +11 -13
- package/dist/tools/web-tool.js.map +1 -1
- package/dist/tui/render-utils.d.ts.map +1 -1
- package/dist/tui/render-utils.js +2 -4
- package/dist/tui/render-utils.js.map +1 -1
- package/dist/tui/render.d.ts +9 -0
- package/dist/tui/render.d.ts.map +1 -1
- package/dist/tui/render.js +78 -39
- package/dist/tui/render.js.map +1 -1
- package/dist/tui/scramble/index.d.ts +1 -1
- package/dist/tui/scramble/index.d.ts.map +1 -1
- package/dist/tui/scramble/index.js +1 -1
- package/dist/tui/scramble/index.js.map +1 -1
- package/dist/tui/scramble/manager.d.ts +1 -1
- package/dist/tui/scramble/manager.d.ts.map +1 -1
- package/dist/tui/scramble/manager.js +14 -2
- package/dist/tui/scramble/manager.js.map +1 -1
- package/dist/tui/scramble/utils.js +1 -1
- package/dist/tui/scramble/utils.js.map +1 -1
- package/dist/types/flow.d.ts.map +1 -1
- package/dist/types/flow.js +11 -2
- package/dist/types/flow.js.map +1 -1
- package/package.json +2 -2
- package/dist/flow/perform-warp.d.ts +0 -28
- package/dist/flow/perform-warp.d.ts.map +0 -1
- package/dist/flow/perform-warp.js +0 -127
- package/dist/flow/perform-warp.js.map +0 -1
- package/dist/flow/warp-command.d.ts +0 -8
- package/dist/flow/warp-command.d.ts.map +0 -1
- package/dist/flow/warp-command.js +0 -144
- package/dist/flow/warp-command.js.map +0 -1
- package/dist/flow/warp-utils.d.ts +0 -11
- package/dist/flow/warp-utils.d.ts.map +0 -1
- package/dist/flow/warp-utils.js +0 -187
- package/dist/flow/warp-utils.js.map +0 -1
package/README.md
CHANGED
|
@@ -1,319 +1,136 @@
|
|
|
1
|
-
|
|
2
|
-
<p align="center"><strong>Pi Agent Flow</strong> is a flow-state delegation extension for the <a href="https://pi.dev">Pi coding agent</a> that runs locally in your terminal.</p>
|
|
3
|
-
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
## Quickstart
|
|
7
|
-
|
|
8
|
-
### Installing Pi Agent Flow
|
|
9
|
-
|
|
10
|
-
Install via the Pi CLI from npm:
|
|
11
|
-
|
|
12
|
-
```shell
|
|
13
|
-
pi install npm:pi-agent-flow
|
|
14
|
-
```
|
|
15
|
-
|
|
16
|
-
Or add it to your Pi settings:
|
|
17
|
-
|
|
18
|
-
```shell
|
|
19
|
-
# ~/.pi/agent/settings.json
|
|
20
|
-
{
|
|
21
|
-
"packages": [
|
|
22
|
-
"npm:pi-agent-flow"
|
|
23
|
-
]
|
|
24
|
-
}
|
|
25
|
-
```
|
|
26
|
-
|
|
27
|
-
Then start Pi and delegate tasks using flow states.
|
|
28
|
-
|
|
29
|
-
<details>
|
|
30
|
-
<summary>You can also install from a local path.</summary>
|
|
1
|
+
# Pi Agent Flow
|
|
31
2
|
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
pi install .
|
|
37
|
-
```
|
|
38
|
-
|
|
39
|
-
</details>
|
|
40
|
-
|
|
41
|
-
---
|
|
42
|
-
|
|
43
|
-
## Features
|
|
3
|
+
<p align="center">
|
|
4
|
+
<a href="https://www.npmjs.com/package/pi-agent-flow"><img src="https://img.shields.io/npm/v/pi-agent-flow" alt="npm version"></a>
|
|
5
|
+
<a href="./LICENSE"><img src="https://img.shields.io/npm/l/pi-agent-flow" alt="license"></a>
|
|
6
|
+
</p>
|
|
44
7
|
|
|
45
|
-
|
|
46
|
-
- **Flow-state delegation** — six bundled specialist flows (`scout`, `debug`, `build`, `craft`, `audit`, `ideas`) plus custom flows via Markdown front-matter
|
|
47
|
-
- **Isolated forked context** — each flow runs as an isolated `pi` child process with a session snapshot (or clean slate when configured)
|
|
48
|
-
- **Parallel execution** — batch independent flows into one call with bounded concurrency
|
|
49
|
-
- **Depth guards & cycle prevention** — configurable max delegation depth (default: `3`) and automatic blocking of re-entering ancestor flows
|
|
50
|
-
- **Post-flow advisories** — built-in transition matrix suggesting optimal next flows (e.g. `scout` → `build`, `debug` → `build`)
|
|
51
|
-
- **Session timeout modes** — child flows use controlled budgets: `fast` (300s), `default` (600s), `long` (900s), or `extreme_long` (1200s)
|
|
52
|
-
- **Two-stage timeout awareness** — flows receive deadline hints in their prompt; the parent UI shows live countdowns and injects warning reminders before hard kill
|
|
53
|
-
- **Graceful shutdown** — parent `SIGINT`/`SIGTERM` propagates to all child process groups; orphaned sub-agents are force-killed after a grace period
|
|
54
|
-
- **Model tiering & failover** — flows map to `lite` / `flash` / `full` tiers with primary + failover model chains
|
|
55
|
-
- **Persistent flow mode** — switch global model strategies with `--flow-mode`; written to `settings.json` and remembered across sessions
|
|
56
|
-
|
|
57
|
-
### Tools
|
|
58
|
-
- **Unified batch tools** — `batch` (read/write/edit/delete) and `batch_read` replace separate file tools for cross-cutting work
|
|
59
|
-
- **Web tool** — built-in `web` search (Brave + DuckDuckGo) and page fetch with HTML→Markdown conversion
|
|
60
|
-
- **Ask-user prompts** — interactive `ask_user` with overlay/inline display, preferred-choice guidance, comments, and optional timeouts
|
|
61
|
-
- **Structured reports** — every flow returns structured output with `summary`, `files`, `actions`, `commands`, `notDone`, `nextSteps`, `reasoning`, and `notes`; optional JSON schema for machine-readable results
|
|
62
|
-
- **Mechanically enriched commands** — bash commands in structured output are replaced with exact verbatim tool-call strings and annotated with `executionTime`
|
|
63
|
-
|
|
64
|
-
### TUI & Rendering
|
|
65
|
-
- **Rich activity panel** — collapsed view with per-flow stats, live countdowns, and expanded view with full reports and tool traces
|
|
66
|
-
- **Glitch scramble animations** — `glitch` text animation on act, msg, TPS lines, and tool results
|
|
67
|
-
- **Smooth streaming metrics** — token counters and smoothed TPS increment tick-by-tick during active streaming
|
|
68
|
-
- **Dynamic notifications** — terminal and desktop alerts adapt their title/body based on flow completion state or pending `ask_user` decisions
|
|
8
|
+
<p align="center"><code>pi install npm:pi-agent-flow</code></p>
|
|
69
9
|
|
|
70
|
-
|
|
71
|
-
- **Local development loop** — `npm link` local checkout for instant iteration; `scripts/switch.sh` toggles between local and published builds
|
|
72
|
-
- **Payload dump workflow** — capture exact child-flow prompts via `PI_FLOW_DUMP_SNAPSHOT` or `--dump`; sync to repo with `scripts/sync-dumps.sh`
|
|
73
|
-
- **Steering hint** — lightweight routing reminder dynamically injected before each user message; stripped from child snapshots to avoid duplication
|
|
74
|
-
- **Session snapshot sanitization** — removes steering hints, reasoning artifacts, and non-inheritable content before forking; compresses prior flow results into compact context maps
|
|
75
|
-
- **Shared context inheritance** — child flows receive the parent's sanitized session automatically; write forward-looking intents and let the child pick up context from its inherited snapshot
|
|
76
|
-
- **Project flow confirmation** — prompts before running project-local flows from `.pi/agents/` for security
|
|
77
|
-
- **TUI-safe logging** — `logWarn`/`logError` routes to a log file instead of stderr during TUI rendering to prevent on-screen text flash
|
|
78
|
-
|
|
79
|
-
### Configuration
|
|
80
|
-
- **Flow model strategies** — define tiered model chains (`lite` / `flash` / `full`) with `flowModelConfigs`; switch modes via `--flow-mode` (performance / balance / quality)
|
|
81
|
-
- **Flow settings** — persistent runtime defaults under `flowSettings` (session mode, concurrency, tool optimization, structured output)
|
|
82
|
-
- **CLI flags** — `--flow-max-depth`, `--flow-session-mode`, `--flow-max-concurrency`, `--no-steering`, `--no-animation`, and more
|
|
83
|
-
- **Environment variables** — `PI_FLOW_DUMP_SNAPSHOT`, `PI_FLOW_MAX_DEPTH`, `PI_FLOW_TOOL_OPTIMIZE`, `PI_TUI_MODE`, and others
|
|
10
|
+
<p align="center"><strong>Flow-state transition</strong> for the <a href="https://pi.dev">Pi coding agent</a>. Isolate context, run specialist agents in parallel, and get structured results back.</p>
|
|
84
11
|
|
|
85
12
|
---
|
|
86
13
|
|
|
87
|
-
## Why
|
|
14
|
+
## Why This Exists
|
|
88
15
|
|
|
89
|
-
|
|
16
|
+
Long conversations bloat context, duplicate tool calls, and bury signal in noise. Pi Agent Flow solves this by forking each task into an isolated child process with only the context it needs. The parent stays clean; the workers stay focused.
|
|
90
17
|
|
|
91
|
-
|
|
18
|
+
Four concrete benefits:
|
|
92
19
|
|
|
93
|
-
1. **Avoid duplicate tool calls** —
|
|
94
|
-
2. **Prevent context bloat** — long transcripts with repeated file listings
|
|
95
|
-
3. **Eliminate unnecessary noise** — the parent
|
|
20
|
+
1. **Avoid duplicate tool calls** — flow states no longer re-run the same `read`, `grep`, or `bash` probes the parent already performed.
|
|
21
|
+
2. **Prevent context bloat** — long transcripts with repeated file listings stay out of the main conversation thread.
|
|
22
|
+
3. **Eliminate unnecessary noise** — the parent sees only structured results instead of pages of intermediate reasoning.
|
|
96
23
|
4. **Preserve focus** — each flow stays locked on its intent because it isn't distracted by unrelated earlier messages.
|
|
97
24
|
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
---
|
|
101
|
-
|
|
102
|
-
## Shared Context
|
|
103
|
-
|
|
104
|
-
When you delegate to a flow, the child agent receives an automatic **sanitized fork** of your current session. This lets you write concise intents that focus on **what new work to do** rather than restating the full problem.
|
|
105
|
-
|
|
106
|
-
### How it works
|
|
107
|
-
|
|
108
|
-
1. **Snapshot serialized** — your conversation (files read, commands run, prior flow results) is serialized into a JSONL snapshot.
|
|
109
|
-
2. **Sanitized** — steering hints, reasoning/thinking artifacts, and other non-inheritable content are stripped.
|
|
110
|
-
3. **Compressed** — prior flow tool results are compacted into short summaries: files touched, commands used, outcome status.
|
|
111
|
-
4. **Forked** — the child agent loads this snapshot via `--session` at startup.
|
|
112
|
-
|
|
113
|
-
### Writing good intents
|
|
25
|
+
## Quick Demo
|
|
114
26
|
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|---|---|
|
|
119
|
-
| `"The auth module uses JWT tokens… inspect src/auth/ for security issues"` | `"Audit the auth module for security issues"` |
|
|
120
|
-
| `"We already found the bug… run the failing test and fix it"` | `"Fix the failing test in tests/auth.test.ts"` |
|
|
121
|
-
| `"The file structure is… implement the feature described in the PRD"` | `"Implement the feature described in the PRD"` |
|
|
122
|
-
|
|
123
|
-
### Clean slate
|
|
124
|
-
|
|
125
|
-
Set `inheritContext: false` in a custom flow's front-matter to start with a clean slate. The child receives only your `intent` — no inherited session. This is ideal for unbiased creative work in `ideas` flows.
|
|
126
|
-
|
|
127
|
-
### What the child sees
|
|
128
|
-
|
|
129
|
-
The child's `<context-seal>` prompt tells it: *"The conversation above is sealed — it is your session history for situational awareness only."* The child can reference files and findings already in context but shouldn't act as if it's still in the parent's conversation.
|
|
130
|
-
|
|
131
|
-
---
|
|
132
|
-
|
|
133
|
-
## Bundled Flows
|
|
134
|
-
|
|
135
|
-
| Flow | Purpose | Tools | Tier |
|
|
136
|
-
|------|---------|-------|------|
|
|
137
|
-
| `[scout]` | Discover files, trace code paths, map architecture | `batch`, `bash`, `find`, `grep`, `ls`, `web` | `lite` |
|
|
138
|
-
| `[debug]` | Investigate logs, errors, stack traces, root causes, and fix bugs | `batch`, `bash`, `find`, `grep`, `ls`, `web` | `lite` |
|
|
139
|
-
| `[build]` | Implement features, fix bugs, write tests, deploy, and ship | `batch`, `bash`, `find`, `grep`, `ls`, `web` | `flash` |
|
|
140
|
-
| `[craft]` | Plan structure, break down requirements, design solutions | `batch`, `bash`, `find`, `grep`, `ls`, `web` | `full` |
|
|
141
|
-
| `[audit]` | Audit security, quality, correctness; fix safe issues autonomously | `batch`, `bash`, `find`, `grep`, `ls`, `web` | `flash` |
|
|
142
|
-
| `[ideas]` | Generate ideas, explore possibilities, and think creatively using inherited context | `batch`, `bash`, `web` | `full` |
|
|
143
|
-
|
|
144
|
-
> **Note:** All bundled flows have `maxDepth: 0`, meaning they do not delegate further by default. Custom flows can override this via front-matter.
|
|
27
|
+
```shell
|
|
28
|
+
# 1) Install the extension
|
|
29
|
+
pi install npm:pi-agent-flow
|
|
145
30
|
|
|
146
|
-
|
|
31
|
+
# 2) Start Pi and transition two tasks in parallel
|
|
32
|
+
pi
|
|
33
|
+
{ "flow": [
|
|
34
|
+
{ "type": "scout", "intent": "Map auth code", "aim": "Find JWT logic" },
|
|
35
|
+
{ "type": "audit", "intent": "Audit auth module", "aim": "Security audit" }
|
|
36
|
+
] }
|
|
37
|
+
```
|
|
147
38
|
|
|
148
|
-
|
|
39
|
+
The root state spawns both flows concurrently. Each receives a sanitized fork of your session, runs in isolation, and returns structured JSON with a summary, files touched, and recommended next steps.
|
|
149
40
|
|
|
150
|
-
|
|
41
|
+
## Quickstart
|
|
151
42
|
|
|
152
|
-
|
|
43
|
+
Install via the Pi CLI:
|
|
153
44
|
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
| `default` | 600s | normal flow work; this is the default |
|
|
158
|
-
| `long` | 900s | large builds, full test runs, broad refactors, complex debugging |
|
|
159
|
-
| `extreme_long` | 1200s | very large refactors, extensive audits, or multi-step debugging sessions |
|
|
45
|
+
```shell
|
|
46
|
+
pi install npm:pi-agent-flow
|
|
47
|
+
```
|
|
160
48
|
|
|
161
|
-
|
|
49
|
+
Or add it to your Pi settings:
|
|
162
50
|
|
|
163
51
|
```json
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
{
|
|
167
|
-
"type": "build",
|
|
168
|
-
"intent": "Run the full test suite and fix failures",
|
|
169
|
-
"aim": "Fix failing tests",
|
|
170
|
-
"sessionMode": "long"
|
|
171
|
-
}
|
|
172
|
-
]
|
|
173
|
-
}
|
|
52
|
+
// ~/.pi/agent/settings.json
|
|
53
|
+
{ "packages": ["npm:pi-agent-flow"] }
|
|
174
54
|
```
|
|
175
55
|
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
### Timeout behavior
|
|
179
|
-
|
|
180
|
-
Flows are aware of their deadline from the moment they start:
|
|
181
|
-
|
|
182
|
-
- **Prompt injection** — the activation block includes the exact time budget and warns the agent to wrap up before the deadline.
|
|
183
|
-
- **Parent UI countdown** — a live `MM:SS` countdown is shown next to the flow's aim while it runs.
|
|
184
|
-
- **Two-stage warnings** — at 2 minutes before hard timeout a warning is injected into the child's reminder stream; at 2 minutes 15 seconds a final urge demands the agent stop all tool use and output structured findings.
|
|
185
|
-
- **Grace period** — after the hard timeout fires, the agent gets a 90-second reporting grace to finish its summary before the process is force-killed.
|
|
186
|
-
- **Graceful shutdown** — when the parent receives `SIGINT` or `SIGTERM`, the signal propagates to every child process group so sub-agents terminate cleanly instead of becoming orphans.
|
|
187
|
-
|
|
188
|
-
---
|
|
189
|
-
|
|
190
|
-
## Flow Definitions
|
|
191
|
-
|
|
192
|
-
Create `.md` files in `~/.pi/agent/agents/` (user-level) or `.pi/agents/` (project-level):
|
|
193
|
-
|
|
194
|
-
```markdown
|
|
195
|
-
---
|
|
196
|
-
name: myflow
|
|
197
|
-
description: Short description of what this flow does
|
|
198
|
-
tools: batch, bash
|
|
199
|
-
model: github-copilot/gpt-5.5
|
|
200
|
-
maxDepth: 1
|
|
201
|
-
inheritContext: true
|
|
202
|
-
---
|
|
203
|
-
|
|
204
|
-
During this myflow flow — your mission is ...
|
|
205
|
-
|
|
206
|
-
When accomplished, end your response with:
|
|
207
|
-
|
|
208
|
-
flow [myflow] accomplished
|
|
209
|
-
|
|
210
|
-
[Summary] what was investigated
|
|
211
|
-
|
|
212
|
-
[Done]
|
|
213
|
-
- completed items
|
|
56
|
+
Restart Pi and transition tasks using `{ "flow": [...] }`.
|
|
214
57
|
|
|
215
|
-
|
|
216
|
-
|
|
58
|
+
<details>
|
|
59
|
+
<summary>Install from a local clone</summary>
|
|
217
60
|
|
|
218
|
-
|
|
219
|
-
|
|
61
|
+
```shell
|
|
62
|
+
git clone https://github.com/tuanhung303/pi-agent-flow.git
|
|
63
|
+
cd pi-agent-flow
|
|
64
|
+
pi install .
|
|
220
65
|
```
|
|
221
66
|
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
| Field | Type | Description |
|
|
225
|
-
|-------|------|-------------|
|
|
226
|
-
| `name` | `string` | Flow identifier (lowercase, required) |
|
|
227
|
-
| `description` | `string` | Short summary (required) |
|
|
228
|
-
| `tools` | `string \| string[]` | Tools available to this flow |
|
|
229
|
-
| `model` | `string` | Override the model for this flow |
|
|
230
|
-
| `thinking` | `string` | Thinking budget (e.g., `"low"`, `"medium"`, `"high"`) |
|
|
231
|
-
| `maxDepth` | `number` | How many more delegation levels this flow may spawn |
|
|
232
|
-
| `inheritContext` | `boolean` | Whether to fork parent session snapshot (`true`) or start clean (`false`) |
|
|
233
|
-
| `tier` | `string` | Explicit tier override: `lite`, `flash`, or `full` |
|
|
234
|
-
|
|
235
|
-
---
|
|
236
|
-
|
|
237
|
-
## Structured Output
|
|
238
|
-
|
|
239
|
-
When `structuredOutput` is enabled (default), flows are instructed to append a JSON code block to their final response. The block is mechanically validated and enriched:
|
|
67
|
+
</details>
|
|
240
68
|
|
|
241
|
-
|
|
242
|
-
- **Execution time** is captured from the timed-bash wrapper and attached to each bash command entry.
|
|
69
|
+
## Core Concepts
|
|
243
70
|
|
|
244
|
-
|
|
71
|
+
| Concept | What it means |
|
|
72
|
+
|---|---|
|
|
73
|
+
| **Root state** | The main Pi agent that routes tasks and talks to you |
|
|
74
|
+
| **Flows** | Isolated specialist workers (`scout`, `build`, `debug`, `audit`, `craft`, `ideas`) |
|
|
75
|
+
| **Forked context** | Child processes receive a sanitized snapshot of your session |
|
|
76
|
+
| **Structured results** | Every flow returns JSON with summary, files, actions, next steps |
|
|
77
|
+
| **Parallel execution** | Batch independent flows with bounded concurrency |
|
|
78
|
+
| **Clean slate** | Optional mode where a flow receives only your intent, no inherited history |
|
|
245
79
|
|
|
246
|
-
|
|
247
|
-
{
|
|
248
|
-
"version": "1.0",
|
|
249
|
-
"status": "complete",
|
|
250
|
-
"summary": "2-3 sentence summary",
|
|
251
|
-
"files": [
|
|
252
|
-
{ "path": "relative/path", "role": "read", "description": "why it matters", "snippet": "short excerpt", "ranges": [{ "start": 10, "end": 25, "label": "bug" }] }
|
|
253
|
-
],
|
|
254
|
-
"actions": [
|
|
255
|
-
{ "type": "read", "description": "what was done", "target": "file.ts", "result": "success", "evidence": "output or proof" }
|
|
256
|
-
],
|
|
257
|
-
"commands": [
|
|
258
|
-
{ "command": "curl -s -X POST https://api.example.com/v1/data", "tool": "bash", "executionTime": "1.2s (normal)" }
|
|
259
|
-
],
|
|
260
|
-
"notDone": [
|
|
261
|
-
{ "item": "unfinished work", "reason": "why it was not completed", "blocker": "blocking issue", "nextStep": "specific follow-up" }
|
|
262
|
-
],
|
|
263
|
-
"nextSteps": ["recommended follow-up action"],
|
|
264
|
-
"reasoning": ["key hypothesis or inference"],
|
|
265
|
-
"notes": ["observation or warning"]
|
|
266
|
-
}
|
|
267
|
-
```
|
|
80
|
+
When you transition, the root state spawns each flow as an isolated `pi` child process, injects your intent, and waits for structured output. The parent conversation stays lean because it only receives the final result, not the full reasoning transcript.
|
|
268
81
|
|
|
269
|
-
|
|
82
|
+
## Features
|
|
270
83
|
|
|
271
|
-
|
|
84
|
+
### Transition
|
|
85
|
+
- Six bundled specialist flows with tiered model selection (`lite` / `flash` / `full`)
|
|
86
|
+
- Configurable max transition depth (default: `3`) and automatic cycle prevention
|
|
87
|
+
- Smart post-flow advisories suggesting the optimal next step (e.g. `scout` → `build`, `debug` → `audit`)
|
|
272
88
|
|
|
273
|
-
|
|
89
|
+
### Isolation
|
|
90
|
+
- Sanitized session snapshots forked to each child; steering hints and reasoning artifacts are stripped
|
|
91
|
+
- Optional clean-slate mode (`inheritContext: false`) for unbiased creative work
|
|
92
|
+
- Child flows see a `<context-seal>` telling them the parent's history is sealed reference only
|
|
274
93
|
|
|
275
|
-
|
|
94
|
+
### Execution
|
|
95
|
+
- Parallel flow batches with bounded concurrency (default: 4, capped to CPU count)
|
|
96
|
+
- Five session modes from `snap` (90s) to `extreme_long` (1200s)
|
|
97
|
+
- Graceful shutdown with two-stage timeout warnings, live `MM:SS` countdowns, and a 90-second reporting grace
|
|
276
98
|
|
|
277
|
-
###
|
|
99
|
+
### Tools
|
|
100
|
+
- Unified `batch` / `batch_read` for cross-cutting file work (read, write, edit, delete in one call)
|
|
101
|
+
- Built-in `web` search (Brave + DuckDuckGo) and fetch with HTML→Markdown conversion
|
|
102
|
+
- `ask_user` interactive prompts for root state decision-gathering; flows emit `⚠️ Decision Required` blocks instead
|
|
278
103
|
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
| `debug` | `build` | success | The root cause has been identified. Consider running a [build] flow to implement the fix. |
|
|
284
|
-
| `debug` | `audit` | success | Root cause identified. Consider running an [audit] flow to verify the fix area for related issues. |
|
|
285
|
-
| `build` | `audit` | success | Consider running an [audit] flow to audit the changes for security, correctness, and code quality. |
|
|
286
|
-
| `build` | `debug` | failure | Build failed. Consider running a [debug] flow to investigate the root cause. |
|
|
287
|
-
| `audit` | `scout` | success | Audit complete. Consider running a [scout] flow to trace the audit findings across the codebase. |
|
|
288
|
-
| `audit` | `build` | failure | Audit found issues. Consider running a [build] flow to fix them. |
|
|
289
|
-
| `craft` | `build` | success | Plan ready. Consider running a [build] flow to implement the design. |
|
|
290
|
-
| `ideas` | `craft` | success | Ideas explored. Consider running a [craft] flow to design the approach, or [build] to implement directly. |
|
|
104
|
+
### Output
|
|
105
|
+
- Structured JSON results with `summary`, `files`, `actions`, `notDone`, `nextSteps`, `reasoning`, and `notes`
|
|
106
|
+
- Mechanically enriched bash commands with exact verbatim strings and execution times
|
|
107
|
+
- `extensions` escape hatch for flow-specific data (audit findings, debug root cause, etc.)
|
|
291
108
|
|
|
292
|
-
|
|
109
|
+
### Developer Experience
|
|
110
|
+
- Local development loop with `npm link` and `scripts/switch.sh` to toggle local ↔ published builds
|
|
111
|
+
- Payload dump workflow via `PI_FLOW_DUMP_SNAPSHOT` to inspect exact child prompts
|
|
112
|
+
- TUI-safe logging (`logWarn`/`logError` write to file instead of stderr), glitch scramble animations, and live countdowns
|
|
293
113
|
|
|
294
|
-
|
|
114
|
+
See [docs/FLOWS.md](docs/FLOWS.md), [docs/TOOLS.md](docs/TOOLS.md), and [docs/STRUCTURED-OUTPUT.md](docs/STRUCTURED-OUTPUT.md) for full details.
|
|
295
115
|
|
|
296
116
|
## Usage
|
|
297
117
|
|
|
298
118
|
### Single flow
|
|
299
|
-
|
|
300
119
|
```json
|
|
301
|
-
{ "flow": [{ "type": "scout", "intent": "Find
|
|
120
|
+
{ "flow": [{ "type": "scout", "intent": "Find auth code", "aim": "Find auth code" }] }
|
|
302
121
|
```
|
|
303
122
|
|
|
304
|
-
###
|
|
305
|
-
|
|
123
|
+
### Parallel flows
|
|
306
124
|
```json
|
|
307
125
|
{
|
|
308
126
|
"flow": [
|
|
309
|
-
{ "type": "scout", "intent": "
|
|
310
|
-
{ "type": "audit", "intent": "Audit auth module", "aim": "Audit auth
|
|
127
|
+
{ "type": "scout", "intent": "Map auth code", "aim": "Map auth" },
|
|
128
|
+
{ "type": "audit", "intent": "Audit auth module", "aim": "Audit auth" }
|
|
311
129
|
]
|
|
312
130
|
}
|
|
313
131
|
```
|
|
314
132
|
|
|
315
|
-
### Override working directory
|
|
316
|
-
|
|
133
|
+
### Override working directory
|
|
317
134
|
```json
|
|
318
135
|
{
|
|
319
136
|
"flow": [
|
|
@@ -322,262 +139,82 @@ Advisories are smart: if the agent already included the suggested flow in the sa
|
|
|
322
139
|
}
|
|
323
140
|
```
|
|
324
141
|
|
|
325
|
-
|
|
142
|
+
### End-to-end example
|
|
143
|
+
Chain discovery → audit → build to fix issues in one batch:
|
|
326
144
|
|
|
327
145
|
```json
|
|
328
146
|
{
|
|
329
147
|
"flow": [
|
|
330
|
-
{ "type": "scout", "intent": "Map
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
```
|
|
335
|
-
|
|
336
|
-
Each flow item also accepts an optional `acceptance` field — a one-sentence success criteria stating what "done" looks like. This helps the flow self-assess completion.
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
---
|
|
341
|
-
|
|
342
|
-
## Tools
|
|
343
|
-
|
|
344
|
-
### `flow` — delegate to flow states
|
|
345
|
-
|
|
346
|
-
The core delegation tool. Accepts an array of flow tasks and runs them in parallel with bounded concurrency (default: 4, capped to CPU count).
|
|
347
|
-
|
|
348
|
-
### `batch` / `batch_read` — unified file operations
|
|
349
|
-
|
|
350
|
-
When **tool optimization** is enabled (default), the separate `read` / `write` / `edit` tools are replaced by:
|
|
351
|
-
|
|
352
|
-
- **`batch`** — sequential read, write, edit, and delete operations in one call. Edits use fuzzy matching and preserve line endings.
|
|
353
|
-
- **`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.
|
|
354
|
-
|
|
355
|
-
### `batch_bash_poll` — poll pending bash commands
|
|
356
|
-
|
|
357
|
-
For child flows using the `batch` tool, `batch_bash_poll` lets the agent check on pending bash operations that exceeded the soft timeout. Pass the operation IDs from the pending results to retrieve completed output or see updated partial output.
|
|
358
|
-
|
|
359
|
-
### `web` — search and fetch
|
|
360
|
-
|
|
361
|
-
Built-in web operations (no API keys required):
|
|
362
|
-
|
|
363
|
-
- **Search** — queries Brave and DuckDuckGo HTML endpoints, returns top results with titles, URLs, and snippets.
|
|
364
|
-
- **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`.
|
|
365
|
-
|
|
366
|
-
In the collapsed activity panel, web operations display as compact one-line summaries (e.g., `search: "query"` or `fetch: example.com`). Like other tools, web results are scramble-animated in the collapsed view.
|
|
367
|
-
|
|
368
|
-
### `ask_user` — interactive prompts
|
|
369
|
-
|
|
370
|
-
Parameters beyond the basic `question`, `options`, `allowMultiple`, `allowFreeform`, `allowCancel`:
|
|
371
|
-
|
|
372
|
-
| Parameter | Type | Description |
|
|
373
|
-
|-----------|------|-------------|
|
|
374
|
-
| `context` | `string` | Summary of findings to show before the question |
|
|
375
|
-
| `allowComment` | `boolean` | Collect an optional freeform comment after selection (default: false) |
|
|
376
|
-
| `displayMode` | `"overlay" \| "inline"` | UI rendering mode; overlay shows a centered modal, inline renders in-place (default: overlay) |
|
|
377
|
-
| `overlayToggleKey` | `string` | Shortcut for hiding/showing the overlay popup (default: `alt+o`; pass `"off"` to disable) |
|
|
378
|
-
| `commentToggleKey` | `string` | Shortcut for toggling the comment row when `allowComment` is true (default: `ctrl+g`) |
|
|
379
|
-
| `timeout` | `number` | Auto-dismiss after N milliseconds; returns null (cancelled) when expired |
|
|
380
|
-
|
|
381
|
-
---
|
|
382
|
-
|
|
383
|
-
## Configuration
|
|
384
|
-
|
|
385
|
-
### Flow model strategies
|
|
386
|
-
|
|
387
|
-
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.
|
|
388
|
-
|
|
389
|
-
```json
|
|
390
|
-
{
|
|
391
|
-
"flowModelConfig": "balance",
|
|
392
|
-
"flowModelConfigs": {
|
|
393
|
-
"performance": {
|
|
394
|
-
"lite": { "primary": "github-copilot/gpt-5.4-mini", "failover": ["github-copilot/gpt-5.5"] },
|
|
395
|
-
"flash": { "primary": "github-copilot/gpt-5.5" },
|
|
396
|
-
"full": { "primary": "github-copilot/gpt-5.5" }
|
|
397
|
-
},
|
|
398
|
-
"balance": {
|
|
399
|
-
"lite": { "primary": "github-copilot/gpt-5.4-mini" },
|
|
400
|
-
"flash": { "primary": "github-copilot/gpt-5.5", "failover": ["github-copilot/gpt-5.4-mini"] },
|
|
401
|
-
"full": { "primary": "github-copilot/gpt-5.5" }
|
|
402
|
-
},
|
|
403
|
-
"quality": {
|
|
404
|
-
"lite": { "primary": "github-copilot/gpt-5.5" },
|
|
405
|
-
"flash": { "primary": "github-copilot/gpt-5.5" },
|
|
406
|
-
"full": { "primary": "github-copilot/gpt-5.5-large", "failover": ["github-copilot/gpt-5.5"] }
|
|
407
|
-
}
|
|
408
|
-
}
|
|
148
|
+
{ "type": "scout", "intent": "Map the auth module", "aim": "Map auth" },
|
|
149
|
+
{ "type": "audit", "intent": "Audit auth for security issues", "aim": "Audit auth" },
|
|
150
|
+
{ "type": "build", "intent": "Fix the issues found", "aim": "Fix auth issues", "acceptance": "All audit findings resolved" }
|
|
151
|
+
]
|
|
409
152
|
}
|
|
410
153
|
```
|
|
411
154
|
|
|
412
|
-
|
|
413
|
-
- `balance` — best default mix of quality and cost.
|
|
414
|
-
- `quality` — prefers the strongest models first.
|
|
415
|
-
|
|
416
|
-
Settings are merged: project `.pi/settings.json` overrides global `~/.pi/agent/settings.json`.
|
|
417
|
-
|
|
418
|
-
### Persistent flow mode switch
|
|
155
|
+
## Flow Loop & Warp
|
|
419
156
|
|
|
420
|
-
|
|
157
|
+
Set a multi-step objective and the system auto-spawns flows to advance it after each turn.
|
|
421
158
|
|
|
422
159
|
```bash
|
|
423
|
-
|
|
424
|
-
|
|
160
|
+
/flow:goal set "Refactor tests to vitest" --acceptance "All tests pass" --max-flows 5
|
|
161
|
+
/flow:goal status # Check progress, budgets, and completed flows
|
|
162
|
+
/flow:goal pause # Stop auto-continuation
|
|
163
|
+
/flow:goal resume # Resume and immediately trigger the next flow
|
|
164
|
+
/flow:goal edit "Refactor tests to vitest + coverage" # Update objective
|
|
165
|
+
/flow:goal complete # Mark finished manually
|
|
166
|
+
/flow:goal clear # Mark abandoned and move to history
|
|
425
167
|
```
|
|
426
168
|
|
|
427
|
-
|
|
169
|
+
- **Auto-continuation** — after each turn, the root state spawns the next flow until the goal is complete or budgets are exhausted
|
|
170
|
+
- **Idle wake-up** — after ~10 min of inactivity, the system nudges the root state to make safe, conservative progress
|
|
171
|
+
- **Warp** — `/flow:warp` distills conversation context into a transfer prompt (## Context + ## Task) and spawns a new session with the goal preserved
|
|
428
172
|
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
```
|
|
432
|
-
mode: balance | lite: gpt-5.4-mini - flash: gpt-5.5 - full: gpt-5.5
|
|
433
|
-
```
|
|
173
|
+
Goals persist in `.pi/flow.json`. Add `.pi/` to `.gitignore` — this is local runtime state.
|
|
434
174
|
|
|
435
|
-
|
|
175
|
+
See [docs/FLOWS.md](docs/FLOWS.md#flow-loop--warp) for details.
|
|
436
176
|
|
|
437
|
-
|
|
177
|
+
## Custom Flows
|
|
438
178
|
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
```json
|
|
442
|
-
{
|
|
443
|
-
"flowSettings": {
|
|
444
|
-
"sessionMode": "default",
|
|
445
|
-
"maxConcurrency": 4,
|
|
446
|
-
"toolOptimize": true,
|
|
447
|
-
"structuredOutput": true
|
|
448
|
-
}
|
|
449
|
-
}
|
|
450
|
-
```
|
|
451
|
-
|
|
452
|
-
| Setting | Default | Description |
|
|
453
|
-
|---------|---------|-------------|
|
|
454
|
-
| `sessionMode` | `default` | Default child-flow session mode: `fast`, `default`, `long`, or `extreme_long` |
|
|
455
|
-
| `maxConcurrency` | `4` | Maximum parallel flows (capped to CPU count) |
|
|
456
|
-
| `toolOptimize` | `true` | Use unified `batch`/`batch_read` instead of separate read/write/edit |
|
|
457
|
-
| `structuredOutput` | `true` | Inject JSON structured-output instructions into flow prompts |
|
|
179
|
+
Create `.md` files in `~/.pi/agent/agents/` (user-level) or `.pi/agents/` (project-level):
|
|
458
180
|
|
|
459
|
-
|
|
181
|
+
```markdown
|
|
182
|
+
---
|
|
183
|
+
name: myflow
|
|
184
|
+
description: Short description
|
|
185
|
+
tools: batch, bash
|
|
186
|
+
maxDepth: 1
|
|
187
|
+
---
|
|
460
188
|
|
|
461
|
-
|
|
462
|
-
per-flow sessionMode > --flow-session-mode > PI_FLOW_SESSION_MODE > flowSettings.sessionMode > default
|
|
189
|
+
Your mission is ...
|
|
463
190
|
```
|
|
464
191
|
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
| Flag | Description | Default |
|
|
468
|
-
|------|-------------|---------|
|
|
469
|
-
| `--flow-max-depth [n]` | Maximum delegation depth | `3` |
|
|
470
|
-
| `--flow-prevent-cycles` | Block cyclic delegation | `true` |
|
|
471
|
-
| `--no-flow-prevent-cycles` | Disable cycle prevention | — |
|
|
472
|
-
| `--flow-model-config [name]` | Select a named model strategy for this invocation | `default` |
|
|
473
|
-
| `--flow-mode [name]` | Persistently switch the global model strategy and apply it immediately | — |
|
|
474
|
-
| `--flow-lite-model [model]` | Override the lite-tier model | — |
|
|
475
|
-
| `--flow-flash-model [model]` | Override the flash-tier model | — |
|
|
476
|
-
| `--flow-full-model [model]` | Override the full-tier model | — |
|
|
477
|
-
| `--flow-session-mode [mode]` | Default child-flow session mode | `default` |
|
|
478
|
-
| `--flow-max-concurrency [n]` | Maximum parallel flows | `4` |
|
|
479
|
-
| `--tool-optimize` | Use unified `batch`/`batch_read` | `true` |
|
|
480
|
-
|
|
481
|
-
### Environment variables
|
|
482
|
-
|
|
483
|
-
| Variable | Description |
|
|
484
|
-
|----------|-------------|
|
|
485
|
-
| `PI_FLOW_DEPTH` | Current delegation depth |
|
|
486
|
-
| `PI_FLOW_MAX_DEPTH` | Max allowed depth |
|
|
487
|
-
| `PI_FLOW_STACK` | JSON array of ancestor flow names |
|
|
488
|
-
| `PI_FLOW_PREVENT_CYCLES` | `"1"` or `"0"` |
|
|
489
|
-
| `PI_FLOW_TOOL_OPTIMIZE` | `"1"` or `"0"` (overrides default tool optimization) |
|
|
490
|
-
| `PI_FLOW_SESSION_MODE` | Default child-flow session mode: `fast`, `default`, `long`, or `extreme_long` |
|
|
491
|
-
| `PI_FLOW_MAX_CONCURRENCY` | Maximum parallel flows |
|
|
492
|
-
| `PI_FLOW_SPAWN_COMMAND` | Override the spawn command for exotic runtime environments (e.g. bundled with pkg/nexe) |
|
|
493
|
-
| `PI_FLOW_DEADLINE_MS` | Absolute deadline timestamp (ms) propagated to child flows for timeout awareness |
|
|
494
|
-
| `PI_FLOW_TOOL_SUMMARY_GRACE_MS` | Time before hard timeout when the agent should stop tool use and summarize (ms) |
|
|
495
|
-
| `PI_FLOW_REMINDER_FILE` | Path to a file the parent writes warning messages into; the timed-bash wrapper reads it before each tool call |
|
|
496
|
-
| `PI_FLOW_DEBUG_CONTEXT` | Set to `1` to emit context-compression telemetry to stderr |
|
|
497
|
-
| `PI_OFFLINE` | Always set to `1` for child flow processes |
|
|
498
|
-
| `PI_FLOW_NO_STEERING` | Set to `1` to disable orchestrator steering hint injection |
|
|
499
|
-
| `PI_FLOW_NO_STRATEGIC_HINT` | Set to `1` to suppress the strategic planning hints appended after tool calls |
|
|
500
|
-
| `PI_FLOW_NO_ANIMATION` | Set to `1` to disable all flow animation (instant render) |
|
|
501
|
-
| `PI_FLOW_NO_GLITCH` | Set to `1` to disable glitch/scramble effect |
|
|
502
|
-
| `PI_FLOW_LOG_FILE` | TUI-safe log file path (default: `$TMPDIR/pi-agent-flow.log`; set to `/dev/null` to suppress) |
|
|
503
|
-
| `PI_FLOW_DUMP_MAX_AGE_HOURS` | Max age of dump files before auto-cleanup deletes them (default: `168` = 7 days) |
|
|
504
|
-
| `PI_FLOW_SKIP_STRUCTURED_DIRECTIVE` | Set to `1` to skip structured output directive if a provider rejects that prompt shape |
|
|
505
|
-
|
|
506
|
-
### Notifications
|
|
507
|
-
|
|
508
|
-
Terminal and desktop notifications fire when the agent finishes a turn and is waiting for you. They adapt dynamically: if a flow completed, the title shows the flow name and acceptance summary; if `ask_user` is pending, the title changes to "Decision Required".
|
|
509
|
-
|
|
510
|
-
Configure notifications with global `~/.pi/agent/extensions/notify.json` or project `.pi/notify.json`. Project settings override global.
|
|
192
|
+
See [docs/CUSTOM-FLOWS.md](docs/CUSTOM-FLOWS.md) for front-matter options and examples.
|
|
511
193
|
|
|
512
|
-
|
|
513
|
-
{
|
|
514
|
-
"enabled": true,
|
|
515
|
-
"onlyWhenInteractive": true,
|
|
516
|
-
"title": "π",
|
|
517
|
-
"body": "task accomplished!",
|
|
518
|
-
"channels": {
|
|
519
|
-
"terminal": true,
|
|
520
|
-
"desktop": true,
|
|
521
|
-
"bell": true,
|
|
522
|
-
"sound": false
|
|
523
|
-
},
|
|
524
|
-
"terminal": { "backend": "auto" },
|
|
525
|
-
"desktop": { "backend": "auto" },
|
|
526
|
-
"sound": {
|
|
527
|
-
"backend": "auto",
|
|
528
|
-
"name": "Glass",
|
|
529
|
-
"linuxSoundId": "complete",
|
|
530
|
-
"frequencyHz": 1000,
|
|
531
|
-
"durationMs": 250,
|
|
532
|
-
"command": ""
|
|
533
|
-
}
|
|
534
|
-
}
|
|
535
|
-
```
|
|
536
|
-
|
|
537
|
-
| Key | Description |
|
|
538
|
-
|-----|-------------|
|
|
539
|
-
| `enabled` | Master switch for notifications |
|
|
540
|
-
| `onlyWhenInteractive` | Only notify when a UI is attached |
|
|
541
|
-
| `channels.terminal` | OSC 777/99 terminal notifications |
|
|
542
|
-
| `channels.desktop` | OS native notifications (macOS, Linux, Windows) |
|
|
543
|
-
| `channels.bell` | Terminal bell |
|
|
544
|
-
| `channels.sound` | System beep or custom sound |
|
|
545
|
-
|
|
546
|
-
**Backends**
|
|
547
|
-
|
|
548
|
-
| Channel | Backends |
|
|
549
|
-
|---------|----------|
|
|
550
|
-
| Terminal | `auto` (detect OSC support), `osc777`, `osc99`, `none` |
|
|
551
|
-
| Desktop | `auto` (detect OS), `macos`, `linux`, `windows-toast`, `none` |
|
|
552
|
-
| Sound | `auto`, `macos`, `linux`, `windows-beep`, `command`, `none` |
|
|
194
|
+
## Configuration
|
|
553
195
|
|
|
554
|
-
|
|
196
|
+
Flow behavior is controlled via CLI flags, environment variables, and `.pi/settings.json`. Resolution priority: **CLI flag > env var > settings.json > default**.
|
|
555
197
|
|
|
556
|
-
|
|
198
|
+
See [docs/CONFIGURATION.md](docs/CONFIGURATION.md) for the full reference (model strategies, flags, env vars, and slash commands).
|
|
557
199
|
|
|
558
200
|
## Local Development
|
|
559
201
|
|
|
560
|
-
|
|
202
|
+
Link the local checkout for instant iteration:
|
|
561
203
|
|
|
562
204
|
```shell
|
|
563
|
-
#
|
|
564
|
-
npm
|
|
205
|
+
./scripts/switch.sh # Link local checkout (or `npm run switch:local`)
|
|
206
|
+
npm run build # Compile TypeScript → dist/
|
|
207
|
+
# Quit pi and restart it to pick up the new dist/ via the symlink
|
|
565
208
|
```
|
|
566
209
|
|
|
567
|
-
|
|
210
|
+
Toggle back to the published version anytime with `./scripts/switch.sh`.
|
|
568
211
|
|
|
569
|
-
|
|
212
|
+
> ⚠️ Never run `pi update` while linked locally — it overwrites the symlink.
|
|
570
213
|
|
|
571
|
-
|
|
572
|
-
npm uninstall -g pi-agent-flow
|
|
573
|
-
npm install -g pi-agent-flow
|
|
574
|
-
```
|
|
575
|
-
|
|
576
|
-
---
|
|
214
|
+
## Contributing
|
|
577
215
|
|
|
578
|
-
|
|
216
|
+
PRs welcome. Please run `npm run lint` and `npm test` before submitting.
|
|
579
217
|
|
|
580
|
-
|
|
581
|
-
- [**License**](./LICENSE)
|
|
218
|
+
## License
|
|
582
219
|
|
|
583
|
-
|
|
220
|
+
[MIT](./LICENSE)
|