@zhuxixi/pi-agent-board 0.5.0 → 0.5.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.
Files changed (31) hide show
  1. package/PROGRESS.md +18 -3
  2. package/README.md +298 -76
  3. package/VERIFY.md +3 -3
  4. package/docs/PTY_ATTACH_IMPLEMENTATION_PLAN.md +3 -3
  5. package/docs/superpowers/plans/2026-08-30-circular-navigation.md +308 -0
  6. package/docs/superpowers/plans/2026-08-30-pty-attach-quality-debt.md +311 -0
  7. package/docs/superpowers/plans/2026-08-30-readme-v2.md +294 -0
  8. package/docs/superpowers/plans/2026-09-01-attach-detach-gate-cursor-anchor.md +284 -0
  9. package/docs/superpowers/plans/2026-09-02-attach-detach-editor-state.md +722 -0
  10. package/docs/superpowers/plans/2026-09-03-detach-gate-glyph-fallback.md +146 -0
  11. package/docs/superpowers/specs/2026-08-21-attach-coldstart-jiggle-rearm-design.md +4 -0
  12. package/docs/superpowers/specs/2026-08-22-jiggle-shrink-and-hold-design.md +4 -0
  13. package/docs/superpowers/specs/2026-08-30-circular-navigation-design.md +47 -0
  14. package/docs/superpowers/specs/2026-08-30-pty-attach-quality-debt-design.md +105 -0
  15. package/docs/superpowers/specs/2026-08-30-readme-v2-design.md +115 -0
  16. package/docs/superpowers/specs/2026-09-01-attach-detach-gate-cursor-anchor-design.md +78 -0
  17. package/docs/superpowers/specs/2026-09-02-attach-detach-editor-state-design.md +120 -0
  18. package/docs/superpowers/specs/2026-09-03-detach-gate-glyph-fallback-design.md +99 -0
  19. package/package.json +1 -1
  20. package/runner/pty-runner.mjs +64 -17
  21. package/src/core/code-refs-store.mjs +3 -0
  22. package/src/core/editor-state-reporter.mjs +102 -0
  23. package/src/core/launch.mjs +6 -0
  24. package/src/core/pty-attach-jiggle-controller.mjs +71 -17
  25. package/src/core/pty-input.mjs +32 -0
  26. package/src/core/pty-scroll.mjs +4 -3
  27. package/src/core/repo.mjs +3 -0
  28. package/src/core/worktree.mjs +1 -0
  29. package/src/index.ts +12 -1
  30. package/src/ui/dashboard.ts +6 -2
  31. package/src/ui/pty-attach.ts +148 -32
package/PROGRESS.md CHANGED
@@ -23,6 +23,19 @@ Status legend: ☐ todo · ◐ in progress · ☑ done
23
23
 
24
24
  ## Checkpoint log
25
25
 
26
+ ### CP5 — 2026-08-30 — hot attach self-heal + safe detach ordering (issue #42)
27
+ - Added G6 post-restore verification: if a hot session's in-flight differential frame makes
28
+ shrink+restore collapse to a net-zero resize, the controller re-shrinks after 900ms without
29
+ a clear; the retry budget remains bounded and G1–G5 behavior is preserved.
30
+ - Restored Pi editor key compatibility: `ctrl+]` passes through to `tui.editor.jumpForward`;
31
+ only `←` on an empty child input detaches.
32
+ - Fixed G3 ordering so a held PTY is restored before the runner receives `detach` and closes
33
+ the control socket.
34
+ - Added hot-session PTY E2E, delayed-clear, external-resize, detach-order, minimum-size, socket-identity,
35
+ and failure-teardown coverage. Final pre-PR verification: `npm run verify` passed with 409/409 tests;
36
+ coverage 93.03% lines / 77.35% branches / 90.55% functions; pack dry-run clean. The SIGKILL escalation
37
+ path is proven by the ~4.1s shutdown-escalation test (SIGTERM-immune child via `trap`+`exec`).
38
+
26
39
  ### CP4 — 2026-05-31 — fast non-live attach via warm PTY hosts
27
40
  - Non-live attach now uses the same Agent Board PTY host path as live sessions. `ctx.switchSession`
28
41
  remains only as a no-PTY fallback, with a fullscreen switching overlay so the previously
@@ -33,12 +46,14 @@ Status legend: ☐ todo · ◐ in progress · ☑ done
33
46
  socket until the host is ready.
34
47
  - Kept completed hosts warm instead of terminating them immediately. Warm pool defaults:
35
48
  `AGENT_BOARD_MAX_WARM_HOSTS=4`, `AGENT_BOARD_WARM_HOST_TTL_MS=600000`.
