loadout-ai 0.8.0 → 0.9.1

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 (98) hide show
  1. package/CHANGELOG.md +136 -0
  2. package/README.md +149 -309
  3. package/SECURITY.md +21 -1
  4. package/catalog/discovered.json +29122 -25325
  5. package/catalog/packages.json +4 -4
  6. package/dist/src/cli.js +12 -4
  7. package/dist/src/commands/agents.js +3 -1
  8. package/dist/src/commands/catalog-candidate.js +150 -0
  9. package/dist/src/commands/catalog-workflows.js +365 -0
  10. package/dist/src/commands/catalog.js +9 -354
  11. package/dist/src/commands/coordinate.js +730 -0
  12. package/dist/src/commands/coordination-discussions.js +218 -0
  13. package/dist/src/commands/coordination-sessions.js +197 -0
  14. package/dist/src/commands/inventory.js +4 -2
  15. package/dist/src/core/{routing → agents}/model-config.js +7 -2
  16. package/dist/src/core/catalog/catalog.js +1 -0
  17. package/dist/src/core/catalog/registry.js +5 -19
  18. package/dist/src/core/coordination/adapters/claude-code.js +154 -0
  19. package/dist/src/core/coordination/adapters/codex.js +160 -0
  20. package/dist/src/core/coordination/adapters/types.js +64 -0
  21. package/dist/src/core/coordination/auth.js +59 -0
  22. package/dist/src/core/coordination/auto-contract.js +457 -0
  23. package/dist/src/core/coordination/bridge-lease.js +79 -0
  24. package/dist/src/core/coordination/conflict-preview.js +167 -0
  25. package/dist/src/core/coordination/contract-diff.js +106 -0
  26. package/dist/src/core/coordination/coordinator.js +552 -0
  27. package/dist/src/core/coordination/crash-recovery.js +169 -0
  28. package/dist/src/core/coordination/daemon.js +670 -0
  29. package/dist/src/core/coordination/discussion-pipeline.js +313 -0
  30. package/dist/src/core/coordination/discussion.js +340 -0
  31. package/dist/src/core/coordination/events.js +161 -0
  32. package/dist/src/core/coordination/git-ownership.js +217 -0
  33. package/dist/src/core/coordination/http-api.js +118 -0
  34. package/dist/src/core/coordination/interrupt-policy.js +89 -0
  35. package/dist/src/core/coordination/lock.js +140 -0
  36. package/dist/src/core/coordination/mcp-server.js +424 -0
  37. package/dist/src/core/coordination/quick-start.js +200 -0
  38. package/dist/src/core/coordination/redaction.js +85 -0
  39. package/dist/src/core/coordination/replay.js +188 -0
  40. package/dist/src/core/coordination/retention.js +180 -0
  41. package/dist/src/core/coordination/runtime.js +21 -0
  42. package/dist/src/core/coordination/session-manager.js +366 -0
  43. package/dist/src/core/coordination/watcher.js +128 -0
  44. package/dist/src/core/{routing → delegation}/first-party-skills.js +25 -13
  45. package/dist/src/core/delegation/handoff-bundle.js +253 -0
  46. package/dist/src/core/delegation/handoff-templates.js +222 -0
  47. package/dist/src/core/delegation/handoff-verification.js +117 -0
  48. package/dist/src/core/delegation/handoff.js +537 -0
  49. package/dist/src/core/discovery/candidate-intelligence-evidence.js +108 -0
  50. package/dist/src/core/discovery/candidate-intelligence-types.js +1 -0
  51. package/dist/src/core/discovery/candidate-intelligence-validation.js +108 -0
  52. package/dist/src/core/discovery/candidate-intelligence.js +3 -214
  53. package/dist/src/core/discovery/community.js +12 -4
  54. package/dist/src/core/discovery/github-discovery.js +6 -2
  55. package/dist/src/core/discovery/private-discovery.js +6 -2
  56. package/dist/src/core/install/reconcile.js +1 -1
  57. package/dist/src/core/install/snapshot.js +24 -5
  58. package/dist/src/core/install/uninstall.js +39 -3
  59. package/dist/src/core/reporting/cli-guide.js +9 -5
  60. package/dist/src/core/reporting/completion.js +43 -38
  61. package/dist/src/core/reporting/doctor.js +1 -1
  62. package/dist/src/core/runtime/bounded-json.js +65 -0
  63. package/dist/src/core/runtime/github.js +30 -16
  64. package/dist/src/core/runtime/mcp-recipes.js +1 -1
  65. package/dist/src/core/workspace/active-policy.js +1 -1
  66. package/docs/DEMO_SCRIPT.md +19 -23
  67. package/docs/DISCOVERED.md +250 -251
  68. package/docs/FEATURE_TEST_MATRIX.md +30 -15
  69. package/docs/LIVE_COLLABORATION.md +283 -0
  70. package/docs/REFERENCE.md +263 -0
  71. package/docs/RELEASE_REVIEW.md +1 -1
  72. package/docs/TESTING.md +17 -1
  73. package/docs/USER_TEST_GUIDE.md +211 -3
  74. package/docs/assets/loadout-discover-activate.webp +0 -0
  75. package/docs/assets/loadout-handoff-coordinate.webp +0 -0
  76. package/docs/assets/loadout-social-preview.png +0 -0
  77. package/docs/decisions/001-coordination-jsonl-locking.md +35 -0
  78. package/docs/decisions/002-local-daemon-authentication.md +32 -0
  79. package/docs/decisions/003-bounded-agent-discussions.md +91 -0
  80. package/docs/evidence/coordination-provider-check-2026-09-05.md +33 -0
  81. package/docs/specs/BOUNDED_AGENT_DISCUSSIONS.md +169 -0
  82. package/docs/specs/HANDOFF_CONTEXT_BUNDLES.md +139 -0
  83. package/docs/specs/HANDOFF_VERIFICATION.md +83 -0
  84. package/docs/superpowers/plans/2026-09-03-coordination-hardening.md +231 -0
  85. package/docs/superpowers/plans/2026-09-03-release-readiness.md +232 -0
  86. package/docs/superpowers/plans/2026-09-04-bounded-agent-discussions.md +121 -0
  87. package/docs/superpowers/plans/2026-09-04-handoff-context-bundles.md +109 -0
  88. package/docs/superpowers/plans/2026-09-04-handoff-verification.md +56 -0
  89. package/docs/superpowers/plans/2026-09-05-pre-release-hardening.md +175 -0
  90. package/docs/superpowers/plans/2026-09-05-public-readiness.md +20 -0
  91. package/package.json +15 -5
  92. package/skills/loadout-handoff/SKILL.md +291 -0
  93. package/dist/src/core/routing/handoff.js +0 -314
  94. package/dist/src/core/routing/policy.js +0 -147
  95. package/dist/src/core/routing/route.js +0 -411
  96. package/docs/assets/loadout-workflow.png +0 -0
  97. package/skills/loadout-router/SKILL.md +0 -85
  98. /package/dist/src/core/{routing → agents}/credentials.js +0 -0
