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.
Files changed (80) hide show
  1. package/CHANGELOG.md +271 -0
  2. package/README.md +112 -2
  3. package/docs/FEATURE_INTAKE.md +1 -1
  4. package/docs/HARNESS.md +20 -19
  5. package/docs/PROJECT_REVIEW.md +132 -133
  6. package/docs/PROJECT_REVIEW_FIXES.md +130 -131
  7. package/docs/actions-reference.md +127 -121
  8. package/docs/architecture.md +1 -1
  9. package/docs/code-review-2026-05-11.md +134 -134
  10. package/docs/commands-reference.md +108 -106
  11. package/docs/comparison-pi-subagents-vs-pi-crew.md +105 -105
  12. package/docs/deep-review-report.md +1 -1
  13. package/docs/dynamic-workflows.md +90 -0
  14. package/docs/fixes/BATCH_A_H1_H2.md +17 -17
  15. package/docs/fixes/bug-007-async-notifier-stale-ctx.md +23 -23
  16. package/docs/followup-plan-2026-05-12.md +135 -135
  17. package/docs/followup-review-2026-05-12.md +86 -86
  18. package/docs/followup-review-round3-2026-05-12.md +123 -123
  19. package/docs/goals.md +59 -0
  20. package/docs/implementation-plan-top3.md +4 -4
  21. package/docs/issue-29-analysis.md +2 -2
  22. package/docs/oh-my-pi-research.md +154 -154
  23. package/docs/optimization-plan.md +2 -0
  24. package/docs/perf/baseline-2026-05.md +9 -9
  25. package/docs/perf/final-report-2026-05.md +2 -2
  26. package/docs/perf/sprint-1-report.md +2 -2
  27. package/docs/perf/sprint-2-report.md +1 -1
  28. package/docs/perf/upgrade-plan-2026-05.md +72 -72
  29. package/docs/pi-crew-bugs.md +230 -230
  30. package/docs/pi-crew-investigation-report.md +102 -102
  31. package/docs/pi-crew-test-round5.md +4 -4
  32. package/docs/runtime-analysis-child-vs-live.md +57 -57
  33. package/docs/runtime-migration-in-process-analysis.md +97 -97
  34. package/package.json +2 -4
  35. package/skills/orchestration/SKILL.md +11 -11
  36. package/src/agents/agent-config.ts +4 -0
  37. package/src/config/config.ts +39 -0
  38. package/src/config/types.ts +11 -0
  39. package/src/extension/action-suggestions.ts +2 -1
  40. package/src/extension/async-notifier.ts +10 -0
  41. package/src/extension/help.ts +14 -0
  42. package/src/extension/registration/commands.ts +27 -0
  43. package/src/extension/team-tool/destructive-gate.ts +1 -1
  44. package/src/extension/team-tool/goal-wrap.ts +288 -0
  45. package/src/extension/team-tool/goal.ts +405 -0
  46. package/src/extension/team-tool/run.ts +103 -4
  47. package/src/extension/team-tool/workflow-manage.ts +194 -0
  48. package/src/extension/team-tool.ts +20 -0
  49. package/src/hooks/types.ts +3 -1
  50. package/src/runtime/async-runner.ts +24 -2
  51. package/src/runtime/background-runner.ts +68 -19
  52. package/src/runtime/child-pi.ts +6 -1
  53. package/src/runtime/completion-guard.ts +1 -1
  54. package/src/runtime/dynamic-workflow-context.ts +450 -0
  55. package/src/runtime/dynamic-workflow-runner.ts +180 -0
  56. package/src/runtime/global-worker-cap.ts +96 -0
  57. package/src/runtime/goal-evaluator.ts +294 -0
  58. package/src/runtime/goal-loop-runner.ts +612 -0
  59. package/src/runtime/goal-state-store.ts +209 -0
  60. package/src/runtime/pi-args.ts +10 -2
  61. package/src/runtime/result-extractor.ts +32 -0
  62. package/src/runtime/team-runner.ts +11 -1
  63. package/src/runtime/verification-gates.ts +85 -5
  64. package/src/runtime/verification-integrity.ts +110 -0
  65. package/src/runtime/verification-worktree.ts +136 -0
  66. package/src/runtime/workspace-lock.ts +448 -0
  67. package/src/schema/config-schema.ts +26 -0
  68. package/src/schema/team-tool-schema.ts +39 -4
  69. package/src/state/atomic-write.ts +9 -0
  70. package/src/state/contracts.ts +14 -0
  71. package/src/state/crew-init.ts +18 -5
  72. package/src/state/event-log.ts +7 -1
  73. package/src/state/state-store.ts +2 -0
  74. package/src/state/types.ts +82 -0
  75. package/src/state/worker-atomic-writer.ts +176 -0
  76. package/src/utils/redaction.ts +104 -24
  77. package/src/workflows/discover-workflows.ts +25 -1
  78. package/src/workflows/workflow-config.ts +13 -0
  79. package/teams/parallel-research.team.md +1 -1
  80. package/workflows/examples/hello.dwf.ts +24 -0
