pi-crew 0.1.30 → 0.1.31
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 +9 -0
- package/agents/analyst.md +11 -11
- package/agents/critic.md +11 -11
- package/agents/executor.md +11 -11
- package/agents/explorer.md +11 -11
- package/agents/planner.md +11 -11
- package/agents/reviewer.md +11 -11
- package/agents/security-reviewer.md +11 -11
- package/agents/test-engineer.md +11 -11
- package/agents/verifier.md +11 -11
- package/agents/writer.md +11 -11
- package/docs/architecture.md +164 -164
- package/docs/refactor-tasks-phase3.md +394 -394
- package/docs/refactor-tasks-phase4.md +564 -564
- package/docs/refactor-tasks-phase5.md +402 -402
- package/docs/refactor-tasks-phase6.md +662 -662
- package/docs/runtime-flow.md +148 -148
- package/docs/source-runtime-refactor-map.md +83 -83
- package/index.ts +6 -6
- package/package.json +1 -1
- package/skills/git-master/SKILL.md +24 -19
- package/skills/read-only-explorer/SKILL.md +26 -21
- package/skills/safe-bash/SKILL.md +21 -16
- package/skills/task-packet/SKILL.md +28 -23
- package/skills/verify-evidence/SKILL.md +27 -22
- package/src/agents/agent-serializer.ts +34 -34
- package/src/agents/discover-agents.ts +102 -102
- package/src/extension/cross-extension-rpc.ts +82 -82
- package/src/extension/registration/artifact-cleanup.ts +14 -14
- package/src/extension/registration/commands.ts +208 -208
- package/src/extension/registration/team-tool.ts +44 -44
- package/src/extension/result-watcher.ts +98 -98
- package/src/extension/run-maintenance.ts +24 -24
- package/src/extension/team-tool/cancel.ts +31 -31
- package/src/extension/team-tool/doctor.ts +178 -178
- package/src/extension/team-tool/inspect.ts +41 -41
- package/src/extension/team-tool/lifecycle-actions.ts +79 -79
- package/src/extension/team-tool/plan.ts +19 -19
- package/src/extension/team-tool/status.ts +73 -73
- package/src/prompt/prompt-runtime.ts +68 -68
- package/src/runtime/agent-control.ts +64 -64
- package/src/runtime/agent-memory.ts +72 -72
- package/src/runtime/agent-observability.ts +113 -113
- package/src/runtime/async-marker.ts +26 -26
- package/src/runtime/background-runner.ts +53 -53
- package/src/runtime/crew-agent-runtime.ts +58 -58
- package/src/runtime/direct-run.ts +35 -35
- package/src/runtime/foreground-control.ts +82 -82
- package/src/runtime/green-contract.ts +46 -46
- package/src/runtime/group-join.ts +88 -88
- package/src/runtime/live-agent-control.ts +78 -78
- package/src/runtime/live-agent-manager.ts +85 -85
- package/src/runtime/live-control-realtime.ts +36 -36
- package/src/runtime/live-session-runtime.ts +299 -299
- package/src/runtime/manifest-cache.ts +214 -214
- package/src/runtime/model-fallback.ts +261 -261
- package/src/runtime/parallel-research.ts +44 -44
- package/src/runtime/parallel-utils.ts +99 -99
- package/src/runtime/pi-json-output.ts +111 -111
- package/src/runtime/pi-spawn.ts +96 -96
- package/src/runtime/policy-engine.ts +78 -78
- package/src/runtime/post-exit-stdio-guard.ts +86 -86
- package/src/runtime/process-status.ts +56 -56
- package/src/runtime/progress-event-coalescer.ts +43 -43
- package/src/runtime/recovery-recipes.ts +74 -74
- package/src/runtime/role-permission.ts +39 -39
- package/src/runtime/session-usage.ts +79 -79
- package/src/runtime/sidechain-output.ts +28 -28
- package/src/runtime/task-display.ts +38 -38
- package/src/runtime/task-output-context.ts +106 -106
- package/src/runtime/task-packet.ts +84 -84
- package/src/runtime/task-runner/live-executor.ts +98 -98
- package/src/runtime/task-runner/progress.ts +111 -111
- package/src/runtime/task-runner/prompt-builder.ts +72 -72
- package/src/runtime/task-runner/result-utils.ts +14 -14
- package/src/runtime/task-runner/state-helpers.ts +22 -22
- package/src/runtime/worker-heartbeat.ts +21 -21
- package/src/runtime/worker-startup.ts +57 -57
- package/src/schema/team-tool-schema.ts +100 -100
- package/src/state/artifact-store.ts +108 -108
- package/src/state/contracts.ts +105 -105
- package/src/state/jsonl-writer.ts +77 -77
- package/src/state/task-claims.ts +42 -42
- package/src/state/types.ts +180 -180
- package/src/state/usage.ts +29 -29
- package/src/subagents/async-entry.ts +1 -1
- package/src/subagents/index.ts +3 -3
- package/src/subagents/live/control.ts +1 -1
- package/src/subagents/live/manager.ts +1 -1
- package/src/subagents/live/realtime.ts +1 -1
- package/src/subagents/live/session-runtime.ts +1 -1
- package/src/subagents/manager.ts +1 -1
- package/src/subagents/spawn.ts +1 -1
- package/src/teams/team-serializer.ts +36 -36
- package/src/types/diff.d.ts +18 -0
- package/src/ui/crew-footer.ts +101 -101
- package/src/ui/crew-select-list.ts +111 -111
- package/src/ui/crew-widget.ts +285 -285
- package/src/ui/dynamic-border.ts +25 -25
- package/src/ui/layout-primitives.ts +106 -106
- package/src/ui/loaders.ts +158 -158
- package/src/ui/mascot.ts +441 -441
- package/src/ui/powerbar-publisher.ts +94 -94
- package/src/ui/render-diff.ts +119 -119
- package/src/ui/run-dashboard.ts +372 -372
- package/src/ui/status-colors.ts +54 -54
- package/src/ui/syntax-highlight.ts +116 -116
- package/src/ui/transcript-viewer.ts +302 -302
- package/src/utils/completion-dedupe.ts +63 -63
- package/src/utils/file-coalescer.ts +84 -84
- package/src/utils/frontmatter.ts +36 -36
- package/src/utils/fs-watch.ts +31 -31
- package/src/utils/git.ts +262 -262
- package/src/utils/ids.ts +12 -12
- package/src/utils/names.ts +26 -26
- package/src/utils/sleep.ts +32 -32
- package/src/utils/timings.ts +31 -31
- package/src/utils/visual.ts +159 -159
- package/src/workflows/validate-workflow.ts +40 -40
- package/src/worktree/branch-freshness.ts +45 -45
- package/src/worktree/cleanup.ts +69 -69
- package/teams/default.team.md +12 -12
- package/teams/fast-fix.team.md +11 -11
- package/teams/implementation.team.md +18 -18
- package/teams/parallel-research.team.md +14 -14
- package/teams/research.team.md +11 -11
- package/teams/review.team.md +12 -12
- package/workflows/default.workflow.md +29 -29
- package/workflows/fast-fix.workflow.md +22 -22
- package/workflows/implementation.workflow.md +38 -38
- package/workflows/parallel-research.workflow.md +46 -46
- package/workflows/research.workflow.md +22 -22
- package/workflows/review.workflow.md +30 -30
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,15 @@
|
|
|
2
2
|
|
|
3
3
|
## Unreleased
|
|
4
4
|
|
|
5
|
+
## 0.1.31
|
|
6
|
+
|
|
7
|
+
### Fixed
|
|
8
|
+
|
|
9
|
+
- Added required Agent Skills frontmatter (`name` and `description`) to built-in coding skills so Pi loads them without conflicts.
|
|
10
|
+
- Tightened built-in skill package coverage to require standards-compliant frontmatter.
|
|
11
|
+
|
|
12
|
+
## 0.1.30
|
|
13
|
+
|
|
5
14
|
### Added
|
|
6
15
|
|
|
7
16
|
- Added Phase 6 async hardening: jiti loader resolution/fail-fast, async startup marker files, and early background-runner exit detection.
|
package/agents/analyst.md
CHANGED
|
@@ -1,11 +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.
|
|
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
CHANGED
|
@@ -1,11 +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.
|
|
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.
|
package/agents/executor.md
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: executor
|
|
3
|
-
description: Implement planned code changes
|
|
4
|
-
model: claude-sonnet-4-5
|
|
5
|
-
systemPromptMode: replace
|
|
6
|
-
inheritProjectContext: true
|
|
7
|
-
inheritSkills: false
|
|
8
|
-
tools: read, grep, find, ls, bash, edit, write
|
|
9
|
-
---
|
|
10
|
-
|
|
11
|
-
You are an implementation specialist. Follow the provided plan, make targeted changes, keep edits minimal, and report changed files plus validation status. Do not broaden scope without explaining why.
|
|
1
|
+
---
|
|
2
|
+
name: executor
|
|
3
|
+
description: Implement planned code changes
|
|
4
|
+
model: claude-sonnet-4-5
|
|
5
|
+
systemPromptMode: replace
|
|
6
|
+
inheritProjectContext: true
|
|
7
|
+
inheritSkills: false
|
|
8
|
+
tools: read, grep, find, ls, bash, edit, write
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
You are an implementation specialist. Follow the provided plan, make targeted changes, keep edits minimal, and report changed files plus validation status. Do not broaden scope without explaining why.
|
package/agents/explorer.md
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: explorer
|
|
3
|
-
description: Fast codebase discovery and file/symbol mapping
|
|
4
|
-
model: claude-haiku-4-5
|
|
5
|
-
systemPromptMode: replace
|
|
6
|
-
inheritProjectContext: true
|
|
7
|
-
inheritSkills: false
|
|
8
|
-
tools: read, grep, find, ls
|
|
9
|
-
---
|
|
10
|
-
|
|
11
|
-
You are a fast codebase explorer. Map relevant files, symbols, data flow, and constraints. Do not modify files. Return concise findings with paths and evidence.
|
|
1
|
+
---
|
|
2
|
+
name: explorer
|
|
3
|
+
description: Fast codebase discovery and file/symbol mapping
|
|
4
|
+
model: claude-haiku-4-5
|
|
5
|
+
systemPromptMode: replace
|
|
6
|
+
inheritProjectContext: true
|
|
7
|
+
inheritSkills: false
|
|
8
|
+
tools: read, grep, find, ls
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
You are a fast codebase explorer. Map relevant files, symbols, data flow, and constraints. Do not modify files. Return concise findings with paths and evidence.
|
package/agents/planner.md
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: planner
|
|
3
|
-
description: Create an execution plan with clear sequencing and risk notes
|
|
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 planning specialist. Convert the goal and discovery notes into a concrete, ordered plan. Identify dependencies, risks, validation steps, and handoff instructions for implementers.
|
|
1
|
+
---
|
|
2
|
+
name: planner
|
|
3
|
+
description: Create an execution plan with clear sequencing and risk notes
|
|
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 planning specialist. Convert the goal and discovery notes into a concrete, ordered plan. Identify dependencies, risks, validation steps, and handoff instructions for implementers.
|
package/agents/reviewer.md
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: reviewer
|
|
3
|
-
description: Review code changes for correctness, maintainability, and regressions
|
|
4
|
-
model: claude-sonnet-4-5
|
|
5
|
-
systemPromptMode: replace
|
|
6
|
-
inheritProjectContext: true
|
|
7
|
-
inheritSkills: false
|
|
8
|
-
tools: read, grep, find, ls, bash
|
|
9
|
-
---
|
|
10
|
-
|
|
11
|
-
You are a code reviewer. Review the implementation for bugs, regressions, maintainability issues, missing tests, and project-rule violations. Return prioritized findings with evidence.
|
|
1
|
+
---
|
|
2
|
+
name: reviewer
|
|
3
|
+
description: Review code changes for correctness, maintainability, and regressions
|
|
4
|
+
model: claude-sonnet-4-5
|
|
5
|
+
systemPromptMode: replace
|
|
6
|
+
inheritProjectContext: true
|
|
7
|
+
inheritSkills: false
|
|
8
|
+
tools: read, grep, find, ls, bash
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
You are a code reviewer. Review the implementation for bugs, regressions, maintainability issues, missing tests, and project-rule violations. Return prioritized findings with evidence.
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: security-reviewer
|
|
3
|
-
description: Review changes for security vulnerabilities and trust-boundary issues
|
|
4
|
-
model: claude-sonnet-4-5
|
|
5
|
-
systemPromptMode: replace
|
|
6
|
-
inheritProjectContext: true
|
|
7
|
-
inheritSkills: false
|
|
8
|
-
tools: read, grep, find, ls, bash
|
|
9
|
-
---
|
|
10
|
-
|
|
11
|
-
You are a security reviewer. Look for injection, authn/authz flaws, insecure defaults, secret exposure, unsafe filesystem/network behavior, and dependency risks. Return severity and remediation.
|
|
1
|
+
---
|
|
2
|
+
name: security-reviewer
|
|
3
|
+
description: Review changes for security vulnerabilities and trust-boundary issues
|
|
4
|
+
model: claude-sonnet-4-5
|
|
5
|
+
systemPromptMode: replace
|
|
6
|
+
inheritProjectContext: true
|
|
7
|
+
inheritSkills: false
|
|
8
|
+
tools: read, grep, find, ls, bash
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
You are a security reviewer. Look for injection, authn/authz flaws, insecure defaults, secret exposure, unsafe filesystem/network behavior, and dependency risks. Return severity and remediation.
|
package/agents/test-engineer.md
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: test-engineer
|
|
3
|
-
description: Design and implement test strategy for a change
|
|
4
|
-
model: claude-sonnet-4-5
|
|
5
|
-
systemPromptMode: replace
|
|
6
|
-
inheritProjectContext: true
|
|
7
|
-
inheritSkills: false
|
|
8
|
-
tools: read, grep, find, ls, bash, edit, write
|
|
9
|
-
---
|
|
10
|
-
|
|
11
|
-
You are a test engineer. Identify the right test level, add or adjust tests when asked, detect flaky assumptions, and report exact validation commands and results.
|
|
1
|
+
---
|
|
2
|
+
name: test-engineer
|
|
3
|
+
description: Design and implement test strategy for a change
|
|
4
|
+
model: claude-sonnet-4-5
|
|
5
|
+
systemPromptMode: replace
|
|
6
|
+
inheritProjectContext: true
|
|
7
|
+
inheritSkills: false
|
|
8
|
+
tools: read, grep, find, ls, bash, edit, write
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
You are a test engineer. Identify the right test level, add or adjust tests when asked, detect flaky assumptions, and report exact validation commands and results.
|
package/agents/verifier.md
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: verifier
|
|
3
|
-
description: Verify that implementation satisfies the requested goal
|
|
4
|
-
model: claude-sonnet-4-5
|
|
5
|
-
systemPromptMode: replace
|
|
6
|
-
inheritProjectContext: true
|
|
7
|
-
inheritSkills: false
|
|
8
|
-
tools: read, grep, find, ls, bash
|
|
9
|
-
---
|
|
10
|
-
|
|
11
|
-
You are a verification specialist. Check whether the work is complete, correct, tested, and aligned with project constraints. Prefer evidence over assumptions. Return PASS or FAIL with reasons.
|
|
1
|
+
---
|
|
2
|
+
name: verifier
|
|
3
|
+
description: Verify that implementation satisfies the requested goal
|
|
4
|
+
model: claude-sonnet-4-5
|
|
5
|
+
systemPromptMode: replace
|
|
6
|
+
inheritProjectContext: true
|
|
7
|
+
inheritSkills: false
|
|
8
|
+
tools: read, grep, find, ls, bash
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
You are a verification specialist. Check whether the work is complete, correct, tested, and aligned with project constraints. Prefer evidence over assumptions. Return PASS or FAIL with reasons.
|
package/agents/writer.md
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: writer
|
|
3
|
-
description: Write concise documentation, migration notes, and summaries
|
|
4
|
-
model: claude-haiku-4-5
|
|
5
|
-
systemPromptMode: replace
|
|
6
|
-
inheritProjectContext: true
|
|
7
|
-
inheritSkills: false
|
|
8
|
-
tools: read, grep, find, ls, edit, write
|
|
9
|
-
---
|
|
10
|
-
|
|
11
|
-
You are a documentation specialist. Produce clear, concise, maintainable docs and summaries. Preserve technical accuracy and avoid marketing fluff.
|
|
1
|
+
---
|
|
2
|
+
name: writer
|
|
3
|
+
description: Write concise documentation, migration notes, and summaries
|
|
4
|
+
model: claude-haiku-4-5
|
|
5
|
+
systemPromptMode: replace
|
|
6
|
+
inheritProjectContext: true
|
|
7
|
+
inheritSkills: false
|
|
8
|
+
tools: read, grep, find, ls, edit, write
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
You are a documentation specialist. Produce clear, concise, maintainable docs and summaries. Preserve technical accuracy and avoid marketing fluff.
|
package/docs/architecture.md
CHANGED
|
@@ -1,164 +1,164 @@
|
|
|
1
|
-
# pi-crew Architecture
|
|
2
|
-
|
|
3
|
-
`pi-crew` is a Pi package for coordinated multi-agent work. It is intentionally durable-first: every run is represented on disk, every task has a state record, and child workers stream progress into JSONL/status files so foreground sessions, background jobs, dashboards, and later restarts all read the same source of truth.
|
|
4
|
-
|
|
5
|
-
## Layers
|
|
6
|
-
|
|
7
|
-
```text
|
|
8
|
-
Pi extension layer
|
|
9
|
-
register tools, slash commands, widget/dashboard, notifier, lifecycle cleanup
|
|
10
|
-
|
|
11
|
-
Runtime layer
|
|
12
|
-
team runner, task graph scheduler, child Pi process runner, async runner,
|
|
13
|
-
model fallback, policy engine, worktree manager, live-session experimental path
|
|
14
|
-
|
|
15
|
-
State layer
|
|
16
|
-
.pi/teams/state/runs/{runId}/manifest.json
|
|
17
|
-
.pi/teams/state/runs/{runId}/tasks.json
|
|
18
|
-
.pi/teams/state/runs/{runId}/events.jsonl
|
|
19
|
-
.pi/teams/state/runs/{runId}/agents/{taskId}/status.json
|
|
20
|
-
.pi/teams/artifacts/{runId}/...
|
|
21
|
-
```
|
|
22
|
-
|
|
23
|
-
## Run flow
|
|
24
|
-
|
|
25
|
-
```text
|
|
26
|
-
user/team tool
|
|
27
|
-
│
|
|
28
|
-
▼
|
|
29
|
-
handleTeamTool(action=run)
|
|
30
|
-
├─ discover agents/teams/workflows
|
|
31
|
-
├─ validate team/workflow refs
|
|
32
|
-
├─ create run manifest + task graph
|
|
33
|
-
├─ write goal artifact
|
|
34
|
-
└─ choose foreground/session-bound or async/background mode
|
|
35
|
-
│
|
|
36
|
-
├─ foreground: startForegroundRun() schedules executeTeamRun()
|
|
37
|
-
│
|
|
38
|
-
└─ async: spawnBackgroundTeamRun()
|
|
39
|
-
├─ node --import jiti-register.mjs background-runner.ts
|
|
40
|
-
├─ background-runner writes async.started + async.pid marker
|
|
41
|
-
└─ executeTeamRun()
|
|
42
|
-
├─ resolve ready task batch
|
|
43
|
-
├─ resolveBatchConcurrency() with hard cap
|
|
44
|
-
├─ runTeamTask() per task
|
|
45
|
-
│ ├─ build prompt + dependency context
|
|
46
|
-
│ ├─ choose configured Pi model candidates
|
|
47
|
-
│ ├─ spawn child `pi` worker
|
|
48
|
-
│ ├─ observe JSONL/stdout progress
|
|
49
|
-
│ ├─ persist agent status/events/output
|
|
50
|
-
│ └─ write result/log/transcript artifacts
|
|
51
|
-
├─ merge task updates monotonically
|
|
52
|
-
├─ write progress artifacts
|
|
53
|
-
└─ synthesize policy closeout
|
|
54
|
-
```
|
|
55
|
-
|
|
56
|
-
## Extension layer
|
|
57
|
-
|
|
58
|
-
`src/extension/register.ts` wires the package into Pi:
|
|
59
|
-
|
|
60
|
-
- `team` tool and management actions.
|
|
61
|
-
- Conflict-safe subagent tools: `crew_agent`, `crew_agent_result`, `crew_agent_steer`.
|
|
62
|
-
- Claude-style aliases: `Agent`, `get_subagent_result`, `steer_subagent` when available.
|
|
63
|
-
- Slash commands including `/team-run`, `/team-status`, `/team-dashboard`, `/team-doctor`, `/team-config`, `/team-summary`.
|
|
64
|
-
- Active-only widget and optional dashboard/sidebar UI.
|
|
65
|
-
- Foreground run scheduling and shutdown cleanup.
|
|
66
|
-
- Async completion notifier and session-start active-run summary.
|
|
67
|
-
|
|
68
|
-
The extension layer should remain thin: user input is normalized into tool parameters, then delegated to runtime/state modules.
|
|
69
|
-
|
|
70
|
-
## Runtime layer
|
|
71
|
-
|
|
72
|
-
### Team runner
|
|
73
|
-
|
|
74
|
-
`src/runtime/team-runner.ts` drives workflow execution. It reads queued tasks, computes the ready set from the task graph, applies concurrency limits, runs a batch, then merges results back into the latest task state. Terminal task states are monotonic: stale parallel snapshots must not regress completed/failed/cancelled/skipped tasks back to queued/running.
|
|
75
|
-
|
|
76
|
-
### Task runner
|
|
77
|
-
|
|
78
|
-
`src/runtime/task-runner.ts` executes one task. It prepares workspace/worktree context, renders a task prompt, chooses model candidates from Pi configuration, launches a child Pi process by default, and writes result artifacts. Scaffold mode is explicit dry-run only.
|
|
79
|
-
|
|
80
|
-
### Child Pi runtime
|
|
81
|
-
|
|
82
|
-
`src/runtime/child-pi.ts` is the default worker runtime. It:
|
|
83
|
-
|
|
84
|
-
- launches real `pi` child processes,
|
|
85
|
-
- hides Windows console windows with `windowsHide: true`,
|
|
86
|
-
- streams JSONL output into transcripts,
|
|
87
|
-
- compacts noisy message updates,
|
|
88
|
-
- isolates observer callback failures so progress persistence cannot kill orchestration,
|
|
89
|
-
- applies post-exit stdio guards for late output.
|
|
90
|
-
|
|
91
|
-
### Async background runner
|
|
92
|
-
|
|
93
|
-
`src/runtime/async-runner.ts` spawns detached background runs. Installed packages use an absolute `jiti-register.mjs` loader path because Node strip-types refuses TypeScript under `node_modules`. The runner fail-fasts if jiti is missing, and writes `async.pid` once startup begins so the parent can distinguish a healthy start from an early import crash.
|
|
94
|
-
|
|
95
|
-
### Concurrency and policy
|
|
96
|
-
|
|
97
|
-
`src/runtime/concurrency.ts` picks batch size from explicit limits, team settings, workflow settings, or built-in defaults. User-provided `limits.maxConcurrentWorkers` is hard-capped by default to prevent local DoS; `limits.allowUnboundedConcurrency=true` is an explicit opt-out and emits an observability event.
|
|
98
|
-
|
|
99
|
-
`src/runtime/policy-engine.ts` applies closeout and safety policy decisions such as limit exceeded, failed task blocking, stale workers, and green-contract failures.
|
|
100
|
-
|
|
101
|
-
### Model routing
|
|
102
|
-
|
|
103
|
-
Model choice is based on Pi's current configuration/model registry, not hardcoded providers. Task and agent records persist model attempts and routing metadata so dashboards/status can show requested model, selected model, fallback chain, and fallback reason.
|
|
104
|
-
|
|
105
|
-
## State layer
|
|
106
|
-
|
|
107
|
-
Run state is under:
|
|
108
|
-
|
|
109
|
-
```text
|
|
110
|
-
.pi/teams/state/runs/{runId}/
|
|
111
|
-
manifest.json run metadata/status/artifacts/async pid
|
|
112
|
-
tasks.json task graph and per-task status
|
|
113
|
-
events.jsonl append-only run events
|
|
114
|
-
events.jsonl.seq event sequence cache
|
|
115
|
-
agents.json aggregate agent cache
|
|
116
|
-
async.pid background startup marker
|
|
117
|
-
agents/{taskId}/
|
|
118
|
-
status.json per-agent status source
|
|
119
|
-
events.jsonl per-agent event stream
|
|
120
|
-
output.log compact worker output
|
|
121
|
-
sidechain.output.jsonl
|
|
122
|
-
live-control.jsonl
|
|
123
|
-
```
|
|
124
|
-
|
|
125
|
-
Artifacts are under:
|
|
126
|
-
|
|
127
|
-
```text
|
|
128
|
-
.pi/teams/artifacts/{runId}/
|
|
129
|
-
goal.md
|
|
130
|
-
prompts/{taskId}.md
|
|
131
|
-
results/{taskId}.txt
|
|
132
|
-
logs/{taskId}.log
|
|
133
|
-
transcripts/{taskId}.jsonl
|
|
134
|
-
metadata/*.json
|
|
135
|
-
progress.md
|
|
136
|
-
summary.md
|
|
137
|
-
```
|
|
138
|
-
|
|
139
|
-
Atomic writes use temp-file replace with retry for transient Windows `EPERM`/`EBUSY`/`EACCES`. JSONL append paths are best-effort where used for observers/progress; write failures must not crash child output parsing.
|
|
140
|
-
|
|
141
|
-
## UI and observability
|
|
142
|
-
|
|
143
|
-
- The persistent widget shows active runs only.
|
|
144
|
-
- Stale async runs with dead background pids are hidden from the active widget.
|
|
145
|
-
- `/team-status` is the canonical detailed state view and can mark stale active async runs failed.
|
|
146
|
-
- `/team-dashboard` provides history and details.
|
|
147
|
-
- Powerbar publishing is optional and event-compatible.
|
|
148
|
-
- Transcript viewer is file-backed so it works for foreground and async runs.
|
|
149
|
-
|
|
150
|
-
## Lifecycle and cleanup
|
|
151
|
-
|
|
152
|
-
Foreground runs are session-bound and should be interrupted on session shutdown or session switch. Only explicit `async: true` runs are allowed to survive the Pi session. Runtime cleanup is registered through Pi lifecycle hooks and a global reload cleanup guard.
|
|
153
|
-
|
|
154
|
-
## Configuration
|
|
155
|
-
|
|
156
|
-
Key config sections:
|
|
157
|
-
|
|
158
|
-
- `runtime`: `auto`, `child-process`, `scaffold`, experimental `live-session`.
|
|
159
|
-
- `limits`: concurrency/task/depth safety controls.
|
|
160
|
-
- `ui`: widget/dashboard/powerbar/model-token display settings.
|
|
161
|
-
- `agents`: builtin overrides for models/fallbacks/tools.
|
|
162
|
-
- `autonomous`: policy injection/profile for proactive team delegation.
|
|
163
|
-
|
|
164
|
-
See `usage.md`, `resource-formats.md`, `runtime-flow.md`, and `live-mailbox-runtime.md` for operational details.
|
|
1
|
+
# pi-crew Architecture
|
|
2
|
+
|
|
3
|
+
`pi-crew` is a Pi package for coordinated multi-agent work. It is intentionally durable-first: every run is represented on disk, every task has a state record, and child workers stream progress into JSONL/status files so foreground sessions, background jobs, dashboards, and later restarts all read the same source of truth.
|
|
4
|
+
|
|
5
|
+
## Layers
|
|
6
|
+
|
|
7
|
+
```text
|
|
8
|
+
Pi extension layer
|
|
9
|
+
register tools, slash commands, widget/dashboard, notifier, lifecycle cleanup
|
|
10
|
+
|
|
11
|
+
Runtime layer
|
|
12
|
+
team runner, task graph scheduler, child Pi process runner, async runner,
|
|
13
|
+
model fallback, policy engine, worktree manager, live-session experimental path
|
|
14
|
+
|
|
15
|
+
State layer
|
|
16
|
+
.pi/teams/state/runs/{runId}/manifest.json
|
|
17
|
+
.pi/teams/state/runs/{runId}/tasks.json
|
|
18
|
+
.pi/teams/state/runs/{runId}/events.jsonl
|
|
19
|
+
.pi/teams/state/runs/{runId}/agents/{taskId}/status.json
|
|
20
|
+
.pi/teams/artifacts/{runId}/...
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
## Run flow
|
|
24
|
+
|
|
25
|
+
```text
|
|
26
|
+
user/team tool
|
|
27
|
+
│
|
|
28
|
+
▼
|
|
29
|
+
handleTeamTool(action=run)
|
|
30
|
+
├─ discover agents/teams/workflows
|
|
31
|
+
├─ validate team/workflow refs
|
|
32
|
+
├─ create run manifest + task graph
|
|
33
|
+
├─ write goal artifact
|
|
34
|
+
└─ choose foreground/session-bound or async/background mode
|
|
35
|
+
│
|
|
36
|
+
├─ foreground: startForegroundRun() schedules executeTeamRun()
|
|
37
|
+
│
|
|
38
|
+
└─ async: spawnBackgroundTeamRun()
|
|
39
|
+
├─ node --import jiti-register.mjs background-runner.ts
|
|
40
|
+
├─ background-runner writes async.started + async.pid marker
|
|
41
|
+
└─ executeTeamRun()
|
|
42
|
+
├─ resolve ready task batch
|
|
43
|
+
├─ resolveBatchConcurrency() with hard cap
|
|
44
|
+
├─ runTeamTask() per task
|
|
45
|
+
│ ├─ build prompt + dependency context
|
|
46
|
+
│ ├─ choose configured Pi model candidates
|
|
47
|
+
│ ├─ spawn child `pi` worker
|
|
48
|
+
│ ├─ observe JSONL/stdout progress
|
|
49
|
+
│ ├─ persist agent status/events/output
|
|
50
|
+
│ └─ write result/log/transcript artifacts
|
|
51
|
+
├─ merge task updates monotonically
|
|
52
|
+
├─ write progress artifacts
|
|
53
|
+
└─ synthesize policy closeout
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
## Extension layer
|
|
57
|
+
|
|
58
|
+
`src/extension/register.ts` wires the package into Pi:
|
|
59
|
+
|
|
60
|
+
- `team` tool and management actions.
|
|
61
|
+
- Conflict-safe subagent tools: `crew_agent`, `crew_agent_result`, `crew_agent_steer`.
|
|
62
|
+
- Claude-style aliases: `Agent`, `get_subagent_result`, `steer_subagent` when available.
|
|
63
|
+
- Slash commands including `/team-run`, `/team-status`, `/team-dashboard`, `/team-doctor`, `/team-config`, `/team-summary`.
|
|
64
|
+
- Active-only widget and optional dashboard/sidebar UI.
|
|
65
|
+
- Foreground run scheduling and shutdown cleanup.
|
|
66
|
+
- Async completion notifier and session-start active-run summary.
|
|
67
|
+
|
|
68
|
+
The extension layer should remain thin: user input is normalized into tool parameters, then delegated to runtime/state modules.
|
|
69
|
+
|
|
70
|
+
## Runtime layer
|
|
71
|
+
|
|
72
|
+
### Team runner
|
|
73
|
+
|
|
74
|
+
`src/runtime/team-runner.ts` drives workflow execution. It reads queued tasks, computes the ready set from the task graph, applies concurrency limits, runs a batch, then merges results back into the latest task state. Terminal task states are monotonic: stale parallel snapshots must not regress completed/failed/cancelled/skipped tasks back to queued/running.
|
|
75
|
+
|
|
76
|
+
### Task runner
|
|
77
|
+
|
|
78
|
+
`src/runtime/task-runner.ts` executes one task. It prepares workspace/worktree context, renders a task prompt, chooses model candidates from Pi configuration, launches a child Pi process by default, and writes result artifacts. Scaffold mode is explicit dry-run only.
|
|
79
|
+
|
|
80
|
+
### Child Pi runtime
|
|
81
|
+
|
|
82
|
+
`src/runtime/child-pi.ts` is the default worker runtime. It:
|
|
83
|
+
|
|
84
|
+
- launches real `pi` child processes,
|
|
85
|
+
- hides Windows console windows with `windowsHide: true`,
|
|
86
|
+
- streams JSONL output into transcripts,
|
|
87
|
+
- compacts noisy message updates,
|
|
88
|
+
- isolates observer callback failures so progress persistence cannot kill orchestration,
|
|
89
|
+
- applies post-exit stdio guards for late output.
|
|
90
|
+
|
|
91
|
+
### Async background runner
|
|
92
|
+
|
|
93
|
+
`src/runtime/async-runner.ts` spawns detached background runs. Installed packages use an absolute `jiti-register.mjs` loader path because Node strip-types refuses TypeScript under `node_modules`. The runner fail-fasts if jiti is missing, and writes `async.pid` once startup begins so the parent can distinguish a healthy start from an early import crash.
|
|
94
|
+
|
|
95
|
+
### Concurrency and policy
|
|
96
|
+
|
|
97
|
+
`src/runtime/concurrency.ts` picks batch size from explicit limits, team settings, workflow settings, or built-in defaults. User-provided `limits.maxConcurrentWorkers` is hard-capped by default to prevent local DoS; `limits.allowUnboundedConcurrency=true` is an explicit opt-out and emits an observability event.
|
|
98
|
+
|
|
99
|
+
`src/runtime/policy-engine.ts` applies closeout and safety policy decisions such as limit exceeded, failed task blocking, stale workers, and green-contract failures.
|
|
100
|
+
|
|
101
|
+
### Model routing
|
|
102
|
+
|
|
103
|
+
Model choice is based on Pi's current configuration/model registry, not hardcoded providers. Task and agent records persist model attempts and routing metadata so dashboards/status can show requested model, selected model, fallback chain, and fallback reason.
|
|
104
|
+
|
|
105
|
+
## State layer
|
|
106
|
+
|
|
107
|
+
Run state is under:
|
|
108
|
+
|
|
109
|
+
```text
|
|
110
|
+
.pi/teams/state/runs/{runId}/
|
|
111
|
+
manifest.json run metadata/status/artifacts/async pid
|
|
112
|
+
tasks.json task graph and per-task status
|
|
113
|
+
events.jsonl append-only run events
|
|
114
|
+
events.jsonl.seq event sequence cache
|
|
115
|
+
agents.json aggregate agent cache
|
|
116
|
+
async.pid background startup marker
|
|
117
|
+
agents/{taskId}/
|
|
118
|
+
status.json per-agent status source
|
|
119
|
+
events.jsonl per-agent event stream
|
|
120
|
+
output.log compact worker output
|
|
121
|
+
sidechain.output.jsonl
|
|
122
|
+
live-control.jsonl
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
Artifacts are under:
|
|
126
|
+
|
|
127
|
+
```text
|
|
128
|
+
.pi/teams/artifacts/{runId}/
|
|
129
|
+
goal.md
|
|
130
|
+
prompts/{taskId}.md
|
|
131
|
+
results/{taskId}.txt
|
|
132
|
+
logs/{taskId}.log
|
|
133
|
+
transcripts/{taskId}.jsonl
|
|
134
|
+
metadata/*.json
|
|
135
|
+
progress.md
|
|
136
|
+
summary.md
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
Atomic writes use temp-file replace with retry for transient Windows `EPERM`/`EBUSY`/`EACCES`. JSONL append paths are best-effort where used for observers/progress; write failures must not crash child output parsing.
|
|
140
|
+
|
|
141
|
+
## UI and observability
|
|
142
|
+
|
|
143
|
+
- The persistent widget shows active runs only.
|
|
144
|
+
- Stale async runs with dead background pids are hidden from the active widget.
|
|
145
|
+
- `/team-status` is the canonical detailed state view and can mark stale active async runs failed.
|
|
146
|
+
- `/team-dashboard` provides history and details.
|
|
147
|
+
- Powerbar publishing is optional and event-compatible.
|
|
148
|
+
- Transcript viewer is file-backed so it works for foreground and async runs.
|
|
149
|
+
|
|
150
|
+
## Lifecycle and cleanup
|
|
151
|
+
|
|
152
|
+
Foreground runs are session-bound and should be interrupted on session shutdown or session switch. Only explicit `async: true` runs are allowed to survive the Pi session. Runtime cleanup is registered through Pi lifecycle hooks and a global reload cleanup guard.
|
|
153
|
+
|
|
154
|
+
## Configuration
|
|
155
|
+
|
|
156
|
+
Key config sections:
|
|
157
|
+
|
|
158
|
+
- `runtime`: `auto`, `child-process`, `scaffold`, experimental `live-session`.
|
|
159
|
+
- `limits`: concurrency/task/depth safety controls.
|
|
160
|
+
- `ui`: widget/dashboard/powerbar/model-token display settings.
|
|
161
|
+
- `agents`: builtin overrides for models/fallbacks/tools.
|
|
162
|
+
- `autonomous`: policy injection/profile for proactive team delegation.
|
|
163
|
+
|
|
164
|
+
See `usage.md`, `resource-formats.md`, `runtime-flow.md`, and `live-mailbox-runtime.md` for operational details.
|