pi-crew 0.9.66 → 0.9.67

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 (49) hide show
  1. package/CHANGELOG.md +61 -0
  2. package/README.md +2 -3
  3. package/agents/executor.md +1 -1
  4. package/agents/test-engineer.md +1 -1
  5. package/agents/verifier.md +1 -1
  6. package/dist/index.mjs +4441 -4091
  7. package/package.json +7 -4
  8. package/scripts/analyze-run.mjs +1333 -0
  9. package/scripts/resource-sampler.mjs +482 -0
  10. package/skills/real-test-pi-crew/SKILL.md +10 -9
  11. package/src/config/role-tools.ts +2 -2
  12. package/src/extension/knowledge-injection.ts +17 -0
  13. package/src/extension/pi-api.ts +0 -16
  14. package/src/extension/team-tool/api/agent-control.ts +358 -0
  15. package/src/extension/team-tool/api/handler-context.ts +57 -0
  16. package/src/extension/team-tool/api/heartbeat.ts +75 -0
  17. package/src/extension/team-tool/api/mailbox.ts +242 -0
  18. package/src/extension/team-tool/api/plan-approval.ts +190 -0
  19. package/src/extension/team-tool/api/read.ts +443 -0
  20. package/src/extension/team-tool/api/task-claims.ts +207 -0
  21. package/src/extension/team-tool/api.ts +56 -1301
  22. package/src/extension/team-tool/cancel.ts +15 -4
  23. package/src/extension/team-tool/goal-wrap.ts +2 -2
  24. package/src/extension/team-tool/goal.ts +4 -4
  25. package/src/extension/team-tool/lifecycle-actions.ts +5 -5
  26. package/src/extension/team-tool/parallel-dispatch.ts +2 -2
  27. package/src/extension/team-tool/respond.ts +11 -3
  28. package/src/extension/team-tool/run-intent.ts +357 -0
  29. package/src/extension/team-tool/run.ts +8 -285
  30. package/src/extension/team-tool/status.ts +56 -21
  31. package/src/extension/team-tool.ts +10 -8
  32. package/src/prompt/scratchpad-lifecycle.ts +80 -5
  33. package/src/runtime/child-pi/child-pi-spawn.ts +13 -7
  34. package/src/runtime/child-pi/child-pi.ts +22 -144
  35. package/src/runtime/child-pi/mock-fixtures.ts +171 -0
  36. package/src/runtime/crew-agent-records.ts +18 -1
  37. package/src/runtime/scratchpad/README.md +6 -0
  38. package/src/runtime/scratchpad/guest.ts +54 -5
  39. package/src/runtime/scratchpad/snapshot-hmac.ts +7 -1
  40. package/src/runtime/supervisor-contact.ts +0 -16
  41. package/src/runtime/task-runner/child-executor.ts +1 -0
  42. package/src/runtime/task-runner/state-helpers.ts +9 -1
  43. package/src/runtime/team-runner.ts +39 -2
  44. package/src/state/contracts.ts +3 -0
  45. package/src/state/event-log/event-log.ts +19 -27
  46. package/src/state/gitignore-manager.ts +61 -7
  47. package/src/utils/glob-match.ts +29 -0
  48. package/types/dwf.d.ts +1 -1
  49. package/src/types/new-api-types.ts +0 -35
package/CHANGELOG.md CHANGED
@@ -2,6 +2,67 @@
2
2
 
3
3
  > **Note:** `atomic-write-v2.ts` / `AtomicWriter` mentioned in historical entries below was consolidated into `atomic-write.ts` as of v0.9.42. This changelog is preserved as historical record — the migration was completed (the v2 class was never adopted; v1 won on simplicity + symlink-safety + link+unlink atomicity). See `docs/migration/atomic-write-v2-migration.md` for the decision rationale.
4
4
 