36
- - Fixed PTY detach flow: `ctrl+]`, `ctrl+g`, or `←` from a live attach returns to the dashboard
37
- loop instead of revealing the original session where `/agent-board` was invoked.
49
+ - Fixed PTY detach flow: `←` from an empty child input returns to the dashboard loop instead of
50
+ revealing the original session where `/agent-board` was invoked. `ctrl+]` and `ctrl+g` pass
51
+ through to the hosted Pi editor's native shortcuts.
38
52
  - Added internal scrollback controls for PTY attach surfaces: mouse wheel, `pgup` / `pgdn`,
39
53
  `home`, `end`. Scrolling uses an agent-board-owned absolute viewport and clamps at top/bottom
40
54
  so fast wheel events cannot wrap back to the bottom. Normal arrow keys still pass through.
41
- - Verification: `npm run typecheck` clean; `npm test` 55/55 green.
55
+ - Historical verification: `npm run typecheck` clean; `npm test` 55/55 green at the time of CP4.
56
+ Later checkpoints supersede this count.
42
57
 
43
58
  ### CP3 — 2026-05-30 — standalone-ish dashboard UX
44
59
  - Added a full-screen **session view** inside `/agent-board`: **v** opens the selected row's
package/README.md CHANGED
@@ -10,126 +10,343 @@
10
10
  | <a href="https://www.npmjs.com/package/@zhuxixi/pi-agent-board">npm</a>
11
11
  </p>
12
12
 
