deadbyte-mcp 0.9.0 → 0.11.0

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 (136) hide show
  1. package/MANIFEST.SHA256 +134 -92
  2. package/README.txt +19 -15
  3. package/bench/fixtures/corpus.json +32 -13
  4. package/bench/fixtures/r36/case-map.json +8 -0
  5. package/bin/WORKER-REGISTRY.txt +3 -3
  6. package/bin/appcontainer-stage.exe +0 -0
  7. package/bin/appcontainer-stage.obj +0 -0
  8. package/bin/bootstrap-advapi32.exe +0 -0
  9. package/bin/bootstrap-advapi32.obj +0 -0
  10. package/bin/bootstrap-exitcode.exe +0 -0
  11. package/bin/bootstrap-exitcode.obj +0 -0
  12. package/bin/bootstrap-kernel32.exe +0 -0
  13. package/bin/bootstrap-kernel32.obj +0 -0
  14. package/bin/child-control-probe.exe +0 -0
  15. package/bin/child-control-probe.obj +0 -0
  16. package/bin/child-control-stage.exe +0 -0
  17. package/bin/child-control-stage.obj +0 -0
  18. package/bin/contained-reverse-worker.exe +0 -0
  19. package/bin/contained-reverse-worker.obj +0 -0
  20. package/bin/contained-transform-worker.exe +0 -0
  21. package/bin/contained-transform-worker.obj +0 -0
  22. package/bin/containment-probe.exe +0 -0
  23. package/bin/containment-probe.obj +0 -0
  24. package/bin/deadbyte-contain.exe +0 -0
  25. package/bin/deadbyte-contain.obj +0 -0
  26. package/bin/deadbyte-exec.exe +0 -0
  27. package/bin/deadbyte-exec.obj +0 -0
  28. package/bin/deadbyte-process-host.exe +0 -0
  29. package/bin/deadbyte-process-host.obj +0 -0
  30. package/bin/deadbyte-tunnel-host.exe +0 -0
  31. package/bin/deadbyte-tunnel-host.obj +0 -0
  32. package/controller/README.TXT +8 -6
  33. package/controller/deadbyte-controller.ps1 +48 -2
  34. package/controller/deadbyte-process-policy.json +5 -5
  35. package/docs/ARCHITECTURE.md +1 -1
  36. package/docs/R36-CAPABILITY-EVIDENCE.md +43 -0
  37. package/docs/superpowers/plans/2026-09-18-r36-zero-loss-autonomy.md +739 -0
  38. package/docs/superpowers/specs/2026-09-18-r36-zero-loss-autonomy-design.md +640 -0
  39. package/package.json +1 -1
  40. package/proof/CONTAINMENT-BUILD.txt +6 -6
  41. package/scripts/deferred-slot-operation.mjs +53 -15
  42. package/scripts/final-closure-r36.mjs +113 -0
  43. package/scripts/final-closure-verify-r36.mjs +208 -0
  44. package/scripts/final-closure-verify.mjs +88 -39
  45. package/scripts/final-closure.mjs +63 -56
  46. package/scripts/gate-windows-r36.ps1 +42 -0
  47. package/scripts/gate-windows.ps1 +3 -3
  48. package/scripts/release-parity-r36.mjs +200 -0
  49. package/scripts/release-parity-tests.ps1 +9 -0
  50. package/scripts/release-parity.mjs +149 -139
  51. package/scripts/windows-gate-evidence-r36.mjs +52 -0
  52. package/scripts/windows-gate-evidence.mjs +5 -5
  53. package/src/agent-memory-plane.mjs +98 -0
  54. package/src/autonomous-context-engine.mjs +2 -1
  55. package/src/autonomous-mcp-tools.mjs +5 -1
  56. package/src/autonomous-output-contracts.mjs +9 -6
  57. package/src/autonomous-planner-contracts.mjs +36 -1
  58. package/src/autonomous-planner.mjs +25 -3
  59. package/src/autonomous-runtime.mjs +337 -43
  60. package/src/autonomous-timeout-recovery.mjs +27 -0
  61. package/src/capability-benchmark-runner.mjs +86 -1
  62. package/src/capability-benchmark.mjs +45 -0
  63. package/src/capability-ledger.mjs +158 -0
  64. package/src/coding-mcp-tools.mjs +31 -17
  65. package/src/coding-output-contracts.mjs +48 -10
  66. package/src/coding-plane.mjs +45 -9
  67. package/src/coding-search.mjs +130 -47
  68. package/src/compact-gateway-mcp-tools.mjs +128 -0
  69. package/src/compact-gateway-output-contracts.mjs +16 -0
  70. package/src/deadbyte-cli.mjs +62 -78
  71. package/src/effect-ledger.mjs +47 -0
  72. package/src/machine-fs-smoke-client.mjs +1 -1
  73. package/src/machine-fs.mjs +51 -8
  74. package/src/mcp-server.mjs +32 -9
  75. package/src/native-diff-v2.mjs +337 -0
  76. package/src/native-diff.mjs +50 -2
  77. package/src/observation-lease.mjs +32 -0
  78. package/src/observation-smoke-client.mjs +1 -1
  79. package/src/operator-surface.mjs +7 -1
  80. package/src/process-runtime.mjs +98 -11
  81. package/src/process-smoke-client.mjs +11 -3
  82. package/src/r36-compact-disarmed-probe.mjs +50 -0
  83. package/src/r36-full-surface-probe.mjs +56 -0
  84. package/src/remote-live-log.mjs +135 -0
  85. package/src/remote-mcp-autonomous-smoke-client.mjs +22 -12
  86. package/src/remote-mcp-coding-smoke-client.mjs +1 -1
  87. package/src/remote-mcp-r36-parity-client.mjs +175 -0
  88. package/src/remote-mcp-smoke-client.mjs +112 -56
  89. package/src/runtime-update.mjs +51 -1
  90. package/src/search-cursor.mjs +45 -0
  91. package/src/semantic-code.mjs +72 -5
  92. package/src/semantic-lsp-backend.mjs +39 -3
  93. package/src/version.mjs +1 -1
  94. package/src/worker-scheduler.mjs +53 -0
  95. package/test/autonomous-capability-r36.test.mjs +151 -0
  96. package/test/autonomous-output-contract.test.mjs +1 -1
  97. package/test/autonomous-runtime.test.mjs +2 -2
  98. package/test/capability-benchmark-r36.test.mjs +107 -0
  99. package/test/capability-benchmark-semantic-r36.test.mjs +52 -0
  100. package/test/capability-claims-r36.test.mjs +23 -0
  101. package/test/capability-ledger-r36.test.mjs +102 -0
  102. package/test/coding-catalog-consistency.test.mjs +2 -2
  103. package/test/coding-plane.test.mjs +2 -2
  104. package/test/coding-runtime.test.mjs +16 -0
  105. package/test/coding-search-r36.test.mjs +90 -0
  106. package/test/compact-catalog-r36.test.mjs +37 -0
  107. package/test/compact-gateway-r36.test.mjs +66 -0
  108. package/test/contained.test.mjs +1 -1
  109. package/test/core.test.mjs +1 -1
  110. package/test/deferred-slot-operation.test.mjs +9 -0
  111. package/test/fixtures/lsp-framed-server.mjs +2 -0
  112. package/test/helpers/autonomous-r34-fixture.mjs +5 -3
  113. package/test/multi-file-read.test.mjs +3 -0
  114. package/test/native-diff-topology-r36.test.mjs +105 -0
  115. package/test/package-boundary.test.mjs +6 -0
  116. package/test/process-longrun-r36.test.mjs +82 -0
  117. package/test/process-release-gate.test.mjs +9 -0
  118. package/test/production-docs.test.mjs +5 -5
  119. package/test/prompts-resources.test.mjs +7 -1
  120. package/test/r33-closeout-regression.test.mjs +4 -3
  121. package/test/r33-finalization.test.mjs +14 -9
  122. package/test/r36-finalization.test.mjs +104 -0
  123. package/test/r36-release-identity.test.mjs +45 -0
  124. package/test/r37-agent-fabric.test.mjs +92 -0
  125. package/test/r37-autonomous-timeout-recovery.test.mjs +60 -0
  126. package/test/r37-finalization.test.mjs +74 -0
  127. package/test/release-version.test.mjs +42 -33
  128. package/test/remote-live-log-r36.test.mjs +37 -0
  129. package/test/remote-live-log-r37.test.mjs +47 -0
  130. package/test/remote-live-log-recovery-r36.test.mjs +41 -0
  131. package/test/remote-r24-catalog.test.mjs +13 -0
  132. package/test/remote-session-cli.test.mjs +53 -66
  133. package/test/runtime-self-update.test.mjs +58 -1
  134. package/test/semantic-lsp-backend.test.mjs +9 -0
  135. package/test/semantic-r36-rename.test.mjs +82 -0
  136. package/deadbyte-mcp-0.8.9.tgz +0 -0
