pi-messenger 0.7.3

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 (45) hide show
  1. package/ARCHITECTURE.md +244 -0
  2. package/CHANGELOG.md +418 -0
  3. package/README.md +394 -0
  4. package/banner.png +0 -0
  5. package/config-overlay.ts +172 -0
  6. package/config.ts +178 -0
  7. package/crew/agents/crew-docs-scout.md +55 -0
  8. package/crew/agents/crew-gap-analyst.md +105 -0
  9. package/crew/agents/crew-github-scout.md +111 -0
  10. package/crew/agents/crew-interview-generator.md +79 -0
  11. package/crew/agents/crew-plan-sync.md +64 -0
  12. package/crew/agents/crew-practice-scout.md +62 -0
  13. package/crew/agents/crew-repo-scout.md +65 -0
  14. package/crew/agents/crew-reviewer.md +58 -0
  15. package/crew/agents/crew-web-scout.md +85 -0
  16. package/crew/agents/crew-worker.md +95 -0
  17. package/crew/agents.ts +200 -0
  18. package/crew/handlers/interview.ts +211 -0
  19. package/crew/handlers/plan.ts +358 -0
  20. package/crew/handlers/review.ts +341 -0
  21. package/crew/handlers/status.ts +257 -0
  22. package/crew/handlers/sync.ts +232 -0
  23. package/crew/handlers/task.ts +511 -0
  24. package/crew/handlers/work.ts +289 -0
  25. package/crew/id-allocator.ts +44 -0
  26. package/crew/index.ts +229 -0
  27. package/crew/state.ts +116 -0
  28. package/crew/store.ts +480 -0
  29. package/crew/types.ts +164 -0
  30. package/crew/utils/artifacts.ts +65 -0
  31. package/crew/utils/config.ts +104 -0
  32. package/crew/utils/discover.ts +170 -0
  33. package/crew/utils/install.ts +373 -0
  34. package/crew/utils/progress.ts +107 -0
  35. package/crew/utils/result.ts +16 -0
  36. package/crew/utils/truncate.ts +79 -0
  37. package/crew-overlay.ts +259 -0
  38. package/handlers.ts +799 -0
  39. package/index.ts +591 -0
  40. package/lib.ts +232 -0
  41. package/overlay.ts +687 -0
  42. package/package.json +20 -0
  43. package/skills/pi-messenger-crew/SKILL.md +140 -0
  44. package/store.ts +1068 -0
  45. package/tsconfig.json +19 -0
