@linxiraos/pi-messenger 1.1.1 → 1.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (66) hide show
  1. package/CHANGELOG.md +741 -676
  2. package/LICENSE +45 -0
  3. package/README.md +424 -424
  4. package/THIRD-PARTY-NOTICES.txt +22951 -0
  5. package/config-overlay.ts +175 -171
  6. package/config.ts +221 -209
  7. package/crew/agents/crew-plan-sync.md +66 -64
  8. package/crew/agents/crew-planner.md +173 -172
  9. package/crew/agents/crew-reviewer.md +58 -58
  10. package/crew/agents/crew-worker.md +130 -129
  11. package/crew/agents.ts +507 -434
  12. package/crew/handlers/coordination.ts +350 -332
  13. package/crew/handlers/plan.ts +988 -906
  14. package/crew/handlers/review.ts +354 -333
  15. package/crew/handlers/revise.ts +400 -376
  16. package/crew/handlers/status.ts +303 -295
  17. package/crew/handlers/sync.ts +237 -233
  18. package/crew/handlers/task.ts +820 -792
  19. package/crew/handlers/team.ts +294 -235
  20. package/crew/handlers/work.ts +467 -425
  21. package/crew/id-allocator.ts +30 -30
  22. package/crew/index.ts +297 -257
  23. package/crew/live-progress.ts +58 -58
  24. package/crew/lobby.ts +504 -473
  25. package/crew/prompt.ts +262 -252
  26. package/crew/registry.ts +114 -114
  27. package/crew/spawn.ts +135 -111
  28. package/crew/state-autonomous.ts +163 -164
  29. package/crew/state-planning.ts +264 -263
  30. package/crew/state.ts +20 -20
  31. package/crew/store.ts +646 -642
  32. package/crew/task-actions.ts +162 -131
  33. package/crew/team/store.ts +572 -479
  34. package/crew/team/subagent-roles.ts +105 -87
  35. package/crew/team/types.ts +50 -50
  36. package/crew/types.ts +194 -194
  37. package/crew/utils/artifacts.ts +57 -62
  38. package/crew/utils/config.ts +158 -156
  39. package/crew/utils/discover.ts +221 -219
  40. package/crew/utils/install.ts +94 -85
  41. package/crew/utils/migrations.ts +126 -0
  42. package/crew/utils/progress.ts +191 -187
  43. package/crew/utils/result.ts +16 -16
  44. package/crew/utils/risk-labels.ts +5 -7
  45. package/crew/utils/task-format.ts +14 -14
  46. package/crew/utils/team-roles.ts +44 -28
  47. package/crew/utils/truncate.ts +76 -79
  48. package/crew/utils/verdict.ts +55 -55
  49. package/editor-binary.ts +150 -0
  50. package/editor-command.ts +107 -0
  51. package/editor-target.ts +40 -0
  52. package/feed.ts +321 -268
  53. package/handlers.ts +1041 -1107
  54. package/index.ts +1314 -1206
  55. package/install.mjs +187 -189
  56. package/lib.ts +587 -467
  57. package/overlay-actions.ts +519 -511
  58. package/overlay-coordinator.ts +150 -150
  59. package/overlay-render.ts +770 -676
  60. package/overlay.ts +872 -830
  61. package/package.json +64 -60
  62. package/paths.ts +60 -0
  63. package/skills/pi-messenger-crew/SKILL.md +375 -347
  64. package/store.ts +1147 -1139
  65. package/teamagent-command.ts +321 -0
  66. package/vitest.config.ts +10 -10