@@ -1,46 +1,48 @@
1
1
  # pi-crew — Slash Commands Reference
2
2
 
3
- Slash commands thao tác thủ công từ Pi chat. Autonomous tool use qua `team` action path chính; slash commands dành cho ops/debug.
3
+ Slash commands are manual actions triggered from the Pi chat. Autonomous tool use via the `team` action is the primary path; slash commands are intended for ops and debugging.
4
4
 
5
- ## Lệnh chính
5
+ ## Main Commands
6
6
 
7
- | Command | tả |
7
+ | Command | Description |
8
8
  |---------|-------|
9
- | `/teams` | Liệt teams, agents, workflows, recent runs |
10
- | `/team-run [options] <goal>` | Chạy team workflow |
11
- | `/team-orchestrate <planPath>` | Execute từ plan document |
12
- | `/team-schedule [options]` | Lên lịch recurring run |
9
+ | `/teams` | List teams, agents, workflows, and recent runs |
10
+ | `/team-run [options] <goal>` | Run a team workflow |
11
+ | `/team-orchestrate <planPath>` | Execute from a plan document |
12
+ | `/team-schedule [options]` | Schedule a recurring run |
13
13
  | `/team-scheduled` | List scheduled jobs |
14
- | `/team-cancel <runId>` | Hủy run |
15
- | `/team-status <runId>` | Xem trạng thái |
16
- | `/team-summary <runId>` | Xem/ghi summary |
17
- | `/team-resume <runId>` | Tiếp tục run đã dừng |
18
- | `/team-search <query>` | BM25 ranked discovery |
19
- | `/team-graph <runId>` | Load/save/list run graphs |
20
- | `/team-events <runId>` | Xem event log |
21
- | `/team-artifacts <runId>` | Xem artifacts |
22
- | `/team-worktrees <runId>` | Xem worktree metadata |
23
- | `/team-cleanup <runId>` | Xóa worktrees |
24
- | `/team-forget <runId>` | Xóa run hoàn toàn |
25
- | `/team-prune` | Xóa nhiều runs |
26
- | `/team-export <runId>` | Export run bundle |
27
- | `/team-import <path>` | Import run bundle |
28
- | `/team-imports` | Liệt imported bundles |
14
+ | `/team-cancel <runId>` | Cancel a run |
15
+ | `/team-status <runId>` | View status |
16
+ | `/team-summary <runId>` | View or write a summary |
17
+ | `/team-resume <runId>` | Resume a stopped run |
18
+ | `/team-search <query>` | BM25-ranked discovery |
19
+ | `/team-graph <runId>` | Load, save, or list run graphs |
20
+ | `/team-events <runId>` | View the event log |
21
+ | `/team-artifacts <runId>` | View artifacts |
22
+ | `/team-worktrees <runId>` | View worktree metadata |
23
+ | `/team-cleanup <runId>` | Remove worktrees |
24
+ | `/team-forget <runId>` | Fully delete a run |
25
+ | `/team-prune` | Delete multiple old runs |
26
+ | `/team-export <runId>` | Export a run bundle |
27
+ | `/team-import <path>` | Import a run bundle |
28
+ | `/team-imports` | List imported bundles |
29
29
  | `/team-api <runId> <op>` | State API interop |
30
- | `/team-metrics [filter]` | Xem metrics |
30
+ | `/team-metrics [filter]` | View metrics |
31
31
  | `/team-manager` | Interactive helper |