@@ -0,0 +1,739 @@
1
+ # DEADBYTE MCP R36 Zero-Loss Autonomy 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:** Ship DEADBYTE MCP `0.10.0 / R36` with zero-loss compact remote capability reachability, broader production coding autonomy, RDC-style live activity, evidence-backed semantic/topology/process workflows, and exact npm publication of the verified artifact.
6
+
7
+ **Architecture:** Preserve the R35 typed/evidence-first runtime and add a canonical capability ledger plus compact typed gateways so the actual remote connector can reach every production non-host capability while staying at or below the observed 42-tool ceiling. Upgrade inspection, semantic rename, topology transactions, process/planner reachability, and live activity without introducing raw shell or arbitrary stdin; release remains manifest-bound, rollback-proven, independently verified, and byte-identical through npm publication.
8
+
9
+ **Tech Stack:** Node.js >=22, ESM, `@modelcontextprotocol/server` 2.0.0, `@modelcontextprotocol/client` 2.0.0, Zod 4.4.3, TypeScript language service 5.9.3, Windows PowerShell 5.1/7, existing C++ native process/containment components, Ed25519 receipts, SHA-256 content identity.
10
+
11
+ **Spec:** `docs/superpowers/specs/2026-09-18-r36-zero-loss-autonomy-design.md`
12
+
13
+ ## Global Constraints
14
+
15
+ - R36 public identity is `0.10.0 / R36`.
16
+ - R35 `0.9.0` frozen source root `D:\Projects\deadbyte-mcp-r35-release-v0.9.0-r2` and manifest `b95e1ec1d9a7e26a96ef492306c1be4df18c883ff03ab3b6015f677d7429ec8d` are immutable.
17
+ - R35 npm tarball SHA-256 `b9f1b6652f4c70ab9ab515908355a00fa1a84d1f4cb9fc8d4055de41a4f1e805` is immutable and remains available after R36 release.
18
+ - Process, coding, autonomous, and host authority remain independently revocable; R36 remote MUST NOT auto-arm Host.
19
+ - No raw shell string, arbitrary executable dispatch, raw arbitrary stdin, or generic `tool_name + JSON` gateway is introduced.
20
+ - Full profile preserves direct typed tools; compact profile is <=42 tools and must reach 100% of declared production non-host capability ids.
21
+ - Every mutation keeps stale-state/precondition semantics and existing receipt/audit requirements.
22
+ - All behavior changes use RED -> GREEN TDD; full regression and Windows/release gates run only after focused slices are green.
23
+ - Workspace is NON-GIT. Do not invent commits. Every task ends with fresh tests plus a hash/evidence checkpoint.
24
+ - Frozen candidates are never edited. A post-freeze defect creates a successor candidate root (`r1`, `r2`, ...).
25
+ - npm publication uses the exact already-verified tarball; browser/2FA confirmation is the only operator-local step if npm requires it.
26
+
27
+ ---
28
+
29
+ ### Task 1: Canonical Capability Ledger and Surface Profiles
30
+
31
+ **Files:**
32
+ - Create: `src/capability-ledger.mjs`
33
+ - Create: `test/capability-ledger-r36.test.mjs`
34
+ - Modify: `src/tool-surface-ledger.mjs`
35
+ - Modify: `src/mcp-server.mjs`
36
+ - Modify: `src/operator-surface.mjs`
37
+ - Test: `test/tool-surface-ledger.test.mjs`
38
+ - Test: `test/package-boundary.test.mjs`
39
+
40
+ **Interfaces:**
41
+ - Produces `createCapabilityLedger(entries)` returning an immutable ledger keyed by stable capability id.
42
+ - Produces `capabilityProfileFromEnv(env)` returning `'full' | 'compact'`.
43
+ - Produces `assertCapabilityClosure({ledger, fullToolSnapshot, compactToolSnapshot})`.
44
+ - Later tasks register direct/full and gateway/compact routes against this ledger.
45
+
46
+ - [ ] **Step 1: Write failing ledger/profile tests**
47
+
48
+ Add tests that require duplicate capability ids to fail, require each production non-host capability to have both a full route and compact route, allow host-only capabilities to omit compact routing, and enforce compact tool count <=42.
49
+
50
+ ```js
51
+ import test from 'node:test';
52
+ import assert from 'node:assert/strict';
53
+ import { createCapabilityLedger, assertCapabilityClosure } from '../src/capability-ledger.mjs';
54
+
55
+ test('R36 capability ledger rejects duplicate ids', () => {
56
+ assert.throws(() => createCapabilityLedger([
57
+ {id:'coding.search', full_tool:'coding_search', compact_tool:'coding_inspect', compact_op:'search', production:true, host_only:false},
58
+ {id:'coding.search', full_tool:'x', compact_tool:'y', compact_op:'z', production:true, host_only:false}
59
+ ]), /duplicate capability id/);
60
+ });
61
+
62
+ test('R36 compact closure covers every production non-host capability', () => {
63
+ const ledger=createCapabilityLedger([
64
+ {id:'coding.search', full_tool:'coding_search', compact_tool:'coding_inspect', compact_op:'search', production:true, host_only:false},
65
+ {id:'host.exec', full_tool:'host_exec', compact_tool:null, compact_op:null, production:false, host_only:true}
66
+ ]);
67
+ assert.equal(assertCapabilityClosure({ledger, fullTools:['coding_search','host_exec'], compactTools:['coding_inspect']}), true);
68
+ });
69
+ ```
70
+
71
+ - [ ] **Step 2: Run focused tests and confirm RED**
72
+
73
+ Run:
74
+
75
+ ```powershell
76
+ node --test test/capability-ledger-r36.test.mjs
77
+ ```
78
+
79
+ Expected: FAIL because `src/capability-ledger.mjs` does not exist.
80
+
81
+ - [ ] **Step 3: Implement canonical ledger/profile primitives**
82
+
83
+ Implement immutable normalized entries with these required fields:
84
+
85
+ ```js
86
+ {
87
+ id, full_tool, compact_tool, compact_op,
88
+ runtime_flag, authority,
89
+ mutating, receipt_class,
90
+ production, host_only
91
+ }
92
+ ```
93
+
94
+ Reject unknown authority values; allowed authorities are `none`, `process`, `coding`, `autonomous`, `host`. Canonically sort by `id` before hashing with SHA-256.
95
+
96
+ - [ ] **Step 4: Bind MCP server profile selection**
97
+
98
+ In `src/mcp-server.mjs`, resolve:
99
+
100
+ ```js
101
+ const surfaceProfile = capabilityProfileFromEnv(process.env);
102
+ ```
103
+
104
+ Local stdio default is `full`; remote Bridge will later set compact explicitly. Registration must preserve existing full tool behavior.
105
+
106
+ - [ ] **Step 5: Run focused ledger/surface tests**
107
+
108
+ Run:
109
+
110
+ ```powershell
111
+ node --test test/capability-ledger-r36.test.mjs test/tool-surface-ledger.test.mjs test/package-boundary.test.mjs
112
+ ```
113
+
114
+ Expected: 0 failures.
115
+
116
+ - [ ] **Step 6: Evidence checkpoint**
117
+
118
+ Record SHA-256 for `src/capability-ledger.mjs`, `src/mcp-server.mjs`, and the focused test output in an external `D:\Projects\deadbyte-r36-evidence\task-01.json`; do not write mutable evidence into a future frozen candidate.
119
+
120
+ ---
121
+
122
+ ### Task 2: Compact Typed Gateways and Actual <=42 Tool Surface
123
+
124
+ **Files:**
125
+ - Create: `src/compact-gateway-mcp-tools.mjs`
126
+ - Create: `src/compact-gateway-output-contracts.mjs`
127
+ - Create: `test/compact-gateway-r36.test.mjs`
128
+ - Modify: `src/mcp-server.mjs`
129
+ - Modify: `src/coding-mcp-tools.mjs`
130
+ - Modify: `src/machine-fs-mcp-tools.mjs`
131
+ - Modify: `src/process-mcp-tools.mjs`
132
+ - Modify: `src/observation-mcp-tools.mjs`
133
+ - Modify: `src/machine-mcp-tools.mjs`
134
+ - Modify: `test/remote-r24-catalog.test.mjs`
135
+ - Modify: `test/output-schema.test.mjs`
136
+
137
+ **Interfaces:**
138
+ - Produces compact tools `capability_manifest`, `coding_inspect`, `machine_fs`, `process_session`, `machine_observe`.
139
+ - Each tool uses a Zod discriminated union; no generic arbitrary dispatch field is accepted.
140
+ - Gateway handlers call runtime methods directly, not MCP-to-MCP recursion.
141
+
142
+ - [ ] **Step 1: Write RED schema tests for five compact gateways**
143
+
144
+ Require unknown ops to fail schema validation and verify that representative operations preserve required preconditions, for example:
145
+
146
+ ```js
147
+ const codingInspectInput = z.discriminatedUnion('op', [
148
+ z.strictObject({op:z.literal('stat'), root_id:id, path:relPath, hash:z.boolean().default(false)}),
149
+ z.strictObject({op:z.literal('search'), root_id:id, path:relPath.default('.'), query:searchQuery}),
150
+ z.strictObject({op:z.literal('files_read'), root_id:id, files:fileList, max_total_bytes:byteBound}),
151
+ z.strictObject({op:z.literal('symbol_outline'), root_id:id, path:relPath, max_symbols:symbolBound}),
152
+ z.strictObject({op:z.literal('symbol_definition'), root_id:id, path:relPath, line:nonneg, column:nonneg}),
153
+ z.strictObject({op:z.literal('symbol_references'), root_id:id, path:relPath, line:nonneg, column:nonneg}),
154
+ z.strictObject({op:z.literal('symbol_diagnostics'), root_id:id, path:relPath}),
155
+ z.strictObject({op:z.literal('symbol_implementations'), root_id:id, path:relPath, line:nonneg, column:nonneg}),
156
+ z.strictObject({op:z.literal('symbol_rename_preview'), root_id:id, path:relPath, line:nonneg, column:nonneg, new_name:symbolName})
157
+ ]);
158
+ ```
159
+
160
+ - [ ] **Step 2: Run gateway tests and confirm RED**
161
+
162
+ ```powershell
163
+ node --test test/compact-gateway-r36.test.mjs
164
+ ```
165
+
166
+ Expected: FAIL because gateway module is absent.
167
+
168
+ - [ ] **Step 3: Implement runtime-direct gateways**
169
+
170
+ Build operation tables as closed objects keyed only by validated discriminated-union ops. Do not accept an arbitrary tool name string. Preserve underlying result structures and `isError` semantics.
171
+
172
+ - [ ] **Step 4: Register compact profile**
173
+
174
+ When `surfaceProfile==='compact'`, register the essential direct control tools plus five gateways while omitting redundant direct inspection/machine-fs/process/observation names. Keep direct Host tools only if host policy is configured; Host remains disarmed unless operator arms it locally.
175
+
176
+ - [ ] **Step 5: Add exact compact catalog test**
177
+
178
+ Negotiate a real stdio server in compact mode and assert:
179
+
180
+ ```js
181
+ assert.ok(toolNames.length <= 42);
182
+ assert.deepEqual(new Set(requiredGatewayNames), new Set(toolNames.filter(x => requiredGatewayNames.includes(x))));
183
+ assert.equal(assertCapabilityClosure(...), true);
184
+ ```
185
+
186
+ - [ ] **Step 6: Run focused surface tests**
187
+
188
+ ```powershell
189
+ node --test test/compact-gateway-r36.test.mjs test/remote-r24-catalog.test.mjs test/output-schema.test.mjs test/tool-surface-ledger.test.mjs
190
+ ```
191
+
192
+ Expected: 0 failures and compact catalog <=42.
193
+
194
+ - [ ] **Step 7: Evidence checkpoint**
195
+
196
+ Emit full and compact canonical tool snapshots plus capability closure SHA-256 to `D:\Projects\deadbyte-r36-evidence\task-02.json`.
197
+
198
+ ---
199
+
200
+ ### Task 3: Production Search, Rich Stat, and Multi-Read Observation Identity
201
+
202
+ **Files:**
203
+ - Modify: `src/coding-search.mjs`
204
+ - Modify: `src/coding-plane.mjs`
205
+ - Modify: `src/coding-mcp-tools.mjs`
206
+ - Modify: `src/coding-output-contracts.mjs`
207
+ - Create: `src/search-cursor.mjs`
208
+ - Create: `test/coding-search-r36.test.mjs`
209
+ - Modify: `test/coding-runtime.test.mjs`
210
+ - Modify: `test/multi-file-read.test.mjs`
211
+
212
+ **Interfaces:**
213
+ - Search query supports `target:'content'|'path'`, `mode:'literal'|'regex'`, deterministic paging cursor, multiple matches per file, scan-byte bounds, result digests.
214
+ - `codingRuntime.stat()` returns reparse classification and `observation_sha256`.
215
+ - Multi-read returns `observation_sha256` over ordered `(path,sha256,bytes,encoding)`.
216
+
217
+ - [ ] **Step 1: Write RED search tests**
218
+
219
+ Cover literal content, regex content, path search, multiple matches per file, deterministic ordering, binary skip/classification, stale cursor rejection, cursor query binding, and scan-byte truncation.
220
+
221
+ ```js
222
+ const first = await search({rootId:'core', path:'.', target:'content', mode:'regex', pattern:'foo\\d+', pageSize:2});
223
+ assert.equal(first.matches.length, 2);
224
+ assert.match(first.query_sha256, /^[0-9a-f]{64}$/);
225
+ assert.match(first.page_sha256, /^[0-9a-f]{64}$/);
226
+ assert.ok(first.next_cursor);
227
+ await assert.rejects(() => search({...differentQuery, cursor:first.next_cursor}), /cursor.*query/i);
228
+ ```
229
+
230
+ - [ ] **Step 2: Run RED test**
231
+
232
+ ```powershell
233
+ node --test test/coding-search-r36.test.mjs
234
+ ```
235
+
236
+ Expected: FAIL because R35 search only accepts literal mode and has no cursor identity.
237
+
238
+ - [ ] **Step 3: Implement `search-cursor.mjs`**
239
+
240
+ Cursor body contains schema, query SHA-256, ordered snapshot/file identities or durable observation search id, next offset, and HMAC/signature binding using the existing authenticated state/evidence convention. Foreign/stale cursor must fail closed.
241
+
242
+ - [ ] **Step 4: Upgrade search implementation**
243
+
244
+ Use deterministic path sorting; for content search collect multiple line/column matches until page/scan bounds. Compile regex once with bounded pattern length; invalid regex fails before repository scan. Do not lossy-decode binary files.
245
+
246
+ - [ ] **Step 5: Upgrade stat and multi-read identities**
247
+
248
+ Add `normalized_path`, `type`, `bytes`, `mtime_utc`, optional file SHA, reparse classification, policy root, and `observation_sha256`. Multi-read aggregate digest is computed from ordered metadata, not raw secret content.
249
+
250
+ - [ ] **Step 6: Run focused inspection tests**
251
+
252
+ ```powershell
253
+ node --test test/coding-search-r36.test.mjs test/coding-runtime.test.mjs test/multi-file-read.test.mjs
254
+ ```
255
+
256
+ Expected: 0 failures.
257
+
258
+ - [ ] **Step 7: Evidence checkpoint**
259
+
260
+ Store representative literal/regex/path search page identities and stale-cursor rejection output in external task evidence.
261
+
262
+ ---
263
+
264
+ ### Task 4: Semantic Diagnostics, Implementations, and Transactional Rename Preview
265
+
266
+ **Files:**
267
+ - Modify: `src/semantic-code.mjs`
268
+ - Modify: `src/semantic-lsp-backend.mjs`
269
+ - Modify: `src/semantic-backend-registry.mjs`
270
+ - Modify: `src/coding-mcp-tools.mjs`
271
+ - Modify: `src/coding-output-contracts.mjs`
272
+ - Modify: `src/native-diff.mjs`
273
+ - Create: `test/semantic-r36-rename.test.mjs`
274
+ - Modify: `test/semantic-code.test.mjs`
275
+ - Modify: `test/semantic-lsp-backend.test.mjs`
276
+ - Modify: `test/semantic-multilang.test.mjs`
277
+
278
+ **Interfaces:**
279
+ - `semanticRuntime.diagnostics(args)` becomes public/compact reachable.
280
+ - Add `semanticRuntime.implementations(args)` returning normalized locations or explicit unsupported capability.
281
+ - Add `semanticRuntime.renamePreview({rootId,relativePath,line,column,newName})` returning `{diff_id, affected_files, edit_count, backend, preimages}` without mutation.
282
+
283
+ - [ ] **Step 1: Write RED semantic tests**
284
+
285
+ Require diagnostics result identity, implementation lookup normalization, and rename preview that does not alter source bytes before `native_diff_apply`.
286
+
287
+ ```js
288
+ const before = await coding.fileRead(...);
289
+ const preview = await semantic.renamePreview({rootId:'core', relativePath:'src/a.ts', line:1, column:10, newName:'renamed'});
290
+ assert.match(preview.diff_id, /^[0-9a-f]{64}$/);
291
+ assert.equal((await coding.fileRead(...)).sha256, before.sha256);
292
+ ```
293
+
294
+ - [ ] **Step 2: Run RED semantic tests**
295
+
296
+ ```powershell
297
+ node --test test/semantic-r36-rename.test.mjs
298
+ ```
299
+
300
+ Expected: FAIL because `implementations` and `renamePreview` are absent.
301
+
302
+ - [ ] **Step 3: Implement backend capability methods**
303
+
304
+ TypeScript backend uses language-service implementation/rename APIs. External LSP backends normalize `textDocument/implementation` and rename edits only when backend supports them. Unsupported operations return typed unsupported result instead of grep fallback.
305
+
306
+ - [ ] **Step 4: Convert rename edits into Native Diff**
307
+
308
+ Group edits per file, read exact current SHA-256 preimages, generate deterministic replacement operations, preview one content-addressed diff, and return its id. Any overlapping/ambiguous edit set fails before diff creation.
309
+
310
+ - [ ] **Step 5: Test preview/apply/verify lifecycle**
311
+
312
+ ```powershell
313
+ node --test test/semantic-r36-rename.test.mjs test/semantic-code.test.mjs test/semantic-lsp-backend.test.mjs test/semantic-multilang.test.mjs test/native-diff.test.mjs
314
+ ```
315
+
316
+ Expected: 0 failures; stale preimage apply must reject.
317
+
318
+ - [ ] **Step 6: Evidence checkpoint**
319
+
320
+ Capture one cross-file rename preview/apply/verify chain with diff id and receipt ids, plus explicit unsupported-operation evidence for a backend lacking implementations.
321
+
322
+ ---
323
+
324
+ ### Task 5: Native Diff V2 Topology Transactions
325
+
326
+ **Files:**
327
+ - Modify: `src/native-diff.mjs`
328
+ - Modify: `src/machine-fs.mjs`
329
+ - Modify: `src/machine-fs-output-contracts.mjs`
330
+ - Modify: `src/machine-fs-mcp-tools.mjs`
331
+ - Create: `test/native-diff-topology-r36.test.mjs`
332
+ - Modify: `test/native-diff.test.mjs`
333
+ - Modify: `test/machine-fs-runtime.test.mjs`
334
+
335
+ **Interfaces:**
336
+ - Native Diff V2 operations add `mkdir`, `move`, and explicit empty-directory delete while preserving V1 read/verify compatibility.
337
+ - `move` requires source identity and destination absence/exact identity.
338
+ - Topology preimage is signed before first mutation; rollback is verified or transaction becomes `conflicted`/`ambiguous`.
339
+
340
+ - [ ] **Step 1: Write RED topology transaction tests**
341
+
342
+ Cover mkdir->write->move transaction, later-operation failure rollback, stale source identity, destination collision, reparse denial, and explicit empty-dir delete only.
343
+
344
+ - [ ] **Step 2: Run RED test**
345
+
346
+ ```powershell
347
+ node --test test/native-diff-topology-r36.test.mjs
348
+ ```
349
+
350
+ Expected: FAIL because Native Diff currently accepts only write/replace/delete file operations.
351
+
352
+ - [ ] **Step 3: Version Native Diff transaction schema**
353
+
354
+ Keep V1 verifier compatibility. V2 normalized operations must include precondition identity fields and canonical sorting/serialization rules used in `diff_id`.
355
+
356
+ - [ ] **Step 4: Implement topology preimage/apply/rollback**
357
+
358
+ Capture parent/source/destination identities before mutation. Roll back in reverse operation order. If rollback verification fails, emit terminal ambiguous/conflicted evidence and never success.
359
+
360
+ - [ ] **Step 5: Run topology and machine-fs tests**
361
+
362
+ ```powershell
363
+ node --test test/native-diff-topology-r36.test.mjs test/native-diff.test.mjs test/machine-fs-runtime.test.mjs
364
+ ```
365
+
366
+ Expected: 0 failures.
367
+
368
+ - [ ] **Step 6: Evidence checkpoint**
369
+
370
+ Persist one successful topology transaction and one induced rollback transaction with independent verification results.
371
+
372
+ ---
373
+
374
+ ### Task 6: Process Reachability and Capability-Aware Autonomous Planner
375
+
376
+ **Files:**
377
+ - Modify: `src/autonomous-planner-contracts.mjs`
378
+ - Modify: `src/autonomous-planner.mjs`
379
+ - Modify: `src/autonomous-runtime.mjs`
380
+ - Modify: `src/autonomous-context-engine.mjs`
381
+ - Modify: `src/autonomous-progress.mjs`
382
+ - Modify: `src/process-runtime.mjs`
383
+ - Modify: `src/process-output-contracts.mjs`
384
+ - Create: `test/autonomous-capability-r36.test.mjs`
385
+ - Create: `test/process-longrun-r36.test.mjs`
386
+ - Modify: `test/autonomous-loop-v2.test.mjs`
387
+ - Modify: `test/process-runtime.test.mjs`
388
+
389
+ **Interfaces:**
390
+ - Planner receives canonical configured capability manifest.
391
+ - Typed planner actions include search/stat/multi-read/semantic/native-diff/machine-fs/process/observation/release actions.
392
+ - Legacy generic `delegate` must validate into a typed action or be rejected.
393
+ - Process long-run API remains existing `process_session_*` semantics with ordered cursor and owned logical session identity.
394
+
395
+ - [ ] **Step 1: Write RED planner contract tests**
396
+
397
+ Require parsing of first-class `search`, `stat`, `semantic_references`, `semantic_rename_preview`, `process_start/read/status/action/terminate`, `machine_fs_*`, and `observation_*` actions. Assert arbitrary delegate records fail.
398
+
399
+ - [ ] **Step 2: Write RED long-process tests**
400
+
401
+ Start an approved fixture profile, return before child exit, read output in multiple monotonic cursor chunks, observe exit, reject stale/foreign session ids, terminate owned session, and reconcile after wrapper restart.
402
+
403
+ - [ ] **Step 3: Run RED tests**
404
+
405
+ ```powershell
406
+ node --test test/autonomous-capability-r36.test.mjs test/process-longrun-r36.test.mjs
407
+ ```
408
+
409
+ Expected: planner action test fails on missing typed variants; process tests may expose any cursor/reconciliation gaps.
410
+
411
+ - [ ] **Step 4: Implement typed planner action union and executor mapping**
412
+
413
+ Map each action to existing runtime primitives; no action may self-arm authority. Capability manifest included in planner prompt/context lists only configured routes and authority class.
414
+
415
+ - [ ] **Step 5: Strengthen progress identity**
416
+
417
+ Progress fingerprint must include capability id, observation identity, mutation epoch, evidence ids, and process session/cursor state while excluding rationale prose.
418
+
419
+ - [ ] **Step 6: Run planner/process focused suites**
420
+
421
+ ```powershell
422
+ node --test test/autonomous-capability-r36.test.mjs test/process-longrun-r36.test.mjs test/autonomous-loop-v2.test.mjs test/process-runtime.test.mjs test/process-supervision.test.mjs
423
+ ```
424
+
425
+ Expected: 0 failures.
426
+
427
+ - [ ] **Step 7: Evidence checkpoint**
428
+
429
+ Record an autonomous fixture that searches, inspects symbols, applies a diff, starts a test process, reads incremental output, repairs a failure, and reaches release gate without operator transport commands.
430
+
431
+ ---
432
+
433
+ ### Task 7: Finish and Harden RDC-Style Live Activity
434
+
435
+ **Files:**
436
+ - Modify: `src/remote-live-log.mjs`
437
+ - Modify: `src/deadbyte-cli.mjs`
438
+ - Modify: `src/remote-result-journal.mjs`
439
+ - Modify: `src/remote-session-guardian.mjs`
440
+ - Modify: `test/remote-live-log-r36.test.mjs`
441
+ - Modify: `test/remote-session-cli.test.mjs`
442
+ - Create: `test/remote-live-log-recovery-r36.test.mjs`
443
+
444
+ **Interfaces:**
445
+ - Existing precursor `▶ RUN / ✅ OK / ❌ ERR` formatter is retained.
446
+ - Add startup/connect/session/recovery markers `🚀`, `🔌`, `🔐`, `♻️`, `⚠️` with emoji only where semantically useful.
447
+ - Correlate request/result by request id and expose bounded sanitized summaries.
448
+
449
+ - [ ] **Step 1: Extend RED tests before changing precursor code**
450
+
451
+ Require bridge/cloud connection lifecycle, session restored/new, ONLINE readiness, explicit Host DISARMED, request-before-result, duration, orphan/interrupted request reconciliation, and cleanup visibility.
452
+
453
+ - [ ] **Step 2: Run live-log tests and confirm only missing R36 behaviors fail**
454
+
455
+ ```powershell
456
+ node --test test/remote-live-log-r36.test.mjs test/remote-live-log-recovery-r36.test.mjs test/remote-session-cli.test.mjs
457
+ ```
458
+
459
+ Expected: existing precursor cases remain green; new lifecycle/recovery cases are RED.
460
+
461
+ - [ ] **Step 3: Implement lifecycle/recovery lines**
462
+
463
+ Start watcher baseline before startup. Existing files tail from old EOF; files created after baseline start at byte zero. Compact mode never prints raw content/replacement/token/private-key fields.
464
+
465
+ - [ ] **Step 4: Verify Host is never auto-armed**
466
+
467
+ Trace controller commands and assert no `armhost` occurs in bare `remote`; status line must show Host DISARMED. Cleanup may call `disarmhost` fail-safe.
468
+
469
+ - [ ] **Step 5: Run complete remote integration**
470
+
471
+ ```powershell
472
+ node --test test/remote-live-log-r36.test.mjs test/remote-live-log-recovery-r36.test.mjs test/remote-session-cli.test.mjs test/remote-result-journal.test.mjs
473
+ ```
474
+
475
+ Expected: 0 failures.
476
+
477
+ - [ ] **Step 6: Evidence checkpoint**
478
+
479
+ Capture a deterministic sample compact transcript and a verbose transcript with sanitized audit ids; scan both for known fixture secrets and assert zero raw secret matches.
480
+
481
+ ---
482
+
483
+ ### Task 8: R36 Capability/Competitor Benchmark Corpus
484
+
485
+ **Files:**
486
+ - Modify: `bench/fixtures/corpus.json`
487
+ - Modify: `src/capability-benchmark.mjs`
488
+ - Modify: `src/capability-benchmark-runner.mjs`
489
+ - Create: `bench/fixtures/r36/` fixture tree
490
+ - Create: `test/capability-benchmark-r36.test.mjs`
491
+ - Modify: `test/capability-benchmark.test.mjs`
492
+ - Modify: `test/capability-benchmark-runner.test.mjs`
493
+ - Modify: `README.txt`
494
+ - Create: `docs/R36-CAPABILITY-EVIDENCE.md`
495
+
496
+ **Interfaces:**
497
+ - Corpus contains the 30 required cases from the R36 spec.
498
+ - Metrics: correctness, round trips, elapsed time, bytes returned, stale-state rejection, duplicate side effects, recovery success, reachability, evidence verify result, release gate result.
499
+ - Competitor matrix separates `documented` from `direct_observation` evidence.
500
+
501
+ - [ ] **Step 1: Write RED corpus identity tests**
502
+
503
+ Assert exact case ids and reject duplicate/missing required cases.
504
+
505
+ - [ ] **Step 2: Run RED benchmark test**
506
+
507
+ ```powershell
508
+ node --test test/capability-benchmark-r36.test.mjs
509
+ ```
510
+
511
+ Expected: FAIL because R35 corpus has only 11 cases.
512
+
513
+ - [ ] **Step 3: Add hermetic R36 fixtures and runner hooks**
514
+
515
+ Each case must use local deterministic fixtures. External competitors are not required for PASS; direct competitor runs are optional evidence when service/quota allows. Documented upstream capability references must be dated and sourced.
516
+
517
+ - [ ] **Step 4: Add anti-marketing assertions**
518
+
519
+ README/docs may not state blanket superiority or tool-count victory. Comparative claims must reference a benchmark case/evidence id.
520
+
521
+ - [ ] **Step 5: Run benchmark suite**
522
+
523
+ ```powershell
524
+ node --test test/capability-benchmark-r36.test.mjs test/capability-benchmark.test.mjs test/capability-benchmark-runner.test.mjs
525
+ ```
526
+
527
+ Then run the offline corpus runner and require all required cases correct.
528
+
529
+ - [ ] **Step 6: Evidence checkpoint**
530
+
531
+ Write aggregate benchmark evidence outside candidate tree with corpus SHA, fixture SHA, per-case evidence ids, and aggregate identity independent of timing noise.
532
+
533
+ ---
534
+
535
+ ### Task 9: Version 0.10.0, Full Regression, Surface Parity, and Release Candidate Freeze
536
+
537
+ **Files:**
538
+ - Modify: `package.json`
539
+ - Modify: `src/version.mjs`
540
+ - Modify: release identity tests (`test/release-version.test.mjs`, `test/r33-finalization.test.mjs` or R36 successor equivalent)
541
+ - Modify: `scripts/gate-windows.ps1`
542
+ - Modify: `scripts/windows-gate-evidence.mjs`
543
+ - Modify: `scripts/release-parity.mjs`
544
+ - Modify: `scripts/final-closure.mjs`
545
+ - Modify: `scripts/final-closure-verify.mjs`
546
+ - Create: R36 release-gate tests as needed
547
+
548
+ **Interfaces:**
549
+ - Package/version identity exactly `deadbyte-mcp@0.10.0` / R36.
550
+ - Windows gate emits manifest-bound external evidence.
551
+ - Release parity proves both full and compact capability surfaces and rollback/restore.
552
+
553
+ - [ ] **Step 1: Write RED version/release tests**
554
+
555
+ Require `package.json.version === '0.10.0'`, `DEADBYTE_VERSION === '0.10.0'`, R36 identity in final closure, and R35 exact predecessor identity.
556
+
557
+ - [ ] **Step 2: Run version tests and confirm RED**
558
+
559
+ ```powershell
560
+ node --test test/release-version.test.mjs test/r33-finalization.test.mjs
561
+ ```
562
+
563
+ Expected: FAIL while current dev identity is still 0.9.0/R35.
564
+
565
+ - [ ] **Step 3: Change version identity only after feature slices are green**
566
+
567
+ Update package/version/release metadata to 0.10.0/R36. Do not change R35 predecessor hashes.
568
+
569
+ - [ ] **Step 4: Run full source regression**
570
+
571
+ ```powershell
572
+ npm test
573
+ ```
574
+
575
+ Expected: 0 failures; intentional semantic skips are separately reported and must satisfy the R36 semantic tracer gate before Final.
576
+
577
+ - [ ] **Step 5: Run semantic, compact-closure, benchmark, live-log, process, topology focused gates**
578
+
579
+ Use explicit commands from Tasks 2-8 and preserve raw outputs externally.
580
+
581
+ - [ ] **Step 6: Run canonical Windows gate**
582
+
583
+ ```powershell
584
+ powershell -NoProfile -ExecutionPolicy Bypass -File scripts/gate-windows.ps1
585
+ ```
586
+
587
+ Expected: native build/smokes, source tests, process/machine-fs/observation/remote smokes, manifest write/verify, and R36 gate evidence PASS.
588
+
589
+ - [ ] **Step 7: Freeze exact candidate**
590
+
591
+ Copy only manifest-bound package files to a new immutable candidate root, mark it read-only according to existing release procedure, compute manifest SHA-256 and file count, and never edit this root afterward.
592
+
593
+ - [ ] **Step 8: Adversarial diff against dev root**
594
+
595
+ Prove candidate contains no live state/private keys/grants/cache/temp evidence and that only declared package files are present.
596
+
597
+ ---
598
+
599
+ ### Task 10: Activate, Roll Back to R35, Restore R36, and Final Closure
600
+
601
+ **Files:**
602
+ - No source mutation in frozen candidate.
603
+ - External evidence only under `%USERPROFILE%\.deadbyte-mcp\evidence\...` and `D:\Projects\deadbyte-r36-evidence\...`.
604
+
605
+ **Interfaces:**
606
+ - Activation binds exact candidate manifest.
607
+ - Rollback target is exact R35 `0.9.0` sealed predecessor.
608
+ - Restore target is exact R36 candidate manifest.
609
+
610
+ - [ ] **Step 1: Activate exact R36 candidate**
611
+
612
+ Use existing signed immutable-slot activation workflow. Verify active pointer release/version/manifest exactly match candidate.
613
+
614
+ - [ ] **Step 2: Run public full/compact parity**
615
+
616
+ Negotiate live HTTPS MCP; verify canonical full surface and compact closure. When the actual ChatGPT connector is available, compare its visible catalog/capability manifest against canonical compact ledger.
617
+
618
+ - [ ] **Step 3: Verify supervisor**
619
+
620
+ Require `Loop supervisor: RUNNING [verified]` and stable live runtime identity across repeated probes.
621
+
622
+ - [ ] **Step 4: Roll back to exact R35**
623
+
624
+ Use signed predecessor receipt. Verify R35 release id/version/manifest and public smoke while R36 is inactive.
625
+
626
+ - [ ] **Step 5: Restore exact R36**
627
+
628
+ Restore the exact frozen R36 slot, not a rebuilt generation. Verify manifest identity and live public surface again.
629
+
630
+ - [ ] **Step 6: Disarm all authority planes**
631
+
632
+ Require Process/Coding/Autonomous/Host all DISARMED before closure.
633
+
634
+ - [ ] **Step 7: Write and independently verify final closure**
635
+
636
+ Run R36 closure writer and the implementation-independent verifier. Closure must bind candidate manifest, parity evidence, rollback receipt, restore receipt, supervisor proof, authority state, benchmark aggregate, and capability closure proof.
637
+
638
+ - [ ] **Step 8: Evidence checkpoint**
639
+
640
+ Record final closure path/SHA and independent verifier PASS. No “Final” claim before this step is green.
641
+
642
+ ---
643
+
644
+ ### Task 11: Exact npm Tarball, Publication, Registry Byte Proof, and Public Live Smoke
645
+
646
+ **Files:**
647
+ - No mutation to frozen candidate.
648
+ - Create external staging directory such as `D:\Projects\deadbyte-r36-npm-stage\`.
649
+ - Create external publish/verify helper scripts only when needed; hash-pin every helper before execution.
650
+
651
+ **Interfaces:**
652
+ - Exact pre-publish tarball SHA-256 is the release artifact identity for npm transport.
653
+ - Publish `deadbyte-mcp@0.10.0` with dist-tag `latest`.
654
+ - Registry-downloaded tarball SHA-256 must equal pre-publish tarball SHA-256 byte-for-byte.
655
+
656
+ - [ ] **Step 1: Pack exact frozen candidate outside candidate root**
657
+
658
+ ```powershell
659
+ npm pack "<R36_FROZEN_ROOT>" --pack-destination "D:\Projects\deadbyte-r36-npm-stage"
660
+ ```
661
+
662
+ Compute SHA-256, SHA-1, and SHA-512/SRI. Inspect package identity, bin entry, file count, and forbidden paths.
663
+
664
+ - [ ] **Step 2: Run local tarball npx smoke**
665
+
666
+ Use a fresh npm cache and exact `.tgz` path:
667
+
668
+ ```powershell
669
+ npx -y "D:\Projects\deadbyte-r36-npm-stage\deadbyte-mcp-0.10.0.tgz" --help
670
+ npx -y "D:\Projects\deadbyte-r36-npm-stage\deadbyte-mcp-0.10.0.tgz" remote status
671
+ npx -y "D:\Projects\deadbyte-r36-npm-stage\deadbyte-mcp-0.10.0.tgz" supervisor status
672
+ ```
673
+
674
+ Require R36 help surface/live-log wording and successful status commands.
675
+
676
+ - [ ] **Step 3: Pre-publish registry race check**
677
+
678
+ Require `0.10.0` absent and record current dist-tags. If version already exists unexpectedly, stop; npm versions are immutable.
679
+
680
+ - [ ] **Step 4: Publish exact tarball**
681
+
682
+ ```powershell
683
+ npm publish "D:\Projects\deadbyte-r36-npm-stage\deadbyte-mcp-0.10.0.tgz" --access public --tag latest
684
+ ```
685
+
686
+ If npm opens browser/2FA confirmation, operator completes only that npm-owned confirmation locally. Never send token/password/OTP through chat.
687
+
688
+ - [ ] **Step 5: Wait for registry visibility without republishing**
689
+
690
+ Poll boundedly until `npm view deadbyte-mcp versions --json` contains `0.10.0` and `npm view deadbyte-mcp dist-tags --json` shows `latest: 0.10.0`. Do not republish during normal propagation delay.
691
+
692
+ - [ ] **Step 6: Download registry tarball and prove byte identity**
693
+
694
+ ```powershell
695
+ npm pack deadbyte-mcp@0.10.0 --pack-destination "$env:TEMP\deadbyte-r36-registry-verify"
696
+ Get-FileHash "$env:TEMP\deadbyte-r36-registry-verify\deadbyte-mcp-0.10.0.tgz" -Algorithm SHA256
697
+ ```
698
+
699
+ Require exact equality with pre-publish SHA-256 and compare registry `dist.shasum`/`dist.integrity` to locally computed values.
700
+
701
+ - [ ] **Step 7: Registry-backed public smoke**
702
+
703
+ Using a fresh npm cache:
704
+
705
+ ```powershell
706
+ npx -y deadbyte-mcp@latest --help
707
+ npx -y deadbyte-mcp@latest remote status
708
+ npx -y deadbyte-mcp@latest supervisor status
709
+ ```
710
+
711
+ Then run real foreground:
712
+
713
+ ```powershell
714
+ npx deadbyte-mcp@latest remote
715
+ ```
716
+
717
+ Require R36 startup live activity (`🚀`, connection state, authority state), tool activity when a remote call arrives, and no Host auto-arm.
718
+
719
+ - [ ] **Step 8: Final authority cleanup**
720
+
721
+ Explicitly disarm autonomous, coding, process, and host; verify all four DISARMED after public smoke.
722
+
723
+ - [ ] **Step 9: Publication evidence checkpoint**
724
+
725
+ Record npm version, dist-tag, registry integrity/shasum/tarball URL, pre-publish SHA-256, registry-downloaded SHA-256, public smoke output hashes, and final authority state. Only then declare `R36 / 0.10.0 FINAL BASELINE — PUBLIC LIVE`.
726
+
727
+ ---
728
+
729
+ ## Plan Self-Review Checklist
730
+
731
+ - Every R36 spec requirement maps to Tasks 1-11.
732
+ - No task adds raw shell, generic arbitrary dispatch, arbitrary stdin, or Host auto-arm.
733
+ - Compact surface success is measured by capability closure, not raw tool count.
734
+ - Search/stat/multi-read, semantic diagnostics/implementations/rename, topology transactions, process control, planner parity, live logs, benchmarks, rollback/restore, and npm byte proof each have explicit tests/gates.
735
+ - R35 exact predecessor identities are copied verbatim from the approved spec.
736
+ - R36 version is consistently `0.10.0`.
737
+ - All mutable evidence is external to future frozen candidate roots.
738
+ - NON-GIT workspace uses evidence checkpoints instead of invented commits.
739
+ - npm publication happens only after final closure and independent verification.