package/CHANGELOG.md CHANGED
@@ -1,676 +1,741 @@
1
- # Changelog
2
-
3
- ## [Unreleased]
4
-
5
- ## [0.15.1] - 2026-08-23
6
-
7
- ### Highlights
8
- - Resuming a session is more reliable when older or malformed agent messages are present.
9
- - Crew planning is less likely to create duplicate task lists from repeated planning runs.
10
- - Crew reviews now look at the task branch, so reviewers see the work they are meant to review.
11
- - Auto-review no longer spends time on tasks that are already blocked or marked as duplicates.
12
-
13
- ### Fixed
14
- - Render malformed persisted agent messages and normalize inbound mail that uses `message` and `ts`, fixing session resume crashes. Thanks to [@rioxiaoliliang](https://github.com/rioxiaoliliang) for #29.
15
- - Prevent duplicate Crew task sets when planning runs overlap or repeat.
16
- - Review task branches instead of the main checkout so Crew reviewers inspect the intended changes.
17
- - Skip auto-review for blocked or duplicate Crew tasks. Thanks to [@selimdizer](https://github.com/selimdizer) for #30.
18
-
19
- ## [0.15.0] - 2026-07-30
20
-
21
- ### Added
22
- - Added an optional Team layer with reusable profiles, project charter/memory, role-aware tasks, approval gates, worker context, and overlay signals.
23
- - Added `team.setup` for first-run Team setup with profile activation, starter charter creation, and next-step guidance.
24
- - Surfaced rejected approval-gated tasks separately with `task.revise` / `task.revise-tree` guidance.
25
-
26
- ### Fixed
27
- - Migrated extension tool schemas from `@sinclair/typebox` to `typebox` 1.x and updated the local test/tsconfig references to the new package entry.
28
- - Guarded status heartbeat updates against stale pi session contexts after reloads or session replacement while preserving non-stale errors, fixing #26, #25, and #18. Thanks to Kire Howard (`MatrixJockey`), `MartinMayday`, and Hydro (`HydroToxin`) for the reports, and to Riwut Libinuko (`cakriwut`) for #19.
29
- - Excluded the orchestrator-only `pi-messenger-crew` skill from worker prompts to avoid irrelevant skill loading during Crew task execution. Thanks to Varun Maliwal (`vmaliwal`) for #15.
30
- - Fixed auto-opened Crew overlays after planning to use the live session cwd.
31
- - Restored `.js` extension path handling in Crew worker and lobby tool configuration.
32
- - Made enum schemas load under typebox compatibility shims that do not expose `Type.Unsafe`, fixing #23. Thanks to David Moshal (`davidmoshal`) for #24.
33
- - Enforced `crew.concurrency.max` in overlay-driven worker spawning paths. Thanks to Martin Hátaš (`MartinHatas`) for #17.
34
- - Prevented the legacy `npx pi-messenger` installer from creating a duplicate extension copy when the native `pi install npm:pi-messenger` package flow is already configured, fixing #22. Thanks to David Moshal (`davidmoshal`) for the report.
35
- - Crew planner, worker, reviewer, analyst, lobby, and revision agents now fall back to the host session model when no task, request, role, or config model override is set, fixing #20. Thanks to Velinus (`velinussage`) for the report.
36
- - Crew subprocess launches use `pi.cmd` on Windows and task reset paths now refuse active workers before making tasks startable again, addressing #11. Thanks to Logan Laughlin (`llaughlin`) for the report.
37
- - Compacted streaming `message_update` artifacts and stopped retaining every parsed event in memory, fixing the transcript amplification in #27. Thanks to Hugo Ruíz (`hugotown`) and `aeturnal` for the measurements, and to `suse-coder` (#13) and Tom (`monotykamary`) (#4) for the earlier reports of the resulting stalls and jank.
38
- - Crew subprocesses now fail fast on terminal provider usage/quota/auth 4xx JSON events instead of waiting through retry loops, fixing #21. Thanks to Velinus (`velinussage`) for the report.
39
-
40
- ### Changed
41
- - `readFeedEvents` now reads only a bounded tail of `feed.jsonl` in backward 64KB chunks instead of parsing the whole file, making overlay feed reads on large histories dramatically faster (~1,800x on a 100k-event feed). Non-positive limits now return no events.
42
- - Overlay rendering, auto-spawn/refill checks, and stuck-agent heartbeats now reuse a single Crew task snapshot per frame instead of rescanning the task directory per section, roughly quadrupling render-helper throughput on large task lists.
43
- - Aligned Team built-in roles and sample profiles with the packaged `pi-subagents` role vocabulary while keeping Crew as the execution engine.
44
- - Moved pi core packages and `typebox` to peer dependencies for packaged installs.
45
-
46
- ## [0.14.1] - 2026-04-04
47
-
48
- ### Changed
49
- - Added a `promptSnippet` for `pi_messenger` so Pi 0.59+ includes it in the default tool prompt section and reliably surfaces Crew/coordination workflows.
50
-
51
- ## [0.14.0] - 2026-04-03
52
-
53
- ### Added
54
- - **`leave` action** — `pi_messenger({ action: "leave" })` now lets the current session leave the mesh without restarting pi. It releases reservations, auto-unclaims the session's active swarm claim, closes the messenger overlay, and allows later rejoin from the same session.
55
-
56
- ### Fixed
57
- - **Leave guardrails for Crew state** — `leave` now refuses while project planning, autonomous work, or session-owned in-progress Crew tasks are still active, preventing stranded coordination state.
58
- - **Immutable-session cwd handling** — Registration, folder scoping, auto-register path matching, and messenger context now follow the live session cwd after pi runtime/session replacement instead of relying on `process.cwd()`.
59
-
60
- ## [0.13.2] - 2026-03-19
61
-
62
- ### Added
63
- - **`work.stop` action** — `pi_messenger({ action: "work.stop" })` now stops autonomous Crew work for the current project and persists the stop state.
64
- - **Autonomous guard coverage tests** — Added targeted tests for `work.stop` routing and `agent_end` autonomous continuation guard behavior.
65
-
66
- ### Fixed
67
- - **Autonomous continuation retry loop guard** — Autonomous Crew mode now stops itself after repeated identical `crew_continue` retries without wave progress (for example when steer turns keep aborting). The extension persists the stopped state and emits a warning instead of looping indefinitely.
68
- - **Persisted autonomous stop state from index-level stop paths** — `max waves` and `no ready tasks` stop paths now append `crew-state` so restored sessions do not revive stale active autonomous state.
69
- - **Autonomous continuation no longer runs in unregistered sessions** — If Crew autonomous state is restored but the current session is not joined to pi-messenger, the extension now stops autonomous mode and persists that stop instead of emitting repeated continuation steer messages that cannot execute.
70
- - **Autonomous continuation now runs only in orchestrator sessions** — Worker and lobby processes (`PI_CREW_WORKER`/`PI_LOBBY_ID`) now skip `agent_end` continuation emission to prevent repeated duplicate `crew_continue` steer loops from non-orchestrator agents.
71
- - **Autonomous continuation is now cwd-scoped** — `agent_end` continuation now requires the session cwd to match the active autonomous cwd (`isAutonomousForCwd`), preventing stale autonomous state from unrelated projects from triggering unexpected `crew_continue` messages.
72
- - **Autonomous state restore now validates owner process** — Restored active autonomous state now requires a live owner PID matching the current process; missing/dead/foreign ownership is treated as stale and auto-stopped to avoid unexpected continuation after session restore.
73
- - **Runtime artifact commit noise** — Added `.pi/` to `.gitignore` to avoid accidentally committing runtime files like feed artifacts.
74
-
75
- ## [0.13.1] - 2026-03-14
76
-
77
- ### Added
78
- - **Auto-review after task completion** — Workers' completed tasks now get an automatic reviewer pass before being counted as done. Controlled by existing `config.review.enabled` (default: true) and `config.review.maxIterations` (default: 3). SHIP keeps the task done, NEEDS_WORK resets it to todo for retry with review feedback injected into the next worker's prompt, MAJOR_RETHINK blocks the task. Reviews run sequentially between worker completion and wave result reporting, and respect the abort signal. Adds `review_count` to the Task interface and `task.review` to the activity feed.
79
-
80
- ## [0.13.0] - 2026-03-02
81
-
82
- ### Added
83
- - **Dynamic skill loading for crew workers** — Workers can now acquire domain-specific knowledge on demand during task execution. A three-tier discovery system scans user skills (`~/.pi/agent/skills/`), extension skills (`crew/skills/`), and project skills (`.pi/messenger/crew/skills/`) to build a skill catalog. The planner sees the catalog and can tag tasks with relevant skill names. Workers see tagged skills as "Recommended" in their prompt alongside the full catalog, and load what they need via `read()` — zero upfront token cost, no config changes. Project-level skills override extension, which override user, matching the agent override pattern. When no skills are configured, prompts are unchanged.
84
-
85
- ### Fixed
86
- - **Artifact dir creation** — `writeArtifact`, `writeMetadata`, and `appendJsonl` now create parent directories on demand. Fixes ENOENT on first `plan` run.
87
- - **Multiline feed sanitization** — Feed events with embedded newlines no longer corrupt the TUI overlay layout.
88
- - **Config model override** — `crew.models` config now actually overrides agent defaults. Priority: task override > config > agent frontmatter.
89
-
90
- ## [0.12.1] - 2026-02-22
91
-
92
- ### Fixed
93
- - **Wrong model resolved for `provider/model` format** - Worker spawn passed `--model zai/glm-5` as a single flag, which pi's model resolver matched as a literal model ID under `vercel-ai-gateway` instead of interpreting `zai` as the provider. Now splits `provider/model` into separate `--provider` and `--model` flags, matching the intended provider. Affects both task workers and lobby workers.
94
-
95
- ## [0.12.0] - 2026-02-21
96
-
97
- ### Added
98
- - **Thinking level support** - Agents support `thinking: <level>` in frontmatter (off, minimal, low, medium, high, xhigh). Config `thinking.<role>` overrides per-agent frontmatter. Applied via `--thinking` flag to spawned processes.
99
- - **Advisory dependencies** - Dependencies are now informational context, not scheduling blockers. All `todo` tasks are eligible for assignment regardless of dependency status. Workers see dependency completion state (done/in-progress/not started) in their prompt and coordinate via reservations and DMs. Configurable via `dependencies` config (`"advisory"` default, `"strict"` for blocking mode). Transitive dependencies pruned from plans automatically.
100
- - **Auto-work on plan completion** - Planning automatically starts autonomous work when tasks are created (default behavior). Pass `autoWork: false` to review the plan first. A steer message triggers the LLM to call `work { autonomous: true }` on its next turn.
101
- - **Continuous worker refill** - Overlay automatically spawns replacement workers when tasks complete, maintaining concurrency up to the configured limit throughout execution.
102
- - **Prompt-based planning** - `plan` action accepts an inline `prompt` parameter as the spec when no PRD file is available. The planner breaks down arbitrary requests into parallel tasks the same way it handles PRD files.
103
- - **Live feed with flash notifications** - Feed tracks last-seen timestamp and highlights new events. Significant events (task completions, messages, plan changes) trigger flash notifications in the status bar.
104
- - **Task revision** - `[p]` revises a single task's spec via the planner. `[P]` revises an entire subtree (target + transitive dependents), preserving done tasks and resetting revisable ones to `todo`. Re-plan with steering prompt injects user guidance into the planning-progress.md Notes section.
105
- - **Chat UX redesign** - Global `[m]` key activates chat input from any overlay state (vim-style command mode). Plain text broadcasts to all peers; `@name message` sends DMs. Tab autocompletes agent names after `@` (Shift+Tab cycles backwards). Feed gets 60/40 space allocation when workers active. `[f]` toggles feed-focus mode (tasks compress to 2-line summary). Visual improvements: system events dimmed, colored agent names, separator dots between groups.
106
- - **Auto-dismiss on completion** - Overlay auto-closes with snapshot handover 3 seconds after all tasks complete. Only triggers when the overlay witnessed tasks in progress. Any keypress cancels.
107
- - **Worker coordination & chatter** - Workers receive environmental context (concurrent tasks, dependency summaries, recent feed, ready tasks) and coordination instructions. Four configurable levels (`none`|`minimal`|`moderate`|`chatty`, default: `chatty`) control verbosity. At `chatty`, workers DM peers and broadcast announcements, creating a chat-room effect in the overlay. New `coordination` config field.
108
- - **Lobby workers** - `+` spawns workers: assigns ready tasks directly when available, otherwise pre-spawns idle lobby workers that join the mesh and chat. Lobby workers receive task assignments via steer message when tasks become available. Token budgets per coordination level cap spending while idle.
109
- - **Auto-spawn on plan completion** - Workers auto-spawn when planning finishes and ready tasks exist. Lobby workers assigned first, then fresh workers up to concurrency limit.
110
- - **TUI coordination level control** - `[v]` cycles coordination level at runtime (`chatty` → `none` → `minimal` → `moderate`).
111
- - **Configurable `concurrency.max`** - Crew config field (default: 10) lets the user lower the worker ceiling. `+`/`-` keys respect the configured max.
112
- - **Stuck task UX** - `[q]` Stop works on any `in_progress` task, not just those with live workers. `[s]` Start rejects when the agent is already busy. Detail view shows "Worker not running" warning for orphaned tasks.
113
- - **Chatter mitigation** - Per-worker outgoing message rate limiting via `messageBudgets` config. Coordination level and per-worker token count displayed in overlay header.
114
- - **Broadcast filtering** - Worker broadcasts now go to the feed only (no inbox delivery, no LLM turn interrupts). Eliminates O(N^2) token cascades between workers. DMs, user broadcasts, and planner broadcasts still deliver to inboxes in real-time. Detection via `PI_CREW_WORKER` env var set at spawn time. Worker name consistency also fixed in `agents.ts` via `PI_AGENT_NAME`.
115
- - **Worker exit feed notifications** - Lobby workers that exit without a task assignment now appear as `leave` events in the feed.
116
- - **2026-02-12 Overlay redesign** - Replaced tabbed `/messenger` UI with a unified crew dashboard layout (status, workers, tasks, feed, agents row, legend), added `Ctrl+T` snapshot transfer, `Ctrl+B` background/reattach support, empty-state system diagnostics, and inline `@all` / `@name` messaging in the overlay input flow.
117
- - **Task progress system** - Added per-task append-only progress logs (`tasks/task-N.progress.md`) with `task.progress`, system auto-entries (assignment, review verdicts, shutdown resets, crash/failure outcomes), and retry-context injection in worker prompts.
118
- - **Interactive Crew task manager** - Crew overlay now supports list/detail modes, task actions (reset/cascade-reset/unblock/start/block/delete), in-overlay confirmations, block-reason input, live worker messaging, context-aware key hints, and transient success/failure notifications.
119
- - **Live worker concurrency adjustment** - In the Crew overlay, `+`/`-` now adjusts worker concurrency live during execution (clamped to 1-10).
120
- - **Auto-open overlay on autonomous work** - The Crew overlay now opens automatically when autonomous mode starts, showing live worker progress without requiring `/messenger`. Configurable via `autoOverlay` (default: `true`). Escape dismisses; won't reopen until a new autonomous session.
121
- - **Auto-open overlay on planning work** - The Crew overlay now opens automatically when planning starts and when an in-progress planning run is restored on session start/switch/fork/tree. Configurable via `autoOverlayPlanning` (default: `true`). Uses per-run planning IDs to avoid reopen loops within the same run after dismissal.
122
- - **Task splitting** - New `task.split` action supports an inspect phase (returns spec/progress/deps/dependents) and an execute phase that creates subtasks, rewires downstream dependencies, converts the parent to a milestone, and auto-completes milestones when all subtasks are done. Milestones can't be started manually and are never dispatched to workers.
123
- - **Planning observability state** - Added first-class planning run state with pass/phase tracking and persistence at `.pi/messenger/crew/planning-state.json`. Status, Crew UI, and feed now expose planning progress (`plan.start`, `plan.pass.*`, `plan.review.*`, `plan.done`, `plan.failed`) so long planning runs are visible by default. Planning runs with no updates for 5 minutes are flagged as stalled in status and Crew UI, with periodic refresh so stalls surface without requiring user interaction.
124
- - **Planning cwd normalization** - Planning state now canonicalizes project paths (realpath) and compares by canonical path, fixing false negatives when sessions use `/tmp/...` while persisted state resolves to `/private/tmp/...`.
125
- - **Structured planning outline** - Planner prompts now require ordered sections (PRD understanding, reviewed resources, sequential steps, parallel task graph). Latest structured output is persisted to `.pi/messenger/crew/planning-outline.md` for audit/review.
126
-
127
- - **Lobby worker keep-alive** - Lobby workers now survive the full planning phase via a file-based keep-alive signal. The orchestrator creates a `.alive` file per lobby worker; the worker's `turn_end` hook checks the file and injects a minimal steer message to prevent the session from exiting. File is deleted on task assignment, planning completion, or shutdown. ~25 tokens per keep-alive cycle.
128
- - **`prompt` tool parameter** - The `prompt` parameter (used by `plan` and `task.revise`/`task.revise-tree`) is now declared in the tool schema so LLMs can discover it without the skill loaded.
129
- - **Dynamic overlay width** - Overlay adapts to terminal width (clamped 40-100) instead of a fixed size. Fits half-width and quarter-width windows on smaller screens.
130
- - **Live coordination level display** - Status bar hints now show the actual coordination level (`v:chatty`, `v:none`, etc.) instead of the opaque `v:Coord` label.
131
-
132
- ### Changed
133
- - **Default `planning.maxPasses` reduced to 1** - Single-pass planning is now the default. Multi-pass planning with reviewer feedback is still available by setting `planning.maxPasses` in user or project config.
134
- - **Structural cleanup** - Extracted `crew/prompt.ts` (worker prompt builder), `crew/spawn.ts` (shared spawn logic), `crew/registry.ts` (unified worker registry replacing separate maps in agents.ts and lobby.ts). Split `crew/state.ts` into `state-autonomous.ts` and `state-planning.ts` with a barrel re-export.
135
- - **Crew agent locality** - Crew agents are now discovered from extension-local `crew/agents/` plus project overrides in `.pi/messenger/crew/agents/`. Removed auto-install/update copy machinery and converted `crew.install` / `--crew-install` to informational commands.
136
-
137
- ### Removed
138
- - **Legacy key-based routing** - Removed the `join`, `claim`, `unclaim`, `complete`, `swarm`, `list`, `rename`, `reserve`, `release`, and `broadcast` tool parameters and the legacy routing block in `index.ts` that duplicated `crew/index.ts` action-based routing. All callers should use `action`-based syntax (e.g., `{ action: "join" }` instead of `{ join: true }`).
139
- - **Interview handler** - Removed `crew/handlers/interview.ts`, `crew-interview-generator.md` agent, and the `interview` action. The feature spawned an LLM to generate questions for the user but never worked (got stuck). Agent moved to deprecated list for cleanup on existing installs.
140
-
141
- ### Fixed
142
- - **Overlay rendering corruption from multi-line bash args** - `extractArgsPreview` returned raw bash `command` strings containing newlines (comments, `&&` chains, heredocs). These embedded newlines broke overlay rows, cascading layout corruption through the workers section, task list, and feed. Newlines are now collapsed to spaces at the extraction point.
143
- - **Fire-and-forget dynamic import in `task-actions.ts`** - `killWorkerByTask` was imported via `import("./registry.js").then(...)` which swallowed errors silently. Replaced with a static import since no circular dependency exists.
144
- - **Stale legacy syntax in user-facing strings** - Five handler/index strings still referenced removed `{ join: true }` / `{ list: true }` / `{ to: "..." }` syntax. Updated to action-based equivalents.
145
- - **SIGKILL escalation never fired** - After `proc.kill("SIGTERM")`, Node.js immediately sets `proc.killed = true`. Both `killWorkerByTask` and `runAgent` graceful shutdown checked `!proc.killed` before escalating to SIGKILL, which was always false. Workers ignoring SIGTERM could hang indefinitely. Now checks only `exitCode === null`.
146
- - **Lobby worker assignment zombie state** - State was mutated before the disk write, so a failed write left the worker permanently marked as assigned but invisible to future assignment. Reordered to write first, mutate on success.
147
- - **Lobby assignment race in work handler** - If a lobby worker exited between availability check and assignment, the task got stuck as `in_progress` with no worker. Added return value check with rollback.
148
- - **Autonomous state checks not cwd-scoped** - Auto-dismiss, snapshot generation, and revision guards used a global flag instead of per-project checks, blocking operations for unrelated projects.
149
- - **Task flicker from lobby worker spawn** - Orchestrator and worker generated independent random names so `assigned_to` never matched. Task was also pre-set to `in_progress` but the worker expected `todo`. Fixed name propagation via env var, made `task.start` idempotent for the assigned agent, and added ownership guards in close handlers.
150
- - **`[q]` Stop couldn't kill lobby-spawned workers** - Stop only checked one worker registry. Lobby workers are tracked separately and now have their own kill path.
151
- - **Double-formatted message previews** - Overlay stored pre-formatted previews that the display layer formatted again. Now stores raw text; preview limit raised from 60 to 200 chars.
152
- - **Stale workersHeight in trim loop** - Worker-line overflow trimming used a pre-computed height, causing over-trim to 0 workers on small terminals.
153
- - **Artifact I/O crash** - Uncaught exceptions in child process event handlers crashed pi. Wrapped all artifact writes with try/catch.
154
- - **Input field scrolling** - Text was clipped at the field edge instead of scrolling to keep the cursor visible.
155
- - **Session shutdown orphans** - Workers now killed at the top of session shutdown, preventing orphan processes.
156
- - **Task list blank line padding** - Task list no longer pads with empty lines. Surplus space goes to the feed.
157
- - **`getLobbyWorkerCount` counted dead workers** - Registry function didn't filter exited processes, inflating the "N in lobby" status bar count.
158
- - **`models.analyst` config was dead** - Config type and docs existed but `interview.ts` and `sync.ts` never read it. Now wired to both analyst handler call sites.
159
-
160
- ## [0.11.0] - 2026-02-08
161
-
162
- ### Added
163
- - **Test suite** — 53 tests across 7 Vitest suites covering store CRUD, state machine, config merging, agent discovery, model resolution, graceful shutdown, and live progress (including cwd isolation). Includes test helpers for temp directories and mock contexts.
164
- - **Per-agent runtime config** — Model override with 4-level priority: per-task > per-wave `model` param > config `crew.models.worker` > agent `.md` frontmatter. Environment variable override via `crew.work.env` config (not exposed as tool param to prevent API keys in logs).
165
- - **Graceful shutdown** — `AbortSignal` threaded from tool execute through to spawned workers. On abort: discovers worker name via PID-based registry scan, writes shutdown message to worker inbox, waits 30s grace period, SIGTERM, waits 5s, SIGKILL. Tasks reset to `todo` for retry. Workers instructed to release reservations and exit without committing.
166
- - **Live crew progress** — In-memory pub/sub store fed by worker JSONL events. Overlay Crew tab shows Active Workers section with tool name, call count, tokens, and elapsed time updating every second. Status bar shows active worker count during autonomous mode (`🔨N`).
167
- - **`shutdownGracePeriodMs` config** — Configurable grace period before SIGTERM (default: 30000).
168
-
169
- ### Changed
170
- - **Dynamic overlay height** — Content area scales with terminal size (8-25 lines) instead of hardcoded 10. On a standard 24-row terminal, visible content goes from 10 to 15 lines.
171
- - **Handler signatures simplified** — Removed unused `state` and `dirs` parameters from plan and review handlers.
172
-
173
- ### Fixed
174
- - **`deepMerge` crash** — Merging config with `models` key crashed when the target didn't have the key. Hardened for undefined target keys.
175
- - **Result/task association** — Worker results now matched by `taskId` field instead of array index, since `spawnAgents` returns in completion order not submission order.
176
-
177
- ### Removed
178
- - `attemptsPerTask` field from `AutonomousState` — declared but never populated by any code.
179
- - `ARCHITECTURE.md` from repo (moved to external docs).
180
-
181
- ## [0.10.0] - 2026-02-05
182
-
183
- ### Fixed
184
- - **Crew spawner applies agent definitions** — Spawned crew workers now receive the agent's system prompt (`--append-system-prompt`), tool restrictions (`--tools`), and model override from their `.md` definitions. Previously a phantom `--agent` flag was passed that pi-core silently ignored, the agent name leaked into the prompt as noise, and the system prompts (worker's 6-phase protocol, reviewer's rubric, planner's exploration workflow) were never delivered. Tool restrictions also take effect: reviewers and interview generators are now limited to `read,bash` instead of getting all default builtins including `write` and `edit`.
185
- - **Crew spawner session cleanup** — Spawned workers now pass `--no-session` to avoid writing ephemeral session files to disk.
186
-
187
- ### Added
188
- - **`--crew-install` / `--crew-uninstall` CLI flags** — `npx pi-messenger --crew-install` copies crew agent `.md` files and the `pi-messenger-crew` skill to user directories. `--crew-uninstall` removes them. Reads from the npm package (not the installed extension) to avoid version skew.
189
-
190
- ### Changed
191
- - **README rewrite** — Installation section now shows real CLI commands instead of tool-call syntax. "How It Works" section explains pi extension API hooks (`pi.on()`, `pi.sendMessage()`, `{ block: true }`, `ctx.ui.custom()`) instead of listing directory trees.
192
-
193
- ## [0.9.0] - 2026-02-05
194
-
195
- ### Added
196
- - **npm publishing** - Package now published to npm. Install with `pi install npm:pi-messenger`.
197
- - **`install.mjs`** - `npx pi-messenger` copies the npm package contents to the extensions directory. No git dependency. Version-pinned to the npm release. `npx pi-messenger --remove` to uninstall.
198
- - `repository`, `homepage`, `bugs` fields in package.json for npm/GitHub integration.
199
- - `bin`, `files` fields in package.json for npm distribution.
200
-
201
- ### Changed
202
- - **Banner image** - README references `banner.png` via absolute GitHub URL (`raw.githubusercontent.com`) instead of relative path, so it renders on both GitHub and npmjs.com without shipping the 1.1MB image in the npm package.
203
- - **Install section** - README now documents `pi install npm:pi-messenger` as the primary install method.
204
-
205
- ## [0.8.2] - 2026-02-01
206
-
207
- ### Fixed
208
- - Adapt execute signature to pi v0.51.0: reorder signal, onUpdate, ctx parameters
209
-
210
- ## [0.8.1] - 2026-01-30
211
-
212
- ### Changed
213
- - **Parallelism-aware planning** - Planner prompt now includes a dedicated Parallel Execution section teaching DAG thinking, independent work streams, critical path minimization, and real data flow dependencies. Plans should produce wider dependency graphs with more concurrent waves instead of linear chains.
214
- - **Parallelism-aware review** - Both the automated planning loop reviewer and the manual plan review (`action: "review"`) now evaluate plans for unnecessary sequential dependencies and critical path length.
215
- - PRD truncation applied consistently to both explicit `prd` parameter and auto-discovered PRD files (100KB limit).
216
-
217
- ### Fixed
218
- - Stale README agent list referenced removed "analysts" instead of the actual 5 agents.
219
-
220
- ## [0.8.0] - 2026-01-30
221
-
222
- ### Added
223
- - **Planning progress file** - `.pi/messenger/crew/planning-progress.md` accumulates planner findings and reviewer feedback across passes and runs. Persists through plan deletions. User-editable: add steering notes that the planner reads on every run.
224
- - `planning.maxPasses` config option (default: 3). Set to 1 for single-pass behavior.
225
- - JSON task block parsing (`tasks-json` fenced block) as the primary task extraction path, with the existing markdown regex as fallback.
226
- - Shared verdict parser (`crew/utils/verdict.ts`) used by both review and planning handlers.
227
-
228
- ### Changed
229
- - **Planning redesign: single planner agent** - Replaced the 5-scout + gap-analyst pipeline (6 LLM sessions) with a single `crew-planner` agent that explores the codebase iteratively in one session. Cheaper, faster, no information loss from truncation handoffs. Crew agent count: 10 to 5.
230
- - **Iterative planning with review** - Planner runs in a multi-pass loop with reviewer feedback until SHIP verdict or `maxPasses` reached. Falls back gracefully on reviewer/planner failures.
231
- - Deprecated scout and gap-analyst agent files auto-cleaned from `~/.pi/agent/agents/` on first use.
232
-
233
- ### Removed
234
- - 5 scout agents (`crew-repo-scout`, `crew-practice-scout`, `crew-docs-scout`, `crew-web-scout`, `crew-github-scout`) and `crew-gap-analyst`.
235
- - `concurrency.scouts` and `truncation.scouts` config options (replaced by `truncation.planners`).
236
-
237
- ## [0.7.4] - 2026-01-29
238
-
239
- ### Added
240
- - **Living Presence** - Agents now have rich status indicators (active, idle, away, stuck) based on activity recency, open tasks, and reservations. Status is computed from `lastActivityAt` with configurable stuck threshold.
241
- - **Activity Feed** - Append-only JSONL feed (`feed.jsonl`) tracks edits, commits, test runs, messages, joins/leaves, and crew task events. Pruned on startup to `feedRetention` limit. New `feed` action to query events.
242
- - **Tool & Token Tracking** - Each agent's session tracks tool call count and cumulative token usage, visible in `list`, `whois`, and the overlay.
243
- - **Auto Status** - Agents generate contextual status messages from recent activity: "on fire" after rapid edits, "debugging..." after repeated test runs, "just shipped" after a commit, "exploring the codebase" while reading files.
244
- - **Stuck Detection** - Agents idle beyond `stuckThreshold` with an open task or reservation are flagged as stuck. Peers with a UI receive a notification. A `stuck` event is logged to the feed.
245
- - **Name Themes** - Five name generation themes: `default` (SwiftRaven), `nature` (OakTree), `space` (LunarDust), `minimal` (Alpha), and `custom` with user-supplied word lists.
246
- - **`whois` action** - Detailed agent info: status, model, branch, session age, tool calls, tokens, reservations, recent files, swarm claims.
247
- - **`set_status` action** - Set or clear a custom status message. Overrides auto-status until cleared.
248
- - **`feed` action** - Query the activity feed with configurable `limit`.
249
- - **Overlay: agent cards** - The Agents tab now renders full presence cards with status indicator, current activity, tool/token counts, reservations, and status messages.
250
- - **Overlay: activity feed section** - Below agent cards, recent feed events are displayed in a compact time-prefixed format.
251
- - **Overlay: chat input** - Type `@Name msg` for DMs, `@all msg` for broadcasts. Plain text broadcasts from the Agents tab or DMs from an agent's tab.
252
- - **Crew events in feed** - Task starts, completions, and blocks appear in the activity feed with a `[Crew]` prefix. Controlled by `crewEventsInFeed` config.
253
- - **New config options** - `nameTheme`, `nameWords`, `feedRetention`, `stuckThreshold`, `stuckNotify`, `autoStatus`, `crewEventsInFeed`.
254
-
255
- ### Fixed
256
- - **Self-whois missing Model and Branch lines** - `buildSelfRegistration` returned `model: ""` and omitted `gitBranch`/`spec`, so self-whois skipped the Model and Branch lines that peers could see. Added `model` to `MessengerState`, populated during registration and updates, and included all three fields in self-representation.
257
- - **Rename desync: stale session time and activity** - `renameAgent` wrote fresh `startedAt` and `lastActivityAt` to disk but didn't update the in-memory state. The next registry flush would overwrite the disk's fresh values with stale ones, making the agent appear idle for the entire pre-rename session duration. Self-whois also showed a different session age than peer-whois.
258
- - **Orphaned comma in crew status "In Progress" formatting** - When a task had no `assigned_to` but `attempt_count > 1`, the output produced a leading comma. Rewrote to build suffix parts as an array and join conditionally.
259
- - **Blocked reason unconditional "..." truncation** - Crew status always appended "..." to `blocked_reason` regardless of length, so "API timeout" displayed as "API timeout...". Now only truncates when the reason exceeds 40 characters.
260
- - **`agentHasTask` duplicated 4 times** - Identical logic checking swarm claims + crew tasks existed in `handlers.ts` (2 places), `index.ts`, and `overlay.ts`. Extracted to a shared pure function in `lib.ts`. Eliminates divergence risk (the crew tasks check was already missing from some copies).
261
- - **Dead code in `executeRelease`** - Removed redundant `before` variable and `releasedCount` computation, replaced with direct `releasedPatterns.length`.
262
-
263
- ## [0.7.3] - 2026-01-27
264
-
265
- ### Fixed
266
- - Google API compatibility: Use `StringEnum` for string literal unions (`type`, `autoRegisterPath`) and `Type.Any()` for mixed-type unions (`to`, `release`) to avoid unsupported `anyOf`/`const` JSON Schema patterns
267
-
268
- ## 0.7.2 - 2026-01-26
269
-
270
- ### Changed
271
- - Added `pi-package` keyword for npm discoverability (pi v0.50.0 package system)
272
-
273
- ## 0.7.1 - 2026-01-24
274
-
275
- ### Added
276
-
277
- - **Skill installation** - `crew.install` now installs `pi-messenger-crew` skill alongside agents
278
- - **Skills directory** - Extension ships skills in `skills/` (moved from `crew/skills/`)
279
- - **README documentation** - Added "Crew Install" section explaining what gets installed
280
-
281
- ### Fixed
282
-
283
- - **Worker pi_messenger access** - Spawned workers now receive `--extension` flag, giving them access to `pi_messenger` tool for mesh coordination, file reservations, and sibling messaging
284
-
285
- ### Changed
286
-
287
- - `crew.install` output now lists both agents and skills
288
- - `crew.uninstall` removes both agents and skills
289
-
290
- ## 0.7.0 - 2026-01-23
291
-
292
- ### Breaking Changes
293
-
294
- **Epic System Removed** - Crew has been simplified to a PRD-based workflow:
295
-
296
- | Before | After |
297
- |--------|-------|
298
- | PRD → epic.create → plan epic → work on epic | PRD → plan → work → done |
299
- | Task IDs: `c-1-abc.1`, `c-1-abc.2` | Task IDs: `task-1`, `task-2` |
300
- | `target: "c-1-abc"` (epic ID) required | No target needed - works on current plan |
301
-
302
- ### Removed
303
-
304
- - **Epic actions** - `epic.create`, `epic.show`, `epic.list`, `epic.close`, `epic.set_spec`
305
- - **Checkpoint actions** - `checkpoint.save`, `checkpoint.restore`, `checkpoint.delete`, `checkpoint.list`
306
- - **Epic validation** - `crew.validate` now validates the plan, not an epic
307
- - **Epic-scoped task operations** - `task.ready` and `task.list` no longer require `epic` parameter
308
- - **Files deleted:**
309
- - `crew/handlers/epic.ts` (~285 lines)
310
- - `crew/handlers/checkpoint.ts` (~190 lines)
311
- - Epic CRUD functions from `crew/store.ts` (~100 lines)
312
-
313
- ### Changed
314
-
315
- - **`plan` action** - Now takes `prd` parameter instead of `target`:
316
- ```typescript
317
- // Before
318
- pi_messenger({ action: "plan", target: "c-1-abc" })
319
-
320
- // After
321
- pi_messenger({ action: "plan" }) // Auto-discover PRD
322
- pi_messenger({ action: "plan", prd: "docs/PRD.md" }) // Explicit path
323
- ```
324
-
325
- - **`work` action** - No longer requires target:
326
- ```typescript
327
- // Before
328
- pi_messenger({ action: "work", target: "c-1-abc" })
329
-
330
- // After
331
- pi_messenger({ action: "work" }) // Work on current plan
332
- pi_messenger({ action: "work", autonomous: true }) // Autonomous mode
333
- ```
334
-
335
- - **`status` action** - Now shows plan progress instead of epic list
336
-
337
- - **Task IDs** - Simplified from `c-N-xxx.M` to `task-N`:
338
- ```typescript
339
- // Before
340
- pi_messenger({ action: "task.show", id: "c-1-abc.1" })
341
-
342
- // After
343
- pi_messenger({ action: "task.show", id: "task-1" })
344
- ```
345
-
346
- - **Crew overlay** - Now shows flat task list under PRD name (no epic grouping)
347
-
348
- ### Storage
349
-
350
- New simplified storage structure:
351
- ```
352
- .pi/messenger/crew/
353
- ├── plan.json # Plan metadata (PRD path, progress)
354
- ├── plan.md # Gap analyst output
355
- ├── tasks/
356
- │ ├── task-1.json # Task metadata
357
- │ ├── task-1.md # Task spec
358
- │ └── ...
359
- ├── artifacts/ # Unchanged
360
- └── config.json # Unchanged
361
- ```
362
-
363
- ### Benefits
364
-
365
- 1. **Simpler mental model** - PRD → Tasks → Done
366
- 2. **Less API surface** - 9 fewer actions to learn
367
- 3. **Cleaner IDs** - `task-1` instead of `c-1-abc.1`
368
- 4. **PRD is the spec** - No redundant epic spec
369
- 5. **Faster onboarding** - Fewer concepts to explain
370
- 6. **~475 lines removed** - Smaller, more maintainable codebase
371
-
372
- ---
373
-
374
- ## 0.6.3 - 2026-01-23
375
-
376
- ### Changed
377
-
378
- - **Crew agent model assignments** - Optimized for cost and capability:
379
- - Scouts (deep): `claude-opus-4-5` - repo-scout, github-scout, practice-scout
380
- - Scouts (fast): `claude-haiku-4-5` - docs-scout, web-scout
381
- - Analysts: `claude-opus-4-5` - gap-analyst, interview-generator, plan-sync
382
- - Worker: `claude-opus-4-5` - quality code generation
383
- - Reviewer: `openai/gpt-5.2-high` - diverse perspective for review
384
-
385
- - **Streamlined scout roster** - Reduced from 7 to 5 focused scouts:
386
- - Removed: `crew-memory-scout` (memory system not implemented)
387
- - Removed: `crew-epic-scout` (only useful for multi-epic projects)
388
- - Removed: `crew-docs-gap-scout` (merged into gap-analyst)
389
- - Renamed: `crew-github-scout` → `crew-web-scout` (web search focus)
390
- - New: `crew-github-scout` (gh CLI integration, sparse checkouts)
391
-
392
- ### Added
393
-
394
- - **PRD auto-discovery** - Plan handler now finds and includes PRD/spec files:
395
- - Searches: `PRD.md`, `SPEC.md`, `REQUIREMENTS.md`, `DESIGN.md`, `PLAN.md`
396
- - Also checks `docs/` subdirectory
397
- - Content included in all scout prompts (up to 50KB)
398
-
399
- - **Review feedback loop** - Workers see previous review feedback on retry:
400
- - `last_review` field added to Task type
401
- - Review handler stores feedback after each review
402
- - Worker prompt includes issues to fix on retry attempts
403
-
404
- - **Scout skip logic** - web-scout and github-scout assess relevance first:
405
- - Can skip with explanation if not relevant to the feature
406
- - Saves time and API costs for internal/simple features
407
-
408
- - **ARCHITECTURE.md** - New documentation with orchestration flow diagram, model summary, and agent inventory
409
-
410
- ### Fixed
411
-
412
- - Template literal bug in worker prompt (epicId not interpolating)
413
- - Retry detection off-by-one (now correctly shows attempt number)
414
- - Case-insensitive filesystem duplicate PRD reads (uses realpath)
415
- - Wave number tracking in autonomous mode (was off-by-one after addWaveResult)
416
- - CREW_AGENTS list in install.ts (removed deleted agents, added crew-web-scout)
417
- - Corrupted crew-plan-sync.md (had TypeScript code appended)
418
-
419
- ## 0.6.2 - 2026-01-23
420
-
421
- ### Changed
422
-
423
- - Initial crew agent model assignments (superseded by 0.6.3)
424
-
425
- ## 0.6.1 - 2026-01-23
426
-
427
- ### Added
428
-
429
- - **Planning Workflow Documentation** - README now explains how the `plan` action works:
430
- - Diagram showing scouts (parallel) → gap-analyst → tasks with dependencies
431
- - Clarifies that no special format is required for PRDs/specs
432
- - Example of starting from a PRD with `idea: true`
433
-
434
- ## 0.6.0 - 2026-01-23
435
-
436
- ### Added
437
-
438
- **Crew: Task Orchestration** - A complete multi-agent task orchestration system for complex epics.
439
-
440
- - **Epics & Tasks** - Hierarchical work items with dependency tracking
441
- - `epic.create`, `epic.show`, `epic.list`, `epic.close`, `epic.set_spec`
442
- - `task.create`, `task.show`, `task.list`, `task.start`, `task.done`, `task.block`, `task.unblock`, `task.ready`, `task.reset`
443
-
444
- - **Planning** - Automated task breakdown with parallel scouts
445
- - `plan` action runs 7 scout agents in parallel to analyze codebase
446
- - Gap analyst synthesizes findings into task graph with dependencies
447
- - Supports planning from idea (`idea: true`) or existing epic
448
-
449
- - **Work Execution** - Parallel worker spawning with concurrency control
450
- - `work` action executes ready tasks (dependencies satisfied)
451
- - `autonomous: true` flag for continuous wave execution until done/blocked
452
- - Configurable concurrency for scouts (default: 4) and workers (default: 2)
453
- - Auto-blocks tasks after `maxAttemptsPerTask` failures
454
-
455
- - **Code Review** - Automated review with verdicts
456
- - `review` action for implementation (git diff) or plan review
457
- - SHIP / NEEDS_WORK / MAJOR_RETHINK verdicts with detailed feedback
458
-
459
- - **Interview** - Clarification question generation
460
- - `interview` action generates 20-40 deep questions
461
- - Outputs JSON file for pi's interview tool
462
-
463
- - **Sync** - Downstream spec updates
464
- - `sync` action updates dependent task specs after completion
465
-
466
- - **Checkpoints** - State save/restore for recovery
467
- - `checkpoint.save`, `checkpoint.restore`, `checkpoint.delete`, `checkpoint.list`
468
-
469
- - **Status & Maintenance**
470
- - `crew.status` - Overall crew status with progress metrics
471
- - `crew.validate` - Validate epic structure and dependencies
472
- - `crew.agents` - List available crew agents by role
473
- - `crew.install` / `crew.uninstall` - Agent management
474
-
475
- - **Crew Overlay Tab** - Visual epic/task tree in `/messenger` overlay
476
- - Tab bar shows "Crew (N)" with active epic count
477
- - Expand/collapse epics with Enter key
478
- - Status icons: ✓ done, ● in_progress, ○ todo, ✗ blocked
479
- - Shows assigned agent, dependencies, and block reasons
480
- - Autonomous mode status bar: wave number, progress, ready count, timer
481
-
482
- - **12 Crew Agents** - Auto-installed on first use of `plan`, `work`, or `review`
483
- - 7 scouts: repo, practice, docs, github, epic, docs-gap, memory
484
- - Plus: worker, reviewer, gap-analyst, interview-generator, plan-sync
485
-
486
- - **Action-based API** - Consistent `action` parameter pattern
487
- - Example: `pi_messenger({ action: "epic.create", title: "OAuth Login" })`
488
- - 24 new crew actions, 38 total actions through one tool
489
-
490
- ### Storage
491
-
492
- New directory `.pi/messenger/crew/` (per-project):
493
- - `epics/*.json` - Epic metadata
494
- - `specs/*.md` - Epic specifications
495
- - `tasks/*.json` - Task metadata
496
- - `tasks/*.md` - Task specifications
497
- - `blocks/*.md` - Block context for blocked tasks
498
- - `checkpoints/` - Saved state snapshots
499
- - `artifacts/` - Debug artifacts (input/output/jsonl per run)
500
- - `config.json` - Project-level config overrides
501
-
502
- ### Configuration
503
-
504
- New `crew` section in `~/.pi/agent/pi-messenger.json`:
505
- ```json
506
- {
507
- "crew": {
508
- "concurrency": { "scouts": 4, "workers": 2 },
509
- "review": { "enabled": true, "maxIterations": 3 },
510
- "work": { "maxAttemptsPerTask": 5, "maxWaves": 50 },
511
- "artifacts": { "enabled": true, "cleanupDays": 7 }
512
- }
513
- }
514
- ```
515
-
516
- ### Fixed
517
-
518
- - 12 bugs fixed during implementation review:
519
- - **Critical:** `loadCrewConfig` called with wrong path in plan.ts and work.ts
520
- - Double-counting bug in work.ts (tasks in both `failed` and `blocked` arrays)
521
- - O(n²) complexity in plan.ts task creation loop
522
- - O(n²) complexity in agents.ts worker spawn loop
523
- - Invalid status icon map in epic.ts (missing `blocked`, `archived`)
524
- - Various unused imports and variables cleaned up
525
-
526
- ---
527
-
528
- ## 0.5.1 - 2026-01-22
529
-
530
- ### Added
531
-
532
- - **Path-based auto-register** - New `autoRegisterPaths` config option allows specifying folders where agents should auto-join the mesh, instead of global auto-register. Supports `~` expansion and glob patterns (`~/work/*`).
533
- - **Folder scoping** - New `scopeToFolder` config option limits agent visibility to the same working directory. When enabled, agents only see other agents in the same folder (broadcasts are scoped, but direct messaging by name still works).
534
- - **Auto-register path management (tool)** - New `autoRegisterPath` parameter:
535
- - `pi_messenger({ autoRegisterPath: "add" })` - Add current folder to auto-register list
536
- - `pi_messenger({ autoRegisterPath: "remove" })` - Remove current folder
537
- - `pi_messenger({ autoRegisterPath: "list" })` - Show all configured paths
538
- - **Config TUI command** - `/messenger config` opens an overlay to manage auto-register paths with keyboard navigation.
539
-
540
- ### Changed
541
-
542
- - Auto-register logic now checks both `autoRegister` (global) and `autoRegisterPaths` (path-based). If either matches, the agent auto-joins.
543
- - `getActiveAgents()` now filters by cwd when `scopeToFolder` is enabled.
544
-
545
- ## 0.5.0 - 2026-01-20
546
-
547
- ### Added
548
-
549
- - **Swarm coordination** - Agents can now coordinate on shared spec files with atomic task claiming
550
- - **Spec registration** - `pi_messenger({ spec: "path/to/spec.md" })` registers your working spec
551
- - **Task claiming** - `pi_messenger({ claim: "TASK-01" })` atomically claims a task in your spec
552
- - **Task completion** - `pi_messenger({ complete: "TASK-01", notes: "..." })` marks tasks done with notes
553
- - **Task unclaiming** - `pi_messenger({ unclaim: "TASK-01" })` releases a claim without completing
554
- - **Swarm status** - `pi_messenger({ swarm: true })` shows all agents' claims and completions
555
- - **Spec-scoped swarm** - `pi_messenger({ swarm: true, spec: "path" })` shows status for one spec only
556
- - **Join with spec** - `pi_messenger({ join: true, spec: "path" })` joins and registers spec atomically
557
- - **Single-claim-per-agent rule** - Must complete or unclaim before claiming another task
558
- - **Stale claim cleanup** - Claims from dead agents (PID gone + lock >10s old) are automatically cleaned
559
-
560
- ### Changed
561
-
562
- - **Agents tab in overlay** - Now groups agents by spec with claims displayed
563
- - **Status output** - Now includes current spec and active claim when set
564
- - **List output** - Now shows spec and claim status for each agent
565
-
566
- ### Storage
567
-
568
- New files in `~/.pi/agent/messenger/`:
569
- - `claims.json` - Active task claims by spec
570
- - `completions.json` - Completed tasks by spec
571
- - `swarm.lock` - Atomic lock for claim/complete mutations
572
-
573
- ### Fixed
574
-
575
- - **Safe completion write order** - Completions are now written before claims removal, so if the second write fails the task completion is still recorded
576
- - **Overlay scroll reset on agent death** - When an agent dies and the overlay auto-switches to another tab, scroll position is now properly reset
577
- - **Type-safe result handling** - Added proper type guards (`isClaimSuccess`, `isUnclaimNotYours`, etc.) for discriminated union result types, replacing fragile `as` casts
578
- - **I/O error cleanup** - If registration write succeeds but read-back fails (extremely rare I/O error), the orphaned file is now cleaned up
579
- - **Single agent lookup for reservations** - `ReservationConflict` now includes full agent registration, eliminating redundant disk reads when blocking reserved files
580
-
581
- ## 0.4.0 - 2026-01-21
582
-
583
- ### Changed
584
-
585
- - **Opt-in registration** - Agents no longer auto-register on startup. Use `pi_messenger({ join: true })` to join the mesh, or open `/messenger` which auto-joins. This reduces context pollution for sessions that don't need multi-agent coordination.
586
- - **New `autoRegister` config** - Set to `true` to restore the old auto-register-on-startup behavior.
587
-
588
- ### Fixed
589
-
590
- - **Read operations no longer blocked by reservations** - Previously, reading reserved files was blocked. Now only `edit` and `write` operations are blocked, allowing agents to read files for context even when another agent has reserved them.
591
-
592
- ## 0.3.0 - 2026-01-21
593
-
594
- ### Added
595
-
596
- - **Agent differentiation** - Agents are now easier to distinguish when multiple work in the same folder
597
- - **Git branch detection** - Automatically detects and displays git branch (or short SHA for detached HEAD)
598
- - **Adaptive display modes** - List and overlay views adapt based on agent context:
599
- - Same folder + branch: Compact view, branch in header
600
- - Same folder, different branches: Shows branch per agent
601
- - Different folders: Shows folder per agent
602
- - **Location awareness** - Status command now shows `Location: folder (branch)`
603
- - **Enhanced context** - Registration and first-contact messages include location info
604
- - **Improved reservation display** - Uses 🔒 prefix, truncates long paths from the left preserving filename
605
-
606
- ### Changed
607
-
608
- - Reservation conflict messages now show the blocking agent's location: `Reserved by: X (in folder on branch)`
609
- - First contact message format: `*X is in folder on branch (model)*`
610
- - Tab bar adapts: name only (same context), name:branch (different branches), name/folder (different folders)
611
- - Status details object now includes `folder` and `gitBranch` for programmatic access
612
-
613
- ### Fixed
614
-
615
- - **Agent identity detection** - When an agent quits and a new pi instance registers with the same name, recipients now correctly see first-contact details. Previously, `seenSenders` tracked names only; now it tracks `name -> sessionId` to detect identity changes.
616
- - **Registration race condition** - Added write-then-verify check to prevent two agents from claiming the same name simultaneously. If another agent wins the race, auto-generated names retry with a fresh lookup; explicit names fail with a clear error.
617
- - **Rename race condition** - Added write-then-verify check to `renameAgent()` to prevent two agents from renaming to the same name simultaneously. If verification fails, returns "race_lost" error and the agent keeps its old name.
618
-
619
- ### Performance
620
-
621
- - **Cached filtered agents** - `getActiveAgents()` now caches filtered results per agent name, avoiding repeated array allocations on every call.
622
- - **Memoized agent colors** - `agentColorCode()` now caches computed color codes, avoiding hash recalculation on every render.
623
- - **Overlay render cache** - Sorted agent list is now cached within each render cycle, avoiding redundant sort operations.
624
- - **Reduced redundant calls** - `formatRelativeTime()` result is now reused in message box rendering instead of being called twice.
625
-
626
- ### Documentation
627
-
628
- - **README overhaul** - New banner image showing connected pi symbols, punchy tagline, license/platform badges, comparison table, organized features section, keyboard shortcuts table, and streamlined layout following reference README patterns.
629
-
630
- ## 0.2.1 - 2026-01-20
631
-
632
- ### Fixed
633
-
634
- - **Performance: Agent registry caching** - `getActiveAgents()` now caches results for 1 second, dramatically reducing disk I/O. Previously, every keypress in the overlay and every tool_call for read/edit/write caused full registry scans.
635
- - **Performance: Watcher debouncing** - File watcher events are now debounced with 50ms delay, coalescing rapid filesystem events into a single message processing call.
636
- - **Stability: Message processing guard** - Concurrent calls to `processAllPendingMessages()` are now serialized to prevent race conditions when watcher events and turn_end overlap.
637
- - **Stability: MessengerState type** - Added `watcherDebounceTimer` field for proper debounce timer management.
638
-
639
- ## 0.2.0 - 2026-01-20
640
-
641
- ### Added
642
-
643
- - **Chat overlay** - `/messenger` now opens an interactive overlay instead of a menu. Full chat interface with tabs for each agent, message history, and an input bar at the bottom.
644
- - **Message history** - Messages persist in memory for the session (up to 50 per conversation). Scroll through history with arrow keys.
645
- - **Unread badges** - Status bar shows total unread count. Tab bar shows per-agent unread counts that clear when you switch to that tab.
646
- - **Broadcast tab** - "+ All" tab for sending messages to all agents at once. Shows your outgoing broadcast history.
647
- - **Agent colors** - Each agent name gets a consistent color based on a hash of their name. Makes it easy to distinguish agents in conversations.
648
- - **Agent details** - When viewing a conversation with no messages, shows the agent's working directory, model, and file reservations.
649
- - **Context injection** - Agents now receive orientation on startup and helpful context with messages:
650
- - Registration message explaining multi-agent environment (once per session)
651
- - Reply hint showing how to respond to messages
652
- - Sender details (cwd, model) on first contact from each agent
653
- - **Configuration file** - `~/.pi/agent/pi-messenger.json` for customizing context injection. Supports `contextMode: "full" | "minimal" | "none"`.
654
-
655
- ### Changed
656
-
657
- - `/messenger` command now opens overlay (was: interactive menu with select prompts)
658
- - Status bar now shows unread count badge when messages are waiting
659
-
660
- ### Fixed
661
-
662
- - Message delivery order: files are now deleted after successful delivery, not before (prevents message loss if delivery fails)
663
- - ANSI escape codes in message text are now stripped to prevent terminal injection
664
- - Watcher recovery: if the inbox watcher dies after exhausting retries, it now automatically recovers on the next turn or session event
665
- - Small terminal handling: overlay now handles very small terminal windows gracefully with minimum height safeguards
666
-
667
- ## 0.1.0 - 2026-01-20
668
-
669
- Initial release.
670
-
671
- - Agent discovery with auto-generated memorable names (SwiftRaven, GoldFalcon, etc.)
672
- - Direct messaging between agents with immediate delivery
673
- - Broadcast messaging to all active agents
674
- - File reservations with conflict detection
675
- - Message renderer for incoming agent messages
676
- - Status bar integration showing agent name and peer count
1
+ ## [Unreleased]
2
+
3
+ $1## [1.3.0] - 2026-10-18
4
+
5
+ - **`/editor` spawns the built-in editor and hands it the context on the command line**: the payload is now the vendored TermIDE editor-only entry (`termide-editor`, shipped in `@linxiraos/editor`'s platform leaves), which takes `FILE[:line[:col]]... [DIRECTORY]` positionally — so `/editor` (and its optional target argument) passes the workspace as the project root and any `file:line:col` the user asked for, instead of writing `~/.zeta/handoff.json`. The handoff module, the `editor.handoffSession` read and the `git rev-parse` root probe are gone with it; `editor.autoInstall` still installs the package on demand.
6
+
7
+ ## [1.2.0] - 2026-10-12
8
+
9
+ - **Crew subprocesses run the zeta CLI, not upstream `pi`**: worker/lobby spawns resolve the CLI that loaded the extension (compiled binary or runtime + entry, `PI_SUBPROCESS_CMD` override, then PATH lookup of `zeta-c`/`zetacode`/`zeta-cli`; never bare `pi`/`zeta`). The spawn flag surface (`--mode json`, `--no-session`, `-p`, `--provider/--model`, `--thinking`, `--tools`, `--extension`, `--append-system-prompt`) is equivalent on the zeta CLI. Windows `.cmd` shims are deliberately not spawned shell-less (EINVAL under Bun/Node, command-injection risk through a shell).
10
+ - **State moved from the `~/.pi` tree to the zeta tree**: global messenger state `~/.zeta/agent/messenger` (was `~/.pi/agent/messenger`), project state `<project>/.zeta/messenger` (was `.pi/messenger`), config `~/.zeta/agent/pi-messenger.json` / `<project>/.zeta/pi-messenger.json`. One-time migrations move pre-existing state on first load (global) or first touch per project; the upstream `settings.json` "messenger" config source is no longer read.
11
+ - **`/teamagent add --user` writes the real discovery directory** `~/.zeta/agent/agents` (was the dead `~/.zeta/agents`), so user-registered agents are actually spawnable.
12
+ - **Project agents are opt-in**: project-scope `/teamagent add` refuses unless the project config sets `"trustProjectAgents": true` in `<project>/.zeta/pi-messenger.json`, and project-supplied crew agent/skill overrides only load with the same opt-in — cloning an untrusted repository no longer registers tool-capable subagents silently. `/teamagent` explains how to enable it.
13
+ - **Removed the false "restart before spawning" notice**: agent discovery re-reads agent files on every task request, so `/teamagent add` results are spawnable immediately.
14
+ - **`/teamagent` roles keep their thinking level and skill list**: the rendered agent file wrote `thinking-level:`, which the crew role mirror (`crew/team/subagent-roles.ts`) never read — it parses frontmatter literally and looks up `thinking`/`skills`. The writer now emits `thinking:` (understood by both readers: the mirror directly, CLI discovery via its legacy fallback), and the mirror falls back to the CLI's `autoloadSkills` key for skills.
15
+
16
+ - **handoff 契约模块**(`handoff.ts`):write-then-rename + 读一次即删,`path:line:col` 解析处理 Windows 盘符冒号;损坏/空 payload 不阻塞启动;显式 CLI 参数优先,同目录已开工作区不拆。
17
+ - **`/editor` + 右上角圆角按钮**:header 挂点(`setHeader` 需要 live ctx,故从 `session_start` 装)而非 status-line segment;`editor.autoInstall` 缺失自动 `npm i -g`,Linux EACCES 走 `sudo -n` 重试,需密码时返回确切命令。
18
+ - **`/teamagent`**:crew 角色注册为可 spawn subagent(七动词归一个命令,原 `/team` 删除消除同名双注册);scope 默认 project,`--user` 全局;保留名与非法名写入前拒绝。
19
+
20
+ ## [0.15.2] - 2026-09-20
21
+
22
+ ### Fixed
23
+
24
+ - Preserve extension tools for crew workers: unknown bare tool names no longer get dropped by the builtin whitelist, so extension-provided tools (e.g. `pi_messenger`) survive worker spawn.
25
+
26
+ ## [0.15.1] - 2026-08-23
27
+
28
+ ### Highlights
29
+
30
+ - Resuming a session is more reliable when older or malformed agent messages are present.
31
+ - Crew planning is less likely to create duplicate task lists from repeated planning runs.
32
+ - Crew reviews now look at the task branch, so reviewers see the work they are meant to review.
33
+ - Auto-review no longer spends time on tasks that are already blocked or marked as duplicates.
34
+
35
+ ### Fixed
36
+
37
+ - Render malformed persisted agent messages and normalize inbound mail that uses `message` and `ts`, fixing session resume crashes. Thanks to [@rioxiaoliliang](https://github.com/rioxiaoliliang) for #29.
38
+ - Prevent duplicate Crew task sets when planning runs overlap or repeat.
39
+ - Review task branches instead of the main checkout so Crew reviewers inspect the intended changes.
40
+ - Skip auto-review for blocked or duplicate Crew tasks. Thanks to [@selimdizer](https://github.com/selimdizer) for #30.
41
+
42
+ ## [0.15.0] - 2026-07-30
43
+
44
+ ### Added
45
+
46
+ - Added an optional Team layer with reusable profiles, project charter/memory, role-aware tasks, approval gates, worker context, and overlay signals.
47
+ - Added `team.setup` for first-run Team setup with profile activation, starter charter creation, and next-step guidance.
48
+ - Surfaced rejected approval-gated tasks separately with `task.revise` / `task.revise-tree` guidance.
49
+
50
+ ### Fixed
51
+
52
+ - Migrated extension tool schemas from `@sinclair/typebox` to `typebox` 1.x and updated the local test/tsconfig references to the new package entry.
53
+ - Guarded status heartbeat updates against stale pi session contexts after reloads or session replacement while preserving non-stale errors, fixing #26, #25, and #18. Thanks to Kire Howard (`MatrixJockey`), `MartinMayday`, and Hydro (`HydroToxin`) for the reports, and to Riwut Libinuko (`cakriwut`) for #19.
54
+ - Excluded the orchestrator-only `pi-messenger-crew` skill from worker prompts to avoid irrelevant skill loading during Crew task execution. Thanks to Varun Maliwal (`vmaliwal`) for #15.
55
+ - Fixed auto-opened Crew overlays after planning to use the live session cwd.
56
+ - Restored `.js` extension path handling in Crew worker and lobby tool configuration.
57
+ - Made enum schemas load under typebox compatibility shims that do not expose `Type.Unsafe`, fixing #23. Thanks to David Moshal (`davidmoshal`) for #24.
58
+ - Enforced `crew.concurrency.max` in overlay-driven worker spawning paths. Thanks to Martin Hátaš (`MartinHatas`) for #17.
59
+ - Prevented the legacy `npx pi-messenger` installer from creating a duplicate extension copy when the native `pi install npm:pi-messenger` package flow is already configured, fixing #22. Thanks to David Moshal (`davidmoshal`) for the report.
60
+ - Crew planner, worker, reviewer, analyst, lobby, and revision agents now fall back to the host session model when no task, request, role, or config model override is set, fixing #20. Thanks to Velinus (`velinussage`) for the report.
61
+ - Crew subprocess launches use `pi.cmd` on Windows and task reset paths now refuse active workers before making tasks startable again, addressing #11. Thanks to Logan Laughlin (`llaughlin`) for the report.
62
+ - Compacted streaming `message_update` artifacts and stopped retaining every parsed event in memory, fixing the transcript amplification in #27. Thanks to Hugo Ruíz (`hugotown`) and `aeturnal` for the measurements, and to `suse-coder` (#13) and Tom (`monotykamary`) (#4) for the earlier reports of the resulting stalls and jank.
63
+ - Crew subprocesses now fail fast on terminal provider usage/quota/auth 4xx JSON events instead of waiting through retry loops, fixing #21. Thanks to Velinus (`velinussage`) for the report.
64
+
65
+ ### Changed
66
+
67
+ - `readFeedEvents` now reads only a bounded tail of `feed.jsonl` in backward 64KB chunks instead of parsing the whole file, making overlay feed reads on large histories dramatically faster (~1,800x on a 100k-event feed). Non-positive limits now return no events.
68
+ - Overlay rendering, auto-spawn/refill checks, and stuck-agent heartbeats now reuse a single Crew task snapshot per frame instead of rescanning the task directory per section, roughly quadrupling render-helper throughput on large task lists.
69
+ - Aligned Team built-in roles and sample profiles with the packaged `pi-subagents` role vocabulary while keeping Crew as the execution engine.
70
+ - Moved pi core packages and `typebox` to peer dependencies for packaged installs.
71
+
72
+ ## [0.14.1] - 2026-04-04
73
+
74
+ ### Changed
75
+
76
+ - Added a `promptSnippet` for `pi_messenger` so Pi 0.59+ includes it in the default tool prompt section and reliably surfaces Crew/coordination workflows.
77
+
78
+ ## [0.14.0] - 2026-04-03
79
+
80
+ ### Added
81
+
82
+ - **`leave` action** — `pi_messenger({ action: "leave" })` now lets the current session leave the mesh without restarting pi. It releases reservations, auto-unclaims the session's active swarm claim, closes the messenger overlay, and allows later rejoin from the same session.
83
+
84
+ ### Fixed
85
+
86
+ - **Leave guardrails for Crew state** — `leave` now refuses while project planning, autonomous work, or session-owned in-progress Crew tasks are still active, preventing stranded coordination state.
87
+ - **Immutable-session cwd handling** — Registration, folder scoping, auto-register path matching, and messenger context now follow the live session cwd after pi runtime/session replacement instead of relying on `process.cwd()`.
88
+
89
+ ## [0.13.2] - 2026-03-19
90
+
91
+ ### Added
92
+
93
+ - **`work.stop` action** — `pi_messenger({ action: "work.stop" })` now stops autonomous Crew work for the current project and persists the stop state.
94
+ - **Autonomous guard coverage tests** — Added targeted tests for `work.stop` routing and `agent_end` autonomous continuation guard behavior.
95
+
96
+ ### Fixed
97
+
98
+ - **Autonomous continuation retry loop guard** — Autonomous Crew mode now stops itself after repeated identical `crew_continue` retries without wave progress (for example when steer turns keep aborting). The extension persists the stopped state and emits a warning instead of looping indefinitely.
99
+ - **Persisted autonomous stop state from index-level stop paths** — `max waves` and `no ready tasks` stop paths now append `crew-state` so restored sessions do not revive stale active autonomous state.
100
+ - **Autonomous continuation no longer runs in unregistered sessions** — If Crew autonomous state is restored but the current session is not joined to pi-messenger, the extension now stops autonomous mode and persists that stop instead of emitting repeated continuation steer messages that cannot execute.
101
+ - **Autonomous continuation now runs only in orchestrator sessions** — Worker and lobby processes (`PI_CREW_WORKER`/`PI_LOBBY_ID`) now skip `agent_end` continuation emission to prevent repeated duplicate `crew_continue` steer loops from non-orchestrator agents.
102
+ - **Autonomous continuation is now cwd-scoped** — `agent_end` continuation now requires the session cwd to match the active autonomous cwd (`isAutonomousForCwd`), preventing stale autonomous state from unrelated projects from triggering unexpected `crew_continue` messages.
103
+ - **Autonomous state restore now validates owner process** — Restored active autonomous state now requires a live owner PID matching the current process; missing/dead/foreign ownership is treated as stale and auto-stopped to avoid unexpected continuation after session restore.
104
+ - **Runtime artifact commit noise** — Added `.pi/` to `.gitignore` to avoid accidentally committing runtime files like feed artifacts.
105
+
106
+ ## [0.13.1] - 2026-03-14
107
+
108
+ ### Added
109
+
110
+ - **Auto-review after task completion** — Workers' completed tasks now get an automatic reviewer pass before being counted as done. Controlled by existing `config.review.enabled` (default: true) and `config.review.maxIterations` (default: 3). SHIP keeps the task done, NEEDS_WORK resets it to todo for retry with review feedback injected into the next worker's prompt, MAJOR_RETHINK blocks the task. Reviews run sequentially between worker completion and wave result reporting, and respect the abort signal. Adds `review_count` to the Task interface and `task.review` to the activity feed.
111
+
112
+ ## [0.13.0] - 2026-03-02
113
+
114
+ ### Added
115
+
116
+ - **Dynamic skill loading for crew workers** — Workers can now acquire domain-specific knowledge on demand during task execution. A three-tier discovery system scans user skills (`~/.pi/agent/skills/`), extension skills (`crew/skills/`), and project skills (`.pi/messenger/crew/skills/`) to build a skill catalog. The planner sees the catalog and can tag tasks with relevant skill names. Workers see tagged skills as "Recommended" in their prompt alongside the full catalog, and load what they need via `read()` — zero upfront token cost, no config changes. Project-level skills override extension, which override user, matching the agent override pattern. When no skills are configured, prompts are unchanged.
117
+
118
+ ### Fixed
119
+
120
+ - **Artifact dir creation** — `writeArtifact`, `writeMetadata`, and `appendJsonl` now create parent directories on demand. Fixes ENOENT on first `plan` run.
121
+ - **Multiline feed sanitization** — Feed events with embedded newlines no longer corrupt the TUI overlay layout.
122
+ - **Config model override** — `crew.models` config now actually overrides agent defaults. Priority: task override > config > agent frontmatter.
123
+
124
+ ## [0.12.1] - 2026-02-22
125
+
126
+ ### Fixed
127
+
128
+ - **Wrong model resolved for `provider/model` format** - Worker spawn passed `--model zai/glm-5` as a single flag, which pi's model resolver matched as a literal model ID under `vercel-ai-gateway` instead of interpreting `zai` as the provider. Now splits `provider/model` into separate `--provider` and `--model` flags, matching the intended provider. Affects both task workers and lobby workers.
129
+
130
+ ## [0.12.0] - 2026-02-21
131
+
132
+ ### Added
133
+
134
+ - **Thinking level support** - Agents support `thinking: <level>` in frontmatter (off, minimal, low, medium, high, xhigh). Config `thinking.<role>` overrides per-agent frontmatter. Applied via `--thinking` flag to spawned processes.
135
+ - **Advisory dependencies** - Dependencies are now informational context, not scheduling blockers. All `todo` tasks are eligible for assignment regardless of dependency status. Workers see dependency completion state (done/in-progress/not started) in their prompt and coordinate via reservations and DMs. Configurable via `dependencies` config (`"advisory"` default, `"strict"` for blocking mode). Transitive dependencies pruned from plans automatically.
136
+ - **Auto-work on plan completion** - Planning automatically starts autonomous work when tasks are created (default behavior). Pass `autoWork: false` to review the plan first. A steer message triggers the LLM to call `work { autonomous: true }` on its next turn.
137
+ - **Continuous worker refill** - Overlay automatically spawns replacement workers when tasks complete, maintaining concurrency up to the configured limit throughout execution.
138
+ - **Prompt-based planning** - `plan` action accepts an inline `prompt` parameter as the spec when no PRD file is available. The planner breaks down arbitrary requests into parallel tasks the same way it handles PRD files.
139
+ - **Live feed with flash notifications** - Feed tracks last-seen timestamp and highlights new events. Significant events (task completions, messages, plan changes) trigger flash notifications in the status bar.
140
+ - **Task revision** - `[p]` revises a single task's spec via the planner. `[P]` revises an entire subtree (target + transitive dependents), preserving done tasks and resetting revisable ones to `todo`. Re-plan with steering prompt injects user guidance into the planning-progress.md Notes section.
141
+ - **Chat UX redesign** - Global `[m]` key activates chat input from any overlay state (vim-style command mode). Plain text broadcasts to all peers; `@name message` sends DMs. Tab autocompletes agent names after `@` (Shift+Tab cycles backwards). Feed gets 60/40 space allocation when workers active. `[f]` toggles feed-focus mode (tasks compress to 2-line summary). Visual improvements: system events dimmed, colored agent names, separator dots between groups.
142
+ - **Auto-dismiss on completion** - Overlay auto-closes with snapshot handover 3 seconds after all tasks complete. Only triggers when the overlay witnessed tasks in progress. Any keypress cancels.
143
+ - **Worker coordination & chatter** - Workers receive environmental context (concurrent tasks, dependency summaries, recent feed, ready tasks) and coordination instructions. Four configurable levels (`none`|`minimal`|`moderate`|`chatty`, default: `chatty`) control verbosity. At `chatty`, workers DM peers and broadcast announcements, creating a chat-room effect in the overlay. New `coordination` config field.
144
+ - **Lobby workers** - `+` spawns workers: assigns ready tasks directly when available, otherwise pre-spawns idle lobby workers that join the mesh and chat. Lobby workers receive task assignments via steer message when tasks become available. Token budgets per coordination level cap spending while idle.
145
+ - **Auto-spawn on plan completion** - Workers auto-spawn when planning finishes and ready tasks exist. Lobby workers assigned first, then fresh workers up to concurrency limit.
146
+ - **TUI coordination level control** - `[v]` cycles coordination level at runtime (`chatty` → `none` → `minimal` → `moderate`).
147
+ - **Configurable `concurrency.max`** - Crew config field (default: 10) lets the user lower the worker ceiling. `+`/`-` keys respect the configured max.
148
+ - **Stuck task UX** - `[q]` Stop works on any `in_progress` task, not just those with live workers. `[s]` Start rejects when the agent is already busy. Detail view shows "Worker not running" warning for orphaned tasks.
149
+ - **Chatter mitigation** - Per-worker outgoing message rate limiting via `messageBudgets` config. Coordination level and per-worker token count displayed in overlay header.
150
+ - **Broadcast filtering** - Worker broadcasts now go to the feed only (no inbox delivery, no LLM turn interrupts). Eliminates O(N^2) token cascades between workers. DMs, user broadcasts, and planner broadcasts still deliver to inboxes in real-time. Detection via `PI_CREW_WORKER` env var set at spawn time. Worker name consistency also fixed in `agents.ts` via `PI_AGENT_NAME`.
151
+ - **Worker exit feed notifications** - Lobby workers that exit without a task assignment now appear as `leave` events in the feed.
152
+ - **2026-02-12 Overlay redesign** - Replaced tabbed `/messenger` UI with a unified crew dashboard layout (status, workers, tasks, feed, agents row, legend), added `Ctrl+T` snapshot transfer, `Ctrl+B` background/reattach support, empty-state system diagnostics, and inline `@all` / `@name` messaging in the overlay input flow.
153
+ - **Task progress system** - Added per-task append-only progress logs (`tasks/task-N.progress.md`) with `task.progress`, system auto-entries (assignment, review verdicts, shutdown resets, crash/failure outcomes), and retry-context injection in worker prompts.
154
+ - **Interactive Crew task manager** - Crew overlay now supports list/detail modes, task actions (reset/cascade-reset/unblock/start/block/delete), in-overlay confirmations, block-reason input, live worker messaging, context-aware key hints, and transient success/failure notifications.
155
+ - **Live worker concurrency adjustment** - In the Crew overlay, `+`/`-` now adjusts worker concurrency live during execution (clamped to 1-10).
156
+ - **Auto-open overlay on autonomous work** - The Crew overlay now opens automatically when autonomous mode starts, showing live worker progress without requiring `/messenger`. Configurable via `autoOverlay` (default: `true`). Escape dismisses; won't reopen until a new autonomous session.
157
+ - **Auto-open overlay on planning work** - The Crew overlay now opens automatically when planning starts and when an in-progress planning run is restored on session start/switch/fork/tree. Configurable via `autoOverlayPlanning` (default: `true`). Uses per-run planning IDs to avoid reopen loops within the same run after dismissal.
158
+ - **Task splitting** - New `task.split` action supports an inspect phase (returns spec/progress/deps/dependents) and an execute phase that creates subtasks, rewires downstream dependencies, converts the parent to a milestone, and auto-completes milestones when all subtasks are done. Milestones can't be started manually and are never dispatched to workers.
159
+ - **Planning observability state** - Added first-class planning run state with pass/phase tracking and persistence at `.pi/messenger/crew/planning-state.json`. Status, Crew UI, and feed now expose planning progress (`plan.start`, `plan.pass.*`, `plan.review.*`, `plan.done`, `plan.failed`) so long planning runs are visible by default. Planning runs with no updates for 5 minutes are flagged as stalled in status and Crew UI, with periodic refresh so stalls surface without requiring user interaction.
160
+ - **Planning cwd normalization** - Planning state now canonicalizes project paths (realpath) and compares by canonical path, fixing false negatives when sessions use `/tmp/...` while persisted state resolves to `/private/tmp/...`.
161
+ - **Structured planning outline** - Planner prompts now require ordered sections (PRD understanding, reviewed resources, sequential steps, parallel task graph). Latest structured output is persisted to `.pi/messenger/crew/planning-outline.md` for audit/review.
162
+
163
+ - **Lobby worker keep-alive** - Lobby workers now survive the full planning phase via a file-based keep-alive signal. The orchestrator creates a `.alive` file per lobby worker; the worker's `turn_end` hook checks the file and injects a minimal steer message to prevent the session from exiting. File is deleted on task assignment, planning completion, or shutdown. ~25 tokens per keep-alive cycle.
164
+ - **`prompt` tool parameter** - The `prompt` parameter (used by `plan` and `task.revise`/`task.revise-tree`) is now declared in the tool schema so LLMs can discover it without the skill loaded.
165
+ - **Dynamic overlay width** - Overlay adapts to terminal width (clamped 40-100) instead of a fixed size. Fits half-width and quarter-width windows on smaller screens.
166
+ - **Live coordination level display** - Status bar hints now show the actual coordination level (`v:chatty`, `v:none`, etc.) instead of the opaque `v:Coord` label.
167
+
168
+ ### Changed
169
+
170
+ - **Default `planning.maxPasses` reduced to 1** - Single-pass planning is now the default. Multi-pass planning with reviewer feedback is still available by setting `planning.maxPasses` in user or project config.
171
+ - **Structural cleanup** - Extracted `crew/prompt.ts` (worker prompt builder), `crew/spawn.ts` (shared spawn logic), `crew/registry.ts` (unified worker registry replacing separate maps in agents.ts and lobby.ts). Split `crew/state.ts` into `state-autonomous.ts` and `state-planning.ts` with a barrel re-export.
172
+ - **Crew agent locality** - Crew agents are now discovered from extension-local `crew/agents/` plus project overrides in `.pi/messenger/crew/agents/`. Removed auto-install/update copy machinery and converted `crew.install` / `--crew-install` to informational commands.
173
+
174
+ ### Removed
175
+
176
+ - **Legacy key-based routing** - Removed the `join`, `claim`, `unclaim`, `complete`, `swarm`, `list`, `rename`, `reserve`, `release`, and `broadcast` tool parameters and the legacy routing block in `index.ts` that duplicated `crew/index.ts` action-based routing. All callers should use `action`-based syntax (e.g., `{ action: "join" }` instead of `{ join: true }`).
177
+ - **Interview handler** - Removed `crew/handlers/interview.ts`, `crew-interview-generator.md` agent, and the `interview` action. The feature spawned an LLM to generate questions for the user but never worked (got stuck). Agent moved to deprecated list for cleanup on existing installs.
178
+
179
+ ### Fixed
180
+
181
+ - **Overlay rendering corruption from multi-line bash args** - `extractArgsPreview` returned raw bash `command` strings containing newlines (comments, `&&` chains, heredocs). These embedded newlines broke overlay rows, cascading layout corruption through the workers section, task list, and feed. Newlines are now collapsed to spaces at the extraction point.
182
+ - **Fire-and-forget dynamic import in `task-actions.ts`** - `killWorkerByTask` was imported via `import("./registry.js").then(...)` which swallowed errors silently. Replaced with a static import since no circular dependency exists.
183
+ - **Stale legacy syntax in user-facing strings** - Five handler/index strings still referenced removed `{ join: true }` / `{ list: true }` / `{ to: "..." }` syntax. Updated to action-based equivalents.
184
+ - **SIGKILL escalation never fired** - After `proc.kill("SIGTERM")`, Node.js immediately sets `proc.killed = true`. Both `killWorkerByTask` and `runAgent` graceful shutdown checked `!proc.killed` before escalating to SIGKILL, which was always false. Workers ignoring SIGTERM could hang indefinitely. Now checks only `exitCode === null`.
185
+ - **Lobby worker assignment zombie state** - State was mutated before the disk write, so a failed write left the worker permanently marked as assigned but invisible to future assignment. Reordered to write first, mutate on success.
186
+ - **Lobby assignment race in work handler** - If a lobby worker exited between availability check and assignment, the task got stuck as `in_progress` with no worker. Added return value check with rollback.
187
+ - **Autonomous state checks not cwd-scoped** - Auto-dismiss, snapshot generation, and revision guards used a global flag instead of per-project checks, blocking operations for unrelated projects.
188
+ - **Task flicker from lobby worker spawn** - Orchestrator and worker generated independent random names so `assigned_to` never matched. Task was also pre-set to `in_progress` but the worker expected `todo`. Fixed name propagation via env var, made `task.start` idempotent for the assigned agent, and added ownership guards in close handlers.
189
+ - **`[q]` Stop couldn't kill lobby-spawned workers** - Stop only checked one worker registry. Lobby workers are tracked separately and now have their own kill path.
190
+ - **Double-formatted message previews** - Overlay stored pre-formatted previews that the display layer formatted again. Now stores raw text; preview limit raised from 60 to 200 chars.
191
+ - **Stale workersHeight in trim loop** - Worker-line overflow trimming used a pre-computed height, causing over-trim to 0 workers on small terminals.
192
+ - **Artifact I/O crash** - Uncaught exceptions in child process event handlers crashed pi. Wrapped all artifact writes with try/catch.
193
+ - **Input field scrolling** - Text was clipped at the field edge instead of scrolling to keep the cursor visible.
194
+ - **Session shutdown orphans** - Workers now killed at the top of session shutdown, preventing orphan processes.
195
+ - **Task list blank line padding** - Task list no longer pads with empty lines. Surplus space goes to the feed.
196
+ - **`getLobbyWorkerCount` counted dead workers** - Registry function didn't filter exited processes, inflating the "N in lobby" status bar count.
197
+ - **`models.analyst` config was dead** - Config type and docs existed but `interview.ts` and `sync.ts` never read it. Now wired to both analyst handler call sites.
198
+
199
+ ## [0.11.0] - 2026-02-08
200
+
201
+ ### Added
202
+
203
+ - **Test suite** — 53 tests across 7 Vitest suites covering store CRUD, state machine, config merging, agent discovery, model resolution, graceful shutdown, and live progress (including cwd isolation). Includes test helpers for temp directories and mock contexts.
204
+ - **Per-agent runtime config** — Model override with 4-level priority: per-task > per-wave `model` param > config `crew.models.worker` > agent `.md` frontmatter. Environment variable override via `crew.work.env` config (not exposed as tool param to prevent API keys in logs).
205
+ - **Graceful shutdown** — `AbortSignal` threaded from tool execute through to spawned workers. On abort: discovers worker name via PID-based registry scan, writes shutdown message to worker inbox, waits 30s grace period, SIGTERM, waits 5s, SIGKILL. Tasks reset to `todo` for retry. Workers instructed to release reservations and exit without committing.
206
+ - **Live crew progress** — In-memory pub/sub store fed by worker JSONL events. Overlay Crew tab shows Active Workers section with tool name, call count, tokens, and elapsed time updating every second. Status bar shows active worker count during autonomous mode (`🔨N`).
207
+ - **`shutdownGracePeriodMs` config** — Configurable grace period before SIGTERM (default: 30000).
208
+
209
+ ### Changed
210
+
211
+ - **Dynamic overlay height** — Content area scales with terminal size (8-25 lines) instead of hardcoded 10. On a standard 24-row terminal, visible content goes from 10 to 15 lines.
212
+ - **Handler signatures simplified** — Removed unused `state` and `dirs` parameters from plan and review handlers.
213
+
214
+ ### Fixed
215
+
216
+ - **`deepMerge` crash** — Merging config with `models` key crashed when the target didn't have the key. Hardened for undefined target keys.
217
+ - **Result/task association** — Worker results now matched by `taskId` field instead of array index, since `spawnAgents` returns in completion order not submission order.
218
+
219
+ ### Removed
220
+
221
+ - `attemptsPerTask` field from `AutonomousState` — declared but never populated by any code.
222
+ - `ARCHITECTURE.md` from repo (moved to external docs).
223
+
224
+ ## [0.10.0] - 2026-02-05
225
+
226
+ ### Fixed
227
+
228
+ - **Crew spawner applies agent definitions** — Spawned crew workers now receive the agent's system prompt (`--append-system-prompt`), tool restrictions (`--tools`), and model override from their `.md` definitions. Previously a phantom `--agent` flag was passed that pi-core silently ignored, the agent name leaked into the prompt as noise, and the system prompts (worker's 6-phase protocol, reviewer's rubric, planner's exploration workflow) were never delivered. Tool restrictions also take effect: reviewers and interview generators are now limited to `read,bash` instead of getting all default builtins including `write` and `edit`.
229
+ - **Crew spawner session cleanup** — Spawned workers now pass `--no-session` to avoid writing ephemeral session files to disk.
230
+
231
+ ### Added
232
+
233
+ - **`--crew-install` / `--crew-uninstall` CLI flags** — `npx pi-messenger --crew-install` copies crew agent `.md` files and the `pi-messenger-crew` skill to user directories. `--crew-uninstall` removes them. Reads from the npm package (not the installed extension) to avoid version skew.
234
+
235
+ ### Changed
236
+
237
+ - **README rewrite** — Installation section now shows real CLI commands instead of tool-call syntax. "How It Works" section explains pi extension API hooks (`pi.on()`, `pi.sendMessage()`, `{ block: true }`, `ctx.ui.custom()`) instead of listing directory trees.
238
+
239
+ ## [0.9.0] - 2026-02-05
240
+
241
+ ### Added
242
+
243
+ - **npm publishing** - Package now published to npm. Install with `pi install npm:pi-messenger`.
244
+ - **`install.mjs`** - `npx pi-messenger` copies the npm package contents to the extensions directory. No git dependency. Version-pinned to the npm release. `npx pi-messenger --remove` to uninstall.
245
+ - `repository`, `homepage`, `bugs` fields in package.json for npm/GitHub integration.
246
+ - `bin`, `files` fields in package.json for npm distribution.
247
+
248
+ ### Changed
249
+
250
+ - **Banner image** - README references `banner.png` via absolute GitHub URL (`raw.githubusercontent.com`) instead of relative path, so it renders on both GitHub and npmjs.com without shipping the 1.1MB image in the npm package.
251
+ - **Install section** - README now documents `pi install npm:pi-messenger` as the primary install method.
252
+
253
+ ## [0.8.2] - 2026-02-01
254
+
255
+ ### Fixed
256
+
257
+ - Adapt execute signature to pi v0.51.0: reorder signal, onUpdate, ctx parameters
258
+
259
+ ## [0.8.1] - 2026-01-30
260
+
261
+ ### Changed
262
+
263
+ - **Parallelism-aware planning** - Planner prompt now includes a dedicated Parallel Execution section teaching DAG thinking, independent work streams, critical path minimization, and real data flow dependencies. Plans should produce wider dependency graphs with more concurrent waves instead of linear chains.
264
+ - **Parallelism-aware review** - Both the automated planning loop reviewer and the manual plan review (`action: "review"`) now evaluate plans for unnecessary sequential dependencies and critical path length.
265
+ - PRD truncation applied consistently to both explicit `prd` parameter and auto-discovered PRD files (100KB limit).
266
+
267
+ ### Fixed
268
+
269
+ - Stale README agent list referenced removed "analysts" instead of the actual 5 agents.
270
+
271
+ ## [0.8.0] - 2026-01-30
272
+
273
+ ### Added
274
+
275
+ - **Planning progress file** - `.pi/messenger/crew/planning-progress.md` accumulates planner findings and reviewer feedback across passes and runs. Persists through plan deletions. User-editable: add steering notes that the planner reads on every run.
276
+ - `planning.maxPasses` config option (default: 3). Set to 1 for single-pass behavior.
277
+ - JSON task block parsing (`tasks-json` fenced block) as the primary task extraction path, with the existing markdown regex as fallback.
278
+ - Shared verdict parser (`crew/utils/verdict.ts`) used by both review and planning handlers.
279
+
280
+ ### Changed
281
+
282
+ - **Planning redesign: single planner agent** - Replaced the 5-scout + gap-analyst pipeline (6 LLM sessions) with a single `crew-planner` agent that explores the codebase iteratively in one session. Cheaper, faster, no information loss from truncation handoffs. Crew agent count: 10 to 5.
283
+ - **Iterative planning with review** - Planner runs in a multi-pass loop with reviewer feedback until SHIP verdict or `maxPasses` reached. Falls back gracefully on reviewer/planner failures.
284
+ - Deprecated scout and gap-analyst agent files auto-cleaned from `~/.pi/agent/agents/` on first use.
285
+
286
+ ### Removed
287
+
288
+ - 5 scout agents (`crew-repo-scout`, `crew-practice-scout`, `crew-docs-scout`, `crew-web-scout`, `crew-github-scout`) and `crew-gap-analyst`.
289
+ - `concurrency.scouts` and `truncation.scouts` config options (replaced by `truncation.planners`).
290
+
291
+ ## [0.7.4] - 2026-01-29
292
+
293
+ ### Added
294
+
295
+ - **Living Presence** - Agents now have rich status indicators (active, idle, away, stuck) based on activity recency, open tasks, and reservations. Status is computed from `lastActivityAt` with configurable stuck threshold.
296
+ - **Activity Feed** - Append-only JSONL feed (`feed.jsonl`) tracks edits, commits, test runs, messages, joins/leaves, and crew task events. Pruned on startup to `feedRetention` limit. New `feed` action to query events.
297
+ - **Tool & Token Tracking** - Each agent's session tracks tool call count and cumulative token usage, visible in `list`, `whois`, and the overlay.
298
+ - **Auto Status** - Agents generate contextual status messages from recent activity: "on fire" after rapid edits, "debugging..." after repeated test runs, "just shipped" after a commit, "exploring the codebase" while reading files.
299
+ - **Stuck Detection** - Agents idle beyond `stuckThreshold` with an open task or reservation are flagged as stuck. Peers with a UI receive a notification. A `stuck` event is logged to the feed.
300
+ - **Name Themes** - Five name generation themes: `default` (SwiftRaven), `nature` (OakTree), `space` (LunarDust), `minimal` (Alpha), and `custom` with user-supplied word lists.
301
+ - **`whois` action** - Detailed agent info: status, model, branch, session age, tool calls, tokens, reservations, recent files, swarm claims.
302
+ - **`set_status` action** - Set or clear a custom status message. Overrides auto-status until cleared.
303
+ - **`feed` action** - Query the activity feed with configurable `limit`.
304
+ - **Overlay: agent cards** - The Agents tab now renders full presence cards with status indicator, current activity, tool/token counts, reservations, and status messages.
305
+ - **Overlay: activity feed section** - Below agent cards, recent feed events are displayed in a compact time-prefixed format.
306
+ - **Overlay: chat input** - Type `@Name msg` for DMs, `@all msg` for broadcasts. Plain text broadcasts from the Agents tab or DMs from an agent's tab.
307
+ - **Crew events in feed** - Task starts, completions, and blocks appear in the activity feed with a `[Crew]` prefix. Controlled by `crewEventsInFeed` config.
308
+ - **New config options** - `nameTheme`, `nameWords`, `feedRetention`, `stuckThreshold`, `stuckNotify`, `autoStatus`, `crewEventsInFeed`.
309
+
310
+ ### Fixed
311
+
312
+ - **Self-whois missing Model and Branch lines** - `buildSelfRegistration` returned `model: ""` and omitted `gitBranch`/`spec`, so self-whois skipped the Model and Branch lines that peers could see. Added `model` to `MessengerState`, populated during registration and updates, and included all three fields in self-representation.
313
+ - **Rename desync: stale session time and activity** - `renameAgent` wrote fresh `startedAt` and `lastActivityAt` to disk but didn't update the in-memory state. The next registry flush would overwrite the disk's fresh values with stale ones, making the agent appear idle for the entire pre-rename session duration. Self-whois also showed a different session age than peer-whois.
314
+ - **Orphaned comma in crew status "In Progress" formatting** - When a task had no `assigned_to` but `attempt_count > 1`, the output produced a leading comma. Rewrote to build suffix parts as an array and join conditionally.
315
+ - **Blocked reason unconditional "..." truncation** - Crew status always appended "..." to `blocked_reason` regardless of length, so "API timeout" displayed as "API timeout...". Now only truncates when the reason exceeds 40 characters.
316
+ - **`agentHasTask` duplicated 4 times** - Identical logic checking swarm claims + crew tasks existed in `handlers.ts` (2 places), `index.ts`, and `overlay.ts`. Extracted to a shared pure function in `lib.ts`. Eliminates divergence risk (the crew tasks check was already missing from some copies).
317
+ - **Dead code in `executeRelease`** - Removed redundant `before` variable and `releasedCount` computation, replaced with direct `releasedPatterns.length`.
318
+
319
+ ## [0.7.3] - 2026-01-27
320
+
321
+ ### Fixed
322
+
323
+ - Google API compatibility: Use `StringEnum` for string literal unions (`type`, `autoRegisterPath`) and `Type.Any()` for mixed-type unions (`to`, `release`) to avoid unsupported `anyOf`/`const` JSON Schema patterns
324
+
325
+ ## 0.7.2 - 2026-01-26
326
+
327
+ ### Changed
328
+
329
+ - Added `pi-package` keyword for npm discoverability (pi v0.50.0 package system)
330
+
331
+ ## 0.7.1 - 2026-01-24
332
+
333
+ ### Added
334
+
335
+ - **Skill installation** - `crew.install` now installs `pi-messenger-crew` skill alongside agents
336
+ - **Skills directory** - Extension ships skills in `skills/` (moved from `crew/skills/`)
337
+ - **README documentation** - Added "Crew Install" section explaining what gets installed
338
+
339
+ ### Fixed
340
+
341
+ - **Worker pi_messenger access** - Spawned workers now receive `--extension` flag, giving them access to `pi_messenger` tool for mesh coordination, file reservations, and sibling messaging
342
+
343
+ ### Changed
344
+
345
+ - `crew.install` output now lists both agents and skills
346
+ - `crew.uninstall` removes both agents and skills
347
+
348
+ ## 0.7.0 - 2026-01-23
349
+
350
+ ### Breaking Changes
351
+
352
+ **Epic System Removed** - Crew has been simplified to a PRD-based workflow:
353
+
354
+ | Before | After |
355
+ | -------------------------------------------- | ---------------------------------------- |
356
+ | PRD → epic.create → plan epic → work on epic | PRD → plan → work → done |
357
+ | Task IDs: `c-1-abc.1`, `c-1-abc.2` | Task IDs: `task-1`, `task-2` |
358
+ | `target: "c-1-abc"` (epic ID) required | No target needed - works on current plan |
359
+
360
+ ### Removed
361
+
362
+ - **Epic actions** - `epic.create`, `epic.show`, `epic.list`, `epic.close`, `epic.set_spec`
363
+ - **Checkpoint actions** - `checkpoint.save`, `checkpoint.restore`, `checkpoint.delete`, `checkpoint.list`
364
+ - **Epic validation** - `crew.validate` now validates the plan, not an epic
365
+ - **Epic-scoped task operations** - `task.ready` and `task.list` no longer require `epic` parameter
366
+ - **Files deleted:**
367
+ - `crew/handlers/epic.ts` (~285 lines)
368
+ - `crew/handlers/checkpoint.ts` (~190 lines)
369
+ - Epic CRUD functions from `crew/store.ts` (~100 lines)
370
+
371
+ ### Changed
372
+
373
+ - **`plan` action** - Now takes `prd` parameter instead of `target`:
374
+
375
+ ```typescript
376
+ // Before
377
+ pi_messenger({ action: "plan", target: "c-1-abc" });
378
+
379
+ // After
380
+ pi_messenger({ action: "plan" }); // Auto-discover PRD
381
+ pi_messenger({ action: "plan", prd: "docs/PRD.md" }); // Explicit path
382
+ ```
383
+
384
+ - **`work` action** - No longer requires target:
385
+
386
+ ```typescript
387
+ // Before
388
+ pi_messenger({ action: "work", target: "c-1-abc" });
389
+
390
+ // After
391
+ pi_messenger({ action: "work" }); // Work on current plan
392
+ pi_messenger({ action: "work", autonomous: true }); // Autonomous mode
393
+ ```
394
+
395
+ - **`status` action** - Now shows plan progress instead of epic list
396
+
397
+ - **Task IDs** - Simplified from `c-N-xxx.M` to `task-N`:
398
+
399
+ ```typescript
400
+ // Before
401
+ pi_messenger({ action: "task.show", id: "c-1-abc.1" });
402
+
403
+ // After
404
+ pi_messenger({ action: "task.show", id: "task-1" });
405
+ ```
406
+
407
+ - **Crew overlay** - Now shows flat task list under PRD name (no epic grouping)
408
+
409
+ ### Storage
410
+
411
+ New simplified storage structure:
412
+
413
+ ```
414
+ .pi/messenger/crew/
415
+ ├── plan.json # Plan metadata (PRD path, progress)
416
+ ├── plan.md # Gap analyst output
417
+ ├── tasks/
418
+ │ ├── task-1.json # Task metadata
419
+ │ ├── task-1.md # Task spec
420
+ │ └── ...
421
+ ├── artifacts/ # Unchanged
422
+ └── config.json # Unchanged
423
+ ```
424
+
425
+ ### Benefits
426
+
427
+ 1. **Simpler mental model** - PRD → Tasks → Done
428
+ 2. **Less API surface** - 9 fewer actions to learn
429
+ 3. **Cleaner IDs** - `task-1` instead of `c-1-abc.1`
430
+ 4. **PRD is the spec** - No redundant epic spec
431
+ 5. **Faster onboarding** - Fewer concepts to explain
432
+ 6. **~475 lines removed** - Smaller, more maintainable codebase
433
+
434
+ ---
435
+
436
+ ## 0.6.3 - 2026-01-23
437
+
438
+ ### Changed
439
+
440
+ - **Crew agent model assignments** - Optimized for cost and capability:
441
+ - Scouts (deep): `claude-opus-4-5` - repo-scout, github-scout, practice-scout
442
+ - Scouts (fast): `claude-haiku-4-5` - docs-scout, web-scout
443
+ - Analysts: `claude-opus-4-5` - gap-analyst, interview-generator, plan-sync
444
+ - Worker: `claude-opus-4-5` - quality code generation
445
+ - Reviewer: `openai/gpt-5.2-high` - diverse perspective for review
446
+
447
+ - **Streamlined scout roster** - Reduced from 7 to 5 focused scouts:
448
+ - Removed: `crew-memory-scout` (memory system not implemented)
449
+ - Removed: `crew-epic-scout` (only useful for multi-epic projects)
450
+ - Removed: `crew-docs-gap-scout` (merged into gap-analyst)
451
+ - Renamed: `crew-github-scout` → `crew-web-scout` (web search focus)
452
+ - New: `crew-github-scout` (gh CLI integration, sparse checkouts)
453
+
454
+ ### Added
455
+
456
+ - **PRD auto-discovery** - Plan handler now finds and includes PRD/spec files:
457
+ - Searches: `PRD.md`, `SPEC.md`, `REQUIREMENTS.md`, `DESIGN.md`, `PLAN.md`
458
+ - Also checks `docs/` subdirectory
459
+ - Content included in all scout prompts (up to 50KB)
460
+
461
+ - **Review feedback loop** - Workers see previous review feedback on retry:
462
+ - `last_review` field added to Task type
463
+ - Review handler stores feedback after each review
464
+ - Worker prompt includes issues to fix on retry attempts
465
+
466
+ - **Scout skip logic** - web-scout and github-scout assess relevance first:
467
+ - Can skip with explanation if not relevant to the feature
468
+ - Saves time and API costs for internal/simple features
469
+
470
+ - **ARCHITECTURE.md** - New documentation with orchestration flow diagram, model summary, and agent inventory
471
+
472
+ ### Fixed
473
+
474
+ - Template literal bug in worker prompt (epicId not interpolating)
475
+ - Retry detection off-by-one (now correctly shows attempt number)
476
+ - Case-insensitive filesystem duplicate PRD reads (uses realpath)
477
+ - Wave number tracking in autonomous mode (was off-by-one after addWaveResult)
478
+ - CREW_AGENTS list in install.ts (removed deleted agents, added crew-web-scout)
479
+ - Corrupted crew-plan-sync.md (had TypeScript code appended)
480
+
481
+ ## 0.6.2 - 2026-01-23
482
+
483
+ ### Changed
484
+
485
+ - Initial crew agent model assignments (superseded by 0.6.3)
486
+
487
+ ## 0.6.1 - 2026-01-23
488
+
489
+ ### Added
490
+
491
+ - **Planning Workflow Documentation** - README now explains how the `plan` action works:
492
+ - Diagram showing scouts (parallel) → gap-analyst → tasks with dependencies
493
+ - Clarifies that no special format is required for PRDs/specs
494
+ - Example of starting from a PRD with `idea: true`
495
+
496
+ ## 0.6.0 - 2026-01-23
497
+
498
+ ### Added
499
+
500
+ **Crew: Task Orchestration** - A complete multi-agent task orchestration system for complex epics.
501
+
502
+ - **Epics & Tasks** - Hierarchical work items with dependency tracking
503
+ - `epic.create`, `epic.show`, `epic.list`, `epic.close`, `epic.set_spec`
504
+ - `task.create`, `task.show`, `task.list`, `task.start`, `task.done`, `task.block`, `task.unblock`, `task.ready`, `task.reset`
505
+
506
+ - **Planning** - Automated task breakdown with parallel scouts
507
+ - `plan` action runs 7 scout agents in parallel to analyze codebase
508
+ - Gap analyst synthesizes findings into task graph with dependencies
509
+ - Supports planning from idea (`idea: true`) or existing epic
510
+
511
+ - **Work Execution** - Parallel worker spawning with concurrency control
512
+ - `work` action executes ready tasks (dependencies satisfied)
513
+ - `autonomous: true` flag for continuous wave execution until done/blocked
514
+ - Configurable concurrency for scouts (default: 4) and workers (default: 2)
515
+ - Auto-blocks tasks after `maxAttemptsPerTask` failures
516
+
517
+ - **Code Review** - Automated review with verdicts
518
+ - `review` action for implementation (git diff) or plan review
519
+ - SHIP / NEEDS_WORK / MAJOR_RETHINK verdicts with detailed feedback
520
+
521
+ - **Interview** - Clarification question generation
522
+ - `interview` action generates 20-40 deep questions
523
+ - Outputs JSON file for pi's interview tool
524
+
525
+ - **Sync** - Downstream spec updates
526
+ - `sync` action updates dependent task specs after completion
527
+
528
+ - **Checkpoints** - State save/restore for recovery
529
+ - `checkpoint.save`, `checkpoint.restore`, `checkpoint.delete`, `checkpoint.list`
530
+
531
+ - **Status & Maintenance**
532
+ - `crew.status` - Overall crew status with progress metrics
533
+ - `crew.validate` - Validate epic structure and dependencies
534
+ - `crew.agents` - List available crew agents by role
535
+ - `crew.install` / `crew.uninstall` - Agent management
536
+
537
+ - **Crew Overlay Tab** - Visual epic/task tree in `/messenger` overlay
538
+ - Tab bar shows "Crew (N)" with active epic count
539
+ - Expand/collapse epics with Enter key
540
+ - Status icons: ✓ done, ● in_progress, ○ todo, ✗ blocked
541
+ - Shows assigned agent, dependencies, and block reasons
542
+ - Autonomous mode status bar: wave number, progress, ready count, timer
543
+
544
+ - **12 Crew Agents** - Auto-installed on first use of `plan`, `work`, or `review`
545
+ - 7 scouts: repo, practice, docs, github, epic, docs-gap, memory
546
+ - Plus: worker, reviewer, gap-analyst, interview-generator, plan-sync
547
+
548
+ - **Action-based API** - Consistent `action` parameter pattern
549
+ - Example: `pi_messenger({ action: "epic.create", title: "OAuth Login" })`
550
+ - 24 new crew actions, 38 total actions through one tool
551
+
552
+ ### Storage
553
+
554
+ New directory `.pi/messenger/crew/` (per-project):
555
+
556
+ - `epics/*.json` - Epic metadata
557
+ - `specs/*.md` - Epic specifications
558
+ - `tasks/*.json` - Task metadata
559
+ - `tasks/*.md` - Task specifications
560
+ - `blocks/*.md` - Block context for blocked tasks
561
+ - `checkpoints/` - Saved state snapshots
562
+ - `artifacts/` - Debug artifacts (input/output/jsonl per run)
563
+ - `config.json` - Project-level config overrides
564
+
565
+ ### Configuration
566
+
567
+ New `crew` section in `~/.pi/agent/pi-messenger.json`:
568
+
569
+ ```json
570
+ {
571
+ "crew": {
572
+ "concurrency": { "scouts": 4, "workers": 2 },
573
+ "review": { "enabled": true, "maxIterations": 3 },
574
+ "work": { "maxAttemptsPerTask": 5, "maxWaves": 50 },
575
+ "artifacts": { "enabled": true, "cleanupDays": 7 }
576
+ }
577
+ }
578
+ ```
579
+
580
+ ### Fixed
581
+
582
+ - 12 bugs fixed during implementation review:
583
+ - **Critical:** `loadCrewConfig` called with wrong path in plan.ts and work.ts
584
+ - Double-counting bug in work.ts (tasks in both `failed` and `blocked` arrays)
585
+ - O(n²) complexity in plan.ts task creation loop
586
+ - O(n²) complexity in agents.ts worker spawn loop
587
+ - Invalid status icon map in epic.ts (missing `blocked`, `archived`)
588
+ - Various unused imports and variables cleaned up
589
+
590
+ ---
591
+
592
+ ## 0.5.1 - 2026-01-22
593
+
594
+ ### Added
595
+
596
+ - **Path-based auto-register** - New `autoRegisterPaths` config option allows specifying folders where agents should auto-join the mesh, instead of global auto-register. Supports `~` expansion and glob patterns (`~/work/*`).
597
+ - **Folder scoping** - New `scopeToFolder` config option limits agent visibility to the same working directory. When enabled, agents only see other agents in the same folder (broadcasts are scoped, but direct messaging by name still works).
598
+ - **Auto-register path management (tool)** - New `autoRegisterPath` parameter:
599
+ - `pi_messenger({ autoRegisterPath: "add" })` - Add current folder to auto-register list
600
+ - `pi_messenger({ autoRegisterPath: "remove" })` - Remove current folder
601
+ - `pi_messenger({ autoRegisterPath: "list" })` - Show all configured paths
602
+ - **Config TUI command** - `/messenger config` opens an overlay to manage auto-register paths with keyboard navigation.
603
+
604
+ ### Changed
605
+
606
+ - Auto-register logic now checks both `autoRegister` (global) and `autoRegisterPaths` (path-based). If either matches, the agent auto-joins.
607
+ - `getActiveAgents()` now filters by cwd when `scopeToFolder` is enabled.
608
+
609
+ ## 0.5.0 - 2026-01-20
610
+
611
+ ### Added
612
+
613
+ - **Swarm coordination** - Agents can now coordinate on shared spec files with atomic task claiming
614
+ - **Spec registration** - `pi_messenger({ spec: "path/to/spec.md" })` registers your working spec
615
+ - **Task claiming** - `pi_messenger({ claim: "TASK-01" })` atomically claims a task in your spec
616
+ - **Task completion** - `pi_messenger({ complete: "TASK-01", notes: "..." })` marks tasks done with notes
617
+ - **Task unclaiming** - `pi_messenger({ unclaim: "TASK-01" })` releases a claim without completing
618
+ - **Swarm status** - `pi_messenger({ swarm: true })` shows all agents' claims and completions
619
+ - **Spec-scoped swarm** - `pi_messenger({ swarm: true, spec: "path" })` shows status for one spec only
620
+ - **Join with spec** - `pi_messenger({ join: true, spec: "path" })` joins and registers spec atomically
621
+ - **Single-claim-per-agent rule** - Must complete or unclaim before claiming another task
622
+ - **Stale claim cleanup** - Claims from dead agents (PID gone + lock >10s old) are automatically cleaned
623
+
624
+ ### Changed
625
+
626
+ - **Agents tab in overlay** - Now groups agents by spec with claims displayed
627
+ - **Status output** - Now includes current spec and active claim when set
628
+ - **List output** - Now shows spec and claim status for each agent
629
+
630
+ ### Storage
631
+
632
+ New files in `~/.pi/agent/messenger/`:
633
+
634
+ - `claims.json` - Active task claims by spec
635
+ - `completions.json` - Completed tasks by spec
636
+ - `swarm.lock` - Atomic lock for claim/complete mutations
637
+
638
+ ### Fixed
639
+
640
+ - **Safe completion write order** - Completions are now written before claims removal, so if the second write fails the task completion is still recorded
641
+ - **Overlay scroll reset on agent death** - When an agent dies and the overlay auto-switches to another tab, scroll position is now properly reset
642
+ - **Type-safe result handling** - Added proper type guards (`isClaimSuccess`, `isUnclaimNotYours`, etc.) for discriminated union result types, replacing fragile `as` casts
643
+ - **I/O error cleanup** - If registration write succeeds but read-back fails (extremely rare I/O error), the orphaned file is now cleaned up
644
+ - **Single agent lookup for reservations** - `ReservationConflict` now includes full agent registration, eliminating redundant disk reads when blocking reserved files
645
+
646
+ ## 0.4.0 - 2026-01-21
647
+
648
+ ### Changed
649
+
650
+ - **Opt-in registration** - Agents no longer auto-register on startup. Use `pi_messenger({ join: true })` to join the mesh, or open `/messenger` which auto-joins. This reduces context pollution for sessions that don't need multi-agent coordination.
651
+ - **New `autoRegister` config** - Set to `true` to restore the old auto-register-on-startup behavior.
652
+
653
+ ### Fixed
654
+
655
+ - **Read operations no longer blocked by reservations** - Previously, reading reserved files was blocked. Now only `edit` and `write` operations are blocked, allowing agents to read files for context even when another agent has reserved them.
656
+
657
+ ## 0.3.0 - 2026-01-21
658
+
659
+ ### Added
660
+
661
+ - **Agent differentiation** - Agents are now easier to distinguish when multiple work in the same folder
662
+ - **Git branch detection** - Automatically detects and displays git branch (or short SHA for detached HEAD)
663
+ - **Adaptive display modes** - List and overlay views adapt based on agent context:
664
+ - Same folder + branch: Compact view, branch in header
665
+ - Same folder, different branches: Shows branch per agent
666
+ - Different folders: Shows folder per agent
667
+ - **Location awareness** - Status command now shows `Location: folder (branch)`
668
+ - **Enhanced context** - Registration and first-contact messages include location info
669
+ - **Improved reservation display** - Uses 🔒 prefix, truncates long paths from the left preserving filename
670
+
671
+ ### Changed
672
+
673
+ - Reservation conflict messages now show the blocking agent's location: `Reserved by: X (in folder on branch)`
674
+ - First contact message format: `*X is in folder on branch (model)*`
675
+ - Tab bar adapts: name only (same context), name:branch (different branches), name/folder (different folders)
676
+ - Status details object now includes `folder` and `gitBranch` for programmatic access
677
+
678
+ ### Fixed
679
+
680
+ - **Agent identity detection** - When an agent quits and a new pi instance registers with the same name, recipients now correctly see first-contact details. Previously, `seenSenders` tracked names only; now it tracks `name -> sessionId` to detect identity changes.
681
+ - **Registration race condition** - Added write-then-verify check to prevent two agents from claiming the same name simultaneously. If another agent wins the race, auto-generated names retry with a fresh lookup; explicit names fail with a clear error.
682
+ - **Rename race condition** - Added write-then-verify check to `renameAgent()` to prevent two agents from renaming to the same name simultaneously. If verification fails, returns "race_lost" error and the agent keeps its old name.
683
+
684
+ ### Performance
685
+
686
+ - **Cached filtered agents** - `getActiveAgents()` now caches filtered results per agent name, avoiding repeated array allocations on every call.
687
+ - **Memoized agent colors** - `agentColorCode()` now caches computed color codes, avoiding hash recalculation on every render.
688
+ - **Overlay render cache** - Sorted agent list is now cached within each render cycle, avoiding redundant sort operations.
689
+ - **Reduced redundant calls** - `formatRelativeTime()` result is now reused in message box rendering instead of being called twice.
690
+
691
+ ### Documentation
692
+
693
+ - **README overhaul** - New banner image showing connected pi symbols, punchy tagline, license/platform badges, comparison table, organized features section, keyboard shortcuts table, and streamlined layout following reference README patterns.
694
+
695
+ ## 0.2.1 - 2026-01-20
696
+
697
+ ### Fixed
698
+
699
+ - **Performance: Agent registry caching** - `getActiveAgents()` now caches results for 1 second, dramatically reducing disk I/O. Previously, every keypress in the overlay and every tool_call for read/edit/write caused full registry scans.
700
+ - **Performance: Watcher debouncing** - File watcher events are now debounced with 50ms delay, coalescing rapid filesystem events into a single message processing call.
701
+ - **Stability: Message processing guard** - Concurrent calls to `processAllPendingMessages()` are now serialized to prevent race conditions when watcher events and turn_end overlap.
702
+ - **Stability: MessengerState type** - Added `watcherDebounceTimer` field for proper debounce timer management.
703
+
704
+ ## 0.2.0 - 2026-01-20
705
+
706
+ ### Added
707
+
708
+ - **Chat overlay** - `/messenger` now opens an interactive overlay instead of a menu. Full chat interface with tabs for each agent, message history, and an input bar at the bottom.
709
+ - **Message history** - Messages persist in memory for the session (up to 50 per conversation). Scroll through history with arrow keys.
710
+ - **Unread badges** - Status bar shows total unread count. Tab bar shows per-agent unread counts that clear when you switch to that tab.
711
+ - **Broadcast tab** - "+ All" tab for sending messages to all agents at once. Shows your outgoing broadcast history.
712
+ - **Agent colors** - Each agent name gets a consistent color based on a hash of their name. Makes it easy to distinguish agents in conversations.
713
+ - **Agent details** - When viewing a conversation with no messages, shows the agent's working directory, model, and file reservations.
714
+ - **Context injection** - Agents now receive orientation on startup and helpful context with messages:
715
+ - Registration message explaining multi-agent environment (once per session)
716
+ - Reply hint showing how to respond to messages
717
+ - Sender details (cwd, model) on first contact from each agent
718
+ - **Configuration file** - `~/.pi/agent/pi-messenger.json` for customizing context injection. Supports `contextMode: "full" | "minimal" | "none"`.
719
+
720
+ ### Changed
721
+
722
+ - `/messenger` command now opens overlay (was: interactive menu with select prompts)
723
+ - Status bar now shows unread count badge when messages are waiting
724
+
725
+ ### Fixed
726
+
727
+ - Message delivery order: files are now deleted after successful delivery, not before (prevents message loss if delivery fails)
728
+ - ANSI escape codes in message text are now stripped to prevent terminal injection
729
+ - Watcher recovery: if the inbox watcher dies after exhausting retries, it now automatically recovers on the next turn or session event
730
+ - Small terminal handling: overlay now handles very small terminal windows gracefully with minimum height safeguards
731
+
732
+ ## 0.1.0 - 2026-01-20
733
+
734
+ Initial release.
735
+
736
+ - Agent discovery with auto-generated memorable names (SwiftRaven, GoldFalcon, etc.)
737
+ - Direct messaging between agents with immediate delivery
738
+ - Broadcast messaging to all active agents
739
+ - File reservations with conflict detection
740
+ - Message renderer for incoming agent messages
741
+ - Status bar integration showing agent name and peer count