@@ -0,0 +1,244 @@
1
+ # Crew Architecture
2
+
3
+ ## Simplified Workflow
4
+
5
+ ```
6
+ PRD → plan → tasks → work → done
7
+ ```
8
+
9
+ No epics. Just PRD-based task planning and execution.
10
+
11
+ ## Orchestration Flow
12
+
13
+ ```
14
+ ┌─────────────────────────────────────────────────────────────────────────────────┐
15
+ │ CREW ORCHESTRATION FLOW │
16
+ └─────────────────────────────────────────────────────────────────────────────────┘
17
+
18
+ ┌─────────────────┐
19
+ │ PRD / Spec │
20
+ │ (PRD.md, etc) │
21
+ └────────┬────────┘
22
+
23
+
24
+ ┌─────────────────────────────────────────────────────────────────────────────────┐
25
+ │ PHASE 1: PLANNING pi_messenger({ │
26
+ │ action: "plan"}) │
27
+ │ ┌─────────────────────────────────────────────────────────────────────────┐ │
28
+ │ │ SCOUTS (parallel) │ │
29
+ │ │ │ │
30
+ │ │ ┌──────────────┐ ┌──────────────┐ ┌──────────────┐ │ │
31
+ │ │ │ repo-scout │ │ docs-scout │ │practice-scout│ │ │
32
+ │ │ │ (opus) │ │ (haiku) │ │ (opus) │ │ │
33
+ │ │ │ │ │ │ │ │ │ │
34
+ │ │ │ Codebase │ │ PRD, README │ │ Conventions │ │ │
35
+ │ │ │ structure │ │ specs, docs │ │ patterns │ │ │
36
+ │ │ └──────┬───────┘ └──────┬───────┘ └──────┬───────┘ │ │
37
+ │ │ │ │ │ │ │
38
+ │ │ ┌──────────────┐ ┌──────────────┐ │ │ │
39
+ │ │ │ web-scout │ │ github-scout │ │ │ │
40
+ │ │ │ (haiku) │ │ (opus) │ │ │ │
41
+ │ │ │ │ │ │ │ │ │
42
+ │ │ │ Best practic-│ │ Real repos │ │ │ │
43
+ │ │ │ es, articles │ │ via gh CLI │ │ │ │
44
+ │ │ └──────┬───────┘ └──────┬───────┘ │ │ │
45
+ │ │ │ │ │ │ │
46
+ │ │ └─────────────────┴─────────────────┘ │ │
47
+ │ │ │ │ │
48
+ │ │ ┌───────▼───────┐ │ │
49
+ │ │ │ Findings... │ │ │
50
+ │ │ └───────┬───────┘ │ │
51
+ │ └────────────────────────────┼─────────────────────────────────────────────┘ │
52
+ │ │ │
53
+ │ ▼ │
54
+ │ ┌─────────────────────────────────────────────────────────────────────────┐ │
55
+ │ │ GAP ANALYST (opus) │ │
56
+ │ │ │ │
57
+ │ │ • Synthesize scout findings │ │
58
+ │ │ • Identify gaps and edge cases │ │
59
+ │ │ • Create task breakdown with dependencies │ │
60
+ │ │ │ │
61
+ │ └──────────────────────────────┬──────────────────────────────────────────┘ │
62
+ │ │ │
63
+ │ ▼ │
64
+ │ ┌─────────────────────────────────────────────────────────────────────────┐ │
65
+ │ │ TASKS CREATED │ │
66
+ │ │ │ │
67
+ │ │ task-1: Setup types ──────────────────┐ │ │
68
+ │ │ task-2: Core logic ───────────────────┼─── depends on task-1 │ │
69
+ │ │ task-3: API endpoints ────────────────┘ │ │
70
+ │ │ task-4: Tests ──────────────────────────── depends on task-2, task-3 │ │
71
+ │ │ │ │
72
+ │ └─────────────────────────────────────────────────────────────────────────┘ │
73
+ └─────────────────────────────────────────────────────────────────────────────────┘
74
+
75
+
76
+ ┌─────────────────────────────────────────────────────────────────────────────────┐
77
+ │ PHASE 2: WORK EXECUTION pi_messenger({ │
78
+ │ action: "work"}) │
79
+ │ │
80
+ │ Ready tasks ──► ┌────────────────────────────────────────────────────────┐ │
81
+ │ (deps met) │ WORKERS (parallel) │ │
82
+ │ │ │ │
83
+ │ │ ┌─────────────┐ ┌─────────────┐ │ │
84
+ │ │ │ worker │ │ worker │ concurrency: 2 │ │
85
+ │ │ │ (opus) │ │ (opus) │ │ │
86
+ │ │ │ │ │ │ │ │
87
+ │ │ │ task-1 │ │ task-3 │ │ │
88
+ │ │ └──────┬──────┘ └──────┬──────┘ │ │
89
+ │ │ │ │ │ │
90
+ │ └──────────┼──────────────────┼──────────────────────────┘ │
91
+ │ │ │ │
92
+ │ ▼ ▼ │
93
+ │ ┌──────────┐ ┌──────────┐ │
94
+ │ │ Done │ │ Done │ │
95
+ │ └────┬─────┘ └────┬─────┘ │
96
+ │ │ │ │
97
+ │ └────────┬─────────┘ │
98
+ │ │ │
99
+ │ ▼ │
100
+ │ ┌─────────────────────────────────────────────────────────────────────────┐ │
101
+ │ │ REVIEW (per task) │ │
102
+ │ │ │ │
103
+ │ │ ┌─────────────────────┐ │ │
104
+ │ │ │ reviewer │ │ │
105
+ │ │ │ (gpt-5.2-high) │ │ │
106
+ │ │ │ │ │ │
107
+ │ │ │ Code quality, docs, │ │ │
108
+ │ │ │ correctness, style │ │ │
109
+ │ │ └──────────┬──────────┘ │ │
110
+ │ │ │ │ │
111
+ │ │ ▼ │ │
112
+ │ │ ┌──────────────────────────────────────────────┐ │ │
113
+ │ │ │ SHIP ✅ │ NEEDS_WORK 🔄 │ MAJOR_RETHINK ❌ │ │ │
114
+ │ │ └──────────────────────────────────────────────┘ │ │
115
+ │ │ │ │
116
+ │ └─────────────────────────────────────────────────────────────────────────┘ │
117
+ │ │
118
+ │ ┌─────────────────────────────────────────────────────────────────────────┐ │
119
+ │ │ AUTONOMOUS MODE (autonomous: true) │ │
120
+ │ │ │ │
121
+ │ │ Wave 1 ──► Wave 2 ──► Wave 3 ──► ... ──► All done or blocked │ │
122
+ │ │ │ │
123
+ │ │ Continues until: │ │
124
+ │ │ • All tasks completed │ │
125
+ │ │ • All remaining tasks blocked (no ready tasks) │ │
126
+ │ └─────────────────────────────────────────────────────────────────────────┘ │
127
+ │ │
128
+ └─────────────────────────────────────────────────────────────────────────────────┘
129
+ ```
130
+
131
+ **Note:** Review is a separate manual action (`action: "review"`), not automatic after work completion.
132
+
133
+ ## Model Summary
134
+
135
+ | Role | Model | Agents |
136
+ |------|-------|--------|
137
+ | Scout (deep) | `claude-opus-4-5` | repo-scout, github-scout, practice-scout |
138
+ | Scout (fast) | `claude-haiku-4-5` | docs-scout, web-scout |
139
+ | Analyst | `claude-opus-4-5` | gap-analyst, interview-generator, plan-sync |
140
+ | Worker | `claude-opus-4-5` | worker |
141
+ | Reviewer | `openai/gpt-5.2-high` | reviewer |
142
+
143
+ ## Agent Inventory
144
+
145
+ ### Scouts (5)
146
+
147
+ | Agent | Model | Purpose |
148
+ |-------|-------|---------|
149
+ | `crew-repo-scout` | opus | Analyzes codebase structure, finds relevant files |
150
+ | `crew-docs-scout` | haiku | Reads project docs (PRD, README, specs) |
151
+ | `crew-practice-scout` | opus | Identifies coding conventions and patterns |
152
+ | `crew-web-scout` | haiku | Searches web for best practices, articles |
153
+ | `crew-github-scout` | opus | Searches GitHub repos, examines real code via `gh` CLI |
154
+
155
+ ### Analysts (3)
156
+
157
+ | Agent | Model | Purpose |
158
+ |-------|-------|---------|
159
+ | `crew-gap-analyst` | opus | Synthesizes scout findings into task breakdown |
160
+ | `crew-interview-generator` | opus | Generates clarifying questions |
161
+ | `crew-plan-sync` | opus | Updates downstream task specs after changes |
162
+
163
+ ### Workers (1)
164
+
165
+ | Agent | Model | Purpose |
166
+ |-------|-------|---------|
167
+ | `crew-worker` | opus | Implements tasks, writes code |
168
+
169
+ ### Reviewers (1)
170
+
171
+ | Agent | Model | Purpose |
172
+ |-------|-------|---------|
173
+ | `crew-reviewer` | gpt-5.2-high | Code review with SHIP/NEEDS_WORK/MAJOR_RETHINK verdicts |
174
+
175
+ ## Data Storage
176
+
177
+ ```
178
+ .pi/messenger/crew/
179
+ ├── plan.json # Plan metadata (PRD path, task counts)
180
+ ├── plan.md # Gap analyst output (task breakdown)
181
+ ├── tasks/
182
+ │ ├── task-1.json # Task metadata (status, deps, attempts)
183
+ │ ├── task-1.md # Task specification
184
+ │ ├── task-2.json
185
+ │ └── task-2.md
186
+ ├── blocks/
187
+ │ └── task-3.md # Block context (if blocked)
188
+ ├── artifacts/ # Debug artifacts (flat, auto-cleaned)
189
+ │ ├── {runId}_{agent}_input.md
190
+ │ ├── {runId}_{agent}_output.md
191
+ │ ├── {runId}_{agent}.jsonl
192
+ │ └── {runId}_{agent}_meta.json
193
+ └── config.json # Project-level crew config
194
+ ```
195
+
196
+ ## Configuration
197
+
198
+ ```json
199
+ {
200
+ "crew": {
201
+ "concurrency": {
202
+ "scouts": 4,
203
+ "workers": 2
204
+ },
205
+ "truncation": {
206
+ "scouts": { "bytes": 51200, "lines": 500 },
207
+ "workers": { "bytes": 204800, "lines": 5000 },
208
+ "reviewers": { "bytes": 102400, "lines": 2000 },
209
+ "analysts": { "bytes": 102400, "lines": 2000 }
210
+ },
211
+ "review": {
212
+ "enabled": true,
213
+ "maxIterations": 3
214
+ },
215
+ "work": {
216
+ "maxAttemptsPerTask": 5,
217
+ "maxWaves": 50,
218
+ "stopOnBlock": false
219
+ },
220
+ "artifacts": {
221
+ "enabled": true,
222
+ "cleanupDays": 7
223
+ },
224
+ "memory": { "enabled": false },
225
+ "planSync": { "enabled": false }
226
+ }
227
+ }
228
+ ```
229
+
230
+ | Section | Description |
231
+ |---------|-------------|
232
+ | `concurrency` | Parallel execution limits |
233
+ | `truncation` | Output size limits per agent role |
234
+ | `review` | Auto-review settings (note: `enabled` and `maxIterations` defined but not enforced) |
235
+ | `work` | Execution limits (note: `maxWaves` and `maxAttemptsPerTask` defined but not enforced) |
236
+ | `artifacts` | Debug artifact storage |
237
+ | `memory` | Memory system (not yet implemented) |
238
+ | `planSync` | Auto-sync downstream specs (not yet implemented) |
239
+
240
+ ## Task IDs
241
+
242
+ Simple format: `task-1`, `task-2`, `task-3`, ...
243
+
244
+ No epic prefixes needed.
package/CHANGELOG.md ADDED
@@ -0,0 +1,418 @@
1
+ # Changelog
2
+
3
+ ## [Unreleased]
4
+
5
+ ## [0.7.3] - 2026-01-27
6
+
7
+ ### Fixed
8
+ - 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
9
+
10
+ ## 0.7.2 - 2026-01-26
11
+
12
+ ### Changed
13
+ - Added `pi-package` keyword for npm discoverability (pi v0.50.0 package system)
14
+
15
+ ## 0.7.1 - 2026-01-24
16
+
17
+ ### Added
18
+
19
+ - **Skill installation** - `crew.install` now installs `pi-messenger-crew` skill alongside agents
20
+ - **Skills directory** - Extension ships skills in `skills/` (moved from `crew/skills/`)
21
+ - **README documentation** - Added "Crew Install" section explaining what gets installed
22
+
23
+ ### Fixed
24
+
25
+ - **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
26
+
27
+ ### Changed
28
+
29
+ - `crew.install` output now lists both agents and skills
30
+ - `crew.uninstall` removes both agents and skills
31
+
32
+ ## 0.7.0 - 2026-01-23
33
+
34
+ ### Breaking Changes
35
+
36
+ **Epic System Removed** - Crew has been simplified to a PRD-based workflow:
37
+
38
+ | Before | After |
39
+ |--------|-------|
40
+ | PRD → epic.create → plan epic → work on epic | PRD → plan → work → done |
41
+ | Task IDs: `c-1-abc.1`, `c-1-abc.2` | Task IDs: `task-1`, `task-2` |
42
+ | `target: "c-1-abc"` (epic ID) required | No target needed - works on current plan |
43
+
44
+ ### Removed
45
+
46
+ - **Epic actions** - `epic.create`, `epic.show`, `epic.list`, `epic.close`, `epic.set_spec`
47
+ - **Checkpoint actions** - `checkpoint.save`, `checkpoint.restore`, `checkpoint.delete`, `checkpoint.list`
48
+ - **Epic validation** - `crew.validate` now validates the plan, not an epic
49
+ - **Epic-scoped task operations** - `task.ready` and `task.list` no longer require `epic` parameter
50
+ - **Files deleted:**
51
+ - `crew/handlers/epic.ts` (~285 lines)
52
+ - `crew/handlers/checkpoint.ts` (~190 lines)
53
+ - Epic CRUD functions from `crew/store.ts` (~100 lines)
54
+
55
+ ### Changed
56
+
57
+ - **`plan` action** - Now takes `prd` parameter instead of `target`:
58
+ ```typescript
59
+ // Before
60
+ pi_messenger({ action: "plan", target: "c-1-abc" })
61
+
62
+ // After
63
+ pi_messenger({ action: "plan" }) // Auto-discover PRD
64
+ pi_messenger({ action: "plan", prd: "docs/PRD.md" }) // Explicit path
65
+ ```
66
+
67
+ - **`work` action** - No longer requires target:
68
+ ```typescript
69
+ // Before
70
+ pi_messenger({ action: "work", target: "c-1-abc" })
71
+
72
+ // After
73
+ pi_messenger({ action: "work" }) // Work on current plan
74
+ pi_messenger({ action: "work", autonomous: true }) // Autonomous mode
75
+ ```
76
+
77
+ - **`status` action** - Now shows plan progress instead of epic list
78
+
79
+ - **Task IDs** - Simplified from `c-N-xxx.M` to `task-N`:
80
+ ```typescript
81
+ // Before
82
+ pi_messenger({ action: "task.show", id: "c-1-abc.1" })
83
+
84
+ // After
85
+ pi_messenger({ action: "task.show", id: "task-1" })
86
+ ```
87
+
88
+ - **Crew overlay** - Now shows flat task list under PRD name (no epic grouping)
89
+
90
+ ### Storage
91
+
92
+ New simplified storage structure:
93
+ ```
94
+ .pi/messenger/crew/
95
+ ├── plan.json # Plan metadata (PRD path, progress)
96
+ ├── plan.md # Gap analyst output
97
+ ├── tasks/
98
+ │ ├── task-1.json # Task metadata
99
+ │ ├── task-1.md # Task spec
100
+ │ └── ...
101
+ ├── artifacts/ # Unchanged
102
+ └── config.json # Unchanged
103
+ ```
104
+
105
+ ### Benefits
106
+
107
+ 1. **Simpler mental model** - PRD → Tasks → Done
108
+ 2. **Less API surface** - 9 fewer actions to learn
109
+ 3. **Cleaner IDs** - `task-1` instead of `c-1-abc.1`
110
+ 4. **PRD is the spec** - No redundant epic spec
111
+ 5. **Faster onboarding** - Fewer concepts to explain
112
+ 6. **~475 lines removed** - Smaller, more maintainable codebase
113
+
114
+ ---
115
+
116
+ ## 0.6.3 - 2026-01-23
117
+
118
+ ### Changed
119
+
120
+ - **Crew agent model assignments** - Optimized for cost and capability:
121
+ - Scouts (deep): `claude-opus-4-5` - repo-scout, github-scout, practice-scout
122
+ - Scouts (fast): `claude-haiku-4-5` - docs-scout, web-scout
123
+ - Analysts: `claude-opus-4-5` - gap-analyst, interview-generator, plan-sync
124
+ - Worker: `claude-opus-4-5` - quality code generation
125
+ - Reviewer: `openai/gpt-5.2-high` - diverse perspective for review
126
+
127
+ - **Streamlined scout roster** - Reduced from 7 to 5 focused scouts:
128
+ - Removed: `crew-memory-scout` (memory system not implemented)
129
+ - Removed: `crew-epic-scout` (only useful for multi-epic projects)
130
+ - Removed: `crew-docs-gap-scout` (merged into gap-analyst)
131
+ - Renamed: `crew-github-scout` → `crew-web-scout` (web search focus)
132
+ - New: `crew-github-scout` (gh CLI integration, sparse checkouts)
133
+
134
+ ### Added
135
+
136
+ - **PRD auto-discovery** - Plan handler now finds and includes PRD/spec files:
137
+ - Searches: `PRD.md`, `SPEC.md`, `REQUIREMENTS.md`, `DESIGN.md`, `PLAN.md`
138
+ - Also checks `docs/` subdirectory
139
+ - Content included in all scout prompts (up to 50KB)
140
+
141
+ - **Review feedback loop** - Workers see previous review feedback on retry:
142
+ - `last_review` field added to Task type
143
+ - Review handler stores feedback after each review
144
+ - Worker prompt includes issues to fix on retry attempts
145
+
146
+ - **Scout skip logic** - web-scout and github-scout assess relevance first:
147
+ - Can skip with explanation if not relevant to the feature
148
+ - Saves time and API costs for internal/simple features
149
+
150
+ - **ARCHITECTURE.md** - New documentation with orchestration flow diagram, model summary, and agent inventory
151
+
152
+ ### Fixed
153
+
154
+ - Template literal bug in worker prompt (epicId not interpolating)
155
+ - Retry detection off-by-one (now correctly shows attempt number)
156
+ - Case-insensitive filesystem duplicate PRD reads (uses realpath)
157
+ - Wave number tracking in autonomous mode (was off-by-one after addWaveResult)
158
+ - CREW_AGENTS list in install.ts (removed deleted agents, added crew-web-scout)
159
+ - Corrupted crew-plan-sync.md (had TypeScript code appended)
160
+
161
+ ## 0.6.2 - 2026-01-23
162
+
163
+ ### Changed
164
+
165
+ - Initial crew agent model assignments (superseded by 0.6.3)
166
+
167
+ ## 0.6.1 - 2026-01-23
168
+
169
+ ### Added
170
+
171
+ - **Planning Workflow Documentation** - README now explains how the `plan` action works:
172
+ - Diagram showing scouts (parallel) → gap-analyst → tasks with dependencies
173
+ - Clarifies that no special format is required for PRDs/specs
174
+ - Example of starting from a PRD with `idea: true`
175
+
176
+ ## 0.6.0 - 2026-01-23
177
+
178
+ ### Added
179
+
180
+ **Crew: Task Orchestration** - A complete multi-agent task orchestration system for complex epics.
181
+
182
+ - **Epics & Tasks** - Hierarchical work items with dependency tracking
183
+ - `epic.create`, `epic.show`, `epic.list`, `epic.close`, `epic.set_spec`
184
+ - `task.create`, `task.show`, `task.list`, `task.start`, `task.done`, `task.block`, `task.unblock`, `task.ready`, `task.reset`
185
+
186
+ - **Planning** - Automated task breakdown with parallel scouts
187
+ - `plan` action runs 7 scout agents in parallel to analyze codebase
188
+ - Gap analyst synthesizes findings into task graph with dependencies
189
+ - Supports planning from idea (`idea: true`) or existing epic
190
+
191
+ - **Work Execution** - Parallel worker spawning with concurrency control
192
+ - `work` action executes ready tasks (dependencies satisfied)
193
+ - `autonomous: true` flag for continuous wave execution until done/blocked
194
+ - Configurable concurrency for scouts (default: 4) and workers (default: 2)
195
+ - Auto-blocks tasks after `maxAttemptsPerTask` failures
196
+
197
+ - **Code Review** - Automated review with verdicts
198
+ - `review` action for implementation (git diff) or plan review
199
+ - SHIP / NEEDS_WORK / MAJOR_RETHINK verdicts with detailed feedback
200
+
201
+ - **Interview** - Clarification question generation
202
+ - `interview` action generates 20-40 deep questions
203
+ - Outputs JSON file for pi's interview tool
204
+
205
+ - **Sync** - Downstream spec updates
206
+ - `sync` action updates dependent task specs after completion
207
+
208
+ - **Checkpoints** - State save/restore for recovery
209
+ - `checkpoint.save`, `checkpoint.restore`, `checkpoint.delete`, `checkpoint.list`
210
+
211
+ - **Status & Maintenance**
212
+ - `crew.status` - Overall crew status with progress metrics
213
+ - `crew.validate` - Validate epic structure and dependencies
214
+ - `crew.agents` - List available crew agents by role
215
+ - `crew.install` / `crew.uninstall` - Agent management
216
+
217
+ - **Crew Overlay Tab** - Visual epic/task tree in `/messenger` overlay
218
+ - Tab bar shows "Crew (N)" with active epic count
219
+ - Expand/collapse epics with Enter key
220
+ - Status icons: ✓ done, ● in_progress, ○ todo, ✗ blocked
221
+ - Shows assigned agent, dependencies, and block reasons
222
+ - Autonomous mode status bar: wave number, progress, ready count, timer
223
+
224
+ - **12 Crew Agents** - Auto-installed on first use of `plan`, `work`, or `review`
225
+ - 7 scouts: repo, practice, docs, github, epic, docs-gap, memory
226
+ - Plus: worker, reviewer, gap-analyst, interview-generator, plan-sync
227
+
228
+ - **Action-based API** - Consistent `action` parameter pattern
229
+ - Example: `pi_messenger({ action: "epic.create", title: "OAuth Login" })`
230
+ - 24 new crew actions, 38 total actions through one tool
231
+
232
+ ### Storage
233
+
234
+ New directory `.pi/messenger/crew/` (per-project):
235
+ - `epics/*.json` - Epic metadata
236
+ - `specs/*.md` - Epic specifications
237
+ - `tasks/*.json` - Task metadata
238
+ - `tasks/*.md` - Task specifications
239
+ - `blocks/*.md` - Block context for blocked tasks
240
+ - `checkpoints/` - Saved state snapshots
241
+ - `artifacts/` - Debug artifacts (input/output/jsonl per run)
242
+ - `config.json` - Project-level config overrides
243
+
244
+ ### Configuration
245
+
246
+ New `crew` section in `~/.pi/agent/pi-messenger.json`:
247
+ ```json
248
+ {
249
+ "crew": {
250
+ "concurrency": { "scouts": 4, "workers": 2 },
251
+ "review": { "enabled": true, "maxIterations": 3 },
252
+ "work": { "maxAttemptsPerTask": 5, "maxWaves": 50 },
253
+ "artifacts": { "enabled": true, "cleanupDays": 7 }
254
+ }
255
+ }
256
+ ```
257
+
258
+ ### Fixed
259
+
260
+ - 12 bugs fixed during implementation review:
261
+ - **Critical:** `loadCrewConfig` called with wrong path in plan.ts and work.ts
262
+ - Double-counting bug in work.ts (tasks in both `failed` and `blocked` arrays)
263
+ - O(n²) complexity in plan.ts task creation loop
264
+ - O(n²) complexity in agents.ts worker spawn loop
265
+ - Invalid status icon map in epic.ts (missing `blocked`, `archived`)
266
+ - Various unused imports and variables cleaned up
267
+
268
+ ---
269
+
270
+ ## 0.5.1 - 2026-01-22
271
+
272
+ ### Added
273
+
274
+ - **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/*`).
275
+ - **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).
276
+ - **Auto-register path management (tool)** - New `autoRegisterPath` parameter:
277
+ - `pi_messenger({ autoRegisterPath: "add" })` - Add current folder to auto-register list
278
+ - `pi_messenger({ autoRegisterPath: "remove" })` - Remove current folder
279
+ - `pi_messenger({ autoRegisterPath: "list" })` - Show all configured paths
280
+ - **Config TUI command** - `/messenger config` opens an overlay to manage auto-register paths with keyboard navigation.
281
+
282
+ ### Changed
283
+
284
+ - Auto-register logic now checks both `autoRegister` (global) and `autoRegisterPaths` (path-based). If either matches, the agent auto-joins.
285
+ - `getActiveAgents()` now filters by cwd when `scopeToFolder` is enabled.
286
+
287
+ ## 0.5.0 - 2026-01-20
288
+
289
+ ### Added
290
+
291
+ - **Swarm coordination** - Agents can now coordinate on shared spec files with atomic task claiming
292
+ - **Spec registration** - `pi_messenger({ spec: "path/to/spec.md" })` registers your working spec
293
+ - **Task claiming** - `pi_messenger({ claim: "TASK-01" })` atomically claims a task in your spec
294
+ - **Task completion** - `pi_messenger({ complete: "TASK-01", notes: "..." })` marks tasks done with notes
295
+ - **Task unclaiming** - `pi_messenger({ unclaim: "TASK-01" })` releases a claim without completing
296
+ - **Swarm status** - `pi_messenger({ swarm: true })` shows all agents' claims and completions
297
+ - **Spec-scoped swarm** - `pi_messenger({ swarm: true, spec: "path" })` shows status for one spec only
298
+ - **Join with spec** - `pi_messenger({ join: true, spec: "path" })` joins and registers spec atomically
299
+ - **Single-claim-per-agent rule** - Must complete or unclaim before claiming another task
300
+ - **Stale claim cleanup** - Claims from dead agents (PID gone + lock >10s old) are automatically cleaned
301
+
302
+ ### Changed
303
+
304
+ - **Agents tab in overlay** - Now groups agents by spec with claims displayed
305
+ - **Status output** - Now includes current spec and active claim when set
306
+ - **List output** - Now shows spec and claim status for each agent
307
+
308
+ ### Storage
309
+
310
+ New files in `~/.pi/agent/messenger/`:
311
+ - `claims.json` - Active task claims by spec
312
+ - `completions.json` - Completed tasks by spec
313
+ - `swarm.lock` - Atomic lock for claim/complete mutations
314
+
315
+ ### Fixed
316
+
317
+ - **Safe completion write order** - Completions are now written before claims removal, so if the second write fails the task completion is still recorded
318
+ - **Overlay scroll reset on agent death** - When an agent dies and the overlay auto-switches to another tab, scroll position is now properly reset
319
+ - **Type-safe result handling** - Added proper type guards (`isClaimSuccess`, `isUnclaimNotYours`, etc.) for discriminated union result types, replacing fragile `as` casts
320
+ - **I/O error cleanup** - If registration write succeeds but read-back fails (extremely rare I/O error), the orphaned file is now cleaned up
321
+ - **Single agent lookup for reservations** - `ReservationConflict` now includes full agent registration, eliminating redundant disk reads when blocking reserved files
322
+
323
+ ## 0.4.0 - 2026-01-21
324
+
325
+ ### Changed
326
+
327
+ - **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.
328
+ - **New `autoRegister` config** - Set to `true` to restore the old auto-register-on-startup behavior.
329
+
330
+ ### Fixed
331
+
332
+ - **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.
333
+
334
+ ## 0.3.0 - 2026-01-21
335
+
336
+ ### Added
337
+
338
+ - **Agent differentiation** - Agents are now easier to distinguish when multiple work in the same folder
339
+ - **Git branch detection** - Automatically detects and displays git branch (or short SHA for detached HEAD)
340
+ - **Adaptive display modes** - List and overlay views adapt based on agent context:
341
+ - Same folder + branch: Compact view, branch in header
342
+ - Same folder, different branches: Shows branch per agent
343
+ - Different folders: Shows folder per agent
344
+ - **Location awareness** - Status command now shows `Location: folder (branch)`
345
+ - **Enhanced context** - Registration and first-contact messages include location info
346
+ - **Improved reservation display** - Uses 🔒 prefix, truncates long paths from the left preserving filename
347
+
348
+ ### Changed
349
+
350
+ - Reservation conflict messages now show the blocking agent's location: `Reserved by: X (in folder on branch)`
351
+ - First contact message format: `*X is in folder on branch (model)*`
352
+ - Tab bar adapts: name only (same context), name:branch (different branches), name/folder (different folders)
353
+ - Status details object now includes `folder` and `gitBranch` for programmatic access
354
+
355
+ ### Fixed
356
+
357
+ - **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.
358
+ - **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.
359
+ - **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.
360
+
361
+ ### Performance
362
+
363
+ - **Cached filtered agents** - `getActiveAgents()` now caches filtered results per agent name, avoiding repeated array allocations on every call.
364
+ - **Memoized agent colors** - `agentColorCode()` now caches computed color codes, avoiding hash recalculation on every render.
365
+ - **Overlay render cache** - Sorted agent list is now cached within each render cycle, avoiding redundant sort operations.
366
+ - **Reduced redundant calls** - `formatRelativeTime()` result is now reused in message box rendering instead of being called twice.
367
+
368
+ ### Documentation
369
+
370
+ - **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.
371
+
372
+ ## 0.2.1 - 2026-01-20
373
+
374
+ ### Fixed
375
+
376
+ - **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.
377
+ - **Performance: Watcher debouncing** - File watcher events are now debounced with 50ms delay, coalescing rapid filesystem events into a single message processing call.
378
+ - **Stability: Message processing guard** - Concurrent calls to `processAllPendingMessages()` are now serialized to prevent race conditions when watcher events and turn_end overlap.
379
+ - **Stability: MessengerState type** - Added `watcherDebounceTimer` field for proper debounce timer management.
380
+
381
+ ## 0.2.0 - 2026-01-20
382
+
383
+ ### Added
384
+
385
+ - **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.
386
+ - **Message history** - Messages persist in memory for the session (up to 50 per conversation). Scroll through history with arrow keys.
387
+ - **Unread badges** - Status bar shows total unread count. Tab bar shows per-agent unread counts that clear when you switch to that tab.
388
+ - **Broadcast tab** - "+ All" tab for sending messages to all agents at once. Shows your outgoing broadcast history.
389
+ - **Agent colors** - Each agent name gets a consistent color based on a hash of their name. Makes it easy to distinguish agents in conversations.
390
+ - **Agent details** - When viewing a conversation with no messages, shows the agent's working directory, model, and file reservations.
391
+ - **Context injection** - Agents now receive orientation on startup and helpful context with messages:
392
+ - Registration message explaining multi-agent environment (once per session)
393
+ - Reply hint showing how to respond to messages
394
+ - Sender details (cwd, model) on first contact from each agent
395
+ - **Configuration file** - `~/.pi/agent/pi-messenger.json` for customizing context injection. Supports `contextMode: "full" | "minimal" | "none"`.
396
+
397
+ ### Changed
398
+
399
+ - `/messenger` command now opens overlay (was: interactive menu with select prompts)
400
+ - Status bar now shows unread count badge when messages are waiting
401
+
402
+ ### Fixed
403
+
404
+ - Message delivery order: files are now deleted after successful delivery, not before (prevents message loss if delivery fails)
405
+ - ANSI escape codes in message text are now stripped to prevent terminal injection
406
+ - Watcher recovery: if the inbox watcher dies after exhausting retries, it now automatically recovers on the next turn or session event
407
+ - Small terminal handling: overlay now handles very small terminal windows gracefully with minimum height safeguards
408
+
409
+ ## 0.1.0 - 2026-01-20
410
+
411
+ Initial release.
412
+
413
+ - Agent discovery with auto-generated memorable names (SwiftRaven, GoldFalcon, etc.)
414
+ - Direct messaging between agents with immediate delivery
415
+ - Broadcast messaging to all active agents
416
+ - File reservations with conflict detection
417
+ - Message renderer for incoming agent messages
418
+ - Status bar integration showing agent name and peer count