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,139 @@
1
+ # Spec: Safe handoff context bundles
2
+
3
+ ## Objective
4
+
5
+ Let a user attach the exact text files needed for a Claude Code ↔ Codex task so
6
+ the receiving agent can begin from a bounded, durable snapshot instead of a
7
+ manually written pointer. The feature must improve cold-start context without
8
+ turning `.handoff/` into an unbounded secret or binary store.
9
+
10
+ ```bash
11
+ loadout handoff codex "write auth tests" --bundle src/auth.ts src/types.ts
12
+ ```
13
+
14
+ Success means the handoff message references a versioned bundle, the receiver's
15
+ normal inbox output makes that bundle impossible to miss, and unsafe inputs fail
16
+ before either the task or bundle is written.
17
+
18
+ ## Tech stack
19
+
20
+ - TypeScript on Node.js 20+
21
+ - Commander for the public CLI
22
+ - Zod for persisted protocol validation
23
+ - Vitest for unit and CLI tests
24
+ - Existing coordination redaction and atomic-file helpers
25
+
26
+ No new runtime dependency is permitted.
27
+
28
+ ## Commands
29
+
30
+ ```bash
31
+ npm test -- tests/handoff-bundle.test.ts tests/handoff.test.ts
32
+ npm run typecheck
33
+ npm run lint
34
+ npm run build
35
+ npm run verify
36
+ ```
37
+
38
+ ## Project structure
39
+
40
+ - `src/core/delegation/handoff-bundle.ts` — safe paths, bounded reads,
41
+ redaction, versioned persistence, and bundle inspection
42
+ - `src/core/delegation/handoff.ts` — additive bundle reference and inbox output
43
+ - `src/commands/catalog-workflows.ts` — `--bundle <paths...>` CLI boundary
44
+ - `tests/handoff-bundle.test.ts` — filesystem and security behavior
45
+ - `tests/handoff.test.ts` — message compatibility and receiver output
46
+ - `README.md`, `docs/REFERENCE.md`, `docs/USER_TEST_GUIDE.md`, and
47
+ `skills/loadout-handoff/SKILL.md` — user and agent documentation
48
+
49
+ ## Public contract
50
+
51
+ Task messages gain one optional additive field:
52
+
53
+ ```ts
54
+ interface HandoffBundleReference {
55
+ schemaVersion: 1;
56
+ path: string;
57
+ fileCount: number;
58
+ storedBytes: number;
59
+ isTruncated: boolean;
60
+ }
61
+ ```
62
+
63
+ `path` is project-relative and always names `.handoff/bundles/<bundle-id>.json`.
64
+ The referenced strict, versioned JSON contains records with `path`,
65
+ `sourceBytes`, `storedBytes`, `sourceSha256`, `isTruncated`, and `content`.
66
+ `sendHandoff` accepts an optional pre-created reference; old callers and logs
67
+ remain valid.
68
+
69
+ ## Code style
70
+
71
+ Use immutable values, Zod at persistence boundaries, and errors that name the
72
+ rejected path and violated rule:
73
+
74
+ ```ts
75
+ const result = handoffBundleSchema.safeParse(JSON.parse(raw));
76
+ if (!result.success)
77
+ throw new Error(`Invalid handoff bundle: ${formatZodError(result.error)}`);
78
+ ```
79
+
80
+ ## Testing strategy
81
+
82
+ - Unit tests use real temporary repositories and files.
83
+ - Every new behavior starts as a failing test observed before implementation.
84
+ - Cover happy path, Unicode, redaction, traversal, absolute paths, symlinks,
85
+ directories, binary content, per-file and total truncation, maximum file
86
+ count, corrupt reads, legacy compatibility, and CLI text/JSON output.
87
+ - Run the complete project verification suite before claiming completion.
88
+
89
+ ## Boundaries
90
+
91
+ - Always: explicit opt-in, repository-relative regular files, deterministic
92
+ order, secret redaction, atomic owner-only writes, strict validation, and
93
+ additive protocol evolution.
94
+ - Ask first: new dependencies, changing the 50 KiB cap, automatically adding
95
+ bundles to Git, or executing verification commands.
96
+ - Never: follow symlinks, leave the project, store binary files, silently omit a
97
+ requested path, include `.git/` or `.handoff/`, upload content, or mutate
98
+ source files.
99
+
100
+ ## Limits
101
+
102
+ - Maximum files: 20
103
+ - Maximum stored UTF-8 bytes per file: 32 KiB
104
+ - Maximum stored UTF-8 bytes per bundle: 50 KiB
105
+ - Larger text files are truncated on a valid UTF-8 boundary and marked.
106
+ - Once the total limit is exhausted, remaining requested files are represented
107
+ with empty content and `isTruncated: true`; none disappear silently.
108
+
109
+ ## Security and trust model
110
+
111
+ Bundle content is untrusted project data, not agent instructions. Common secret
112
+ patterns are redacted before storage, but heuristic redaction is not a guarantee
113
+ and users must not bundle credential files. Bundles are owner-only and are not
114
+ automatically committed.
115
+
116
+ ## Success criteria
117
+
118
+ - The example creates one task and one readable bundle.
119
+ - The task JSON contains a valid additive reference.
120
+ - Inbox output prints bundle path, file list, size, truncation warning, and an
121
+ untrusted-data notice without dumping all source into the terminal.
122
+ - Unsafe files fail before a task is appended.
123
+ - Stored content never exceeds the limits.
124
+ - Secret fixture values are absent from persisted bundle text.
125
+ - Old logs without `bundle` behave identically.
126
+ - Complete repository verification passes.
127
+
128
+ ## Deferred work
129
+
130
+ - Typed verification criteria and completion evidence
131
+ - Bounded provider-driven retry loops
132
+ - Handoff templates and automatic context selection
133
+ - Cross-machine bundle publication policy
134
+
135
+ These require separate contracts and are not hidden inside `--bundle`.
136
+
137
+ ## Open questions
138
+
139
+ None for this conservative, opt-in slice.
@@ -0,0 +1,83 @@
1
+ # Spec: Handoff verification evidence
2
+
3
+ ## Objective
4
+
5
+ Close the handoff reliability loop without an unbounded agent conversation or
6
+ implicit shell execution. A sender can attach acceptance criteria and,
7
+ optionally, an exact executable plus arguments. When the receiver explicitly
8
+ adds `--run-verification` while completing the task, Loadout runs only that
9
+ stored argv command from the project root. A
10
+ passing check records bounded evidence and settles the task; a failing check
11
+ records the attempt and leaves the task pending.
12
+
13
+ ```bash
14
+ loadout handoff codex "write auth tests" \
15
+ --verify "the focused tests pass" \
16
+ --verify-command npm --verify-args '["test","--","tests/auth.test.ts"]'
17
+ ```
18
+
19
+ Human-only criteria remain useful. They require an explicit completion note:
20
+
21
+ ```bash
22
+ loadout handoff --done <task-id> --evidence "Reviewed the rendered states"
23
+ ```
24
+
25
+ ## Tech stack and structure
26
+
27
+ - `src/core/delegation/handoff.ts` owns additive persisted types and schemas.
28
+ - `src/core/delegation/handoff-verification.ts` owns no-shell command execution,
29
+ output bounding/redaction, and completion transitions.
30
+ - `src/commands/catalog-workflows.ts` owns Commander validation and output.
31
+ - Vitest unit and CLI tests use real temporary repositories; the command runner
32
+ is injectable for deterministic timeout/output/error cases.
33
+ - No new dependency.
34
+
35
+ ## Public contract
36
+
37
+ Task messages may add:
38
+
39
+ ```ts
40
+ interface HandoffVerification {
41
+ criteria: string;
42
+ command?: {
43
+ executable: string;
44
+ args: string[];
45
+ timeoutMs: number;
46
+ };
47
+ }
48
+ ```
49
+
50
+ `done` and verification `status` messages may add bounded evidence with mode,
51
+ status, command argv, exit code, duration, stdout, stderr, timeout, and
52
+ truncation fields. Old messages remain valid.
53
+
54
+ ## Bounds and safety
55
+
56
+ - Criteria and manual evidence: 2,000 UTF-8 characters maximum.
57
+ - Command: one non-empty executable, at most 64 arguments and 4,096 characters
58
+ per argument; no shell is used.
59
+ - Timeout: 1-900 seconds, default 120.
60
+ - Persisted stdout and stderr: 8 KiB each after secret redaction, with a visible
61
+ truncation flag.
62
+ - The command runs only with `--done <id> --run-verification`; legacy `--done`
63
+ alone never executes a stored command.
64
+ - A nonzero exit, timeout, output overflow, or spawn failure never settles the
65
+ task.
66
+ - There is no autonomous retry loop. The receiver fixes the work and explicitly
67
+ invokes `--done` again.
68
+
69
+ ## Success criteria
70
+
71
+ - Existing sends and `--done` behave unchanged without verification.
72
+ - `--verify-command` or `--verify-timeout` without `--verify` fails before send.
73
+ - Human-only criteria cannot be completed without `--evidence`.
74
+ - Commands receive literal argv with `shell: false` and run at project root.
75
+ - Passing commands append one `done` event with redacted, bounded evidence.
76
+ - Failing commands append a nonterminal `status` event and keep the task in the
77
+ receiver inbox, where the last failure is visible.
78
+ - Full verification and coverage gates pass.
79
+
80
+ ## Deferred
81
+
82
+ Provider-bridge retries may consume this evidence in a later feature, but must
83
+ remain opt-in, preview their provider-turn budget, and enforce a hard round cap.
@@ -0,0 +1,231 @@
1
+ # Coordination Hardening 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:** Make Loadout coordination safe under concurrent processes, secure on localhost, correctly packaged over MCP, truthful about provider capabilities, and releasable behind an explicit beta contract.
6
+
7
+ **Architecture:** Keep the human-readable JSONL audit log, but serialize every state-changing operation through one project-local lock and one canonical validated/redacted write path. Treat the HTTP daemon and stdio MCP server as authenticated/validated adapters over that core. Provider adapters may submit a new turn to a resumable session; they must never claim to inject into an active turn unless the host exposes that capability.
8
+
9
+ **Tech Stack:** Node.js 20+, TypeScript, Zod, Vitest, `@modelcontextprotocol/sdk` v1, `@openai/codex-sdk`.
10
+
11
+ ## Global Constraints
12
+
13
+ - Preserve existing `loadout handoff` behavior and `.handoff/messages.jsonl` compatibility.
14
+ - Persist coordination events before notifying watchers or SSE subscribers.
15
+ - Every persisted event has a unique, strictly increasing sequence number across concurrent processes.
16
+ - Bind HTTP only to loopback and require a project-scoped bearer token for every API/SSE request.
17
+ - Never persist raw secrets through any CLI, HTTP, or MCP write path.
18
+ - Keep destructive actions, publishing, deployment, and permission expansion under user control.
19
+ - Mark provider-driven live turns beta until both installed-host integration tests pass.
20
+
21
+ ---
22
+
23
+ ### Task 1: Restore the quality gate
24
+
25
+ **Files:**
26
+
27
+ - Modify: `src/core/coordination/adapters/codex.ts`
28
+ - Modify: `src/core/coordination/daemon.ts`
29
+ - Modify: `src/core/coordination/retention.ts`
30
+ - Modify: `tests/coordination-concurrency.test.ts`
31
+ - Modify: `tests/coordination-crash-recovery.test.ts`
32
+ - Modify: `tests/coordination-interrupt-policy.test.ts`
33
+
34
+ **Interfaces:**
35
+
36
+ - Produces: a zero-error `npm run lint` baseline without weakening ESLint rules.
37
+
38
+ - [ ] Remove imports that have no runtime or type use.
39
+ - [ ] Rename or omit unused parameters rather than disabling lint rules.
40
+ - [ ] Run `npm run lint`; expect exit 0.
41
+ - [ ] Run `npm run typecheck`; expect exit 0.
42
+ - [ ] Commit as `chore: restore coordination quality gate`.
43
+
44
+ ### Task 2: Serialize the coordination log and enforce invariants
45
+
46
+ **Files:**
47
+
48
+ - Create: `src/core/coordination/lock.ts`
49
+ - Modify: `src/core/coordination/coordinator.ts`
50
+ - Modify: `src/core/coordination/events.ts`
51
+ - Modify: `src/commands/coordinate.ts`
52
+ - Modify: `tests/coordination-concurrency.test.ts`
53
+ - Create: `tests/fixtures/coordination-writer.mjs`
54
+
55
+ **Interfaces:**
56
+
57
+ - Produces: `withCoordinationLock<T>(projectRoot, operation): Promise<T>`.
58
+ - Produces: `claimOwnership(projectRoot, input): Promise<CoordinationEvent>`.
59
+ - Produces: atomic `publishContract` revision allocation and validated `ack` watermarks.
60
+
61
+ - [ ] Add a failing multi-process test that starts independent Node writers and asserts 100 unique sequence numbers equal `0..99`.
62
+ - [ ] Add failing tests for overlapping ownership (`src/api` vs `src/api/user.ts`), future acknowledgements, concurrent contract revisions, stale-lock recovery, and permission errors from an existing unreadable log.
63
+ - [ ] Run `npx vitest run tests/coordination-concurrency.test.ts`; confirm failures describe duplicate sequences and missing validation.
64
+ - [ ] Implement an exclusive lock file using `open(path, "wx", 0o600)`, bounded jittered retries, owner metadata, stale-owner recovery, and `finally` cleanup.
65
+ - [ ] Move append, sequence allocation, contract revision allocation, ownership check/claim, and acknowledgement validation inside the lock.
66
+ - [ ] Normalize project-relative paths and detect equal, parent, and child overlap.
67
+ - [ ] Catch only `ENOENT` as an empty coordination log; propagate other I/O errors.
68
+ - [ ] Cap IDs/agent names at 128 characters, descriptions at 8 KiB, context at 64 KiB, path counts at 256, and paths at 1 KiB.
69
+ - [ ] Run the focused test until green, then run all coordination tests.
70
+ - [ ] Commit as `fix: make coordination state atomic across processes`.
71
+
72
+ ### Task 3: Make redaction canonical
73
+
74
+ **Files:**
75
+
76
+ - Modify: `src/core/coordination/redaction.ts`
77
+ - Modify: `src/core/coordination/coordinator.ts`
78
+ - Modify: `src/core/coordination/daemon.ts`
79
+ - Modify: `tests/coordination-redaction.test.ts`
80
+ - Modify: `tests/coordination.test.ts`
81
+
82
+ **Interfaces:**
83
+
84
+ - Produces: `sanitizeEmitOptions(options): EmitOptions` used by the sole append path.
85
+
86
+ - [ ] Add failing tests that emit secrets through direct core calls, CLI-equivalent calls, nested payloads, and daemon calls.
87
+ - [ ] Confirm direct writes currently persist the sample secret.
88
+ - [ ] Apply redaction inside the canonical locked writer before schema validation and persistence.
89
+ - [ ] Remove adapter-specific duplicate redaction.
90
+ - [ ] Verify all paths persist `[REDACTED]` and preserve non-sensitive fields.
91
+ - [ ] Commit as `fix: redact every coordination write path`.
92
+
93
+ ### Task 4: Secure the localhost daemon and stabilize its API
94
+
95
+ **Files:**
96
+
97
+ - Create: `src/core/coordination/auth.ts`
98
+ - Create: `src/core/coordination/http-api.ts`
99
+ - Modify: `src/core/coordination/daemon.ts`
100
+ - Modify: `src/commands/coordinate.ts`
101
+ - Modify: `tests/coordination-daemon.test.ts`
102
+ - Create: `tests/coordination-daemon-security.test.ts`
103
+
104
+ **Interfaces:**
105
+
106
+ - Produces: `ensureDaemonToken(projectRoot): Promise<string>` with a mode-0600 token file.
107
+ - Produces: one structured error shape `{ error: { code, message } }`.
108
+ - Consumes: atomic coordinator operations from Task 2.
109
+
110
+ - [ ] Add failing tests for missing/wrong bearer token, malicious `Origin`, forged `Host`, unauthenticated SSE, oversized bodies, malformed JSON, and project-root leakage.
111
+ - [ ] Confirm authenticated loopback requests remain possible.
112
+ - [ ] Generate a 32-byte random token, store it under `.handoff` with mode `0600`, and compare tokens using `timingSafeEqual`.
113
+ - [ ] Require `Authorization: Bearer <token>` for API requests; allow a query token only for the initial dashboard document and immediately move it to session storage/history-free state.
114
+ - [ ] Replace wildcard CORS with same-origin behavior and reject non-loopback Host headers.
115
+ - [ ] Return 400 for malformed JSON, 401 for missing authentication, 403 for origin/host rejection, 409 for ownership/revision conflict, and 413 for oversized bodies.
116
+ - [ ] Stop returning absolute project paths from browser-visible status payloads.
117
+ - [ ] Split the 700-line daemon into HTTP policy/route and lifecycle modules.
118
+ - [ ] Run daemon security, daemon behavior, and full coordination tests.
119
+ - [ ] Commit as `fix: authenticate and isolate the coordination daemon`.
120
+
121
+ ### Task 5: Ship a real MCP server
122
+
123
+ **Files:**
124
+
125
+ - Modify: `package.json`
126
+ - Modify: `package-lock.json`
127
+ - Modify: `tsconfig.json`
128
+ - Modify: `src/core/coordination/mcp-server.ts`
129
+ - Create: `tests/coordination-mcp.test.ts`
130
+ - Modify: `scripts/package-smoke.mjs`
131
+
132
+ **Interfaces:**
133
+
134
+ - Produces: packaged `dist/src/core/coordination/mcp-server.js`.
135
+ - Produces: stdio tools backed only by validated coordinator operations.
136
+
137
+ - [ ] Add `@modelcontextprotocol/sdk` v1 as a runtime dependency and remove the TypeScript exclusion.
138
+ - [ ] Add a failing package test asserting that `mcp-server.js` exists in the tarball.
139
+ - [ ] Add an MCP client smoke test that initializes the server, lists tools, emits an event, and reads a snapshot in a temporary project.
140
+ - [ ] Update handlers to use the SDK v1 API and convert validation/conflict failures into MCP tool errors.
141
+ - [ ] Verify stdout contains only protocol messages and diagnostics go to stderr.
142
+ - [ ] Run MCP tests and `npm pack --dry-run --json`.
143
+ - [ ] Commit as `fix: compile and package the coordination MCP server`.
144
+
145
+ ### Task 6: Replace fictional provider commands with supported adapters
146
+
147
+ **Files:**
148
+
149
+ - Modify: `package.json`
150
+ - Modify: `package-lock.json`
151
+ - Modify: `src/core/coordination/adapters/types.ts`
152
+ - Modify: `src/core/coordination/adapters/codex.ts`
153
+ - Modify: `src/core/coordination/adapters/claude-code.ts`
154
+ - Modify: `src/core/coordination/session-manager.ts`
155
+ - Create: `tests/coordination-adapter-codex.test.ts`
156
+ - Create: `tests/coordination-adapter-claude.test.ts`
157
+ - Create: `tests/coordination-session-manager.test.ts`
158
+
159
+ **Interfaces:**
160
+
161
+ - Produces: capability `canSubmitTurn`, distinct from unsupported mid-turn injection.
162
+ - Produces: Codex `start`, `resume`, and `submitTurn` through `@openai/codex-sdk`.
163
+ - Produces: Claude `start`, `resume`, and `submitTurn` through documented positional CLI prompts.
164
+
165
+ - [ ] Write adapter contract tests around injected process/SDK drivers so exact command arguments and session IDs are observable.
166
+ - [ ] Assert Codex never uses `--quiet` and Claude never uses `--message` or `sessions list`.
167
+ - [ ] Add `@openai/codex-sdk` as a runtime dependency and implement start/resume/turn using `startThread()`, `resumeThread(id)`, and `run()`.
168
+ - [ ] Implement Claude print-mode turns as `claude -p --output-format json [--resume id] <prompt>` and parse `session_id` from validated output.
169
+ - [ ] Track sessions Loadout itself creates instead of claiming to enumerate every host session.
170
+ - [ ] Queue relevant events until an adapter is idle; do not interrupt active work unless a future host capability explicitly supports steering.
171
+ - [ ] Run adapter and session-manager tests with fake drivers, followed by opt-in smoke checks against the locally installed CLIs.
172
+ - [ ] Commit as `fix: use supported Codex and Claude session APIs`.
173
+
174
+ ### Task 7: Reconcile retention, recovery, and observability
175
+
176
+ **Files:**
177
+
178
+ - Modify: `src/core/coordination/retention.ts`
179
+ - Modify: `src/core/coordination/crash-recovery.ts`
180
+ - Modify: `src/core/coordination/replay.ts`
181
+ - Modify: `src/core/coordination/watcher.ts`
182
+ - Modify: `tests/coordination-retention.test.ts`
183
+ - Modify: `tests/coordination-crash-recovery.test.ts`
184
+ - Modify: `tests/coordination-replay.test.ts`
185
+
186
+ **Interfaces:**
187
+
188
+ - Consumes: the same lock from Task 2 for compaction and recovery.
189
+ - Produces: explicit health data without filesystem secrets.
190
+
191
+ - [ ] Add failing tests for append-during-compaction, truncated final lines, duplicate legacy sequences, reconnect after compaction, and backup restoration.
192
+ - [ ] Make compaction and recovery use the same exclusive lock as append.
193
+ - [ ] Preserve corrupt-line evidence rather than silently discarding it.
194
+ - [ ] Bound replay and snapshot queries by event count and serialized byte size.
195
+ - [ ] Add counters for connected clients, high watermark, corrupt records, rejected writes, and last compaction time.
196
+ - [ ] Run focused recovery/retention/replay tests.
197
+ - [ ] Commit as `fix: harden coordination recovery and retention`.
198
+
199
+ ### Task 8: Make the product contract truthful and test the release artifact
200
+
201
+ **Files:**
202
+
203
+ - Create: `docs/decisions/001-coordination-jsonl-locking.md`
204
+ - Create: `docs/decisions/002-local-daemon-authentication.md`
205
+ - Modify: `README.md`
206
+ - Modify: `MASTERPLAN.md`
207
+ - Modify: `docs/LIVE_COLLABORATION.md`
208
+ - Modify: `docs/USER_TEST_GUIDE.md`
209
+ - Modify: `CHANGELOG.md`
210
+ - Modify: `scripts/readme-product-flow.mjs`
211
+ - Modify: `scripts/cli-product-flow.mjs`
212
+
213
+ **Interfaces:**
214
+
215
+ - Produces: one user-facing distinction between durable handoff, live coordination, and provider-driven beta turns.
216
+
217
+ - [ ] Document the locking and authentication decisions, rejected alternatives, limitations, and recovery behavior.
218
+ - [ ] Remove contradictory phase/status claims and document exact supported commands.
219
+ - [ ] Add a two-agent walkthrough: backend contract publish, frontend acknowledgement, revision diff, ownership conflict, reconnect, and kill switch.
220
+ - [ ] Add CLI/product-flow coverage for the walkthrough without invoking paid model turns.
221
+ - [ ] Run `npm run verify:full` from the clean branch.
222
+ - [ ] Run `npm pack --dry-run --json`, install the tarball in a temporary directory, and execute `loadout --version`, `loadout coordinate --help`, daemon authentication, and MCP initialization.
223
+ - [ ] Run opt-in real-host smoke tests with installed Codex and Claude CLIs; do not make destructive project changes.
224
+ - [ ] Review `git diff` for secrets and unrelated changes.
225
+ - [ ] Commit as `docs: define the live coordination beta contract`.
226
+
227
+ ## Self-review
228
+
229
+ - Spec coverage: concurrency, authentication, MCP packaging, real provider APIs, validation, redaction, ownership overlap, acknowledgements, retention, recovery, documentation, clean-room packaging, and launch gates are each assigned to a task.
230
+ - Placeholder scan: no deferred implementation placeholders are used; provider mid-turn interruption is explicitly excluded until supported by a host API.
231
+ - Type consistency: all external adapters converge on `canSubmitTurn` and canonical coordinator operations; HTTP and MCP do not own state logic.