5
+ ## [0.9.67] — RLM/scratchpad adoption batch (I1–I7) (2026-08-11)
6
+
7
+ First shippable slice of `improvement-plan-2026-08-11.md` — the scratchpad was
8
+ armed-but-unused (0 cells in 14 runs); this batch fixes the doctrine, adds an
9
+ adoption/value metric, and ports the pattern-12 shell guard. Each item was
10
+ loop-reviewed (iterative-audit) before commit; `test:critical` 101/0, 129
11
+ scratchpad tests, `tsc`/biome clean.
12
+
13
+ ### Fixes
14
+ - **Doctrine truthfulness (I1–I2)** (`src/prompt/scratchpad-lifecycle.ts`):
15
+ removed the "await expressions" bullet that advertised a tools bridge that
16
+ does not exist (pattern-22 "silence is cheaper"); replaced the foreign
17
+ `<rlm_engine_reset>` marker with the real `[scratchpad]` restore-notice prefix,
18
+ keeping the I6-pairing "especially inside shell commands" clause. New pins in
19
+ `test/unit/scratchpad-lifecycle.test.ts` (no absent-binding ads, no foreign
20
+ marker, real prefix taught).
21
+ - **English model-facing surface (I3)**: `description` + `promptSnippet`
22
+ translated from Vietnamese to English (model-facing channel only; human docs
23
+ stay Vietnamese). Pin asserts no non-ASCII prose.
24
+ - **Worked example + when-to-prefer rule (I4)**: 7th doctrine bullet shows a
25
+ two-cell `await import('node:fs')` example with `const failures` persisting
26
+ across cells, a prefer-scratchpad-over-bash rule, the "bash is cheaper for
27
+ one-shot" negative rule, and a "keep namespace values small" caveat. Perf
28
+ metric re-recorded: doctrine=299, delta=310 est-tokens (under the ~350
29
+ budget).
30
+ - **Adoption/value metric (I5)**: fire-and-forget `scratchpad.cell` (per cell:
31
+ status/durationMs/codeLength/resultBytes) and `scratchpad.restored`
32
+ (attempt/restoredCount/failedCount/status, incl. restore-throw) events, threaded
33
+ via new `PI_CREW_EVENTS_PATH` env + runId (now set unconditionally, uncoupled
34
+ from the broker gate). Both literals registered in `TEAM_EVENT_TYPES`; a
35
+ non-zero `## Scratchpad` section is reported in `summary.md` (silent when
36
+ unused). DI-seam failing-writer test added.
37
+ - **Pattern-12 shell guard (I6)** (`src/runtime/scratchpad/guest.ts`): guest-local
38
+ `sh(cmd, args[])` refuses null/empty args before spawn (the `rm -rf undefined`
39
+ class bug), runs `execFile(shell:false, args array)`, returns
40
+ `{ exitCode, stdout, stderr }` (non-zero does not throw). Registered in
41
+ `INTERNAL_BINDINGS` + namespace (identity skip excludes it from snapshots);
42
+ re-installed after restore. Advisory guard only — cells run at full worker
43
+ trust (no VM sandbox). 5 new guest tests.
44
+ - **NOT WIRED banners (I7)**: `snapshot-hmac.ts` marked unmissably NOT WIRED
45
+ (module + test header + README threat-model cross-ref) pending the J1
46
+ wire-or-delete decision.
47
+
48
+ ### Verified
49
+ - `npm run test:critical`: 101/0; 19 scratchpad test files 129/129; `test:spike`
50
+ 12 pass/1 pre-existing skip.
51
+ - `npx tsc --noEmit`, biome lint + format clean; `check:event-types` 67
52
+ registered (2 new), drift unchanged at 72; `check:lazy-imports`
53
+ (LAZY marker on the doctrine example string), bundle-staleness/size OK.
54
+ - Bundle rebuilt (2.81 MB < 3.5 MB budget).
55
+ - Observation window for the §5 decision gate starts after this release
56
+ (scratchpad.cell counts now visible in run state + summary.md).
57
+
58
+ ### CI regression fixes (same release)
59
+ - **Untracked api/ modules committed** (`src/extension/team-tool/api/*`, `run-intent.ts`, `src/utils/glob-match.ts`, `src/runtime/child-pi/mock-fixtures.ts`): the 08-10 batch staged only tracked files; CI typecheck failed `Cannot find module './api/*.ts'`. Fixed by committing the 10 missing source files.
60
+ - **Sync appendEvent restored in extracted api/ handlers** (`team-tool/api/{agent-control,mailbox,heartbeat,plan-approval}.ts` + `team-tool/status.ts`): the H3 extract silently changed 11 sync `appendEvent` → fire-and-forget `appendEventAsync`, breaking byte-identical behavior and racing integration tests (status/ack/nudge events missed when read immediately after the call). Reverted to sync `appendEvent`; integration 188/0 (was 3 fails), unit 7121/0.
61
+ - **removeCrewAgent test fixed** for H2 coalesced non-terminal status writes (use a terminal record).
62
+
63
+ ### Verified (CI)
64
+ - GitHub Actions: ubuntu + windows + macOS all green (run `31556762231`).
65
+
5
66
  ## [0.9.66] — real-test findings: cross-project run lookup, output validation, config no-op-write, retry clarity, cron grammar (2026-08-10)
