pi-crew 0.5.1 → 0.5.5

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 (132) hide show
  1. package/CHANGELOG.md +95 -0
  2. package/README.md +1 -1
  3. package/docs/actions-reference.md +87 -0
  4. package/docs/bugs/cross-session-notification-leakage.md +82 -0
  5. package/docs/coding-agent-optimization.md +268 -0
  6. package/docs/commands-reference.md +5 -0
  7. package/docs/deep-review-report.md +384 -0
  8. package/docs/distillation/cybersecurity-patterns.md +294 -0
  9. package/docs/migration-v0.4-v0.5.md +191 -0
  10. package/docs/optimization-plan.md +642 -0
  11. package/docs/pi-crew-bugs.md +6 -0
  12. package/docs/pi-mono-opportunities.md +969 -0
  13. package/docs/pi-mono-review.md +291 -0
  14. package/{skills → docs/skills}/REFERENCE.md +13 -5
  15. package/index.ts +1 -1
  16. package/package.json +19 -16
  17. package/skills/artifact-analysis-loop/SKILL.md +302 -0
  18. package/skills/async-worker-recovery/SKILL.md +19 -1
  19. package/skills/child-pi-spawning/SKILL.md +19 -6
  20. package/skills/context-artifact-hygiene/SKILL.md +19 -2
  21. package/skills/delegation-patterns/SKILL.md +68 -3
  22. package/skills/detection-pipeline-design/SKILL.md +285 -0
  23. package/skills/event-log-tracing/SKILL.md +20 -6
  24. package/skills/git-master/SKILL.md +20 -6
  25. package/skills/hunting-investigation-loop/SKILL.md +401 -0
  26. package/skills/incident-playbook-construction/SKILL.md +383 -0
  27. package/skills/live-agent-lifecycle/SKILL.md +20 -6
  28. package/skills/mailbox-interactive/SKILL.md +19 -6
  29. package/skills/model-routing-context/SKILL.md +19 -1
  30. package/skills/multi-perspective-review/SKILL.md +19 -4
  31. package/skills/observability-reliability/SKILL.md +19 -2
  32. package/skills/orchestration/SKILL.md +20 -2
  33. package/skills/ownership-session-security/SKILL.md +20 -2
  34. package/skills/pi-extension-lifecycle/SKILL.md +20 -2
  35. package/skills/post-mortem/SKILL.md +7 -2
  36. package/skills/read-only-explorer/SKILL.md +20 -6
  37. package/skills/requirements-to-task-packet/SKILL.md +23 -3
  38. package/skills/resource-discovery-config/SKILL.md +20 -2
  39. package/skills/runtime-state-reader/SKILL.md +20 -2
  40. package/skills/safe-bash/SKILL.md +21 -6
  41. package/skills/scrutinize/SKILL.md +20 -2
  42. package/skills/secure-agent-orchestration-review/SKILL.md +29 -2
  43. package/skills/security-review/SKILL.md +560 -0
  44. package/skills/state-mutation-locking/SKILL.md +22 -2
  45. package/skills/systematic-debugging/SKILL.md +8 -6
  46. package/skills/threat-hypothesis-framework/SKILL.md +175 -0
  47. package/skills/ui-render-performance/SKILL.md +20 -2
  48. package/skills/verification-before-done/SKILL.md +17 -2
  49. package/skills/widget-rendering/SKILL.md +21 -6
  50. package/skills/workspace-isolation/SKILL.md +20 -6
  51. package/skills/worktree-isolation/SKILL.md +20 -6
  52. package/src/agents/agent-config.ts +40 -1
  53. package/src/benchmark/benchmark-runner.ts +245 -0
  54. package/src/benchmark/feedback-loop.ts +66 -0
  55. package/src/config/config.ts +22 -5
  56. package/src/config/role-tools.ts +82 -0
  57. package/src/config/types.ts +4 -0
  58. package/src/extension/async-notifier.ts +1 -1
  59. package/src/extension/autonomous-policy.ts +1 -1
  60. package/src/extension/crew-cleanup.ts +114 -0
  61. package/src/extension/cross-extension-rpc.ts +1 -1
  62. package/src/extension/plan-orchestrate.ts +322 -0
  63. package/src/extension/register.ts +46 -44
  64. package/src/extension/registration/command-utils.ts +1 -1
  65. package/src/extension/registration/commands.ts +1 -1
  66. package/src/extension/registration/compaction-guard.ts +1 -1
  67. package/src/extension/registration/subagent-helpers.ts +1 -1
  68. package/src/extension/registration/subagent-tools.ts +1 -1
  69. package/src/extension/registration/team-tool.ts +1 -1
  70. package/src/extension/registration/viewers.ts +1 -1
  71. package/src/extension/session-summary.ts +1 -1
  72. package/src/extension/team-manager-command.ts +1 -1
  73. package/src/extension/team-tool/context.ts +1 -1
  74. package/src/extension/team-tool/handle-schedule.ts +183 -0
  75. package/src/extension/team-tool/orchestrate.ts +102 -0
  76. package/src/extension/team-tool/run.ts +222 -35
  77. package/src/extension/team-tool.ts +10 -0
  78. package/src/extension/tool-result.ts +1 -1
  79. package/src/i18n.ts +1 -1
  80. package/src/observability/event-bus.ts +60 -0
  81. package/src/observability/event-to-metric.ts +1 -1
  82. package/src/prompt/prompt-runtime.ts +1 -1
  83. package/src/runtime/background-runner.ts +35 -7
  84. package/src/runtime/child-pi.ts +122 -34
  85. package/src/runtime/crash-recovery.ts +1 -1
  86. package/src/runtime/crew-agent-runtime.ts +1 -0
  87. package/src/runtime/crew-hooks.ts +240 -0
  88. package/src/runtime/custom-tools/irc-tool.ts +1 -1
  89. package/src/runtime/custom-tools/submit-result-tool.ts +1 -1
  90. package/src/runtime/diagnostic-export.ts +38 -2
  91. package/src/runtime/foreground-control.ts +87 -17
  92. package/src/runtime/foreground-watchdog.ts +1 -1
  93. package/src/runtime/live-session-runtime.ts +1 -1
  94. package/src/runtime/mcp-proxy.ts +1 -1
  95. package/src/runtime/pi-args.ts +11 -1
  96. package/src/runtime/pi-json-output.ts +31 -0
  97. package/src/runtime/pi-spawn.ts +20 -4
  98. package/src/runtime/process-status.ts +15 -2
  99. package/src/runtime/progress-tracker.ts +124 -0
  100. package/src/runtime/runtime-resolver.ts +1 -1
  101. package/src/runtime/session-resources.ts +1 -1
  102. package/src/runtime/skill-effectiveness.ts +473 -0
  103. package/src/runtime/skill-instructions.ts +37 -3
  104. package/src/runtime/task-runner.ts +122 -18
  105. package/src/runtime/team-runner.ts +17 -11
  106. package/src/runtime/tool-progress.ts +10 -3
  107. package/src/runtime/verification-gates.ts +367 -0
  108. package/src/schema/team-tool-schema.ts +31 -1
  109. package/src/state/crew-init.ts +56 -38
  110. package/src/state/decision-ledger.ts +344 -0
  111. package/src/state/event-log.ts +136 -10
  112. package/src/state/hook-instinct-bridge.ts +90 -0
  113. package/src/state/hook-integrations.ts +51 -0
  114. package/src/state/instinct-store.ts +249 -0
  115. package/src/state/run-metrics.ts +135 -0
  116. package/src/state/state-store.ts +3 -1
  117. package/src/state/tiered-eval.ts +471 -0
  118. package/src/state/types-eval.ts +58 -0
  119. package/src/state/types.ts +7 -0
  120. package/src/tools/safe-bash-extension.ts +5 -5
  121. package/src/types/new-api-types.ts +34 -0
  122. package/src/ui/agent-management-overlay.ts +5 -1
  123. package/src/ui/crew-widget.ts +30 -16
  124. package/src/ui/pi-ui-compat.ts +1 -1
  125. package/src/ui/powerbar-publisher.ts +100 -7
  126. package/src/ui/run-action-dispatcher.ts +1 -1
  127. package/src/ui/tool-render.ts +17 -17
  128. package/src/utils/project-detector.ts +160 -0
  129. package/src/utils/session-utils.ts +52 -0
  130. package/src/worktree/worktree-manager.ts +32 -13
  131. package/test-bugs-all.mjs +1 -1
  132. package/skills/.gitkeep +0 -0
