pi-crew 0.1.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/AGENTS.md +32 -0
- package/CHANGELOG.md +6 -0
- package/LICENSE +21 -0
- package/NOTICE.md +15 -0
- package/README.md +703 -0
- package/agents/analyst.md +11 -0
- package/agents/critic.md +11 -0
- package/agents/executor.md +11 -0
- package/agents/explorer.md +11 -0
- package/agents/planner.md +11 -0
- package/agents/reviewer.md +11 -0
- package/agents/security-reviewer.md +11 -0
- package/agents/test-engineer.md +11 -0
- package/agents/verifier.md +11 -0
- package/agents/writer.md +11 -0
- package/docs/architecture.md +92 -0
- package/docs/live-mailbox-runtime.md +36 -0
- package/docs/publishing.md +65 -0
- package/docs/resource-formats.md +131 -0
- package/docs/usage.md +203 -0
- package/index.ts +6 -0
- package/install.mjs +19 -0
- package/package.json +79 -0
- package/schema.json +45 -0
- package/skills/.gitkeep +0 -0
- package/src/agents/agent-config.ts +27 -0
- package/src/agents/agent-serializer.ts +34 -0
- package/src/agents/discover-agents.ts +73 -0
- package/src/config/config.ts +193 -0
- package/src/extension/async-notifier.ts +36 -0
- package/src/extension/autonomous-policy.ts +122 -0
- package/src/extension/help.ts +43 -0
- package/src/extension/import-index.ts +52 -0
- package/src/extension/management.ts +335 -0
- package/src/extension/project-init.ts +74 -0
- package/src/extension/register.ts +349 -0
- package/src/extension/run-bundle-schema.ts +85 -0
- package/src/extension/run-export.ts +59 -0
- package/src/extension/run-import.ts +46 -0
- package/src/extension/run-index.ts +28 -0
- package/src/extension/run-maintenance.ts +24 -0
- package/src/extension/session-summary.ts +8 -0
- package/src/extension/team-manager-command.ts +86 -0
- package/src/extension/team-recommendation.ts +174 -0
- package/src/extension/team-tool.ts +783 -0
- package/src/extension/tool-result.ts +16 -0
- package/src/extension/validate-resources.ts +77 -0
- package/src/prompt/prompt-runtime.ts +58 -0
- package/src/runtime/async-runner.ts +26 -0
- package/src/runtime/background-runner.ts +43 -0
- package/src/runtime/child-pi.ts +75 -0
- package/src/runtime/model-fallback.ts +101 -0
- package/src/runtime/pi-args.ts +81 -0
- package/src/runtime/pi-json-output.ts +110 -0
- package/src/runtime/pi-spawn.ts +96 -0
- package/src/runtime/process-status.ts +25 -0
- package/src/runtime/task-runner.ts +164 -0
- package/src/runtime/team-runner.ts +135 -0
- package/src/runtime/worker-heartbeat.ts +21 -0
- package/src/schema/team-tool-schema.ts +100 -0
- package/src/state/artifact-store.ts +36 -0
- package/src/state/atomic-write.ts +18 -0
- package/src/state/contracts.ts +88 -0
- package/src/state/event-log.ts +27 -0
- package/src/state/locks.ts +40 -0
- package/src/state/mailbox.ts +188 -0
- package/src/state/state-store.ts +119 -0
- package/src/state/task-claims.ts +42 -0
- package/src/state/types.ts +88 -0
- package/src/state/usage.ts +29 -0
- package/src/teams/discover-teams.ts +84 -0
- package/src/teams/team-config.ts +22 -0
- package/src/teams/team-serializer.ts +36 -0
- package/src/ui/run-dashboard.ts +138 -0
- package/src/utils/frontmatter.ts +36 -0
- package/src/utils/ids.ts +12 -0
- package/src/utils/names.ts +26 -0
- package/src/utils/paths.ts +15 -0
- package/src/workflows/discover-workflows.ts +101 -0
- package/src/workflows/validate-workflow.ts +40 -0
- package/src/workflows/workflow-config.ts +24 -0
- package/src/workflows/workflow-serializer.ts +31 -0
- package/src/worktree/cleanup.ts +69 -0
- package/src/worktree/worktree-manager.ts +60 -0
- package/teams/default.team.md +12 -0
- package/teams/fast-fix.team.md +11 -0
- package/teams/implementation.team.md +15 -0
- package/teams/research.team.md +11 -0
- package/teams/review.team.md +12 -0
- package/tsconfig.json +19 -0
- package/workflows/default.workflow.md +29 -0
- package/workflows/fast-fix.workflow.md +22 -0
- package/workflows/implementation.workflow.md +47 -0
- package/workflows/research.workflow.md +22 -0
- package/workflows/review.workflow.md +30 -0
package/README.md
ADDED
|
@@ -0,0 +1,703 @@
|
|
|
1
|
+
# pi-crew
|
|
2
|
+
|
|
3
|
+
`pi-crew` is a Pi extension/package for coordinated AI teams: autonomous routing, manual slash-command controls, durable run state, artifacts, async/background execution, optional worktree isolation, resource management, validation, import/export, dashboard helpers, and safe API interop.
|
|
4
|
+
|
|
5
|
+
It is intentionally located at workspace root:
|
|
6
|
+
|
|
7
|
+
```text
|
|
8
|
+
pi-crew/
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
not under `Source/`.
|
|
12
|
+
|
|
13
|
+
## Status
|
|
14
|
+
|
|
15
|
+
`pi-crew` is implemented as a local Pi package with safe execution defaults and product-oriented foundations.
|
|
16
|
+
|
|
17
|
+
Current highlights:
|
|
18
|
+
|
|
19
|
+
- one main Pi tool: `team`
|
|
20
|
+
- autonomous delegation policy injection before agent start
|
|
21
|
+
- metadata-aware `recommend` action for routing, decomposition, fanout hints, async/worktree suggestions
|
|
22
|
+
- configurable autonomy profiles: `manual`, `suggested`, `assisted`, `aggressive`
|
|
23
|
+
- builtin agents, teams, and workflows
|
|
24
|
+
- user/project/builtin resource discovery with priority `builtin < user < project`
|
|
25
|
+
- resource format support for routing metadata: `triggers`, `useWhen`, `avoidWhen`, `cost`, `category`
|
|
26
|
+
- durable run state: manifest, tasks, events, artifacts, imports/exports
|
|
27
|
+
- foreground workflow scheduler
|
|
28
|
+
- detached async/background runner
|
|
29
|
+
- stale async PID detection
|
|
30
|
+
- active run summary and async completion notifications in Pi sessions
|
|
31
|
+
- safe scaffold execution by default; real child Pi workers are opt-in
|
|
32
|
+
- child Pi JSON output parsing for final text, usage, and event counts
|
|
33
|
+
- retryable model fallback attempts per task
|
|
34
|
+
- aggregate usage totals in status/summary
|
|
35
|
+
- progress, summary, prompt, result, log, diff, patch, export artifacts
|
|
36
|
+
- opt-in git worktree isolation per task
|
|
37
|
+
- worktree branch mismatch detection
|
|
38
|
+
- dirty worktree preservation unless `force` is explicitly set
|
|
39
|
+
- cancel/resume lifecycle operations
|
|
40
|
+
- forget/prune cleanup operations with explicit confirmation
|
|
41
|
+
- export/import portable run bundles
|
|
42
|
+
- resource create/update/delete with backups, dry-run, reference checks, and optional reference updates
|
|
43
|
+
- resource validation and doctor checks
|
|
44
|
+
- project initialization for `.pi` layout and `.gitignore`
|
|
45
|
+
- config show/update with user/project scope and nested unset support
|
|
46
|
+
- safe API interop for manifest/task/event/heartbeat/claim/mailbox operations
|
|
47
|
+
- run-level and task-level mailbox files with validation/repair support
|
|
48
|
+
- `/team-manager` interactive helper
|
|
49
|
+
- `/team-dashboard` custom TUI overlay with progress preview, action shortcuts, and reload
|
|
50
|
+
- package polish: `schema.json`, TypeScript semantic check, strip-types import smoke, cross-platform CI workflow, dry-run package verification
|
|
51
|
+
|
|
52
|
+
## Install
|
|
53
|
+
|
|
54
|
+
From npm:
|
|
55
|
+
|
|
56
|
+
```bash
|
|
57
|
+
pi install npm:pi-crew
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
From the workspace root for local development:
|
|
61
|
+
|
|
62
|
+
```bash
|
|
63
|
+
pi install ./pi-crew
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
Optional config bootstrap:
|
|
67
|
+
|
|
68
|
+
```bash
|
|
69
|
+
node ./pi-crew/install.mjs
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
Local verification from this package:
|
|
73
|
+
|
|
74
|
+
```bash
|
|
75
|
+
cd pi-crew
|
|
76
|
+
npm run ci
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
## Runtime safety model
|
|
80
|
+
|
|
81
|
+
By default, `run` uses safe scaffold mode. It creates run state, task prompts, events, and placeholder result artifacts without launching child Pi workers.
|
|
82
|
+
|
|
83
|
+
Real child Pi workers only run when explicitly enabled by either:
|
|
84
|
+
|
|
85
|
+
```bash
|
|
86
|
+
PI_TEAMS_EXECUTE_WORKERS=1 pi
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
or config:
|
|
90
|
+
|
|
91
|
+
```json
|
|
92
|
+
{
|
|
93
|
+
"executeWorkers": true
|
|
94
|
+
}
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
Worktree mode is opt-in:
|
|
98
|
+
|
|
99
|
+
```json
|
|
100
|
+
{
|
|
101
|
+
"action": "run",
|
|
102
|
+
"team": "implementation",
|
|
103
|
+
"goal": "Implement feature X",
|
|
104
|
+
"workspaceMode": "worktree"
|
|
105
|
+
}
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
By default, worktree mode requires a clean leader repository. Dirty task worktrees are preserved unless cleanup is called with `force: true`.
|
|
109
|
+
|
|
110
|
+
## Config
|
|
111
|
+
|
|
112
|
+
User config path:
|
|
113
|
+
|
|
114
|
+
```text
|
|
115
|
+
~/.pi/agent/extensions/pi-crew/config.json
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
Project config path:
|
|
119
|
+
|
|
120
|
+
```text
|
|
121
|
+
.pi/teams/config.json
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
Config merge priority:
|
|
125
|
+
|
|
126
|
+
```text
|
|
127
|
+
user < project
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
Supported config:
|
|
131
|
+
|
|
132
|
+
```json
|
|
133
|
+
{
|
|
134
|
+
"asyncByDefault": false,
|
|
135
|
+
"executeWorkers": false,
|
|
136
|
+
"notifierIntervalMs": 5000,
|
|
137
|
+
"requireCleanWorktreeLeader": true,
|
|
138
|
+
"autonomous": {
|
|
139
|
+
"profile": "suggested",
|
|
140
|
+
"enabled": true,
|
|
141
|
+
"injectPolicy": true,
|
|
142
|
+
"preferAsyncForLongTasks": false,
|
|
143
|
+
"allowWorktreeSuggestion": true,
|
|
144
|
+
"magicKeywords": {
|
|
145
|
+
"review": ["review", "audit", "inspect"]
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
Show config:
|
|
152
|
+
|
|
153
|
+
```text
|
|
154
|
+
/team-config
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
Update user config:
|
|
158
|
+
|
|
159
|
+
```text
|
|
160
|
+
/team-config asyncByDefault=true notifierIntervalMs=5000
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
Update project config:
|
|
164
|
+
|
|
165
|
+
```text
|
|
166
|
+
/team-config autonomous.profile=assisted autonomous.preferAsyncForLongTasks=true --project
|
|
167
|
+
```
|
|
168
|
+
|
|
169
|
+
Unset/delete nested config keys:
|
|
170
|
+
|
|
171
|
+
```text
|
|
172
|
+
/team-config --unset=autonomous.preferAsyncForLongTasks --project
|
|
173
|
+
/team-config autonomous.preferAsyncForLongTasks=unset --project
|
|
174
|
+
/team-config autonomous.preferAsyncForLongTasks=null --project
|
|
175
|
+
```
|
|
176
|
+
|
|
177
|
+
Config schema is exported as:
|
|
178
|
+
|
|
179
|
+
```text
|
|
180
|
+
./schema.json
|
|
181
|
+
```
|
|
182
|
+
|
|
183
|
+
## Main tool
|
|
184
|
+
|
|
185
|
+
The extension registers one main tool:
|
|
186
|
+
|
|
187
|
+
```text
|
|
188
|
+
team
|
|
189
|
+
```
|
|
190
|
+
|
|
191
|
+
Use it for complex multi-file work, planning, implementation, tests, reviews, security audits, research, async/background runs, and worktree-isolated execution.
|
|
192
|
+
|
|
193
|
+
When unsure which team/workflow to choose, call:
|
|
194
|
+
|
|
195
|
+
```json
|
|
196
|
+
{
|
|
197
|
+
"action": "recommend",
|
|
198
|
+
"goal": "Refactor auth flow and add tests"
|
|
199
|
+
}
|
|
200
|
+
```
|
|
201
|
+
|
|
202
|
+
## Tool actions
|
|
203
|
+
|
|
204
|
+
Supported actions:
|
|
205
|
+
|
|
206
|
+
| Action | Purpose |
|
|
207
|
+
|---|---|
|
|
208
|
+
| `list` | List discovered teams, agents, workflows, and recent runs |
|
|
209
|
+
| `get` | Inspect a named agent/team/workflow |
|
|
210
|
+
| `recommend` | Suggest team/workflow/action plus decomposition and fanout hints |
|
|
211
|
+
| `run` | Create a run and execute the workflow scheduler |
|
|
212
|
+
| `plan` | Validate and preview workflow execution without running tasks |
|
|
213
|
+
| `status` | Read durable run status |
|
|
214
|
+
| `summary` | Read/write run summary artifact |
|
|
215
|
+
| `events` | Read run event log |
|
|
216
|
+
| `artifacts` | List run artifacts |
|
|
217
|
+
| `worktrees` | List run worktree metadata |
|
|
218
|
+
| `cancel` | Cancel queued/running work |
|
|
219
|
+
| `resume` | Re-queue failed/cancelled/skipped/running tasks |
|
|
220
|
+
| `cleanup` | Clean run worktrees; dirty worktrees are preserved unless forced |
|
|
221
|
+
| `forget` | Delete run state/artifacts after `confirm: true` |
|
|
222
|
+
| `prune` | Delete old finished runs after `confirm: true` |
|
|
223
|
+
| `export` | Export a portable run bundle |
|
|
224
|
+
| `import` | Import a run bundle into local imports |
|
|
225
|
+
| `imports` | List imported run bundles |
|
|
226
|
+
| `create` | Create agent/team/workflow in user/project scope |
|
|
227
|
+
| `update` | Update agent/team/workflow with backup |
|
|
228
|
+
| `delete` | Delete agent/team/workflow with `confirm: true` and backup |
|
|
229
|
+
| `validate` | Validate agents, teams, workflows, references, and model hints |
|
|
230
|
+
| `doctor` | Check local readiness and optionally run child Pi smoke check |
|
|
231
|
+
| `config` | Show/update config |
|
|
232
|
+
| `init` | Create project `.pi` layout and update `.gitignore` |
|
|
233
|
+
| `autonomy` | Show/update autonomous delegation settings |
|
|
234
|
+
| `api` | Safe interop for run/task/event/heartbeat/claim/mailbox state |
|
|
235
|
+
| `help` | Show help text |
|
|
236
|
+
|
|
237
|
+
## Example tool calls
|
|
238
|
+
|
|
239
|
+
Run a default team safely:
|
|
240
|
+
|
|
241
|
+
```json
|
|
242
|
+
{
|
|
243
|
+
"action": "run",
|
|
244
|
+
"team": "default",
|
|
245
|
+
"goal": "Investigate failing tests and propose a fix"
|
|
246
|
+
}
|
|
247
|
+
```
|
|
248
|
+
|
|
249
|
+
Run async:
|
|
250
|
+
|
|
251
|
+
```json
|
|
252
|
+
{
|
|
253
|
+
"action": "run",
|
|
254
|
+
"team": "implementation",
|
|
255
|
+
"goal": "Implement the user settings screen",
|
|
256
|
+
"async": true
|
|
257
|
+
}
|
|
258
|
+
```
|
|
259
|
+
|
|
260
|
+
Run with worktrees:
|
|
261
|
+
|
|
262
|
+
```json
|
|
263
|
+
{
|
|
264
|
+
"action": "run",
|
|
265
|
+
"team": "implementation",
|
|
266
|
+
"workflow": "implementation",
|
|
267
|
+
"goal": "Add API endpoint and tests",
|
|
268
|
+
"workspaceMode": "worktree"
|
|
269
|
+
}
|
|
270
|
+
```
|
|
271
|
+
|
|
272
|
+
Inspect a run:
|
|
273
|
+
|
|
274
|
+
```json
|
|
275
|
+
{
|
|
276
|
+
"action": "status",
|
|
277
|
+
"runId": "team_..."
|
|
278
|
+
}
|
|
279
|
+
```
|
|
280
|
+
|
|
281
|
+
Create a routed agent:
|
|
282
|
+
|
|
283
|
+
```json
|
|
284
|
+
{
|
|
285
|
+
"action": "create",
|
|
286
|
+
"resource": "agent",
|
|
287
|
+
"config": {
|
|
288
|
+
"scope": "project",
|
|
289
|
+
"name": "api-reviewer",
|
|
290
|
+
"description": "Reviews backend API changes",
|
|
291
|
+
"systemPrompt": "You review backend API changes for correctness and compatibility.",
|
|
292
|
+
"triggers": ["api", "endpoint", "contract"],
|
|
293
|
+
"useWhen": ["backend API change", "OpenAPI contract update"],
|
|
294
|
+
"avoidWhen": ["documentation-only edits"],
|
|
295
|
+
"cost": "cheap",
|
|
296
|
+
"category": "backend"
|
|
297
|
+
}
|
|
298
|
+
}
|
|
299
|
+
```
|
|
300
|
+
|
|
301
|
+
## Slash commands
|
|
302
|
+
|
|
303
|
+
Manual slash commands are ops/debug controls. Autonomous tool use via policy/recommendation is the primary agent-driven path.
|
|
304
|
+
|
|
305
|
+
```text
|
|
306
|
+
/teams
|
|
307
|
+
/team-run [--team=name] [--workflow=name] [--async] [--worktree] <goal>
|
|
308
|
+
/team-cancel <runId>
|
|
309
|
+
/team-status <runId>
|
|
310
|
+
/team-summary <runId>
|
|
311
|
+
/team-resume <runId>
|
|
312
|
+
/team-events <runId>
|
|
313
|
+
/team-artifacts <runId>
|
|
314
|
+
/team-worktrees <runId>
|
|
315
|
+
/team-cleanup <runId> [--force]
|
|
316
|
+
/team-forget <runId> --confirm [--force]
|
|
317
|
+
/team-prune --keep=20 --confirm
|
|
318
|
+
/team-export <runId>
|
|
319
|
+
/team-import <path-to-run-export.json> [--user]
|
|
320
|
+
/team-imports
|
|
321
|
+
/team-api <runId> <operation> [key=value]
|
|
322
|
+
/team-manager
|
|
323
|
+
/team-dashboard
|
|
324
|
+
/team-init [--copy-builtins] [--overwrite]
|
|
325
|
+
/team-config [key=value] [--unset=key.path] [--project]
|
|
326
|
+
/team-autonomy [status|on|off|manual|suggested|assisted|aggressive] [--prefer-async] [--no-worktree-suggest]
|
|
327
|
+
/team-validate
|
|
328
|
+
/team-help
|
|
329
|
+
/team-doctor
|
|
330
|
+
```
|
|
331
|
+
|
|
332
|
+
### `/team-api` examples
|
|
333
|
+
|
|
334
|
+
```text
|
|
335
|
+
/team-api team_... read-manifest
|
|
336
|
+
/team-api team_... list-tasks
|
|
337
|
+
/team-api team_... read-task taskId=task_...
|
|
338
|
+
/team-api team_... read-events
|
|
339
|
+
/team-api team_... read-heartbeat taskId=task_...
|
|
340
|
+
/team-api team_... write-heartbeat taskId=task_... alive=true
|
|
341
|
+
/team-api team_... claim-task taskId=task_... owner=worker-1
|
|
342
|
+
/team-api team_... release-task-claim taskId=task_... owner=worker-1 token=...
|
|
343
|
+
/team-api team_... transition-task-status taskId=task_... owner=worker-1 token=... status=running
|
|
344
|
+
/team-api team_... send-message direction=outbox to=worker body="please check this"
|
|
345
|
+
/team-api team_... send-message taskId=task_... direction=inbox to=worker body="task scoped message"
|
|
346
|
+
/team-api team_... read-mailbox direction=outbox
|
|
347
|
+
/team-api team_... read-mailbox taskId=task_... direction=inbox
|
|
348
|
+
/team-api team_... ack-message messageId=msg_...
|
|
349
|
+
/team-api team_... read-delivery
|
|
350
|
+
/team-api team_... validate-mailbox repair=true
|
|
351
|
+
```
|
|
352
|
+
|
|
353
|
+
## Dashboard
|
|
354
|
+
|
|
355
|
+
Open:
|
|
356
|
+
|
|
357
|
+
```text
|
|
358
|
+
/team-dashboard
|
|
359
|
+
```
|
|
360
|
+
|
|
361
|
+
Shortcuts:
|
|
362
|
+
|
|
363
|
+
```text
|
|
364
|
+
↑/↓ or j/k select run
|
|
365
|
+
r reload run list
|
|
366
|
+
p toggle short/long progress preview
|
|
367
|
+
Enter or s show status
|
|
368
|
+
a list artifacts
|
|
369
|
+
u show summary
|
|
370
|
+
i API read-manifest
|
|
371
|
+
q or Esc close
|
|
372
|
+
```
|
|
373
|
+
|
|
374
|
+
## Manager
|
|
375
|
+
|
|
376
|
+
Open:
|
|
377
|
+
|
|
378
|
+
```text
|
|
379
|
+
/team-manager
|
|
380
|
+
```
|
|
381
|
+
|
|
382
|
+
Current flows:
|
|
383
|
+
|
|
384
|
+
- list resources/runs
|
|
385
|
+
- run a team
|
|
386
|
+
- show run status
|
|
387
|
+
- cleanup run worktrees
|
|
388
|
+
- create routed agent/team resources
|
|
389
|
+
- update routed agent/team resources
|
|
390
|
+
- doctor
|
|
391
|
+
|
|
392
|
+
## Resource paths
|
|
393
|
+
|
|
394
|
+
Builtin package resources:
|
|
395
|
+
|
|
396
|
+
```text
|
|
397
|
+
agents/*.md
|
|
398
|
+
teams/*.team.md
|
|
399
|
+
workflows/*.workflow.md
|
|
400
|
+
```
|
|
401
|
+
|
|
402
|
+
User resources:
|
|
403
|
+
|
|
404
|
+
```text
|
|
405
|
+
~/.pi/agent/agents/*.md
|
|
406
|
+
~/.pi/agent/teams/*.team.md
|
|
407
|
+
~/.pi/agent/workflows/*.workflow.md
|
|
408
|
+
```
|
|
409
|
+
|
|
410
|
+
Project resources:
|
|
411
|
+
|
|
412
|
+
```text
|
|
413
|
+
.pi/agents/*.md
|
|
414
|
+
.pi/teams/*.team.md
|
|
415
|
+
.pi/workflows/*.workflow.md
|
|
416
|
+
```
|
|
417
|
+
|
|
418
|
+
Discovery priority:
|
|
419
|
+
|
|
420
|
+
```text
|
|
421
|
+
builtin < user < project
|
|
422
|
+
```
|
|
423
|
+
|
|
424
|
+
## Resource metadata
|
|
425
|
+
|
|
426
|
+
Agents and teams may include optional routing metadata in frontmatter:
|
|
427
|
+
|
|
428
|
+
```yaml
|
|
429
|
+
---
|
|
430
|
+
name: api-reviewer
|
|
431
|
+
description: Reviews API changes
|
|
432
|
+
triggers: api, endpoint, contract
|
|
433
|
+
useWhen: backend API changes, OpenAPI changes
|
|
434
|
+
avoidWhen: docs-only edits
|
|
435
|
+
cost: cheap
|
|
436
|
+
category: backend
|
|
437
|
+
---
|
|
438
|
+
```
|
|
439
|
+
|
|
440
|
+
These fields guide autonomous policy injection and `recommend` routing.
|
|
441
|
+
|
|
442
|
+
## Builtin resources
|
|
443
|
+
|
|
444
|
+
Builtin agents include roles such as:
|
|
445
|
+
|
|
446
|
+
```text
|
|
447
|
+
analyst
|
|
448
|
+
critic
|
|
449
|
+
executor
|
|
450
|
+
explorer
|
|
451
|
+
planner
|
|
452
|
+
reviewer
|
|
453
|
+
security-reviewer
|
|
454
|
+
test-engineer
|
|
455
|
+
verifier
|
|
456
|
+
writer
|
|
457
|
+
```
|
|
458
|
+
|
|
459
|
+
Builtin teams include:
|
|
460
|
+
|
|
461
|
+
```text
|
|
462
|
+
default
|
|
463
|
+
fast-fix
|
|
464
|
+
implementation
|
|
465
|
+
research
|
|
466
|
+
review
|
|
467
|
+
```
|
|
468
|
+
|
|
469
|
+
Builtin workflows include:
|
|
470
|
+
|
|
471
|
+
```text
|
|
472
|
+
default
|
|
473
|
+
fast-fix
|
|
474
|
+
implementation
|
|
475
|
+
research
|
|
476
|
+
review
|
|
477
|
+
```
|
|
478
|
+
|
|
479
|
+
## State layout
|
|
480
|
+
|
|
481
|
+
Project-local state is preferred when the cwd has `.git` or `.pi`; otherwise user-global state is used.
|
|
482
|
+
|
|
483
|
+
Typical project-local state:
|
|
484
|
+
|
|
485
|
+
```text
|
|
486
|
+
.pi/teams/state/runs/{runId}/manifest.json
|
|
487
|
+
.pi/teams/state/runs/{runId}/tasks.json
|
|
488
|
+
.pi/teams/state/runs/{runId}/events.jsonl
|
|
489
|
+
.pi/teams/artifacts/{runId}/...
|
|
490
|
+
.pi/teams/worktrees/{runId}/{taskId}
|
|
491
|
+
.pi/teams/imports/{runId}/run-export.json
|
|
492
|
+
```
|
|
493
|
+
|
|
494
|
+
Mailbox state:
|
|
495
|
+
|
|
496
|
+
```text
|
|
497
|
+
.pi/teams/state/runs/{runId}/mailbox/inbox.jsonl
|
|
498
|
+
.pi/teams/state/runs/{runId}/mailbox/outbox.jsonl
|
|
499
|
+
.pi/teams/state/runs/{runId}/mailbox/delivery.json
|
|
500
|
+
.pi/teams/state/runs/{runId}/mailbox/tasks/{taskId}/inbox.jsonl
|
|
501
|
+
.pi/teams/state/runs/{runId}/mailbox/tasks/{taskId}/outbox.jsonl
|
|
502
|
+
```
|
|
503
|
+
|
|
504
|
+
User-global fallback:
|
|
505
|
+
|
|
506
|
+
```text
|
|
507
|
+
~/.pi/agent/extensions/pi-crew/runs/...
|
|
508
|
+
~/.pi/agent/extensions/pi-crew/imports/...
|
|
509
|
+
```
|
|
510
|
+
|
|
511
|
+
## Project initialization
|
|
512
|
+
|
|
513
|
+
Initialize project-local layout:
|
|
514
|
+
|
|
515
|
+
```text
|
|
516
|
+
/team-init
|
|
517
|
+
```
|
|
518
|
+
|
|
519
|
+
Optionally copy builtin resources:
|
|
520
|
+
|
|
521
|
+
```text
|
|
522
|
+
/team-init --copy-builtins
|
|
523
|
+
/team-init --copy-builtins --overwrite
|
|
524
|
+
```
|
|
525
|
+
|
|
526
|
+
Created directories:
|
|
527
|
+
|
|
528
|
+
```text
|
|
529
|
+
.pi/agents/
|
|
530
|
+
.pi/teams/
|
|
531
|
+
.pi/workflows/
|
|
532
|
+
.pi/teams/imports/
|
|
533
|
+
```
|
|
534
|
+
|
|
535
|
+
`.gitignore` entries:
|
|
536
|
+
|
|
537
|
+
```text
|
|
538
|
+
.pi/teams/state/
|
|
539
|
+
.pi/teams/artifacts/
|
|
540
|
+
.pi/teams/worktrees/
|
|
541
|
+
.pi/teams/imports/
|
|
542
|
+
```
|
|
543
|
+
|
|
544
|
+
## Import/export
|
|
545
|
+
|
|
546
|
+
Export writes:
|
|
547
|
+
|
|
548
|
+
```text
|
|
549
|
+
{artifactsRoot}/export/run-export.json
|
|
550
|
+
{artifactsRoot}/export/run-export.md
|
|
551
|
+
```
|
|
552
|
+
|
|
553
|
+
Import stores bundles under:
|
|
554
|
+
|
|
555
|
+
```text
|
|
556
|
+
.pi/teams/imports/{runId}/run-export.json
|
|
557
|
+
.pi/teams/imports/{runId}/README.md
|
|
558
|
+
```
|
|
559
|
+
|
|
560
|
+
or user-global imports with `--user`.
|
|
561
|
+
|
|
562
|
+
## Doctor and validation
|
|
563
|
+
|
|
564
|
+
Validate resources:
|
|
565
|
+
|
|
566
|
+
```text
|
|
567
|
+
/team-validate
|
|
568
|
+
```
|
|
569
|
+
|
|
570
|
+
Doctor:
|
|
571
|
+
|
|
572
|
+
```text
|
|
573
|
+
/team-doctor
|
|
574
|
+
```
|
|
575
|
+
|
|
576
|
+
Doctor checks include:
|
|
577
|
+
|
|
578
|
+
- cwd
|
|
579
|
+
- platform/architecture/Node.js version
|
|
580
|
+
- `pi --version`
|
|
581
|
+
- `git --version`
|
|
582
|
+
- writable state paths
|
|
583
|
+
- config parse
|
|
584
|
+
- discovery counts
|
|
585
|
+
- resource validation
|
|
586
|
+
- current model/provider when available
|
|
587
|
+
- model/fallback hints
|
|
588
|
+
|
|
589
|
+
Optional child Pi smoke check is explicit only:
|
|
590
|
+
|
|
591
|
+
```json
|
|
592
|
+
{
|
|
593
|
+
"action": "doctor",
|
|
594
|
+
"config": {
|
|
595
|
+
"smokeChildPi": true
|
|
596
|
+
}
|
|
597
|
+
}
|
|
598
|
+
```
|
|
599
|
+
|
|
600
|
+
## Environment variables
|
|
601
|
+
|
|
602
|
+
```text
|
|
603
|
+
PI_TEAMS_EXECUTE_WORKERS=1 enable real child Pi worker execution
|
|
604
|
+
PI_TEAMS_MOCK_CHILD_PI=success test/mock child worker success
|
|
605
|
+
PI_TEAMS_MOCK_CHILD_PI=json-success
|
|
606
|
+
PI_TEAMS_MOCK_CHILD_PI=retryable-failure
|
|
607
|
+
PI_TEAMS_INHERIT_PROJECT_CONTEXT control child prompt context inheritance
|
|
608
|
+
PI_TEAMS_INHERIT_SKILLS control skill inheritance
|
|
609
|
+
PI_TEAMS_HOME override home path for tests/config/state
|
|
610
|
+
PI_TEAMS_PI_BIN optional explicit Pi CLI script/shim path for doctor/child workers
|
|
611
|
+
```
|
|
612
|
+
|
|
613
|
+
## Development
|
|
614
|
+
|
|
615
|
+
Install dependencies:
|
|
616
|
+
|
|
617
|
+
```bash
|
|
618
|
+
cd pi-crew
|
|
619
|
+
npm install
|
|
620
|
+
```
|
|
621
|
+
|
|
622
|
+
Run tests:
|
|
623
|
+
|
|
624
|
+
```bash
|
|
625
|
+
npm test
|
|
626
|
+
```
|
|
627
|
+
|
|
628
|
+
Typecheck and smoke import:
|
|
629
|
+
|
|
630
|
+
```bash
|
|
631
|
+
npm run typecheck
|
|
632
|
+
```
|
|
633
|
+
|
|
634
|
+
Full local CI-equivalent check:
|
|
635
|
+
|
|
636
|
+
```bash
|
|
637
|
+
npm run ci
|
|
638
|
+
```
|
|
639
|
+
|
|
640
|
+
GitHub CI runs the same typecheck/test/pack checks on:
|
|
641
|
+
|
|
642
|
+
```text
|
|
643
|
+
ubuntu-latest
|
|
644
|
+
windows-latest
|
|
645
|
+
macos-latest
|
|
646
|
+
```
|
|
647
|
+
|
|
648
|
+
Package dry-run only:
|
|
649
|
+
|
|
650
|
+
```bash
|
|
651
|
+
npm pack --dry-run
|
|
652
|
+
```
|
|
653
|
+
|
|
654
|
+
## Documentation
|
|
655
|
+
|
|
656
|
+
Package docs:
|
|
657
|
+
|
|
658
|
+
```text
|
|
659
|
+
pi-crew/docs/architecture.md
|
|
660
|
+
pi-crew/docs/usage.md
|
|
661
|
+
pi-crew/docs/resource-formats.md
|
|
662
|
+
pi-crew/docs/live-mailbox-runtime.md
|
|
663
|
+
pi-crew/docs/publishing.md
|
|
664
|
+
```
|
|
665
|
+
|
|
666
|
+
Workspace-level design/progress docs:
|
|
667
|
+
|
|
668
|
+
```text
|
|
669
|
+
docs/pi-crew-source-review-and-lessons.md
|
|
670
|
+
docs/pi-crew-architecture.md
|
|
671
|
+
docs/pi-crew-mvp-plan.md
|
|
672
|
+
docs/pi-crew-*-progress-2026-04-26.md
|
|
673
|
+
```
|
|
674
|
+
|
|
675
|
+
## Known remaining release metadata
|
|
676
|
+
|
|
677
|
+
Package metadata still needs real project values before publishing:
|
|
678
|
+
|
|
679
|
+
- `author`
|
|
680
|
+
- `repository`
|
|
681
|
+
- `homepage`
|
|
682
|
+
- `bugs`
|
|
683
|
+
|
|
684
|
+
Local Pi smoke still requires an actual Pi environment:
|
|
685
|
+
|
|
686
|
+
```bash
|
|
687
|
+
cd pi-crew
|
|
688
|
+
npm run smoke:pi
|
|
689
|
+
```
|
|
690
|
+
|
|
691
|
+
Then in Pi:
|
|
692
|
+
|
|
693
|
+
```text
|
|
694
|
+
/team-doctor
|
|
695
|
+
/team-validate
|
|
696
|
+
/team-autonomy status
|
|
697
|
+
```
|
|
698
|
+
|
|
699
|
+
## Acknowledgements
|
|
700
|
+
|
|
701
|
+
`pi-crew` builds on ideas and selected MIT-licensed implementation patterns from `pi-subagents` and `oh-my-claudecode`.
|
|
702
|
+
|
|
703
|
+
It also draws conceptual inspiration from `oh-my-openagent`; no `oh-my-openagent` source code is copied unless separately documented and license-compatible.
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: analyst
|
|
3
|
+
description: Analyze requirements, ambiguity, and hidden constraints
|
|
4
|
+
model: claude-sonnet-4-5
|
|
5
|
+
systemPromptMode: replace
|
|
6
|
+
inheritProjectContext: true
|
|
7
|
+
inheritSkills: false
|
|
8
|
+
tools: read, grep, find, ls
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
You are a requirements analyst. Identify what is known, unknown, risky, ambiguous, or underspecified. Produce clarifying assumptions and acceptance criteria.
|
package/agents/critic.md
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: critic
|
|
3
|
+
description: Challenge plans and designs before execution
|
|
4
|
+
model: claude-sonnet-4-5
|
|
5
|
+
systemPromptMode: replace
|
|
6
|
+
inheritProjectContext: true
|
|
7
|
+
inheritSkills: false
|
|
8
|
+
tools: read, grep, find, ls
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
You are a critical reviewer. Find flaws, missing steps, unsafe assumptions, overengineering, underengineering, and verification gaps. Return concrete fixes to the plan.
|