6
67
 
7
68
  Six fixes distilled from the `real-test-pi-crew` 9-tier battery (run 2026-08-10). All verified live end-to-end; `npm run test:critical` 101/101, `npx tsc --noEmit` exit 0, biome lint+format clean.
package/README.md CHANGED
@@ -271,7 +271,7 @@ The guidance is available in three places agents see:
271
271
 
272
272
  ### How to silence the advisory
273
273
 
274
- The advisory is **informational only** — there is no `force:true` flag needed (the run proceeds regardless). If you want to silence the `console.warn` output for cleaner logs, set `PI_CREW_QUIET_PREFLIGHT=1` in your environment.
274
+ The advisory is **informational only** — there is no `force:true` flag needed (the run proceeds regardless).
275
275
 
276
276
  ### Implementation
277
277
 
@@ -827,7 +827,7 @@ This is pi-crew's cliff-resilient mode: the workflow definitions, phase structur
827
827
  { "action": "auto-summarize" }
828
828
  ```
829
829
 
830
- 📖 Full actions reference (40+ actions): [docs/actions-reference.md](docs/actions-reference.md)
830
+ 📖 Full actions reference (54 schema actions across 5 domain dispatchers: run/status/control/manage/automate): [docs/actions-reference.md](docs/actions-reference.md)
831
831
 
832
832
  ---
833
833
 
@@ -911,7 +911,6 @@ Your system prompt here.
911
911
  |----------|---------|
912
912
  | `PI_CREW_BROKER=0` | **Disable the inter-pi broker entirely** (always wins over config). Use to opt out of cross-session messaging. |
913
913
  | `PI_CREW_BROKER=1` | Explicitly enable the broker (redundant under the v0.9.47 default-on; useful for overriding a config `broker.enabled: false`). |
914
- | `PI_CREW_BROKER_DIAG_UI=1` | Make the run-dashboard `handleInput` emit a `[PI-CREW-DIAG]` line to stderr per keystroke — for TUI keybinding probes. |
915
914
  | `PI_CREW_USE_BUNDLE=1` | Force-load via bundled `dist/index.mjs` (~19% faster cold-start than strip-types). Default: bundle (since v0.9.17). Set `PI_CREW_USE_BUNDLE=0` to force strip-types fallback. Requires `npm run build:bundle` to have produced `dist/`. |
916
915
  | `PI_CREW_EXECUTE_WORKERS=0` | Disable child workers (scaffold mode) |
917
916
  | `PI_TEAMS_EXECUTE_WORKERS=0` | Legacy disable flag |
@@ -5,7 +5,7 @@ model: false
5
5
  systemPromptMode: replace
6
6
  inheritProjectContext: true
7
7
  inheritSkills: false
8
- tools: read, grep, find, ls, bash, edit, write
8
+ tools: read, grep, find, ls, bash, edit, write, scratchpad
9
9
  ---
10
10
 
11
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.
@@ -5,7 +5,7 @@ model: false
5
5
  systemPromptMode: replace
6
6
  inheritProjectContext: true
7
7
  inheritSkills: false
8
- tools: read, edit, write, bash, ls
8
+ tools: read, edit, write, bash, ls, scratchpad
9
9
  ---
10
10
 
11
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.
@@ -5,7 +5,7 @@ model: false
5
5
  systemPromptMode: replace
6
6
  inheritProjectContext: true
7
7
  inheritSkills: false
8
- tools: read, grep, find, ls, bash
8
+ tools: read, grep, find, ls, bash, scratchpad
9
9
  maxTurns: 15
10
10
  ---
11
11