13
- Pi Agent Board is a full-screen TUI dashboard for [Pi](https://github.com/earendil-works/pi-mono). It lets you dispatch, monitor, peek/reply to, attach to, and clean up multiple background Pi sessions from one place.
13
+ Pi Agent Board is a full-screen TUI dashboard for [Pi](https://github.com/earendil-works/pi-mono) that manages durable background Pi sessions. Use one global board to dispatch work across projects, watch progress, triage summaries and evidence, reply without opening a transcript, and attach to a real interactive session when hands-on work is needed.
14
14
 
15
- ## Problems It Solves
15
+ ## What It Does
16
16
 
17
- - Run several Pi tasks at once without losing track of which are queued, running, needs answer, needs instructions, done, failed, or stopped.
18
- - Keep real Pi sessions durable and resumable after `/reload`, closing Pi, or restarting the terminal.
19
- - Check the latest output and answer follow-up questions without interrupting a running session.
20
- - Attach to the full interactive Pi session only when hands-on work is needed.
21
- - Manage work across multiple projects in one global board.
17
+ - Run several Pi tasks at once without losing track of their current state.
18
+ - Keep each task as a real, resumable Pi session that survives `/reload`, closing Pi, or restarting the terminal.
19
+ - Triage the latest output, blockers, evidence, and diagnostics before opening a full transcript.
20
+ - Reply to a session without attaching; replies sent while a session is busy are preserved for later delivery.
21
+ - Fall back to a JSON runner for eligible background work when live PTY support is unavailable.
22
22
 
23
- ## Install
23
+ > **Write-safety note:** Worktree isolation is currently disabled. Multiple sessions in the same repository may run concurrently, so avoid overlapping writes or provide your own isolation.
24
+
25
+ ## Requirements
26
+
27
+ - [Pi](https://github.com/earendil-works/pi-mono) installed and working.
28
+ - Node.js 20 or newer.
29
+ - Working Pi provider authentication for real model execution. Agent Board does not have a separate login or credential store.
30
+ - PTY support from `node-pty` for live attach and **start & attach**. Background work can use a JSON-runner fallback when PTY support is unavailable.
24
31
 
25
- From npm:
32
+ If rows remain in `Running`, first verify that Pi itself can complete a one-shot model call:
26
33
 
27
34
  ```bash
28
- pi install npm:@zhuxixi/pi-agent-board
29
- pi /agent-board
35
+ pi --mode json -p --no-session "Reply with exactly: DONE"
30
36
  ```
31
37
 
32
- You can also start Pi normally and run `/agent-board`.
38
+ A healthy command emits an assistant `message_end`, then an `agent_end` event, and exits. See [VERIFY.md](VERIFY.md) for the complete no-auth, provider-auth, and PTY checks.
39
+
40
+ ## Install
33
41
 
34
- Pi Agent Board requires Node 20+ and working Pi provider auth. If rows stay in `Running`, first confirm Pi can complete a one-shot model call:
42
+ ### Published package
35
43
 
36
44
  ```bash
37
- pi --mode json -p --no-session "Reply with exactly: DONE"
45
+ pi install npm:@zhuxixi/pi-agent-board
38
46
  ```
39
47
 
40
- That command should produce an assistant reply and finish with an `agent_end` event.
48
+ Start Pi normally and run `/agent-board`, or use one of the startup entry points below.
41
49
 
42
- From a local checkout:
50
+ ### Local checkout
43
51
 
44
52
  ```bash
45
53
  npm install
46
54
  pi install "$(pwd)"
47
- pi /agent-board
48
55
  ```
49
56
 
50
- For auto-discovery while developing:
57
+ This installs the current checkout as a Pi package. Remove that path installation with:
58
+
59
+ ```bash
60
+ pi remove "$(pwd)"
61
+ ```
62
+
63
+ ### Development auto-discovery
64
+
65
+ To have Pi load the checkout directly while developing:
51
66
 
52
67
  ```bash
53
68
  ln -s "$(pwd)" ~/.pi/agent/extensions/agent-board
54
69
  pi
55
70
  ```
56
71
 
57
- Remove that symlink when you no longer want Pi to auto-load the checkout. If you installed by path, remove it with `pi remove "$(pwd)"`.
72
+ Remove the symlink when you no longer want Pi to auto-load the checkout:
73
+
74
+ ```bash
75
+ rm ~/.pi/agent/extensions/agent-board
76
+ ```
58
77
 
59
- ## Use
78
+ ## Quick Start
60
79
 
61
- Open the board with `pi /agent-board` or `/agent-board` inside Pi.
80
+ Open the board with `/agent-board` inside Pi, then:
62
81
 
63
- - Type a task in the bottom input, then press `enter`.
64
- - Confirm **Start session**, or adjust `cwd`, model, and thinking level first.
65
- - Watch rows move through `Queued`, `Running`, `Needs answer`, `Needs instructions`, `Done`, `Failed`, and `Stopped`.
66
- - Press `space` to peek at the selected row's summary, blocker, and latest output.
67
- - Press `r` to reply inline without attaching.
68
- - Press `enter`, `right`, or `>` to attach to the real Pi session.
69
- - Press `v` for a read-only live transcript.
70
- - Press `/` to filter by text or state, such as `s:running`.
71
- - Press `ctrl+r` rename, `ctrl+t` pin, `ctrl+s` stop, `d` mark done, `m` multi-select, `ctrl+x` delete/archive, `X` delete inactive rows in the selected state, and `?` for help.
82
+ 1. Press `i` to enter INSERT mode.
83
+ 2. Type a task.
84
+ 3. Press `Enter` to open the **Start session** dialog.
85
+ 4. Review or change the working directory (`cwd`), model, thinking level, and action.
86
+ 5. Press `Enter` on **Start session** to launch the task.
72
87
 
73
- Rows are stored under `~/.pi/agent/agent-board/` by default. Deleting a row archives it from the board; it does not remove the underlying Pi session file.
88
+ With a draft in the input, `Enter` opens **Start session**; with an empty input, `Enter` attaches/resumes the selected session. The row starts in `Queued`, then moves through `Running` to a terminal state such as `Needs answer`, `Needs instructions`, `Done`, `Failed`, or `Stopped`.
74
89
 
75
- ## Configuration
90
+ From the board:
91
+
92
+ - Press `Space` to peek at the selected session's summary, blocker, and latest output.
93
+ - In Peek, press `r` to reply without attaching.
94
+ - Press `v` for a read-only transcript, or `e` for evidence and diagnostics.
95
+ - Press `Enter`, `Right`, or `>` to attach to the real Pi session.
96
+ - In PTY attach mode, press `Left` on an empty child input line to return to the board. `Ctrl+]` is not a detach key — it is passed through to the child Pi editor. When the host is disconnected, `Left` always exits.
97
+
98
+ ## Dashboard Workflow
99
+
100
+ The dashboard has two input modes:
101
+
102
+ - **Normal mode** owns dashboard shortcuts such as navigation, peek, attach, and filtering.
103
+ - **INSERT mode** owns text editing. Press `i` before typing or pasting a task; `/` is literal while editing a prompt.
104
+
105
+ When you submit a task, the **Start session** dialog lets you review:
76
106
 
77
- Useful environment variables:
107
+ - `cwd`: an existing-directory picker with usage-ranked favorites, filesystem browsing, and Tab completion;
108
+ - `model`: models available to Pi, including models scoped by the current directory's Pi settings;
109
+ - `thinking`: a level supported by the selected model;
110
+ - `action`: **start in background** or **start & attach**.
78
111
 
79
- | Variable | Use |
112
+ Launch preferences are persisted and reused for later sessions. **Start & attach** requires PTY support; if PTY is unavailable, Agent Board launches the session in the background and shows a warning instead.
113
+
114
+ Session actions are deliberately confirmation-aware:
115
+
116
+ - `d` confirms moving an inactive session to **Done**. Manual completion is the default.
117
+ - Press `Ctrl+X` twice quickly to archive/delete the selected row. Archiving removes the row from the board but preserves its underlying Pi session file.
118
+ - `X` archives inactive rows in the selected state; live work is skipped.
119
+ - `m` enters multi-select mode. Use `Space` to toggle rows, `a` to select all visible rows, `u` to clear the selection, `d` to mark inactive rows Done, or `Ctrl+X` to delete selected Done rows.
120
+
121
+ ## Views and Actions
122
+
123
+ Shortcuts are scoped to the view where they are available:
124
+
125
+ ### Main list
126
+
127
+ | Key | Action |
80
128
  | --- | --- |
81
- | `AGENT_BOARD_ROOT` | Store location. Defaults to `~/.pi/agent/agent-board/`. |
82
- | `AGENT_BOARD_AUTO_STATE=off` | Disable automatic terminal-state moves. |
83
- | `AGENT_BOARD_AUTO_STATE_MODEL=<model>` | Model for classifying finished turns. Defaults to `gpt-4o`; use `off` for heuristic-only. |
84
- | `AGENT_BOARD_AUTO_STATE_NO_DONE` | Disables automatic `completed` classification (default: enabled). Set to `0`/`false`/`off`/`no` to restore auto-done. |
85
- | `AGENT_BOARD_CODE_REFS=off` | Disable issue/PR badge extraction from session evidence. |
86
- | `AGENT_BOARD_SUMMARY_MODEL=<model>` | Model for short row summaries. Defaults to `gpt-4o`; use `off` to disable. |
87
- | `AGENT_BOARD_TITLE_MODEL=<model>` | Model for generated session titles. Defaults to `openai-codex/gpt-5.5`; use `off` to disable. |
88
- | `AGENT_BOARD_TITLE_THINKING_LEVEL=<level>` | Thinking level for title generation. Defaults to `low`; use `off` to omit it. |
89
- | `AGENT_BOARD_DISABLE_PTY=1` | Disable PTY attach mode. |
90
- | `AGENT_BOARD_IME_FIX=0` | Disable the IME cursor-rect coalescer (issue #28). The coalescer folds pi-tui's per-frame cursor-park writes into the frame's synchronized-output block so terminals report one stable IME cursor position per frame instead of two (candidate-window flicker in busy sessions). |
91
- | `AGENT_BOARD_FORCE_PTY=1` | Force PTY attach mode. |
92
- | `AGENT_BOARD_ATTACH_MOUSE=0` | Disable attach-view mouse handling and use terminal-native selection. |
93
- | `AGENT_BOARD_WHEEL_LINES=<1-50>` | Lines scrolled per mouse-wheel event in attach view. Defaults to `1`. |
94
-
95
- Legacy `AGENT_VIEW_*` variables are still honored for migration.
96
-
97
- If the board reports `node-pty unavailable`, press `!` in the dashboard for diagnosis and fix steps.
98
-
99
- ## Develop
129
+ | `Up` / `Down` | Move the selection. |
130
+ | `i` | Enter INSERT mode for a new task. |
131
+ | `Enter` | Open Start session for a draft, or attach/resume when the input is empty. |
132
+ | `Right` / `>` | Attach to the selected session. |
133
+ | `Space` | Open Peek. |
134
+ | `v` | Open the read-only transcript. |
135
+ | `e` | Open Evidence / Diagnostics. |
136
+ | `/` | Enter filter mode. |
137
+ | `Ctrl+N` | Enter INSERT mode with a pre-filled `hello` prompt; press `Enter` to open the Start session dialog. |
138
+ | `Ctrl+R` | Rename the selected session. |
139
+ | `Ctrl+T` | Pin or unpin the selected session. |
140
+ | `Ctrl+S` | Stop the selected active session. |
141
+ | `d` | Confirm marking the selected inactive session Done. |
142
+ | `Ctrl+X` twice quickly | Archive/delete the selected row. |
143
+ | `X` | Delete inactive rows in the selected state. |
144
+ | `m` | Enter multi-select mode. |
145
+ | `!` | Open node-pty diagnostics and repair hints. |
146
+ | `?` | Open the help overlay. |
147
+ | `Esc` | Clear a draft, or exit when the input is empty. |
148
+
149
+ ### Peek
150
+
151
+ Peek shows the selected session's summary, blocker or question, latest output, and available issue/PR references.
152
+
153
+ | Key | Action |
154
+ | --- | --- |
155
+ | `r` or `Enter` | Enter reply mode; type a follow-up and press `Enter` to send it without attaching. |
156
+ | `a`, `Right`, or `>` | Attach to the session. |
157
+ | `v` | Open the read-only transcript. |
158
+ | `e` | Open Evidence / Diagnostics. |
159
+ | `Up` / `Down` | Move to the previous or next session. |
160
+ | `Esc` | Return to the main list. |
100
161
 
101
- ```bash
102
- npm install
103
- npm run typecheck
104
- npm test
105
- npm run test:coverage
106
- npm run pack:dry
162
+ When a Pi question or questionnaire tool is pending, inline reply is rejected; attach to answer that interactive question in the real Pi session.
163
+
164
+ ### Transcript
165
+
166
+ The `v` view is a read-only projection of the durable Pi session JSONL. It does not interrupt a running worker.
167
+
168
+ | Key | Action |
169
+ | --- | --- |
170
+ | `Up` / `Down` | Scroll one line. |
171
+ | `PageUp` / `PageDown` | Scroll one page. |
172
+ | `Space` | Open Peek. |
173
+ | `r` | Enter reply mode. |
174
+ | `Enter` or `a` | Attach to the session. |
175
+ | `e` | Open Evidence / Diagnostics. |
176
+ | `d` | Confirm marking the inactive session Done. |
177
+ | `Left` / `Esc` / `<` | Return to the main list. |
178
+
179
+ ### Evidence / Diagnostics
180
+
181
+ The `e` view shows durable session evidence, including changed files, commands and their outcomes, command output previews, assistant evidence, errors, diagnostics, and artifact paths. Press `x` to clear diagnostics while preserving the evidence artifacts.
182
+
183
+ | Key | Action |
184
+ | --- | --- |
185
+ | `Up` / `Down` | Scroll one line. |
186
+ | `PageUp` / `PageDown` | Scroll one page. |
187
+ | `r` | Enter reply mode. |
188
+ | `v` | Open the read-only transcript. |
189
+ | `Enter`, `a`, or `Right` | Attach to the session. |
190
+ | `x` | Clear diagnostics; evidence is preserved. |
191
+ | `Left` / `Esc` / `<` | Return to the main list. |
192
+
193
+ ### PTY attach
194
+
195
+ PTY attach opens the real interactive Pi session. On an empty child input line, use `Left` to detach and return to the board; while you are editing text, `Left` is forwarded to the Pi editor, and a disconnected host can always be exited with `Left`. `Ctrl+]` is not a detach key — it is passed through to the child Pi editor. While attached, `PageUp`, `PageDown`, `Home`, `End`, and the mouse wheel scroll local scrollback. Mouse drag or double-click selects and copies text, clicks open detected links, and middle-click paste is available on systems with the required X11 tooling.
196
+
197
+ The attach surface can forward terminal clipboard and image/file passthrough sequences. These behaviors can be disabled individually in [Configuration](#configuration). Cold hosts may briefly show a loading/reconnect surface while their PTY becomes ready.
198
+
199
+ ## States, Grouping, and Filters
200
+
201
+ Agent Board separates a session's semantic task state from whether a worker process is currently alive. An exited worker can therefore leave a durable row that is still resumable or attachable.
202
+
203
+ | Display state | Meaning |
204
+ | --- | --- |
205
+ | **Queued** | A run has been scheduled but has not started processing. |
206
+ | **Running** | The session is actively processing. |
207
+ | **Needs answer** | The session is waiting for user input or an answer to a question. |
208
+ | **Needs instructions** | The run ended without being marked complete and needs the next directive. |
209
+ | **Done** | The user marked the inactive session complete; this is the default completion path. |
210
+ | **Failed** | The worker or host ended with an error. |
211
+ | **Stopped** | The user stopped the active work. |
212
+
213
+ Rows are grouped by state. When a state contains sessions from multiple directories, rows are grouped by folder within that state. Pinned rows and folders come first, then creation order remains stable; activity does not reshuffle the list. New agent activity is marked unread with stronger row glyphs and header/footer counts. Replies sent while a session is busy enter a durable FIFO follow-up queue and are delivered when the session is ready; a `qN` badge shows queued follow-ups.
214
+
215
+ Press `/` to enter filter mode. Filter tokens are case-insensitive and can be combined with free-text terms:
216
+
217
+ ```text
218
+ s:running
219
+ review:ready
220
+ diag:stalled
221
+ evidence:error
222
+ queued:true
223
+ steer:awaiting-approval
107
224
  ```
108
225
 
109
- Run all checks with:
226
+ - `s:<state>` matches a state prefix, including display-label aliases such as `needs-answer`.
227
+ - `review:ready` finds sessions with review-ready evidence.
228
+ - `evidence:error` finds sessions whose evidence contains errors.
229
+ - `queued:true` (also `yes` or `1`) finds sessions with queued follow-ups.
230
+ - `steer:<state>` filters by a persisted steering state.
231
+ - Bare words match name, summary, and working directory; multiple words use AND matching.
232
+
233
+ `diag:stalled` can consume persisted stalled diagnostics, but the current runner does not provide a general provider-stall detector. It should not be read as a complete automatic stall-detection feature.
234
+
235
+ ## Evidence and Code References
236
+
237
+ Evidence is collected locally from session events. Agent Board can extract issue and pull-request references from that evidence and show badges such as `#40` or `▸#45` on rows; Peek includes the provider, confidence, source, and URL when available. Built-in GitHub/GitLab-style providers are available, and an optional per-store `providers.json` can extend the provider rules. The `AGENT_BOARD_CODE_REFS=off` setting disables extraction.
238
+
239
+ ## Attach and Fallback Behavior
240
+
241
+ When PTY support is healthy, Agent Board uses an interactive PTY host for attach and start-and-attach. If PTY support is unavailable, eligible managed sessions can still run in the background through the JSON runner; start-and-attach falls back to background launch with a warning. Adopted external foreground sessions require PTY to continue safely. Press `!` in the dashboard for diagnosis and repair hints.
242
+
243
+ On Windows, PTY host control uses a named pipe and spawned child console windows are hidden. Terminal behavior can still vary between terminal emulators.
244
+
245
+ ## Entry Points
246
+
247
+ | Entry point | What it does |
248
+ | --- | --- |
249
+ | `/agent-board` | Opens the dashboard from an interactive Pi session. Use this command path to attach to managed sessions. |
250
+ | `pi /agent-board` | Starts Pi by invoking the dashboard command. Quitting the standalone dashboard shuts down Pi instead of dropping into a normal chat session. |
251
+ | `pi --agent-board` | Opens the dashboard through the extension startup flag. This startup path cannot attach to a managed session; use `/agent-board` from a normal Pi session for attach. |
252
+ | `/bg [prompt]` | Adopts the current interactive Pi session into Agent Board. An optional prompt is added to its follow-up queue before the dashboard opens. |
253
+
254
+ The board is global across projects by default. Rows are stored under `~/.pi/agent/agent-board/`; archiving a row removes it from the board but preserves the underlying Pi session file.
255
+
256
+ ## Persistence, Safety, and Limitations
257
+
258
+ Agent Board stores its durable roster and per-session artifacts under `~/.pi/agent/agent-board/` by default. Set `AGENT_BOARD_ROOT` to use another location. The store includes the roster, launch preferences, per-session metadata and state, Pi session JSONL, run status/events, evidence, diagnostics, and (for PTY hosts) a replayable screen log.
259
+
260
+ Rows and session history survive Pi reloads, Pi restarts, and worker exits. When the dashboard opens, it reconciles stale runner or host records and keeps resumable sessions visible. Archiving a row removes it from the board but does not delete its underlying Pi session file.
261
+
262
+ > **Worktree isolation is currently disabled.** Agent Board does not automatically create or manage Git worktrees. Multiple sessions in the same repository may run concurrently, so avoid overlapping writes or provide your own isolation before starting parallel coding tasks.
263
+
264
+ Other current limitations:
265
+
266
+ - Agent Board runs locally; it does not provide cloud execution, multi-user coordination, or shared dashboards.
267
+ - Real model output still depends on Pi provider authentication and network access.
268
+ - The `--agent-board` startup path opens the dashboard but cannot attach to a managed session; use `/agent-board` from a normal Pi session for attach.
269
+ - Pending Pi question or questionnaire tools must be answered in the attached interactive session; inline reply is rejected while one is pending.
270
+ - PTY-dependent features require a working `node-pty` installation. Background work can use the JSON-runner fallback when PTY is unavailable, but start & attach then becomes background-only.
271
+
272
+ ## Configuration
273
+
274
+ Set these variables before starting Pi. Model-backed features fall back gracefully where noted, so disabling them does not prevent the core dashboard from working.
275
+
276
+ | Variable | Default / values | Purpose |
277
+ | --- | --- | --- |
278
+ | `AGENT_BOARD_ROOT` | `~/.pi/agent/agent-board/` | Override the durable store location. |
279
+ | `AGENT_BOARD_AUTO_STATE` | enabled; `off` disables | Enable automatic terminal-state refinement after a turn. |
280
+ | `AGENT_BOARD_AUTO_STATE_MODEL` | `gpt-4o`; `off` uses heuristics | Model for classifying the terminal state of a finished turn. |
281
+ | `AGENT_BOARD_AUTO_STATE_NO_DONE` | unset = manual Done; `0`, `false`, `off`, or `no` restores auto-Done | Keep completion manual by default, or restore automatic `Done` classification. |
282
+ | `AGENT_BOARD_SUMMARY_MODEL` | `gpt-4o`; `off` disables | Generate short row summaries. Heuristic summaries remain available as a fallback. |
283
+ | `AGENT_BOARD_TITLE_MODEL` | `openai-codex/gpt-5.5`; `off` disables | Generate a short session title after dispatch. The initial slug remains if generation fails. |
284
+ | `AGENT_BOARD_TITLE_THINKING_LEVEL` | `low`; `off` omits the option | Thinking level used by title generation. |
285
+ | `AGENT_BOARD_CODE_REFS` | enabled; `off` disables | Extract issue/PR badges from session evidence. |
286
+ | `AGENT_BOARD_DISABLE_PTY` | unset; `1` disables | Disable PTY host and attach mode. |
287
+ | `AGENT_BOARD_FORCE_PTY` | unset; `1` forces the PTY path | Force the PTY availability path when diagnosing or controlling fallback behavior. |
288
+ | `AGENT_BOARD_ATTACH_MOUSE` | enabled; `0`, `off`, or `false` disables | Disable attach-view mouse handling and use terminal-native selection instead. |
289
+ | `AGENT_BOARD_ENABLE_MOUSE_SCROLL` | enabled; `0` disables | Compatibility switch to disable attach-view mouse scrolling. |
290
+ | `AGENT_BOARD_WHEEL_LINES` | `1`, clamped to `1..50` | Lines scrolled per mouse-wheel event in attach view. |
291
+ | `AGENT_BOARD_MAX_WARM_HOSTS` | `4`, clamped to `0..50` | Maximum number of idle PTY hosts retained for faster attach. |
292
+ | `AGENT_BOARD_WARM_HOST_TTL_MS` | `600000` (10 minutes); `0` disables TTL eviction | How long an idle warm host may remain before it is evicted. |
293
+ | `AGENT_BOARD_ATTACH_NATIVE_PASTE` | enabled; `0` disables | Disable X11 PRIMARY selection copy and middle-click paste integration. |
294
+ | `AGENT_BOARD_FORWARD_OSC52` | enabled; `0` disables | Disable OSC 52 clipboard sequence forwarding from an attached session. |
295
+ | `AGENT_BOARD_FORWARD_IMAGES` | enabled; `0` disables | Disable terminal image/file passthrough forwarding from an attached session. |
296
+ | `AGENT_BOARD_IME_FIX` | enabled; `0` disables | Disable the attach-view IME cursor coalescer if your terminal has compatibility problems. |
297
+
298
+ Older `AGENT_VIEW_*` names are still read in selected compatibility paths. Prefer `AGENT_BOARD_*` for new setups. Internal child markers are managed by Agent Board and are not user settings.
299
+
300
+ The `providers.json` file under the configured store root can extend the built-in issue/PR reference providers; see the [Evidence and Code References](#evidence-and-code-references) section for the feature overview.
301
+
302
+ ## Troubleshooting
303
+
304
+ ### Rows stay in `Running`
305
+
306
+ First verify that Pi itself can complete a one-shot model call:
110
307
 
111
308
  ```bash
112
- npm run verify
309
+ pi --mode json -p --no-session "Reply with exactly: DONE"
113
310
  ```
114
311
 
115
- `npm run verify` runs typecheck, tests, coverage, and a dry npm pack.
312
+ The command should emit an assistant reply, then an `agent_end` event, and exit. If it hangs before the assistant reply, fix Pi provider authentication or network access first. Agent Board cannot produce live model results until Pi works independently.
313
+
314
+ ### `node-pty unavailable`
315
+
316
+ Press `!` in the dashboard to open the diagnostic panel and follow its repair hints. Common causes include a missing native `node-pty` binary, a Node/architecture mismatch, a missing or non-executable macOS `spawn-helper`, or macOS quarantine. You can temporarily set `AGENT_BOARD_DISABLE_PTY=1` to use background JSON-runner behavior where supported.
317
+
318
+ ### Attach is slow or keeps reconnecting
319
+
320
+ A cold PTY host may briefly show a loading or reconnecting surface while it starts. Check the PTY status in the dashboard with `!`; stale hosts are diagnosed separately from active task workers. If the host never becomes healthy, repair `node-pty` or use background mode for eligible managed sessions.
321
+
322
+ ### Start & attach falls back to background
323
+
324
+ Start & attach requires PTY support. When PTY is unavailable, the task is still dispatched in the background and the dashboard displays a warning. Repair PTY and retry attach from the normal `/agent-board` command path.
325
+
326
+ ### Inline reply is rejected
116
327
 
117
- ### QA baseline
328
+ A pending Pi question or questionnaire requires the real interactive session. Attach to the row and answer it there; ordinary replies can be sent from Peek and are queued while a session is busy.
118
329
 
119
- Every push and PR runs the same checks in CI (`.github/workflows/ci.yml`, Node 22 + 24),
120
- and `main` branch protection requires both CI checks to pass before merging.
330
+ ### Sessions in the same repository conflict
121
331
 
122
- Coverage is enforced by `c8` with thresholds configured in `.c8rc.json`
123
- (lines ≥ 85%, functions ≥ 80%, branches ≥ 70%). The TS UI layer
124
- (`src/ui/*.ts`, `src/commands/*.ts`) is covered by a smoke test
125
- (`test/ui-smoke.test.mjs`) that constructs and renders the real entrypoints;
126
- it is excluded from the coverage thresholds by design.
332
+ Worktree isolation is not enabled. Stop overlapping writers, separate their working directories, or create and manage Git worktrees yourself before running concurrent coding tasks.
127
333
 
128
- Current baseline: 300+ tests, ~92% line coverage on the core modules.
334
+ See [VERIFY.md](VERIFY.md) for no-auth checks, extension loading checks, provider checks, persistence checks, and the manual dashboard flow.
129
335
 
130
- ## Publish
336
+ ## Development
131
337
 
132
- Before publishing a new release, bump the package version, run verification, then publish:
338
+ For local development:
339
+
340
+ ```bash
341
+ npm install
342
+ npm run verify
343
+ ```
344
+
345
+ `npm run verify` runs typecheck, tests, coverage, and a package dry-run. The same checks run in CI on Node 22 and Node 24. See [VERIFY.md](VERIFY.md) for the full verification checklist and known environment-dependent limitations.
346
+
347
+ ## Publishing
348
+
349
+ Before publishing a release, verify the package, bump the version, and publish it:
133
350
 
134
351
  ```bash
135
352
  npm run verify
@@ -137,12 +354,17 @@ npm version patch
137
354
  npm publish
138
355
  ```
139
356
 
140
- If the version is already bumped, skip `npm version patch`.
141
-
142
- Use `npm version minor` or `npm version major` instead when the release warrants it. After publish, users install with:
357
+ Use `npm version minor` or `npm version major` when appropriate. If the version is already bumped, skip `npm version patch`. After publishing, users install the scoped package with:
143
358
 
144
359
  ```bash
145
360
  pi install npm:@zhuxixi/pi-agent-board
146
361
  ```
147
362
 
148
363
  The Pi package gallery uses the `pi.video` and `pi.image` URLs from `package.json`.
364
+
365
+ ## Further Reading
366
+
367
+ - [Manual verification](VERIFY.md) — static checks, Pi loading, provider authentication, persistence, and dashboard flows.
368
+ - [Product requirements](PRD.md) — original product scope and design context.
369
+ - [Progress log](PROGRESS.md) — implementation checkpoints and known environment notes.
370
+ - [Exploration notes](docs/EXPLORATION.md) — Pi API and integration research.
package/VERIFY.md CHANGED
@@ -59,7 +59,7 @@ ln -s "$(pwd)" ~/.pi/agent/extensions/agent-board
59
59
  ```
60
60
  After publish, install with:
61
61
  ```bash
62
- pi install npm:pi-agent-board
62
+ pi install npm:@zhuxixi/pi-agent-board
63
63
  ```
64
64
  Then start pi normally:
65
65
  ```bash
@@ -72,10 +72,10 @@ Inside pi:
72
72
  1. Type `/agent-board`, or start with `pi /agent-board` → the full-screen dashboard opens.
73
73
  - With `pi /agent-board`, quitting the dashboard exits Pi instead of dropping you into a normal chat session.
74
74
  - The startup path should feel cleaner than `/agent-board`: no normal Pi header/footer chrome and no dispatch notifications above the dashboard.
75
- 2. Type a task in the bottom input (e.g. `list the files in this repo and summarize the README`), then press **Enter**.
75
+ 2. Press **i** to enter INSERT mode, then type a task in the bottom input (e.g. `list the files in this repo and summarize the README`) and press **Enter**.
76
76
  - A **Start session** dialog opens with **Start session** focused by default.
77
77
  - Press **Enter** again to launch immediately, or move with **↑/↓** to change **cwd**, **model**, or **thinking** first.
78
- - A row appears and moves `Queued Running Done` (needs step 2 healthy).
78
+ - With automatic Done disabled by default, a successful run settles in **Needs instructions** until you review it and press **d** to confirm **Done**. Set `AGENT_BOARD_AUTO_STATE_NO_DONE=0` to restore automatic Done classification for this verification path.
79
79
  3. **space** = peek when the input is empty (summary, blocker, latest output); in peek **r** = reply, **a** = attach.
80
80
  **→** / **>** = open a full-screen live session view without interrupting; **←** / **<** returns.
81
81
  4. **enter** on an empty input = attach to the selected full session (confirms first if it's still running).
@@ -280,9 +280,9 @@ Runner → client:
280
280
  {"type":"error","message":"..."}
281
281
  ```
282
282
 
283
- For attach, the parent sends raw input bytes through `input`. The only intercepted key should be the detach chord.
283
+ For attach, the parent sends raw input bytes through `input`. The attach surface intercepts only `←` when the child input line appears empty; all other keys, including Pi's native `ctrl+]` editor shortcut, pass through to the child.
284
284
 
285
- Recommended detach chord for spike: `ctrl+]`, because it is already an editor jump key but less commonly needed than arrows/escape/enter. Make it configurable later.
285
+ The detach chord is `←` because it is already the board navigation key and preserves Pi editor keybindings.
286
286
 
287
287
  ## 6. Attach UI design
288
288
 
@@ -560,7 +560,7 @@ MVP live attach is accepted when:
560
560
  | child Pi extension recursion | medium | `AGENT_BOARD_CHILD=1`; skip dashboard auto-open/footer in child |
561
561
  | host liveness conflated with agent activity | high | add `host.json`; separate `hostAlive` from `row.alive` |
562
562
  | worktree safety too conservative with idle hosts | low/medium | conservative MVP, later refine with activity state |
563
- | detach chord conflicts with Pi keybindings | low | configurable later; start with `ctrl+]` |
563
+ | `←` is also a child-editor cursor key | low | detach only when the child input line appears empty; keep all other editor shortcuts, including `ctrl+]`, pass-through |
564
564
  | terminal images/OSC links not perfect in virtual renderer | medium | document limitation; raw takeover/core API if needed |
565
565
 
566
566
  ## 13. Confidence