pi-crew 0.8.14 → 0.9.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.
- package/CHANGELOG.md +271 -0
- package/README.md +112 -2
- package/docs/FEATURE_INTAKE.md +1 -1
- package/docs/HARNESS.md +20 -19
- package/docs/PROJECT_REVIEW.md +132 -133
- package/docs/PROJECT_REVIEW_FIXES.md +130 -131
- package/docs/actions-reference.md +127 -121
- package/docs/architecture.md +1 -1
- package/docs/code-review-2026-05-11.md +134 -134
- package/docs/commands-reference.md +108 -106
- package/docs/comparison-pi-subagents-vs-pi-crew.md +105 -105
- package/docs/deep-review-report.md +1 -1
- package/docs/dynamic-workflows.md +90 -0
- package/docs/fixes/BATCH_A_H1_H2.md +17 -17
- package/docs/fixes/bug-007-async-notifier-stale-ctx.md +23 -23
- package/docs/followup-plan-2026-05-12.md +135 -135
- package/docs/followup-review-2026-05-12.md +86 -86
- package/docs/followup-review-round3-2026-05-12.md +123 -123
- package/docs/goals.md +59 -0
- package/docs/implementation-plan-top3.md +4 -4
- package/docs/issue-29-analysis.md +2 -2
- package/docs/oh-my-pi-research.md +154 -154
- package/docs/optimization-plan.md +2 -0
- package/docs/perf/baseline-2026-05.md +9 -9
- package/docs/perf/final-report-2026-05.md +2 -2
- package/docs/perf/sprint-1-report.md +2 -2
- package/docs/perf/sprint-2-report.md +1 -1
- package/docs/perf/upgrade-plan-2026-05.md +72 -72
- package/docs/pi-crew-bugs.md +230 -230
- package/docs/pi-crew-investigation-report.md +102 -102
- package/docs/pi-crew-test-round5.md +4 -4
- package/docs/runtime-analysis-child-vs-live.md +57 -57
- package/docs/runtime-migration-in-process-analysis.md +97 -97
- package/package.json +2 -4
- package/skills/orchestration/SKILL.md +11 -11
- package/src/agents/agent-config.ts +4 -0
- package/src/config/config.ts +39 -0
- package/src/config/types.ts +11 -0
- package/src/extension/action-suggestions.ts +2 -1
- package/src/extension/async-notifier.ts +10 -0
- package/src/extension/help.ts +14 -0
- package/src/extension/registration/commands.ts +27 -0
- package/src/extension/team-tool/destructive-gate.ts +1 -1
- package/src/extension/team-tool/goal-wrap.ts +288 -0
- package/src/extension/team-tool/goal.ts +405 -0
- package/src/extension/team-tool/run.ts +103 -4
- package/src/extension/team-tool/workflow-manage.ts +194 -0
- package/src/extension/team-tool.ts +20 -0
- package/src/hooks/types.ts +3 -1
- package/src/runtime/async-runner.ts +24 -2
- package/src/runtime/background-runner.ts +68 -19
- package/src/runtime/child-pi.ts +6 -1
- package/src/runtime/completion-guard.ts +1 -1
- package/src/runtime/dynamic-workflow-context.ts +450 -0
- package/src/runtime/dynamic-workflow-runner.ts +180 -0
- package/src/runtime/global-worker-cap.ts +96 -0
- package/src/runtime/goal-evaluator.ts +294 -0
- package/src/runtime/goal-loop-runner.ts +612 -0
- package/src/runtime/goal-state-store.ts +209 -0
- package/src/runtime/pi-args.ts +10 -2
- package/src/runtime/result-extractor.ts +32 -0
- package/src/runtime/team-runner.ts +11 -1
- package/src/runtime/verification-gates.ts +85 -5
- package/src/runtime/verification-integrity.ts +110 -0
- package/src/runtime/verification-worktree.ts +136 -0
- package/src/runtime/workspace-lock.ts +448 -0
- package/src/schema/config-schema.ts +26 -0
- package/src/schema/team-tool-schema.ts +39 -4
- package/src/state/atomic-write.ts +9 -0
- package/src/state/contracts.ts +14 -0
- package/src/state/crew-init.ts +18 -5
- package/src/state/event-log.ts +7 -1
- package/src/state/state-store.ts +2 -0
- package/src/state/types.ts +82 -0
- package/src/state/worker-atomic-writer.ts +176 -0
- package/src/utils/redaction.ts +104 -24
- package/src/workflows/discover-workflows.ts +25 -1
- package/src/workflows/workflow-config.ts +13 -0
- package/teams/parallel-research.team.md +1 -1
- package/workflows/examples/hello.dwf.ts +24 -0
|
@@ -1,22 +1,22 @@
|
|
|
1
|
-
# Research: oh-my-pi v15.0.0 —
|
|
1
|
+
# Research: oh-my-pi v15.0.0 — Features Applicable to pi-crew
|
|
2
2
|
|
|
3
3
|
> Date: 2026-05-13
|
|
4
4
|
> Source: `D:/my/my_project/source/oh-my-pi` (v15.0.0)
|
|
5
|
-
> Purpose:
|
|
5
|
+
> Purpose: Find features that can be ported into pi-crew
|
|
6
6
|
|
|
7
7
|
---
|
|
8
8
|
|
|
9
9
|
## 1. Feature: Hashline Engine (`hashline/`)
|
|
10
10
|
|
|
11
|
-
###
|
|
12
|
-
|
|
13
|
-
- Line-level content addressing (hash
|
|
14
|
-
- Semantic anchors (
|
|
15
|
-
- Recovery mode (
|
|
11
|
+
### Purpose
|
|
12
|
+
Fully replace the old hashline with a new engine supporting:
|
|
13
|
+
- Line-level content addressing (hash each line)
|
|
14
|
+
- Semantic anchors (not just line numbers but content hashes)
|
|
15
|
+
- Recovery mode (recover from crash state)
|
|
16
16
|
- Conflict resolution (3-way merge)
|
|
17
17
|
- Streaming diff output
|
|
18
18
|
|
|
19
|
-
###
|
|
19
|
+
### How it works
|
|
20
20
|
|
|
21
21
|
**Core types** (`hashline/types.ts`):
|
|
22
22
|
```typescript
|
|
@@ -32,36 +32,36 @@ export type HashlineEdit =
|
|
|
32
32
|
```
|
|
33
33
|
|
|
34
34
|
**Key modules:**
|
|
35
|
-
- `hash.ts` (694→) — Line hashing
|
|
35
|
+
- `hash.ts` (694→) — Line hashing with bigram index
|
|
36
36
|
- `parser.ts` (192 lines) — Parse hashline input
|
|
37
|
-
- `apply.ts` (716 lines) — Apply edits
|
|
38
|
-
- `recovery.ts` (72 lines) — Recovery
|
|
37
|
+
- `apply.ts` (716 lines) — Apply edits with validation
|
|
38
|
+
- `recovery.ts` (72 lines) — Recovery from crash state
|
|
39
39
|
- `execute.ts` (267 lines) — Execute hashline commands
|
|
40
40
|
- `diff.ts` / `diff-preview.ts` — Streaming diff
|
|
41
41
|
|
|
42
|
-
### Potential
|
|
42
|
+
### Potential application to pi-crew
|
|
43
43
|
|
|
44
|
-
**Option A —
|
|
45
|
-
-
|
|
46
|
-
-
|
|
44
|
+
**Option A — Use directly (if oh-my-pi splits hashline into a separate package):**
|
|
45
|
+
- pi-crew needs to edit files in worktrees
|
|
46
|
+
- The hashline engine could help detect conflicts when multiple agents edit the same file
|
|
47
47
|
|
|
48
|
-
**Option B — Conflict detection (
|
|
49
|
-
-
|
|
48
|
+
**Option B — Conflict detection (already have `conflict-detect.ts`):**
|
|
49
|
+
- See the next feature
|
|
50
50
|
|
|
51
|
-
**Effort: HIGH** — hashline strongly coupled
|
|
51
|
+
**Effort: HIGH** — hashline is strongly coupled to oh-my-pi internals (ToolSession, LSP batch request, etc.)
|
|
52
52
|
|
|
53
53
|
### Risk/Dependency
|
|
54
|
-
- Requires oh-my-pi package
|
|
55
|
-
- Strong dependency on oh-my-pi tool execution model
|
|
54
|
+
- Requires the oh-my-pi package or a fork
|
|
55
|
+
- Strong dependency on oh-my-pi's tool execution model
|
|
56
56
|
|
|
57
57
|
---
|
|
58
58
|
|
|
59
59
|
## 2. Feature: Conflict Detection & Resolution (`conflict-detect.ts`)
|
|
60
60
|
|
|
61
|
-
###
|
|
62
|
-
Detect git merge conflicts (<<<<<<, =======, >>>>>>>)
|
|
61
|
+
### Purpose
|
|
62
|
+
Detect git merge conflicts (<<<<<<, =======, >>>>>>>) in file content without extra I/O. Each conflict block is assigned a stable id; the agent can resolve it by writing to `conflict://<id>`.
|
|
63
63
|
|
|
64
|
-
###
|
|
64
|
+
### How it works
|
|
65
65
|
|
|
66
66
|
```typescript
|
|
67
67
|
export interface ConflictBlock {
|
|
@@ -83,41 +83,41 @@ export interface ConflictBlock {
|
|
|
83
83
|
```
|
|
84
84
|
|
|
85
85
|
**Workflow:**
|
|
86
|
-
1. `read` collects lines
|
|
87
|
-
2. `scanConflictLines` inspects
|
|
86
|
+
1. `read` collects lines from disk
|
|
87
|
+
2. `scanConflictLines` inspects for `<<<<<<<` / `=======` / `>>>>>>>` markers
|
|
88
88
|
3. Each completed block → `ConflictHistory` (stable id)
|
|
89
|
-
4. Read output
|
|
90
|
-
5. Agent
|
|
89
|
+
4. Read output returns with a footer containing conflict ids
|
|
90
|
+
5. Agent calls `write({ path: "conflict://<id>", content })` to resolve
|
|
91
91
|
|
|
92
|
-
**Key insight:** Marker shape
|
|
92
|
+
**Key insight:** Marker shape must be strict — column-0, exact prefix length, followed by EOL or a single space + label.
|
|
93
93
|
|
|
94
|
-
### Potential
|
|
94
|
+
### Potential application to pi-crew
|
|
95
95
|
|
|
96
|
-
**HIGH VALUE
|
|
97
|
-
-
|
|
98
|
-
- Conflict detection
|
|
96
|
+
**HIGH VALUE for pi-crew:**
|
|
97
|
+
- When multiple agents edit the same file in a worktree, conflicts can occur
|
|
98
|
+
- Conflict detection lets the agent recognize and resolve them automatically
|
|
99
99
|
|
|
100
100
|
**Implementation approach:**
|
|
101
101
|
1. Fork `conflict-detect.ts` (license OK — MIT)
|
|
102
|
-
2. Integrate
|
|
103
|
-
3. Register conflicts
|
|
104
|
-
4. Provide `conflict://` protocol
|
|
105
|
-
5. Add `detect-conflicts` tool
|
|
102
|
+
2. Integrate into pi-crew's file read path
|
|
103
|
+
3. Register conflicts into `LiveAgentHandle.activity` or the artifact store
|
|
104
|
+
4. Provide a `conflict://` protocol in the write tool
|
|
105
|
+
5. Add a `detect-conflicts` tool for agents
|
|
106
106
|
|
|
107
|
-
**Effort: MEDIUM** — standalone module,
|
|
107
|
+
**Effort: MEDIUM** — standalone module, can be copied + adapted
|
|
108
108
|
|
|
109
109
|
### Risk/Dependency
|
|
110
|
-
-
|
|
111
|
-
-
|
|
110
|
+
- Need to handle the `conflict://` protocol in the write tool
|
|
111
|
+
- Need to update the read tool to detect and report conflicts
|
|
112
112
|
|
|
113
113
|
---
|
|
114
114
|
|
|
115
115
|
## 3. Feature: ACP Client Bridge (`acp-client-bridge.ts`)
|
|
116
116
|
|
|
117
|
-
###
|
|
118
|
-
|
|
117
|
+
### Purpose
|
|
118
|
+
A bridge between oh-my-pi's internal ClientBridge interface and the ACP (Agent Client Protocol) SDK. Allows tools (read/write/bash/edit) to route through the client when the client has the capabilities.
|
|
119
119
|
|
|
120
|
-
###
|
|
120
|
+
### How it works
|
|
121
121
|
|
|
122
122
|
```typescript
|
|
123
123
|
export interface ClientBridgeCapabilities {
|
|
@@ -136,31 +136,31 @@ export interface ClientBridge {
|
|
|
136
136
|
}
|
|
137
137
|
```
|
|
138
138
|
|
|
139
|
-
**Pattern:** Feature detection → conditional implementation.
|
|
139
|
+
**Pattern:** Feature detection → conditional implementation. If the client lacks a capability, fall back to the default implementation.
|
|
140
140
|
|
|
141
|
-
### Potential
|
|
141
|
+
### Potential application to pi-crew
|
|
142
142
|
|
|
143
143
|
**LOW-MEDIUM VALUE:**
|
|
144
144
|
|
|
145
|
-
pi-crew
|
|
145
|
+
pi-crew already has `LiveExtensionBridge` and `LiveAgentControl` — doesn't need an ACP bridge. However, this pattern is useful for:
|
|
146
146
|
|
|
147
|
-
1. **pi-crew tool permission system** —
|
|
148
|
-
2. **Cross-extension communication** — `ClientBridge` pattern
|
|
147
|
+
1. **pi-crew tool permission system** — Could use this pattern to check permission before allowing tool execution
|
|
148
|
+
2. **Cross-extension communication** — The `ClientBridge` pattern could be adapted for `CrossExtensionRPC`
|
|
149
149
|
|
|
150
|
-
**Effort: LOW** —
|
|
150
|
+
**Effort: LOW** — just learn the pattern, no need to port code
|
|
151
151
|
|
|
152
152
|
### Risk/Dependency
|
|
153
|
-
- ACP SDK
|
|
154
|
-
-
|
|
153
|
+
- ACP SDK is proprietary (`@agentclientprotocol/sdk`)
|
|
154
|
+
- The pattern can be applied without the SDK
|
|
155
155
|
|
|
156
156
|
---
|
|
157
157
|
|
|
158
158
|
## 4. Feature: Todo Helper (`todo.ts`)
|
|
159
159
|
|
|
160
|
-
###
|
|
161
|
-
|
|
160
|
+
### Purpose
|
|
161
|
+
A slash command helper that lets agents manage a todo list within a project. Supports subcommands: `done`, `drop`, `rm`, and parses markdown todo format.
|
|
162
162
|
|
|
163
|
-
###
|
|
163
|
+
### How it works
|
|
164
164
|
|
|
165
165
|
**Tokenize approach:**
|
|
166
166
|
```typescript
|
|
@@ -187,36 +187,36 @@ function tokenize(input: string): string[] {
|
|
|
187
187
|
- Escape sequences: `\<char>`
|
|
188
188
|
- Whitespace splitting
|
|
189
189
|
|
|
190
|
-
### Potential
|
|
190
|
+
### Potential application to pi-crew
|
|
191
191
|
|
|
192
|
-
**HIGH VALUE
|
|
192
|
+
**HIGH VALUE for pi-crew:**
|
|
193
193
|
|
|
194
|
-
pi-crew
|
|
194
|
+
pi-crew has `YieldReminder` and `TaskRunner` — can integrate todo management:
|
|
195
195
|
|
|
196
|
-
1. **Team task tracking** — Workflow tasks
|
|
197
|
-
2. **Yield + Todo integration** —
|
|
198
|
-
3. **Slash command `/crew todo`** — Management interface
|
|
196
|
+
1. **Team task tracking** — Workflow tasks can be represented as todos
|
|
197
|
+
2. **Yield + Todo integration** — When an agent yields with a todo request, can parse and update the todo list
|
|
198
|
+
3. **Slash command `/crew todo`** — Management interface for team tasks
|
|
199
199
|
|
|
200
200
|
**Implementation approach:**
|
|
201
|
-
1. Fork `todo.ts` helper (279 lines)
|
|
202
|
-
2. Integrate
|
|
203
|
-
3. Add `/crew todo` slash command
|
|
204
|
-
4. Wire
|
|
201
|
+
1. Fork the `todo.ts` helper (279 lines)
|
|
202
|
+
2. Integrate into `CrewTaskRunner` or `YieldHandler`
|
|
203
|
+
3. Add a `/crew todo` slash command
|
|
204
|
+
4. Wire into the `TaskDisplay` component
|
|
205
205
|
|
|
206
|
-
**Effort: MEDIUM** —
|
|
206
|
+
**Effort: MEDIUM** — can copy the module, needs integration with the existing task system
|
|
207
207
|
|
|
208
208
|
### Risk/Dependency
|
|
209
209
|
- Dependency on `todo-write.ts` tool
|
|
210
|
-
-
|
|
210
|
+
- Needs to sync with actual task state in the manifest
|
|
211
211
|
|
|
212
212
|
---
|
|
213
213
|
|
|
214
214
|
## 5. Feature: Compaction Error Types (`compaction/errors.ts`)
|
|
215
215
|
|
|
216
|
-
###
|
|
217
|
-
Typed error sentinels
|
|
216
|
+
### Purpose
|
|
217
|
+
Typed error sentinels for compaction operations. Uses `instanceof` discrimination instead of string matching.
|
|
218
218
|
|
|
219
|
-
###
|
|
219
|
+
### How it works
|
|
220
220
|
|
|
221
221
|
```typescript
|
|
222
222
|
export class CompactionCancelledError extends Error {
|
|
@@ -228,18 +228,18 @@ export type CompactionOutcome = "ok" | "cancelled" | "failed";
|
|
|
228
228
|
```
|
|
229
229
|
|
|
230
230
|
**Pattern:**
|
|
231
|
-
- Sentinel class
|
|
232
|
-
- Downstream callers
|
|
233
|
-
- Source-agnostic: Esc, extension hook, programmatic abort
|
|
231
|
+
- Sentinel class with a readonly `name` property
|
|
232
|
+
- Downstream callers use `instanceof CompactionCancelledError`
|
|
233
|
+
- Source-agnostic: Esc, extension hook, programmatic abort all share the same type
|
|
234
234
|
|
|
235
|
-
### Potential
|
|
235
|
+
### Potential application to pi-crew
|
|
236
236
|
|
|
237
|
-
**MEDIUM VALUE
|
|
237
|
+
**MEDIUM VALUE for pi-crew:**
|
|
238
238
|
|
|
239
|
-
pi-crew
|
|
239
|
+
pi-crew has `YieldResult` and compaction tracking — can use this pattern:
|
|
240
240
|
|
|
241
241
|
1. **Typed cancellation errors** — `CrewCancelledError`, `CrewTimeoutError`, `CrewDeadletterError`
|
|
242
|
-
2. **Better error discrimination** —
|
|
242
|
+
2. **Better error discrimination** — Instead of string matching, use `instanceof`
|
|
243
243
|
3. **Error outcome tracking** — `CrewRunOutcome = "ok" | "cancelled" | "failed" | "deadletter"`
|
|
244
244
|
|
|
245
245
|
**Implementation approach:**
|
|
@@ -261,24 +261,24 @@ export class CrewDeadletterError extends Error {
|
|
|
261
261
|
}
|
|
262
262
|
```
|
|
263
263
|
|
|
264
|
-
**Effort: LOW** —
|
|
264
|
+
**Effort: LOW** — just create the error classes and replace `instanceof Error` checks
|
|
265
265
|
|
|
266
266
|
### Risk/Dependency
|
|
267
|
-
- None — pure TypeScript,
|
|
268
|
-
-
|
|
267
|
+
- None — pure TypeScript, can copy the pattern
|
|
268
|
+
- Need to audit existing error handling to update
|
|
269
269
|
|
|
270
270
|
---
|
|
271
271
|
|
|
272
272
|
## 6. Feature: ACP Agent Session (`acp-agent.ts`)
|
|
273
273
|
|
|
274
|
-
###
|
|
275
|
-
ACP protocol handler
|
|
274
|
+
### Purpose
|
|
275
|
+
ACP protocol handler in oh-my-pi. Extends from `agent-session.ts` with:
|
|
276
276
|
- Fork sessions (clone session state)
|
|
277
277
|
- Session list/load/resume
|
|
278
278
|
- Model state management
|
|
279
279
|
- MCP server discovery
|
|
280
280
|
|
|
281
|
-
###
|
|
281
|
+
### How it works
|
|
282
282
|
|
|
283
283
|
**ACP Protocol types:**
|
|
284
284
|
```typescript
|
|
@@ -289,42 +289,42 @@ type ClientCapabilities (fs, terminal, permission)
|
|
|
289
289
|
```
|
|
290
290
|
|
|
291
291
|
**Key capabilities:**
|
|
292
|
-
- `forkSession` — Clone session
|
|
292
|
+
- `forkSession` — Clone a session with the same conversation history
|
|
293
293
|
- `listSessions` — Enumerate active sessions
|
|
294
|
-
- `loadSession` / `resumeSession` — Restore previous session
|
|
294
|
+
- `loadSession` / `resumeSession` — Restore a previous session
|
|
295
295
|
- `setSessionModel` — Change model mid-session
|
|
296
296
|
|
|
297
|
-
### Potential
|
|
297
|
+
### Potential application to pi-crew
|
|
298
298
|
|
|
299
|
-
**HIGH VALUE
|
|
299
|
+
**HIGH VALUE for pi-crew:**
|
|
300
300
|
|
|
301
|
-
1. **Fork session** —
|
|
302
|
-
2. **Session resume** — Resume a previous run
|
|
303
|
-
3. **Model switching** — Change model for specific tasks (e.g
|
|
301
|
+
1. **Fork session** — In workflow orchestration, could fork an agent session to run parallel experiments
|
|
302
|
+
2. **Session resume** — Resume a previous run from manifest/events
|
|
303
|
+
3. **Model switching** — Change model for specific tasks (e.g. cheap model for exploration, expensive model for final generation)
|
|
304
304
|
|
|
305
305
|
**Current pi-crew state:**
|
|
306
|
-
- pi-crew
|
|
307
|
-
-
|
|
306
|
+
- pi-crew already has `ResumeSession` for team runs (re-spawn child Pi)
|
|
307
|
+
- But no in-process session fork
|
|
308
308
|
|
|
309
309
|
**Implementation approach:**
|
|
310
|
-
- `forkLiveAgentSession()` — Clone `LiveAgentHandle`
|
|
311
|
-
- Store forked sessions
|
|
312
|
-
- Add `fork-session` operation
|
|
310
|
+
- `forkLiveAgentSession()` — Clone `LiveAgentHandle` with the same conversation
|
|
311
|
+
- Store forked sessions in `live-agent-manager.ts`
|
|
312
|
+
- Add a `fork-session` operation to the `team-tool api`
|
|
313
313
|
|
|
314
|
-
**Effort: HIGH** —
|
|
314
|
+
**Effort: HIGH** — needs deep understanding of `LiveSessionHandle` and session state
|
|
315
315
|
|
|
316
316
|
### Risk/Dependency
|
|
317
317
|
- Requires oh-my-pi internals (AgentSession, ToolSession)
|
|
318
|
-
- pi-crew
|
|
318
|
+
- pi-crew uses a child Pi process — fork may not be compatible
|
|
319
319
|
|
|
320
320
|
---
|
|
321
321
|
|
|
322
322
|
## 7. Feature: User Metrics (`stats/src/user-metrics.ts`)
|
|
323
323
|
|
|
324
|
-
###
|
|
325
|
-
Tracking
|
|
324
|
+
### Purpose
|
|
325
|
+
Tracking and aggregation of user behavior metrics: edits, tool usage, model selection, cost, session quality.
|
|
326
326
|
|
|
327
|
-
###
|
|
327
|
+
### How it works
|
|
328
328
|
|
|
329
329
|
**Database schema:**
|
|
330
330
|
- Sessions table: session_id, start_time, end_time, model, cost
|
|
@@ -337,30 +337,30 @@ Tracking và aggregation của user behavior metrics: edits, tools usage, model
|
|
|
337
337
|
- Model comparison: cost vs quality per model
|
|
338
338
|
- Session summary: duration, token usage, task completion rate
|
|
339
339
|
|
|
340
|
-
### Potential
|
|
340
|
+
### Potential application to pi-crew
|
|
341
341
|
|
|
342
342
|
**MEDIUM VALUE:**
|
|
343
343
|
|
|
344
|
-
pi-crew
|
|
344
|
+
pi-crew already has `UsageTracker` and `MetricsRegistry` — can learn from:
|
|
345
345
|
|
|
346
346
|
1. **Team metrics** — Track team run performance (workflow duration, agent utilization, cost)
|
|
347
347
|
2. **Agent quality scoring** — Rate agent output quality
|
|
348
348
|
3. **Cost tracking** — Per-agent, per-task, per-team cost
|
|
349
349
|
|
|
350
|
-
**Effort: MEDIUM** —
|
|
350
|
+
**Effort: MEDIUM** — Need to design a database schema and API
|
|
351
351
|
|
|
352
352
|
### Risk/Dependency
|
|
353
|
-
- SQLite
|
|
353
|
+
- SQLite or a separate database
|
|
354
354
|
- Privacy implications (storing user behavior data)
|
|
355
355
|
|
|
356
356
|
---
|
|
357
357
|
|
|
358
358
|
## 8. Feature: Shell Minimizer (`crates/pi-shell/src/minimizer/`)
|
|
359
359
|
|
|
360
|
-
###
|
|
361
|
-
|
|
360
|
+
### Purpose
|
|
361
|
+
Automatically minimize command output (remove noise like progress bars, ANSI codes) so the LLM can read cleaner results.
|
|
362
362
|
|
|
363
|
-
###
|
|
363
|
+
### How it works
|
|
364
364
|
|
|
365
365
|
**100+ TOML config files:**
|
|
366
366
|
- `cargo.toml` — Filter cargo progress output
|
|
@@ -378,63 +378,63 @@ pub struct Minimizer {
|
|
|
378
378
|
// Filter types: line removal, replacement, truncation
|
|
379
379
|
```
|
|
380
380
|
|
|
381
|
-
### Potential
|
|
381
|
+
### Potential application to pi-crew
|
|
382
382
|
|
|
383
|
-
**HIGH VALUE
|
|
383
|
+
**HIGH VALUE for pi-crew:**
|
|
384
384
|
|
|
385
|
-
pi-crew agents
|
|
386
|
-
-
|
|
387
|
-
-
|
|
388
|
-
-
|
|
385
|
+
pi-crew agents run bash commands — the output can be very noisy. The minimizer helps:
|
|
386
|
+
- Agents read clean output
|
|
387
|
+
- Reduces context usage
|
|
388
|
+
- Focuses on important information
|
|
389
389
|
|
|
390
390
|
**Implementation approach:**
|
|
391
|
-
1. Fork minimizer engine (Rust)
|
|
392
|
-
2. Integrate
|
|
393
|
-
3. Auto-detect command type
|
|
391
|
+
1. Fork the minimizer engine (Rust) or port to TypeScript
|
|
392
|
+
2. Integrate into `TaskRunner` bash execution
|
|
393
|
+
3. Auto-detect command type and apply the appropriate filter
|
|
394
394
|
|
|
395
|
-
**Effort: HIGH** — Rust code
|
|
395
|
+
**Effort: HIGH** — Rust code needs rewriting or integration via FFI
|
|
396
396
|
|
|
397
397
|
### Risk/Dependency
|
|
398
398
|
- Rust dependency
|
|
399
|
-
- May not be necessary
|
|
399
|
+
- May not be necessary if oh-my-pi splits it into a standalone tool
|
|
400
400
|
|
|
401
401
|
---
|
|
402
402
|
|
|
403
403
|
## 9. Feature: MCP Helper (`slash-commands/helpers/mcp.ts`)
|
|
404
404
|
|
|
405
|
-
###
|
|
406
|
-
Helper
|
|
405
|
+
### Purpose
|
|
406
|
+
Helper for MCP (Model Context Protocol) slash commands. Manages MCP server configuration and tool invocation.
|
|
407
407
|
|
|
408
|
-
###
|
|
408
|
+
### How it works
|
|
409
409
|
|
|
410
|
-
532 lines TypeScript. **Key functions:**
|
|
410
|
+
532 lines of TypeScript. **Key functions:**
|
|
411
411
|
- `resolveMcpServer` — Resolve MCP server config
|
|
412
|
-
- `invokeMcpTool` — Call MCP tool
|
|
412
|
+
- `invokeMcpTool` — Call an MCP tool
|
|
413
413
|
- `listMcpResources` — List available resources
|
|
414
414
|
- `mcpServerStatus` — Check server health
|
|
415
415
|
|
|
416
|
-
### Potential
|
|
416
|
+
### Potential application to pi-crew
|
|
417
417
|
|
|
418
418
|
**MEDIUM VALUE:**
|
|
419
419
|
|
|
420
|
-
pi-crew
|
|
420
|
+
pi-crew already has `McpProxy` in `live-extension-bridge.ts` — can learn more:
|
|
421
421
|
1. **MCP server lifecycle** — Start/stop MCP servers per team
|
|
422
|
-
2. **MCP tool routing** — Route MCP calls
|
|
422
|
+
2. **MCP tool routing** — Route MCP calls through the team session
|
|
423
423
|
|
|
424
|
-
**Effort: LOW** —
|
|
424
|
+
**Effort: LOW** — just learn the pattern, no need to port code
|
|
425
425
|
|
|
426
426
|
### Risk/Dependency
|
|
427
427
|
- MCP protocol knowledge required
|
|
428
|
-
-
|
|
428
|
+
- Can reuse the existing `buildMcpProxyFromSession`
|
|
429
429
|
|
|
430
430
|
---
|
|
431
431
|
|
|
432
432
|
## 10. Feature: Issue-PR Protocol (`internal-urls/issue-pr-protocol.ts`)
|
|
433
433
|
|
|
434
|
-
###
|
|
435
|
-
Protocol handler
|
|
434
|
+
### Purpose
|
|
435
|
+
Protocol handler for `issue://` and `pr://` internal URLs. Lets agents interact with GitHub/GitLab issues and PRs through a unified interface.
|
|
436
436
|
|
|
437
|
-
###
|
|
437
|
+
### How it works
|
|
438
438
|
|
|
439
439
|
```typescript
|
|
440
440
|
// Handle URLs like:
|
|
@@ -449,16 +449,16 @@ Protocol handler cho `issue://` và `pr://` internal URLs. Cho phép agents inte
|
|
|
449
449
|
- `comment` — Add comment
|
|
450
450
|
- `close` / `reopen` — State transitions
|
|
451
451
|
|
|
452
|
-
### Potential
|
|
452
|
+
### Potential application to pi-crew
|
|
453
453
|
|
|
454
|
-
**HIGH VALUE
|
|
454
|
+
**HIGH VALUE for pi-crew:**
|
|
455
455
|
|
|
456
|
-
pi-crew workflow agents
|
|
457
|
-
1. **Task creation** — Create issue
|
|
458
|
-
2. **PR review** — Use `pr://` protocol
|
|
456
|
+
pi-crew workflow agents can benefit from issue/PR integration:
|
|
457
|
+
1. **Task creation** — Create an issue from a failed task
|
|
458
|
+
2. **PR review** — Use the `pr://` protocol in the review workflow
|
|
459
459
|
3. **Task linking** — Link workflow tasks to issues
|
|
460
460
|
|
|
461
|
-
**Effort: MEDIUM** —
|
|
461
|
+
**Effort: MEDIUM** — Need to port `issue-pr-protocol.ts` (577 lines)
|
|
462
462
|
|
|
463
463
|
### Risk/Dependency
|
|
464
464
|
- GitHub API authentication
|
|
@@ -468,42 +468,42 @@ pi-crew workflow agents có thể benefit từ issue/PR integration:
|
|
|
468
468
|
|
|
469
469
|
## Summary: Recommendations
|
|
470
470
|
|
|
471
|
-
### Tier 1 — High Value, Medium Effort (
|
|
471
|
+
### Tier 1 — High Value, Medium Effort (High priority)
|
|
472
472
|
|
|
473
473
|
| Feature | Why | Effort | Notes |
|
|
474
474
|
|---|---|---|---|
|
|
475
|
-
| **Conflict Detection** | Prevents data loss
|
|
475
|
+
| **Conflict Detection** | Prevents data loss when multiple agents edit the same file | MEDIUM | Fork `conflict-detect.ts`, add `conflict://` protocol |
|
|
476
476
|
| **Typed Crew Errors** | Better error handling, cleaner code | LOW | Create `CrewCancelledError`, `CrewTimeoutError`, `CrewDeadletterError` |
|
|
477
|
-
| **Todo Integration** | Task tracking
|
|
478
|
-
| **Issue-PR Protocol** | Link team tasks
|
|
477
|
+
| **Todo Integration** | Task tracking for team workflows | MEDIUM | Fork `todo.ts`, integrate with `TaskRunner` |
|
|
478
|
+
| **Issue-PR Protocol** | Link team tasks to GitHub issues | MEDIUM | Port `issue-pr-protocol.ts` |
|
|
479
479
|
|
|
480
|
-
### Tier 2 — High Value, High Effort (
|
|
480
|
+
### Tier 2 — High Value, High Effort (Lower priority)
|
|
481
481
|
|
|
482
482
|
| Feature | Why | Effort | Notes |
|
|
483
483
|
|---|---|---|---|
|
|
484
|
-
| **Shell Minimizer** | Clean command output
|
|
485
|
-
| **ACP Fork Session** | Parallel agent experiments | HIGH |
|
|
484
|
+
| **Shell Minimizer** | Clean command output for agents | HIGH | Rust → TypeScript port or FFI |
|
|
485
|
+
| **ACP Fork Session** | Parallel agent experiments | HIGH | Needs deep `LiveSessionHandle` understanding |
|
|
486
486
|
| **User Metrics** | Team performance analytics | MEDIUM | Design DB schema, build API |
|
|
487
487
|
|
|
488
|
-
### Tier 3 — Low Value (
|
|
488
|
+
### Tier 3 — Low Value (Not prioritized)
|
|
489
489
|
|
|
490
490
|
| Feature | Why | Effort |
|
|
491
491
|
|---|---|---|
|
|
492
|
-
| Hashline Engine | Strongly coupled
|
|
493
|
-
| ACP Client Bridge | pi-crew
|
|
494
|
-
| MCP Helper | pi-crew
|
|
492
|
+
| Hashline Engine | Strongly coupled to oh-my-pi | HIGH |
|
|
493
|
+
| ACP Client Bridge | pi-crew already has `LiveExtensionBridge` | LOW |
|
|
494
|
+
| MCP Helper | pi-crew already has `McpProxy` | LOW |
|
|
495
495
|
|
|
496
496
|
---
|
|
497
497
|
|
|
498
498
|
## Next Steps
|
|
499
499
|
|
|
500
|
-
1. **Conflict Detection** — Start
|
|
501
|
-
2. **Typed Errors** — Quick win,
|
|
502
|
-
3. **Todo Integration** — Long-term,
|
|
500
|
+
1. **Conflict Detection** — Start with porting `conflict-detect.ts` because it's standalone and high-value
|
|
501
|
+
2. **Typed Errors** — Quick win, just create the error classes
|
|
502
|
+
3. **Todo Integration** — Long-term, needs integration with the workflow engine
|
|
503
503
|
|
|
504
|
-
## Files
|
|
504
|
+
## Files to read further
|
|
505
505
|
|
|
506
|
-
- `packages/coding-agent/src/tools/conflict-detect.ts` (
|
|
507
|
-
- `packages/coding-agent/src/tools/todo-write.ts` (dependency
|
|
508
|
-
- `packages/coding-agent/src/session/agent-session.ts` (
|
|
509
|
-
- `crates/pi-shell/src/minimizer/engine.rs` (
|
|
506
|
+
- `packages/coding-agent/src/tools/conflict-detect.ts` (entire file)
|
|
507
|
+
- `packages/coding-agent/src/tools/todo-write.ts` (dependency of todo.ts)
|
|
508
|
+
- `packages/coding-agent/src/session/agent-session.ts` (the fork/resume session part)
|
|
509
|
+
- `crates/pi-shell/src/minimizer/engine.rs` (if you want to port the shell minimizer)
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
# pi-crew Optimization Plan: coding-agent Integration
|
|
2
2
|
|
|
3
|
+
> **Status note (2026-06-22):** Dated 2026-05-28 — verify against current code before acting. Some items may already be implemented.
|
|
4
|
+
|
|
3
5
|
**Date:** 2026-05-28
|
|
4
6
|
**Based on:** 133 coding-agent commits (May 2026), direct source analysis
|
|
5
7
|
**Goal:** Implement 4 optimization opportunities for pi-crew
|
|
@@ -79,18 +79,18 @@ $env:BASELINE = "test/bench/baseline-2026-05.json"
|
|
|
79
79
|
|
|
80
80
|
CPU profile: `.profile/startup-2026-05-14T14-38-20-180Z.cpuprofile` (open in Chrome DevTools → Performance → Load profile).
|
|
81
81
|
|
|
82
|
-
> `registerMs`
|
|
82
|
+
> `registerMs` is lower than the register-startup bench because the profile runs 5 iters in the same process (the module cache is warm after iter 1). The `register-startup` bench is what reflects the actual cold start.
|
|
83
83
|
|
|
84
|
-
## Sprint targets (
|
|
84
|
+
## Sprint targets (vs. the baseline above)
|
|
85
85
|
|
|
86
|
-
| Metric | Baseline | Target
|
|
86
|
+
| Metric | Baseline | Target after completing the full plan | Expected sprint |
|
|
87
87
|
|---|---|---|---|
|
|
88
88
|
| register-startup.import.p95 | 655 ms | ≤ 400 ms (lazy) / ≤ 200 ms (bundled) | 2 / 5 |
|
|
89
|
-
| register-startup.register.p95 | 27.5 ms | ≤ 25 ms (
|
|
90
|
-
| render-flush.p95 | 0.36 ms | ≤ 0.5 ms (
|
|
89
|
+
| register-startup.register.p95 | 27.5 ms | ≤ 25 ms (keep as-is) | — |
|
|
90
|
+
| render-flush.p95 | 0.36 ms | ≤ 0.5 ms (keep as-is) | — |
|
|
91
91
|
| snapshot-cache.cold.p95 | 3.06 ms | ≤ 2.1 ms (-30%) | 1, 2 |
|
|
92
92
|
| snapshot-cache.warm.p95 | 3.06 ms | ≤ 1.5 ms (-50%) | 1, 2 |
|
|
93
|
-
| dashboard FPS
|
|
93
|
+
| dashboard FPS while a run is active | n/a | +50% | 3 |
|
|
94
94
|
| events.jsonl tail 32 KB parse p95 | n/a | < 5 ms | 2 |
|
|
95
95
|
| cancel round-trip | n/a | < 200 ms | 4 |
|
|
96
96
|
|
|
@@ -108,6 +108,6 @@ CPU profile: `.profile/startup-2026-05-14T14-38-20-180Z.cpuprofile` (open in Chr
|
|
|
108
108
|
|
|
109
109
|
## Caveats
|
|
110
110
|
|
|
111
|
-
-
|
|
112
|
-
- `register-startup` bench
|
|
113
|
-
-
|
|
111
|
+
- The baseline was recorded on a single Windows machine. Other machines with different CPU/disk will produce different numbers. When you need to re-baseline (Node major bump, OS upgrade, different CI machine), copy `results.json → baseline.json` and write a new file `baseline-<date>.md`.
|
|
112
|
+
- The `register-startup` bench takes ~13 s (20 iters × 600 ms); keep it in CI. Locally you can set `BENCH_ITERS=5` for fast debugging.
|
|
113
|
+
- The bench does not run as part of `npm test` to keep the test suite fast; trigger it separately via `npm run bench` or a dedicated CI step.
|
|
@@ -37,7 +37,7 @@ projected to bring `register-startup.import.p95` to ≤ 250 ms after a
|
|
|
37
37
|
- Bonus fix: pre-existing `// LAZY:` marker missing in
|
|
38
38
|
`src/runtime/background-runner.ts`
|
|
39
39
|
|
|
40
|
-
### Sprint 1 — UI
|
|
40
|
+
### Sprint 1 — Smooth UI, low risk (6 items)
|
|
41
41
|
|
|
42
42
|
- 1.4 events stamp via `.seq` sequence file
|
|
43
43
|
- 1.5 drop per-agent outputStamp from SnapshotStamps
|
|
@@ -47,7 +47,7 @@ projected to bring `register-startup.import.p95` to ≤ 250 ms after a
|
|
|
47
47
|
- 1.2 drop sync `refreshIfStale` fallback on hot render path
|
|
48
48
|
- 1.10 mascot pause idle — skipped (mascot is splash, not always-on)
|
|
49
49
|
|
|
50
|
-
### Sprint 2 —
|
|
50
|
+
### Sprint 2 — Cut I/O sync hot path (4 items)
|
|
51
51
|
|
|
52
52
|
- 2.10 cache findRepoRoot lookups (TTL-LRU 30 s)
|
|
53
53
|
- 2.7 lazy-load OTLPExporter, LiveRunSidebar, crash-recovery
|