32
32
  | `/team-dashboard` | Live dashboard overlay |
33
- | `/team-init [options]` | Khởi tạo project layout |
34
- | `/team-config [options]` | Xem/sửa config |
35
- | `/team-settings <subcmd>` | Quản config keys |
36
- | `/team-autonomy <subcmd>` | Quản delegation |
33
+ | `/team-init [options]` | Initialize the project layout |
34
+ | `/team-config [options]` | View or update config |
35
+ | `/team-settings <subcmd>` | Manage config keys |
36
+ | `/team-autonomy <subcmd>` | Manage delegation |
37
37
  | `/team-validate` | Validate resources |
38
38
  | `/team-help` | Help text |
39
- | `/team-doctor` | Chẩn đoán môi trường |
39
+ | `/team-doctor` | Diagnose the environment |
40
+ | **`/team-goal`** | **v0.9.0** Start autonomous goal loop (sub-actions: `start/status/pause/resume/stop/step/clear`) |
41
+ | **`/workflows`** | **v0.9.0** List static + dynamic workflows (`.dwf.ts`) |
40
42
 
41
43
  ---
42
44
 
43
- ## `/team-run` — Chi tiết
45
+ ## `/team-run` — Details
44
46
 
45
47
  ```text
46
48
  /team-run <goal>
@@ -52,17 +54,17 @@ Slash commands là thao tác thủ công từ Pi chat. Autonomous tool use qua `
52
54
 
53
55
  Options:
54
56
 
55
- | Flag | tả |
57
+ | Flag | Description |
56
58
  |------|-------|