@@ -0,0 +1,191 @@
1
+ # pi-crew Migration Guide: v0.4 → v0.5
2
+
3
+ **Author:** pi-crew team
4
+ **Date:** 2026-05-29
5
+ **Version:** 0.5.2
6
+
7
+ ---
8
+
9
+ ## Overview
10
+
11
+ This guide covers breaking changes and new features introduced in v0.5.x.
12
+
13
+ ---
14
+
15
+ ## Breaking Changes
16
+
17
+ ### 1. Environment Variable Allowlist (Security)
18
+
19
+ **Before (v0.4):**
20
+ ```typescript
21
+ // Child Pi workers received ALL matching secrets
22
+ "*_API_KEY",
23
+ "*_TOKEN",
24
+ "*_SECRET",
25
+ ```
26
+
27
+ **After (v0.5):**
28
+ ```typescript
29
+ // Only explicit provider keys
30
+ "ANTHROPIC_API_KEY",
31
+ "OPENAI_API_KEY",
32
+ "GOOGLE_API_KEY",
33
+ // ...
34
+ ```
35
+
36
+ **Action Required:** If your workflows rely on custom environment variables with `*_API_KEY` patterns, you must now explicitly list them:
37
+ ```json
38
+ {
39
+ "piCrew": {
40
+ "runtime": {
41
+ "envAllowlist": ["MY_CUSTOM_API_KEY", "MY_OTHER_KEY"]
42
+ }
43
+ }
44
+ }
45
+ ```
46
+
47
+ ---
48
+
49
+ ### 2. Mock Mode Requires Dual Environment Variables
50
+
51
+ **Before (v0.4):**
52
+ ```bash
53
+ PI_TEAMS_MOCK_CHILD_PI=success # Works silently
54
+ ```
55
+
56
+ **After (v0.5):**
57
+ ```bash
58
+ PI_TEAMS_MOCK_CHILD_PI=success
59
+ PI_CREW_ALLOW_MOCK=1 # Required for security
60
+ ```
61
+
62
+ **Action Required:** Update CI/CD and test scripts that use mock mode.
63
+
64
+ ---
65
+
66
+ ### 3. Skill Frontmatter Format
67
+
68
+ **Before (v0.4):**
69
+ ```yaml
70
+ ---
71
+ name: my-skill
72
+ description: "My skill description"
73
+ ---
74
+ ```
75
+
76
+ **After (v0.5):**
77
+ ```yaml
78
+ ---
79
+ name: my-skill
80
+ description: "My skill description"
81
+ triggers:
82
+ - "trigger phrase 1"
83
+ - "trigger phrase 2"
84
+ ---
85
+ ```
86
+
87
+ **Action Required:** Run `node scripts/check-all-skills.ts` to identify skills needing `triggers` field.
88
+
89
+ ---
90
+
91
+ ## New Features in v0.5
92
+
93
+ ### 1. Enhanced Security
94
+
95
+ - **Secure env allowlist**: Only explicit API keys passed to child processes
96
+ - **Mock mode protection**: Requires `PI_CREW_ALLOW_MOCK=1` alongside `PI_TEAMS_MOCK_CHILD_PI`
97
+ - **Worktree hook hardening**: Safer execution on Windows
98
+
99
+ ### 2. Improved Reliability
100
+
101
+ - **Terminal event durability**: Critical events (task.completed, task.failed) now bypass event buffering
102
+ - **Race condition fixes**: Foreground interrupt requests are now properly serialized
103
+ - **File descriptor cleanup**: Background runner properly closes log file descriptors
104
+
105
+ ### 3. Better Observability
106
+
107
+ - **Reduced cache TTL**: Manifest cache now expires in 30s instead of 5min for faster state updates
108
+ - **Decision ledger integrity**: Ledger entries are preserved during promote/decay operations
109
+
110
+ ### 4. Skill System
111
+
112
+ - **Standardized triggers**: All 35 built-in skills now have explicit trigger phrases
113
+ - **Enforcement gates**: Skills include checklist-based enforcement sections
114
+ - **Anti-patterns**: Most skills include anti-pattern documentation
115
+
116
+ ---
117
+
118
+ ## Configuration Changes
119
+
120
+ ### New Config Keys
121
+
122
+ | Key | Type | Default | Description |
123
+ |-----|------|---------|-------------|
124
+ | `limits.heartbeatStaleMs` | number | 30000 | Stale heartbeat threshold |
125
+ | `runtime.effectivenessGuard` | string | "off" | Effectiveness guard level |
126
+ | `runtime.completionMutationGuard` | string | "off" | Mutation guard level |
127
+
128
+ ### Deprecated Config Keys
129
+
130
+ None in v0.5.
131
+
132
+ ---
133
+
134
+ ## Workflow Migration
135
+
136
+ ### Updating Custom Agents
137
+
138
+ 1. Ensure agent files have `triggers` in frontmatter:
139
+ ```yaml
140
+ ---
141
+ name: my-agent
142
+ triggers:
143
+ - "my trigger"
144
+ ---
145
+ ```
146
+
147
+ 2. Verify agent is discovered:
148
+ ```bash
149
+ team action=list agent=my-agent
150
+ ```
151
+
152
+ ### Updating Custom Teams
153
+
154
+ 1. Validate team config:
155
+ ```bash
156
+ team action=validate resource=team name=my-team
157
+ ```
158
+
159
+ 2. Check for breaking changes in role/task definitions.
160
+
161
+ ---
162
+
163
+ ## Testing Checklist
164
+
165
+ After upgrading to v0.5:
166
+
167
+ - [ ] Run `team action=doctor` to verify configuration
168
+ - [ ] Run `node scripts/check-all-skills.ts` to verify skills
169
+ - [ ] Test mock mode with both env vars set
170
+ - [ ] Verify environment variables are properly filtered in child processes
171
+ - [ ] Test foreground interrupt (cancel) behavior
172
+ - [ ] Verify terminal events are properly logged
173
+
174
+ ---
175
+
176
+ ## Rollback
177
+
178
+ If issues occur after upgrade:
179
+
180
+ ```bash
181
+ # Revert to v0.4.x
182
+ pi install npm:pi-crew@0.4.x
183
+ ```
184
+
185
+ ---
186
+
187
+ ## Support
188
+
189
+ - **Issues**: https://github.com/baphuongna/pi-crew/issues
190
+ - **Documentation**: [docs/](docs/)
191
+ - **Changelog**: [CHANGELOG.md](CHANGELOG.md)