@@ -0,0 +1,232 @@
1
+ # Loadout Release Readiness Implementation Plan
2
+
3
+ > **For agentic workers:** REQUIRED SUB-SKILL: Use superpowers:subagent-driven-development (recommended) or superpowers:executing-plans to implement this plan task-by-task. Steps use checkbox (`- [ ]`) syntax for tracking.
4
+
5
+ **Goal:** Resolve every actionable weakness from the 2026-09-03 audit and leave a locally testable, release-ready Loadout tree without publishing it.
6
+
7
+ **Architecture:** Centralize bounded JSON HTTP handling, validate handoff data at its boundary, and derive CLI metadata from the Commander tree instead of parallel lists. Keep landing-page material concise while moving detailed reference content into focused documents. Reduce the two largest implementation files by extracting cohesive command and discovery responsibilities without changing their public behavior.
8
+
9
+ **Tech Stack:** TypeScript, Node.js 20+, Commander, Zod, Vitest, GitHub Actions, npm.
10
+
11
+ ## Global Constraints
12
+
13
+ - Do not push, publish, tag, or create a GitHub Release; the user will test first.
14
+ - Preserve current user changes, including the pre-existing deletion of `loadout-ai-0.8.0.tgz`.
15
+ - Add no runtime dependency; use Node web streams and the existing Zod dependency.
16
+ - Every behavior change follows red-green TDD.
17
+ - Preserve Node 20, macOS, Linux, and Windows compatibility.
18
+ - Keep mutating CLI behavior preview-first and reversible.
19
+
20
+ ---
21
+
22
+ ### Task 1: Bound JSON network responses
23
+
24
+ **Files:**
25
+
26
+ - Create: `src/core/runtime/bounded-json.ts`
27
+ - Create: `tests/bounded-json.test.ts`
28
+ - Modify: `src/core/catalog/registry.ts`
29
+ - Modify: `src/core/agents/model-config.ts`
30
+ - Modify: `src/core/discovery/community.ts`
31
+ - Modify: `src/core/discovery/github-discovery.ts`
32
+ - Modify: `src/core/discovery/private-discovery.ts`
33
+ - Modify: `src/core/runtime/github.ts`
34
+ - Test: the existing tests for each consumer above
35
+
36
+ **Interfaces:**
37
+
38
+ - Produces: `boundedJson(fetcher, input, init, limits): Promise<{ response: Response; value: unknown }>` with required timeout and byte limits.
39
+ - Consumes: standard `fetch`, `AbortSignal.timeout`, and `ReadableStreamDefaultReader`.
40
+
41
+ - [ ] Add tests proving declared oversize, streamed oversize, malformed JSON, timeout signal composition, and exact-limit success.
42
+ - [ ] Run `npx vitest run tests/bounded-json.test.ts tests/security-regressions.test.ts` and confirm the new cases fail for the missing helper/old full-buffer behavior.
43
+ - [ ] Implement incremental stream reads that cancel above the cap and parse only after the bounded byte array is complete.
44
+ - [ ] Route every listed JSON request through the helper with endpoint-appropriate caps and 30-second defaults.
45
+ - [ ] Run all affected unit tests and confirm they pass.
46
+
47
+ ### Task 2: Validate every handoff log entry
48
+
49
+ **Files:**
50
+
51
+ - Modify: `src/core/delegation/handoff.ts`
52
+ - Modify: `tests/handoff.test.ts`
53
+
54
+ **Interfaces:**
55
+
56
+ - Produces: a strict internal Zod schema matching `HandoffMessage`, including the terminal type enum and ISO timestamp.
57
+ - Consumes: existing `readMessagesDetailed` corrupt-line reporting.
58
+
59
+ - [ ] Add tests for missing timestamp/from/to/description, unsupported type, malformed resolves, and valid legacy terminal context.
60
+ - [ ] Run `npx vitest run tests/handoff.test.ts` and confirm malformed-but-valid JSON reaches the old unsafe path.
61
+ - [ ] Parse with the complete schema and report schema failures as corrupt lines without hiding valid neighbors.
62
+ - [ ] Run the handoff suite and a CLI inbox formatting test.
63
+
64
+ ### Task 3: Generate complete shell command metadata
65
+
66
+ **Files:**
67
+
68
+ - Modify: `src/core/reporting/completion.ts`
69
+ - Modify: `src/cli.ts`
70
+ - Modify: `tests/completion.test.ts`
71
+ - Modify: `scripts/check-documented-commands.mjs`
72
+ - Create: `tests/documented-commands-script.test.ts`
73
+
74
+ **Interfaces:**
75
+
76
+ - Produces: recursive `CommandTree` nodes and shell completion output for every registered parent/child pair.
77
+ - Produces: a machine-readable CLI command-path mode consumed by the documentation gate.
78
+
79
+ - [ ] Add tests requiring `skills list/install/remove` in all four shells and rejecting invalid documented parent-child combinations.
80
+ - [ ] Run the focused tests and capture the expected failures.
81
+ - [ ] Render nested cases from the command tree rather than hard-coded parent names.
82
+ - [ ] Change the documentation gate to compare full command paths extracted from executable snippets against registered paths.
83
+ - [ ] Reset completion registry state per test and run focused tests green.
84
+
85
+ ### Task 4: Make release verification match the release promise
86
+
87
+ **Files:**
88
+
89
+ - Modify: `package.json`
90
+ - Modify: `.github/workflows/release.yml`
91
+ - Modify: `tests/package-release.test.ts`
92
+ - Modify: `CHANGELOG.md`
93
+
94
+ **Interfaces:**
95
+
96
+ - Produces: `verify:full` that runs `verify` plus `test:coverage`.
97
+ - Consumes: release workflow tag/version and npm provenance checks.
98
+
99
+ - [ ] Add tests requiring the release job to call `verify:full` and requiring that script to include coverage.
100
+ - [ ] Run `npx vitest run tests/package-release.test.ts` and confirm failure against the old release command.
101
+ - [ ] Update scripts/workflow, and document the post-0.8 removal of model routing under Unreleased with a 0.9 migration note.
102
+ - [ ] Run release contract tests green.
103
+
104
+ ### Task 5: Replace stale planning and package metadata
105
+
106
+ **Files:**
107
+
108
+ - Modify: `MASTERPLAN.md`
109
+ - Modify: `package.json`
110
+ - Modify: `tests/package-release.test.ts`
111
+
112
+ **Interfaces:**
113
+
114
+ - Produces: one current roadmap that contains no fixed vulnerabilities, removed paths, or routing feature claims.
115
+ - Produces: npm metadata aligned with GitHub positioning and search terms.
116
+
117
+ - [ ] Add metadata assertions for the canonical description and keywords.
118
+ - [ ] Run the package contract test red.
119
+ - [ ] Rewrite `MASTERPLAN.md` around remaining post-audit work and align npm description/keywords.
120
+ - [ ] Run metadata and README claim tests green.
121
+
122
+ ### Task 6: Complete open-source contribution scaffolding
123
+
124
+ **Files:**
125
+
126
+ - Create: `CONTRIBUTING.md`
127
+ - Create: `CODE_OF_CONDUCT.md`
128
+ - Create: `.github/ISSUE_TEMPLATE/bug_report.yml`
129
+ - Create: `.github/ISSUE_TEMPLATE/feature_request.yml`
130
+ - Create: `.github/pull_request_template.md`
131
+ - Create or modify: `tests/community-health.test.ts`
132
+ - Modify: `README.md`
133
+
134
+ **Interfaces:**
135
+
136
+ - Produces: a contributor path with exact setup, verification, security, and PR expectations.
137
+
138
+ - [ ] Add file/content contract tests and run them red.
139
+ - [ ] Add concise community files and link contribution guidance from the README.
140
+ - [ ] Run community and README tests green.
141
+
142
+ ### Task 7: Make the README convert quickly
143
+
144
+ **Files:**
145
+
146
+ - Modify: `README.md`
147
+ - Create: `docs/REFERENCE.md`
148
+ - Modify: `tests/readme-product-flow.test.ts`
149
+ - Modify: `scripts/readme-product-flow.mjs`
150
+
151
+ **Interfaces:**
152
+
153
+ - Produces: a proof-first README under 400 lines with hero, first win, demo, install, handoff, trust, concise reference links, and contributor CTA.
154
+ - Produces: detailed material moved without loss to `docs/REFERENCE.md`.
155
+
156
+ - [ ] Change README structure assertions to require the demo before deep explanation and enforce the line budget.
157
+ - [ ] Run focused README tests red.
158
+ - [ ] Move detailed profiles, discovery, MCP, runtime tools, and long command tables into the reference document.
159
+ - [ ] Keep all material claims and generated marker blocks valid, then run README/evidence tests green.
160
+
161
+ ### Task 8: Prepare a social preview asset
162
+
163
+ **Files:**
164
+
165
+ - Create: `docs/assets/loadout-social-preview.png`
166
+ - Modify: `tests/readme-product-flow.test.ts`
167
+
168
+ **Interfaces:**
169
+
170
+ - Produces: solid-background 1280x640 PNG under 1 MB for manual upload in GitHub Settings.
171
+
172
+ - [ ] Add dimension, format, and size assertions and run them red while the asset is absent.
173
+ - [ ] Generate a concise social card using the established visual language and handoff differentiator.
174
+ - [ ] Optimize without reducing readability and run asset tests green.
175
+
176
+ ### Task 9: Split oversized modules along existing responsibilities
177
+
178
+ **Files:**
179
+
180
+ - Modify: `src/commands/catalog.ts`
181
+ - Create: `src/commands/catalog-skills.ts`
182
+ - Create: `src/commands/catalog-discovery.ts`
183
+ - Modify: `src/core/discovery/candidate-intelligence.ts`
184
+ - Create: `src/core/discovery/candidate-signals.ts`
185
+ - Create: `src/core/discovery/candidate-report.ts`
186
+ - Test: existing catalog, discovery, candidate, CLI help, and completion suites
187
+
188
+ **Interfaces:**
189
+
190
+ - Produces: command registration functions imported by `catalog.ts` with no CLI contract change.
191
+ - Produces: pure candidate signal/report helpers imported by candidate intelligence.
192
+
193
+ - [ ] Record current CLI/help and candidate JSON fixtures through existing behavior tests.
194
+ - [ ] Extract command groups without changing option names, output, or action wiring.
195
+ - [ ] Extract pure candidate scoring/reporting groups and keep exported compatibility.
196
+ - [ ] Require each former 1,000-line hotspot to fall below 850 lines.
197
+ - [ ] Run all catalog/discovery/CLI suites green and scan for orphaned exports.
198
+
199
+ ### Task 10: Final review and local release rehearsal
200
+
201
+ **Files:**
202
+
203
+ - Review: every changed file
204
+ - Modify only defects found by review
205
+
206
+ **Interfaces:**
207
+
208
+ - Consumes: all previous task outputs.
209
+ - Produces: a local release candidate for the user to test.
210
+
211
+ - [ ] Run Prettier, lint, typecheck, dependency audit, documentation/evidence gates, all unit tests, E2E flows, package smoke, performance benchmark, and coverage.
212
+ - [ ] Run `npm pack --dry-run --json` and install the resulting local package in a disposable directory.
213
+ - [ ] Review correctness, readability, architecture, security, and performance; fix every required finding with red-green coverage.
214
+ - [ ] Run `loadout handoff codex`, verify no pending tasks, and report exact remaining manual steps without publishing.
215
+
216
+ ## Risks and Mitigations
217
+
218
+ | Risk | Impact | Mitigation |
219
+ | ------------------------------------------------------- | ------ | -------------------------------------------------------------------------------------------- |
220
+ | Shared working tree edits collide | High | Assign agents disjoint file sets and integrate only after reviewing diffs. |
221
+ | README claim markers break during shortening | High | Move content around marker blocks intact and run both claim gates after each edit. |
222
+ | Generic fetch helper changes mock behavior | Medium | Preserve injectable fetchers and test standard Response streams plus mocked consumers. |
223
+ | Command extraction changes Commander registration order | Medium | Snapshot public help/command paths before extraction and assert exact equivalence. |
224
+ | Social preview is not automatically active | Low | Deliver the validated file and clearly leave GitHub Settings upload as the only manual step. |
225
+
226
+ ## Self-Review
227
+
228
+ - Every audit weakness maps to Tasks 1–9.
229
+ - No task publishes or mutates remote repository state.
230
+ - Each behavior change includes an explicit failing-test step and focused verification.
231
+ - Shared interfaces are named before parallel implementation.
232
+ - No placeholders or deferred implementation steps remain.
@@ -0,0 +1,121 @@
1
+ # Bounded Agent Discussions Implementation Plan
2
+
3
+ > **For agentic workers:** REQUIRED SUB-SKILL: Use superpowers:subagent-driven-development (recommended) or superpowers:executing-plans to implement this plan task-by-task. Steps use checkbox (`- [ ]`) syntax for tracking.
4
+
5
+ **Goal:** Let Claude Code and Codex conduct a safe, bounded, auditable design discussion and record a final decision.
6
+
7
+ **Architecture:** Add one typed discussion event to the append-only coordination protocol and reconstruct thread state from those events. A provider-neutral orchestrator alternates two responders sequentially, while a thin Commander module starts or resumes concrete Claude/Codex sessions and enforces the paid-turn budget before any turn.
8
+
9
+ **Tech Stack:** TypeScript, Commander, Zod, Vitest, existing provider adapters and JSONL coordination store.
10
+
11
+ ## Global constraints
12
+
13
+ - Exactly two participants and 1-8 rounds in the MVP.
14
+ - Required provider turns are `rounds * 2 + 1` and may never exceed `--max-turns`.
15
+ - Only explicit design-room responses are persisted; private reasoning is never requested or stored.
16
+ - Discussion prompts prohibit edits and command execution.
17
+ - Every provider turn is preceded by a kill-switch check.
18
+ - No new dependency.
19
+
20
+ ---
21
+
22
+ ### Task 1: Define the discussion protocol and state reader
23
+
24
+ **Files:**
25
+
26
+ - Modify: `src/core/coordination/events.ts`
27
+ - Create: `src/core/coordination/discussion.ts`
28
+ - Test: `tests/coordination-discussion.test.ts`
29
+
30
+ **Interfaces:**
31
+
32
+ - Produces: `discussionPayloadSchema`, `DiscussionPayload`,
33
+ `listDiscussions(projectRoot)`, and `getDiscussion(projectRoot, threadId)`.
34
+
35
+ - [ ] Write schema/state tests for strict kinds, bounds, reply IDs, bounded lists,
36
+ and reconstruction from real coordination events.
37
+ - [ ] Run `npx vitest run tests/coordination-discussion.test.ts` and confirm the
38
+ missing exports fail.
39
+ - [ ] Add the event schema and minimal state reader.
40
+ - [ ] Re-run the focused test until green.
41
+
42
+ ### Task 2: Implement the provider-neutral bounded orchestrator
43
+
44
+ **Files:**
45
+
46
+ - Modify: `src/core/coordination/discussion.ts`
47
+ - Modify: `src/core/coordination/adapters/types.ts`
48
+ - Test: `tests/coordination-discussion.test.ts`
49
+ - Test: `tests/coordination-adapters.test.ts`
50
+
51
+ **Interfaces:**
52
+
53
+ - Consumes: `emit(projectRoot, EmitOptions)` and participant `respond(prompt)`.
54
+ - Produces: `runDiscussion(projectRoot, options): Promise<DiscussionResult>` and
55
+ public transcript formatting.
56
+
57
+ - [ ] Write failing tests for alternating turns, reply chains, safe prompts,
58
+ exact turn counts, final synthesis, provider rejection, and kill switch.
59
+ - [ ] Run the focused tests and confirm behavioral failures.
60
+ - [ ] Implement the minimum sequential orchestration and discussion formatting.
61
+ - [ ] Re-run the focused suites until green.
62
+
63
+ ### Task 3: Add the public CLI and provider-session bridge
64
+
65
+ **Files:**
66
+
67
+ - Create: `src/commands/coordination-discussions.ts`
68
+ - Modify: `src/commands/coordinate.ts`
69
+ - Modify: `src/core/coordination/session-manager.ts`
70
+ - Test: `tests/coordination-session-commands.test.ts`
71
+ - Test: `tests/coordination-discussion.test.ts`
72
+
73
+ **Interfaces:**
74
+
75
+ - Produces: `parseDiscussionAgents`, `parseDiscussionSessions`,
76
+ `registerCoordinationDiscussions`, and a SessionManager-backed responder.
77
+
78
+ - [ ] Write failing parser and provider-composition tests.
79
+ - [ ] Reject invalid rounds, insufficient budgets, duplicate providers, and
80
+ simultaneous `--agents`/`--sessions` before starting a provider session.
81
+ - [ ] Implement `start`, `list`, and `show` with JSON output.
82
+ - [ ] Run CLI and discussion focused suites until green.
83
+
84
+ ### Task 4: Integrate visibility and documentation
85
+
86
+ **Files:**
87
+
88
+ - Modify: `src/core/coordination/replay.ts`
89
+ - Modify: `src/core/coordination/interrupt-policy.ts`
90
+ - Modify: `README.md`
91
+ - Modify: `docs/LIVE_COLLABORATION.md`
92
+ - Modify: `docs/USER_TEST_GUIDE.md`
93
+ - Create: `docs/decisions/003-bounded-agent-discussions.md`
94
+ - Test: `tests/coordination-replay.test.ts`
95
+ - Test: `tests/coordination-interrupt-policy.test.ts`
96
+ - Test: `tests/readme-product-flow.test.ts`
97
+
98
+ **Interfaces:**
99
+
100
+ - Consumes: additive `discussion` events.
101
+ - Produces: readable replay, safe-boundary delivery, and copy-paste user flows.
102
+
103
+ - [ ] Write failing formatting/policy/docs assertions.
104
+ - [ ] Add replay and injection visibility without changing existing semantics.
105
+ - [ ] Record why the design is bounded, sequential, and local-first.
106
+ - [ ] Run focused tests until green.
107
+
108
+ ### Task 5: Release-quality verification and review
109
+
110
+ **Files:**
111
+
112
+ - Modify: `CHANGELOG.md`
113
+ - Modify: `tasks/plan.md`
114
+ - Modify: `tasks/todo.md`
115
+
116
+ - [ ] Run `npx vitest run 'tests/coordination*.test.ts'`.
117
+ - [ ] Run `npm run verify:full` and inspect every exit code and test count.
118
+ - [ ] Run `git diff --check`, inspect the complete diff for correctness,
119
+ readability, architecture, security, and performance, and fix findings.
120
+ - [ ] Update the 0.9.0 changelog and task checklist with the verified behavior.
121
+ - [ ] Commit atomically and push the feature branch; do not tag or publish npm.
@@ -0,0 +1,109 @@
1
+ # Safe Handoff Context Bundles Implementation Plan
2
+
3
+ > **For agentic workers:** REQUIRED SUB-SKILL: Use test-driven-development to implement this plan task-by-task. Steps use checkbox (`- [ ]`) syntax for tracking.
4
+
5
+ **Goal:** Add explicit, bounded, secret-redacted file snapshots to durable handoff tasks without breaking existing logs or callers.
6
+
7
+ **Architecture:** A focused `handoff-bundle` module validates and snapshots files before the task is appended. `handoff.ts` stores only a typed reference in JSONL, while the versioned bundle lives in `.handoff/bundles/` and is loaded for receiver display or direct inspection. Commander composes both operations and preserves the existing no-bundle path.
8
+
9
+ **Tech Stack:** TypeScript, Node.js filesystem/crypto/path APIs, Commander, Zod, Vitest.
10
+
11
+ ## Global constraints
12
+
13
+ - No new runtime dependencies.
14
+ - Maximum 20 files, 32 KiB stored content per file, and 50 KiB total.
15
+ - Never follow symlinks, leave the repository, read binary files, or bundle `.git/`/`.handoff/`.
16
+ - Redact before persistence; write owner-only bundle files atomically.
17
+ - Keep existing handoff messages and callers backward compatible.
18
+
19
+ ---
20
+
21
+ ### Task 1: Define and persist safe bundles
22
+
23
+ **Files:**
24
+
25
+ - Create: `src/core/delegation/handoff-bundle.ts`
26
+ - Create: `tests/handoff-bundle.test.ts`
27
+
28
+ **Interfaces:**
29
+
30
+ - Produces: `createHandoffBundle(projectRoot, taskId, requestedPaths)`
31
+ - Produces: `readHandoffBundle(projectRoot, reference)`
32
+ - Produces: bundle types and exported limits
33
+
34
+ - [ ] Write the failing happy-path test and observe the missing module failure.
35
+ - [ ] Implement strict schemas, path validation, bounded UTF-8 reads, redaction,
36
+ atomic persistence, and validated reads.
37
+ - [ ] Add red-green tests for path escapes, internal state, symlinks,
38
+ directories, binary/missing files, limits, Unicode, and corruption.
39
+ - [ ] Run `npm test -- tests/handoff-bundle.test.ts`.
40
+
41
+ ### Task 2: Extend the message protocol and receiver output
42
+
43
+ **Files:**
44
+
45
+ - Modify: `src/core/delegation/handoff.ts`
46
+ - Modify: `tests/handoff.test.ts`
47
+
48
+ **Interfaces:**
49
+
50
+ - Consumes: `HandoffBundleReference`
51
+ - Produces: optional `bundle` on messages and send options
52
+ - Produces: resolved bundle summaries in inbox output
53
+
54
+ - [ ] Write a failing round-trip test for a bundle reference plus a legacy task.
55
+ - [ ] Add the optional strict field and run the test.
56
+ - [ ] Write a failing output test for bundle metadata and trust warning.
57
+ - [ ] Implement async inbox display loading while preserving old output.
58
+ - [ ] Run both focused suites.
59
+
60
+ ### Task 3: Add the public CLI option
61
+
62
+ **Files:**
63
+
64
+ - Modify: `src/commands/catalog-workflows.ts`
65
+ - Create or modify: `tests/cli-handoff.test.ts`
66
+
67
+ **Interfaces:**
68
+
69
+ - Consumes: `--bundle <paths...>`
70
+ - Produces: bundle metadata in JSON and concise text confirmation
71
+
72
+ - [ ] Write and observe a failing CLI happy-path test.
73
+ - [ ] Add the variadic option and compose bundle creation before task append.
74
+ - [ ] Remove a newly created orphan bundle if message persistence fails.
75
+ - [ ] Add an invalid-path test proving there is no partial task.
76
+ - [ ] Run CLI and handoff focused suites.
77
+
78
+ ### Task 4: Document receiver behavior and manual testing
79
+
80
+ **Files:**
81
+
82
+ - Modify: `README.md`
83
+ - Modify: `docs/REFERENCE.md`
84
+ - Modify: `docs/USER_TEST_GUIDE.md`
85
+ - Modify: `skills/loadout-handoff/SKILL.md`
86
+ - Modify: `src/core/delegation/handoff.ts`
87
+
88
+ **Interfaces:**
89
+
90
+ - Documents: exact command, limits, local persistence, and trust model
91
+
92
+ - [ ] Add the command near the existing handoff quick start.
93
+ - [ ] Document limits and failure modes in the reference.
94
+ - [ ] Add a disposable-repository test for redaction and pickup.
95
+ - [ ] Teach agents to inspect the bundle as untrusted project data.
96
+ - [ ] Run documentation and first-party skill checks.
97
+
98
+ ### Task 5: Verify and review
99
+
100
+ **Files:**
101
+
102
+ - Modify: `tasks/plan.md`
103
+ - Modify: `tasks/todo.md`
104
+
105
+ - [ ] Run formatting, lint, typecheck, full verification, and inspect exits.
106
+ - [ ] Review correctness, security, maintainability, performance, and tests.
107
+ - [ ] Fix findings through new failing tests.
108
+ - [ ] Run `loadout handoff codex` per repository instructions.
109
+ - [ ] Commit the verified branch without tagging or publishing.
@@ -0,0 +1,56 @@
1
+ # Handoff Verification Evidence Implementation Plan
2
+
3
+ > **For agentic workers:** REQUIRED SUB-SKILL: Use test-driven-development to implement this plan task-by-task. Steps use checkbox (`- [ ]`) syntax for tracking.
4
+
5
+ **Goal:** Make handoff completion evidence-backed while keeping execution explicit, bounded, redacted, and shell-free.
6
+
7
+ **Architecture:** Extend the JSONL message contract additively, then put command execution and state transitions in a dedicated verification module. The CLI validates option combinations and invokes verification only on an explicit completion command. Failed checks write a nonterminal status event, so the original task remains actionable.
8
+
9
+ **Tech Stack:** TypeScript, Node.js child processes, Zod, Commander, Vitest.
10
+
11
+ ## Global constraints
12
+
13
+ - No shell strings, automatic retries, provider turns, or new dependencies.
14
+ - A stored command requires explicit `--run-verification` approval at completion.
15
+ - Preserve legacy handoff behavior.
16
+ - Bound and redact every persisted output.
17
+ - Every behavior follows a red-green test cycle.
18
+
19
+ ### Task 1: Add typed verification and evidence fields
20
+
21
+ **Files:** `src/core/delegation/handoff.ts`, `tests/handoff.test.ts`
22
+
23
+ - [ ] Write a failing round-trip test for verification and evidence.
24
+ - [ ] Add strict bounded optional schemas and types.
25
+ - [ ] Render criteria and command argv in the task inbox.
26
+ - [ ] Verify legacy logs still parse.
27
+
28
+ ### Task 2: Implement explicit completion verification
29
+
30
+ **Files:** `src/core/delegation/handoff-verification.ts`,
31
+ `tests/handoff-verification.test.ts`
32
+
33
+ - [ ] Write a failing passing-command test with an injected runner.
34
+ - [ ] Implement pass → `done` and fail → nonterminal `status` transitions.
35
+ - [ ] Add red-green cases for manual evidence, missing evidence, nonzero exit,
36
+ timeout, spawn error, output truncation, and secret redaction.
37
+ - [ ] Keep `markDone` compatible for tasks without criteria and make it refuse
38
+ to bypass criteria.
39
+
40
+ ### Task 3: Wire and document the CLI
41
+
42
+ **Files:** `src/commands/catalog-workflows.ts`, `tests/cli-handoff.test.ts`,
43
+ `README.md`, `docs/REFERENCE.md`, `docs/USER_TEST_GUIDE.md`,
44
+ `skills/loadout-handoff/SKILL.md`, `CHANGELOG.md`
45
+
46
+ - [ ] Test and add `--verify`, `--verify-command`, `--verify-timeout`, and
47
+ `--evidence`.
48
+ - [ ] Validate incompatible combinations before writing a task.
49
+ - [ ] Show pass/fail evidence in text and JSON output.
50
+ - [ ] Document the exact trust boundary and lack of autonomous retries.
51
+
52
+ ### Task 4: Verify and commit
53
+
54
+ - [ ] Run focused tests, formatting, lint, typecheck, `npm run verify:full`, and
55
+ a five-axis review.
56
+ - [ ] Commit and push the isolated incremental change without publishing.