57
- | `--team=<name>` | Chọn team (default: `default`) |
58
- | `--workflow=<name>` | Chọn workflow (default: team's defaultWorkflow) |
59
- | `--async` | Chạy bất đồng bộ |
60
- | `--worktree` | Sử dụng worktree isolation |
59
+ | `--team=<name>` | Select a team (default: `default`) |
60
+ | `--workflow=<name>` | Select a workflow (default: the team's defaultWorkflow) |
61
+ | `--async` | Run asynchronously |
62
+ | `--worktree` | Use worktree isolation |
61
63
 
62
- Ví dụ:
64
+ Examples:
63
65
 
64
66
  ```text
65
- # Chạy default team
67
+ # Run the default team
66
68
  /team-run Investigate failing tests and propose a fix
67
69
 
68
70
  # Implementation team, async
@@ -74,24 +76,24 @@ Ví dụ:
74
76
 
75
77
  ---
76
78
 
77
- ## `/team-forget` — Xóa run
79
+ ## `/team-forget` — Delete a Run
78
80
 
79
81
  ```text
80
- /team-forget <runId> --confirm # Xóa state + artifacts
81
- /team-forget <runId> --confirm --force # Xóa kể cả dirty worktrees
82
+ /team-forget <runId> --confirm # Delete state + artifacts
83
+ /team-forget <runId> --confirm --force # Delete even dirty worktrees
82
84
  ```
83
85
 
84
- ⚠️ Cần `--confirm`. Dirty worktrees được giữ lại trừ khi thêm `--force`.
86
+ ⚠️ Requires `--confirm`. Dirty worktrees are kept unless `--force` is also provided.
85
87
 
86
88
  ---
87
89
 
88
- ## `/team-prune` — Dọn dẹp hàng loạt
90
+ ## `/team-prune` — Bulk Cleanup
89
91
 
90
92
  ```text
91
93
  /team-prune --keep=20 --confirm
92
94
  ```
93
95
 
94
- Giữ lại 20 runs gần nhất, xóa phần còn lại.
96
+ Keeps the 20 most recent runs and deletes the rest.
95
97
 
96
98
  ---
97
99
 
@@ -144,8 +146,8 @@ Giữ lại 20 runs gần nhất, xóa phần còn lại.
144
146
  ## `/team-metrics` — Observability
145
147
 
146
148
  ```text
147
- /team-metrics # Toàn bộ metrics
148
- /team-metrics crew.task.* # Filter theo glob pattern
149
+ /team-metrics # All metrics
150
+ /team-metrics crew.task.* # Filter by glob pattern
149
151
  ```
150
152
 
151
153
  ---
@@ -153,9 +155,9 @@ Giữ lại 20 runs gần nhất, xóa phần còn lại.
153
155
  ## `/team-config` — Configuration
154
156
 
155
157
  ```text
156
- /team-config # Xem config hiện tại
157
- /team-config asyncByDefault=true # Update key
158
- /team-config --unset=key.path # Unset key
158
+ /team-config # View current config
159
+ /team-config asyncByDefault=true # Update a key
160
+ /team-config --unset=key.path # Unset a key
159
161
  /team-config ... --project # Project scope
160
162
  ```
161
163
 
@@ -164,63 +166,63 @@ Giữ lại 20 runs gần nhất, xóa phần còn lại.
164
166
  ## `/team-settings` — Config Management
165
167
 
166
168
  ```text
167
- /team-settings # Liệt tất cả keys
168
- /team-settings get limits.maxTurns # Đọc 1 key
169
- /team-settings set limits.maxTurns 20 # Ghi key
170
- /team-settings unset runtime.maxTurns # Reset về default
171
- /team-settings path # Đường dẫn file config
172
- /team-settings scope # Scope hiện tại (user/project)
169
+ /team-settings # List all keys
170
+ /team-settings get limits.maxTurns # Read a single key
171
+ /team-settings set limits.maxTurns 20 # Write a key
172
+ /team-settings unset runtime.maxTurns # Reset to default
173
+ /team-settings path # Path to the config file
174
+ /team-settings scope # Current scope (user/project)
173
175
  ```
174
176
 
175
177
  ### Supported Keys
176
178
 
177
- | Key | Type | Default | tả |
179
+ | Key | Type | Default | Description |
178
180
  |-----|------|---------|-------|
179
- | `asyncByDefault` | boolean | `false` | Chạy async mặc định |
181
+ | `asyncByDefault` | boolean | `false` | Run async by default |
180
182
  | `executeWorkers` | boolean | `true` | Spawn child Pi workers |
181
- | `notifierIntervalMs` | number | `5000` | Polling interval cho async notifications |
183
+ | `notifierIntervalMs` | number | `5000` | Polling interval for async notifications |
182
184
  | `runtime.mode` | string | `"auto"` | Runtime: `auto`, `scaffold`, `child-process`, `live-session` |
183
185
  | `runtime.maxTurns` | number | — | Max turns per worker |
184
- | `runtime.graceTurns` | number | — | Grace turns sau max |
185
- | `runtime.inheritContext` | boolean | — | Workers kế thừa parent context |
186
- | `runtime.promptMode` | string | — | `replace` hoặc `append` |
186
+ | `runtime.graceTurns` | number | — | Grace turns after max |
187
+ | `runtime.inheritContext` | boolean | — | Workers inherit parent context |
188
+ | `runtime.promptMode` | string | — | `replace` or `append` |
187
189
  | `runtime.groupJoin` | string | `"smart"` | Group join: `off`, `group`, `smart` |
188
190
  | `runtime.groupJoinAckTimeoutMs` | number | `300000` | Group join ack timeout (ms) |
189
- | `runtime.requirePlanApproval` | boolean | `false` | Yêu cầu approve plan trước execute |
191
+ | `runtime.requirePlanApproval` | boolean | `false` | Require approving the plan before execution |
190
192
  | `runtime.completionMutationGuard` | string | `"warn"` | `off`, `warn`, `fail` |
191
- | `limits.maxConcurrentWorkers` | number | `1024` | Max workers chạy song song |
193
+ | `limits.maxConcurrentWorkers` | number | `1024` | Max workers running in parallel |
192
194
  | `limits.maxTaskDepth` | number | `100` | Max task tree depth |
193
195
  | `limits.maxChildrenPerTask` | number | — | Max children per task |
194
- | `limits.maxRunMinutes` | number | `1440` | Max run duration (phút) |
196
+ | `limits.maxRunMinutes` | number | `1440` | Max run duration (minutes) |
195
197
  | `limits.maxRetriesPerTask` | number | `100` | Max retries per task |
196
198
  | `limits.maxTasksPerRun` | number | `10000` | Max tasks per run |
197
199
  | `limits.heartbeatStaleMs` | number | `86400000` | Heartbeat stale threshold |
198
- | `control.enabled` | boolean | — | Enable agent control-plane |
200
+ | `control.enabled` | boolean | — | Enable the agent control-plane |
199
201
  | `control.needsAttentionAfterMs` | number | — | Attention timeout |
200
202
  | `autonomous.profile` | string | `"suggested"` | `manual`, `suggested`, `assisted`, `aggressive` |
201
- | `autonomous.injectPolicy` | boolean | `true` | Inject policy vào prompt |
202
- | `autonomous.preferAsyncForLongTasks` | boolean | `false` | Auto-async cho tasks dài |
203
- | `autonomous.allowWorktreeSuggestion` | boolean | `true` | Gợi ý worktree mode |
203
+ | `autonomous.injectPolicy` | boolean | `true` | Inject policy into the prompt |
204
+ | `autonomous.preferAsyncForLongTasks` | boolean | `false` | Auto-async for long tasks |
205
+ | `autonomous.allowWorktreeSuggestion` | boolean | `true` | Suggest worktree mode |
204
206
  | `tools.enableClaudeStyleAliases` | boolean | `true` | Enable Claude-style aliases |
205
- | `tools.enableSteer` | boolean | `true` | Enable steer tool |
206
- | `tools.terminateOnForeground` | boolean | `false` | Return terminate từ foreground Agent |
207
+ | `tools.enableSteer` | boolean | `true` | Enable the steer tool |
208
+ | `tools.terminateOnForeground` | boolean | `false` | Return terminate from a foreground Agent |
207
209
  | `agents.disableBuiltins` | boolean | `false` | Disable builtin agents |
208
210
  | `observability.enabled` | boolean | `false` | Enable metrics collection |
209
211
  | `observability.pollIntervalMs` | number | — | Metrics poll interval |
210
- | `otlp.enabled` | boolean | `false` | Enable OTLP exporter |
212
+ | `otlp.enabled` | boolean | `false` | Enable the OTLP exporter |
211
213
  | `otlp.endpoint` | string | — | OTLP endpoint URL |
212
214
  | `worktree.setupHook` | string | — | Worktree setup hook command |
213
- | `worktree.linkNodeModules` | boolean | — | Symlink node_modules into worktree |
214
- | `worktree.seedPaths` | array | — | Extra paths to seed into worktree |
215
+ | `worktree.linkNodeModules` | boolean | — | Symlink node_modules into the worktree |
216
+ | `worktree.seedPaths` | array | — | Extra paths to seed into the worktree |
215
217
 
216
218
  ---
217
219
 
218
220
  ## `/team-autonomy` — Delegation Policy
219
221
 
220
222
  ```text
221
- /team-autonomy status # Xem trạng thái
222
- /team-autonomy on # Bật autonomous delegation
223
- /team-autonomy off # Tắt
223
+ /team-autonomy status # View status
224
+ /team-autonomy on # Enable autonomous delegation
225
+ /team-autonomy off # Disable
224
226
  /team-autonomy manual # Profile: manual
225
227
  /team-autonomy suggested # Profile: suggested (default)
226
228
  /team-autonomy assisted # Profile: assisted
@@ -230,30 +232,30 @@ Giữ lại 20 runs gần nhất, xóa phần còn lại.
230
232
  Options:
231
233
 
232
234
  ```text
233
- /team-autonomy suggested --prefer-async # Tự động async cho tasks dài
234
- /team-autonomy suggested --no-worktree-suggest # Không gợi ý worktree
235
+ /team-autonomy suggested --prefer-async # Auto-async for long tasks
236
+ /team-autonomy suggested --no-worktree-suggest # Do not suggest worktree
235
237
  ```
236
238
 
237
239
  ### Autonomy Profiles
238
240
 
239
- | Profile | Hành vi |
241
+ | Profile | Behavior |
240
242
  |---------|---------|
241
- | `manual` | Không tự động delegate. Chạy khi host agent gọi team tool trực tiếp |
242
- | `suggested` | Đề xuất khi phù hợp, host agent quyết định (default) |
243
- | `assisted` | Chủ động delegate cho hầu hết tasks phức tạp |
244
- | `aggressive` | Luôn delegate, tối đa parallel execution |
243
+ | `manual` | No automatic delegation. Runs only when the host agent calls the team tool directly |
244
+ | `suggested` | Suggests when appropriate; the host agent decides (default) |
245
+ | `assisted` | Proactively delegates most complex tasks |
246
+ | `aggressive` | Always delegates, maximizing parallel execution |
245
247
 
246
248
  ---
247
249
 
248
250
  ## `/team-init` — Project Setup
249
251
 
250
252
  ```text
251
- /team-init # Khởi tạo layout cơ bản
252
- /team-init --copy-builtins # Copy builtin resources vào project
253
- /team-init --copy-builtins --overwrite # Copy ghi đè
253
+ /team-init # Initialize the basic layout
254
+ /team-init --copy-builtins # Copy builtin resources into the project
255
+ /team-init --copy-builtins --overwrite # Copy and overwrite
254
256
  ```
255
257
 
256
- Tạo directories:
258
+ Creates directories:
257
259
 
258
260
  ```text
259
261
  # New projects (.crew/ layout)
@@ -262,7 +264,7 @@ Tạo directories:
262
264
  .crew/workflows/
263
265
  .crew/imports/
264
266
 
265
- # Legacy (.pi/ layout, khi .pi/ đã tồn tại)
267
+ # Legacy (.pi/ layout, when .pi/ already exists)
266
268
  .pi/teams/agents/
267
269
  .pi/teams/teams/
268
270
  .pi/teams/workflows/
@@ -279,16 +281,16 @@ Tạo directories:
279
281
 
280
282
  ### Keyboard Shortcuts
281
283
 
282
- | Key | Hành động |
284
+ | Key | Action |
283
285
  |-----|-----------|
284
- | `↑`/`↓` hoặc `j`/`k` | Chọn run |
285
- | `r` | Reload run list |
286
+ | `↑`/`↓` or `j`/`k` | Select a run |
287
+ | `r` | Reload the run list |
286
288
  | `p` | Toggle short/long progress |
287
- | `Enter` hoặc `s` | Xem status |
288
- | `a` | Xem artifacts |
289
- | `u` | Xem summary |
289
+ | `Enter` or `s` | View status |
290
+ | `a` | View artifacts |
291
+ | `u` | View summary |
290
292
  | `i` | API read-manifest |
291
- | `q` hoặc `Esc` | Đóng |
293
+ | `q` or `Esc` | Close |
292
294
 
293
295
  ---
294
296
 
@@ -299,11 +301,11 @@ Tạo directories:
299
301
  ```
300
302
 
301
303
  Flows:
302
- - Liệt resources/runs
303
- - Chạy team
304
- - Xem run status
304
+ - List resources/runs
305
+ - Run a team
306
+ - View run status
305
307
  - Cleanup worktrees
306
- - Tạo/sửa agent/team resources
308
+ - Create/edit agent/team resources
307
309
  - Doctor check
308
310
 
309
311
  ---
@@ -314,11 +316,11 @@ Flows:
314
316
  /team-validate
315
317
  ```
316
318
 
317
- Kiểm tra:
318
- - Agents, teams, workflows hợp lệ
319
- - References đúng (agent tồn tại trong team roles)
320
- - Model hints hợp lệ
321
- - Workflow steps đúng format
319
+ Checks:
320
+ - Valid agents, teams, and workflows
321
+ - Correct references (the agent exists in team roles)
322
+ - Valid model hints
323
+ - Properly formatted workflow steps
322
324
 
323
325
  ---
324
326
 
@@ -328,13 +330,13 @@ Kiểm tra:
328
330
  /team-doctor
329
331
  ```
330
332
 
331
- Kiểm tra:
333
+ Checks:
332
334
  - cwd, platform, architecture
333
335
  - Node.js version
334
336
  - `pi --version`
335
337
  - `git --version`
336
- - State paths writable
337
- - Config parse
338
+ - State paths are writable
339
+ - Config parsing
338
340
  - Discovery counts (agents, teams, workflows)
339
341
  - Resource validation
340
342
  - Current model/provider
@@ -346,7 +348,7 @@ Child Pi smoke test (explicit):
346
348
  /team-api team_... doctor smokeChildPi=true
347
349
  ```
348
350
 
349
- hoặc qua tool:
351
+ or via the tool:
350
352
 
351
353
  ```json
352
354
  {