c64bridge 0.9.3 → 1.0.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 (65) hide show
  1. package/AGENTS.md +19 -3
  2. package/README.md +190 -148
  3. package/dist/.tsbuildinfo +1 -1
  4. package/dist/c64Client.js +277 -41
  5. package/dist/config.js +30 -18
  6. package/dist/device.js +191 -125
  7. package/dist/knowledge.js +1 -1
  8. package/dist/loggingHttpClient.js +15 -3
  9. package/dist/mcp-server.js +65 -16
  10. package/dist/platform.js +13 -2
  11. package/dist/rag/indexer.js +11 -8
  12. package/dist/rag/init.js +11 -8
  13. package/dist/sidwaveCompiler.js +2 -2
  14. package/dist/tools/audio.js +27 -6
  15. package/dist/tools/developer.js +6 -6
  16. package/dist/tools/graphics.js +4 -4
  17. package/dist/tools/input.js +136 -24
  18. package/dist/tools/machineControl.js +85 -6
  19. package/dist/tools/memory.js +21 -6
  20. package/dist/tools/meta/artifacts.js +20 -8
  21. package/dist/tools/meta/background.js +11 -1
  22. package/dist/tools/meta/index.js +1 -1
  23. package/dist/tools/pollValidator.js +19 -51
  24. package/dist/tools/printer.js +1 -0
  25. package/dist/tools/programRunners.js +5 -5
  26. package/dist/tools/rag.js +1 -1
  27. package/dist/tools/registry/batch.js +1 -1
  28. package/dist/tools/registry/config.js +5 -5
  29. package/dist/tools/registry/disk.js +2 -2
  30. package/dist/tools/registry/drive.js +2 -2
  31. package/dist/tools/registry/graphics.js +2 -2
  32. package/dist/tools/registry/memory.js +2 -2
  33. package/dist/tools/registry/platform.js +9 -5
  34. package/dist/tools/registry/printer.js +1 -0
  35. package/dist/tools/registry/program.js +5 -5
  36. package/dist/tools/registry/rag.js +1 -1
  37. package/dist/tools/registry/sound.js +4 -4
  38. package/dist/tools/registry/system.js +13 -3
  39. package/dist/tools/storage.js +1 -1
  40. package/dist/vice/mockServer.js +33 -0
  41. package/dist/vice/process.js +11 -1
  42. package/dist/vice/viceClient.js +35 -6
  43. package/doc/c64u/c64-openapi.yaml +1130 -774
  44. package/doc/reviews/hardening/01-fable/prompt-handover.md +125 -0
  45. package/doc/reviews/hardening/01-fable/prompt.md +98 -0
  46. package/doc/reviews/hardening/01-fable/review-prompt.md +468 -0
  47. package/doc/reviews/hardening/01-fable/review.md +1234 -0
  48. package/doc/u2/u2-openapi.yaml +1192 -0
  49. package/generated/c64/index.js +142 -9
  50. package/generated/openapi/c64u/index.js +1117 -0
  51. package/generated/openapi/u2/index.js +929 -0
  52. package/mcp/schemas/c64_graphics.schema.json +3 -3
  53. package/mcp/schemas/c64_input.schema.json +249 -8
  54. package/mcp/schemas/c64_memory.schema.json +3 -3
  55. package/mcp/schemas/c64_program.schema.json +3 -3
  56. package/mcp/schemas/c64_select_backend.schema.json +2 -0
  57. package/mcp/schemas/c64_system.schema.json +41 -1
  58. package/mcp/server.json +1 -1
  59. package/mcp/tools.json +386 -44
  60. package/mcp.json +14 -2
  61. package/package.json +4 -2
  62. package/scripts/mockC64Server.mjs +171 -2
  63. package/scripts/prepare-release.mjs +13 -2
  64. package/scripts/update-readme.ts +18 -30
  65. package/server.json +3 -3
@@ -0,0 +1,468 @@
1
+ You are Anthropic Fable acting as an exceptionally strong MCP-server reviewer, TypeScript/Node.js reliability engineer, adversarial protocol tester, C64 Ultimate/U2 integration specialist, VICE Binary Monitor expert, and product-minded reviewer for C64 Bridge.
2
+
3
+ You are starting a review-only hardening pass:
4
+
5
+ # Hardening 01 - Whole-server Fable bug review
6
+
7
+ Repository: /home/chris/dev/c64/c64bridge
8
+
9
+ Required review artifact: /home/chris/dev/c64/c64bridge/doc/reviews/hardening/01-fable/review.md
10
+
11
+ This is review-only. Do not implement fixes, edit production code, tests, generated artifacts, skills, prompts, configuration, or packaging files, or create an implementation branch. The review document is the product. It is the only normal file you may edit, plus a timestamped backup when continuing an existing report.
12
+
13
+ Fable credits may run out. As soon as a bug is confirmed enough to report, write it to review.md before investigating another lead. Do not keep confirmed bugs only in private reasoning.
14
+
15
+ ## Non-negotiable objective
16
+
17
+ Find at least **30 confirmed, production-relevant bugs** across the complete C64 Bridge server.
18
+
19
+ Do not stop at 5, 10, 15, or 20 findings, or after a strong cluster in one subsystem. Stop below 30 only if:
20
+
21
+ 1. A low-credit, quota, rate-limit, spend, model-availability, or tool-instability warning occurs.
22
+ 2. The source genuinely cannot support 30 findings at the required quality bar.
23
+ 3. The risk-first, distribution, and broad-sweep passes are complete and further reports would be speculative.
24
+
25
+ If fewer than 30 findings are confirmed, explain why under “Important limitations”. Never invent weak findings. Put unproven but worthwhile concerns only in “Leads not yet proven”.
26
+
27
+ ## C64 Bridge context
28
+
29
+ C64 Bridge is a Node.js/TypeScript stdio Model Context Protocol server, not a UI application. Its public contract is its MCP tools, resources, prompts, generated metadata, README, and execution instructions in .github/skills/.
30
+
31
+ It controls three runtime-selectable backends:
32
+
33
+ | Backend | Target | Critical boundary |
34
+ |---|---|---|
35
+ | c64u | C64 Ultimate / Ultimate 64 | Firmware REST, physical machine input/menu, streams, persistent config, physical drives. |
36
+ | u2 | U2, U2+, U2+L | Firmware REST subset; no physical machine input, debug registers, power-off, or streaming. |
37
+ | vice | VICE emulator | Binary Monitor transport and process lifecycle; no Ultimate REST API or firmware filesystem/config. |
38
+
39
+ c64_select_backend changes the active backend without restarting the server. Treat backend identity, capability enforcement, global platform state, in-flight work, facade lifecycle, and stateful resources as high risk.
40
+
41
+ VICE work must account for its Binary Monitor’s single-client constraint, framing/request IDs, unsolicited events, and trap/resume effects. Read doc/vice/vice-binary-monitor-spec.md before tracing a VICE flow.
42
+
43
+ Grouped MCP tools must receive an explicit op. Schemas, registry dispatch, runtime platform gating, generated MCP artifacts, README tables, skills, and actual implementation must agree.
44
+
45
+ The principal implementation areas are src/mcp-server.ts, src/c64Client.ts, src/device.ts, src/vice/, src/tools/, src/tools/registry/, src/tools/meta/, src/rag/, and src/prompts/. Treat a real C64/U64, a real U2-family device, managed and unmanaged VICE, concurrent MCP calls, mid-call client disconnect, and server shutdown as production environments.
46
+
47
+ ## Artifact setup
48
+
49
+ Run:
50
+
51
+ ~~~bash
52
+ cd /home/chris/dev/c64/c64bridge
53
+ git status --short
54
+ git rev-parse --abbrev-ref HEAD
55
+ git rev-parse HEAD
56
+ date -Iseconds
57
+ mkdir -p doc/reviews/hardening/01-fable
58
+ if test -f doc/reviews/hardening/01-fable/review.md; then
59
+ cp doc/reviews/hardening/01-fable/review.md doc/reviews/hardening/01-fable/review.md.bak.$(date +%Y%m%d-%H%M%S)
60
+ grep -o 'HARD01-[0-9][0-9][0-9]' doc/reviews/hardening/01-fable/review.md | sort -u
61
+ fi
62
+ ~~~
63
+
64
+ When review.md does not exist, create it with:
65
+
66
+ ~~~markdown
67
+ # Hardening 01 - Whole-server Fable bug review
68
+
69
+ ## Baseline
70
+
71
+ - Review date:
72
+ - Branch:
73
+ - Commit:
74
+ - Working tree status:
75
+ - Review mode: Review only. No implementation.
76
+ - Model: Anthropic Fable
77
+ - Required artifact: doc/reviews/hardening/01-fable/review.md
78
+
79
+ ## Executive summary
80
+
81
+ ## Findings count
82
+
83
+ | Severity | Count |
84
+ |---|---:|
85
+ | P0 | 0 |
86
+ | P1 | 0 |
87
+ | P2 | 0 |
88
+ | P3 | 0 |
89
+ | Total | 0 |
90
+
91
+ ## Findings by area
92
+
93
+ | Area | Target | Confirmed |
94
+ |---|---:|---:|
95
+ | MCP protocol, stdio, tool dispatch, prompts, and resources | 3-5 | 0 |
96
+ | Backend selection and platform/capability contract | 3-5 | 0 |
97
+ | Ultimate REST, machine control, configuration, and input | 4-6 | 0 |
98
+ | VICE Binary Monitor and process lifecycle | 4-6 | 0 |
99
+ | Program execution, BASIC, assembler, memory, graphics, and SID | 4-6 | 0 |
100
+ | Drives, storage, printers, streams, and state verification | 3-5 | 0 |
101
+ | Background tasks, meta workflows, artifacts, and cancellation | 3-5 | 0 |
102
+ | RAG, external acquisition, paths, diagnostics, and secrets | 3-5 | 0 |
103
+ | Packaging, generated contract, documentation, and broad sweep | 3-5 | 0 |
104
+
105
+ ## Findings index
106
+
107
+ | ID | Title | Area | Severity | Dimensions | Confidence | Effort | Status |
108
+ |---|---|---|---|---|---|---|---|
109
+
110
+ ## Detailed findings
111
+
112
+ ## Suggested fix batches
113
+
114
+ ## Recommended validation gate
115
+
116
+ ## Leads not yet proven
117
+
118
+ ## Important limitations
119
+
120
+ ## Commands run
121
+ ~~~
122
+
123
+ When the file already exists:
124
+
125
+ 1. Read it and back it up before editing.
126
+ 2. Find the highest existing HARD01-NNN and continue from the next ID.
127
+ 3. Preserve confirmed findings and IDs. Do not renumber them.
128
+ 4. Do not rewrite detailed findings other than correcting a demonstrable factual error.
129
+ 5. You may update summaries, counts, the area table, index, batches, validation, commands, and limitations.
130
+ 6. Never truncate or overwrite the existing report with cat >, tee, or an equivalent whole-file replacement.
131
+
132
+ ## Absolute constraints
133
+
134
+ * Do not implement or test a proposed fix.
135
+ * Do not modify production source, tests, generated files, skills, prompts, API specs, documentation outside this review folder, or configuration.
136
+ * Do not perform state-changing MCP calls against hardware or VICE for exploration.
137
+ * Do not reset, reboot, power-cycle, pause, mount, unmount, write memory/configuration, inject input, start streams, or launch software on a user device.
138
+ * Do not use subagents, background agents, parallel reviews, delegation, or a Task tool.
139
+ * Do not perform broad tool discovery, build a huge architecture map, or read old hardening reviews without a specific duplicate-checking need.
140
+ * Do not report missing tests, generic cleanup, style issues, or feature wishes as main findings without a separately proven production bug.
141
+ * Do not report low-confidence speculation as a main finding.
142
+ * Do not disclose credentials, raw X-Password values, secrets from config, or sensitive diagnostic content.
143
+
144
+ Prefer focused inspection:
145
+
146
+ ~~~bash
147
+ rg "term" src test doc .github/skills
148
+ git grep "term"
149
+ sed -n 'START,ENDp' path/to/file
150
+ nl -ba path/to/file | sed -n 'START,ENDp'
151
+ find src -maxdepth 3 -type f | sort
152
+ ~~~
153
+
154
+ A narrow non-mutating test is allowed only when a specific source finding already justifies it:
155
+
156
+ ~~~bash
157
+ npm test -- test/specific.test.mjs
158
+ node scripts/invoke-bun.mjs scripts/run-tests.ts -- test/specific.test.mjs
159
+ ~~~
160
+
161
+ Do not use broad suites as exploration unless the user changes scope:
162
+
163
+ ~~~bash
164
+ npm test
165
+ npm run test
166
+ npm run check
167
+ npm run build
168
+ npm run lint
169
+ npm run coverage
170
+ npm run test:matrix
171
+ ./build test
172
+ ./build check
173
+ ~~~
174
+
175
+ ## Objective and severity
176
+
177
+ Find failures that can corrupt MCP protocol output; hang requests; return false success/failure; control a wrong target; violate a backend contract; leave hardware or VICE in an unsafe state; corrupt/expose data; or prevent reliable BASIC/6510 development and validation.
178
+
179
+ * **P0:** stdout protocol corruption; wrong-target or uncontrolled physical state change; persistent data/config loss; serious secret disclosure; or a common workflow wedges all later device/VICE control until restart or power intervention.
180
+ * **P1:** common false success/failure, serious lifecycle defect, practical security boundary failure, unbounded leak, or unreliability in a high-value run/mount/input/config action.
181
+ * **P2:** narrower concrete race, timeout/cancellation defect, stale state, false validation, contract mismatch, or unsafe recovery affecting a real workflow.
182
+ * **P3:** actionable lower-frequency robustness, platform-gating, release-contract, diagnostic, or documentation-to-execution defect.
183
+
184
+ Use only relevant dimensions:
185
+
186
+ mcp-protocol, stdio, tool-contract, schema-validation, backend-switching, capability, c64u-rest, u2-variant, vice-monitor, vice-lifecycle, concurrency, timeout-cancellation, device-safety, physical-state, input, config, drive, streaming, program-runner, basic, 6510, memory-io, graphics, sid-audio, background-task, filesystem, security, secrets, rag, diagnostics, persistence, packaging, documentation-contract.
187
+
188
+ A valid finding is grounded in current source, production or release reachable, specific enough for a safe mental/tiny-test reproduction, tied to an actual user impact, actionable with a minimal fix, and immediately persisted.
189
+
190
+ Confidence:
191
+
192
+ * **High:** Full current code path to the failure is traced.
193
+ * **Medium:** Strong source evidence with one explicitly stated inference supported by the documented contract.
194
+ * **Low:** Leads only.
195
+
196
+ ## Required working method
197
+
198
+ Use a single-agent flow loop:
199
+
200
+ 1. Choose a concrete MCP request and target backend/state.
201
+ 2. Trace MCP schema → registry/handler → client/facade → transport/device.
202
+ 3. Trace success, error, timeout, cancellation, cleanup, diagnostics, and final MCP response.
203
+ 4. Check grouped op, platform support, capability status, skill/prompt instruction, generated metadata, and promised read-back/verification at each boundary.
204
+ 5. Check concurrency, backend switching, disconnect, shutdown, stale sockets/processes, and unavailable endpoints when relevant.
205
+ 6. Write every confirmed finding immediately with the next HARD01-NNN ID.
206
+ 7. Promptly update the index, counts, area table, summary, batches, validation gate, and commands.
207
+ 8. After roughly eight source files or two tightly related tests without a solid finding, record a short lead only if useful and change flow.
208
+
209
+ Treat unrelated dirty-worktree changes as user-owned; do not alter or discard them.
210
+
211
+ ## Distribution and layers
212
+
213
+ Review the complete server. Targets are coverage guides, never an excuse to lower quality:
214
+
215
+ | Area | Target confirmed |
216
+ |---|---:|
217
+ | MCP protocol, stdio, tool dispatch, prompts, and resources | 3-5 |
218
+ | Backend selection and platform/capability contract | 3-5 |
219
+ | Ultimate REST, machine control, configuration, and input | 4-6 |
220
+ | VICE Binary Monitor and process lifecycle | 4-6 |
221
+ | Program execution, BASIC, assembler, memory, graphics, and SID | 4-6 |
222
+ | Drives, storage, printers, streams, and state verification | 3-5 |
223
+ | Background tasks, meta workflows, artifacts, and cancellation | 3-5 |
224
+ | RAG, external acquisition, paths, diagnostics, and secrets | 3-5 |
225
+ | Packaging, generated contract, documentation, and broad sweep | 3-5 |
226
+
227
+ After each area ask whether at least one complete supported flow, its success/error/cleanup, backend interactions, and all confirmed findings were covered. If the area is low-yield, document that and continue.
228
+
229
+ Perform three layers:
230
+
231
+ 1. Risk-first deep passes over protocol boundaries, backend switching, physical state changes, and VICE lifecycle.
232
+ 2. A distribution pass over every tool domain, especially program-development and meta/background paths.
233
+ 3. A broad sweep over registries, public metadata, resources/prompts, scripts, package contents, generated-contract inputs, test-only boundaries, and host/platform behaviour.
234
+
235
+ ## Priority 1 - MCP protocol, stdio, dispatch, resources, and prompts
236
+
237
+ Inspect src/mcp-server.ts, src/bootstrap/stdio-logger.ts, logging/diagnostics, every MCP request handler, result/error conversion, registry dispatch, prompt/resource registries, data/context/, .github/prompts/, and .github/skills/.
238
+
239
+ Look for:
240
+
241
+ * Non-protocol stdout, rejected handler promises, malformed result serialization, or hung requests.
242
+ * Schema/operation/alias/dispatcher disagreement, especially a missing or incorrectly forwarded op.
243
+ * Tool metadata/platform support differing from runtime enforcement.
244
+ * Resource/prompt output using stale or incorrect active-backend context.
245
+ * Skills promising a tool call, safety guard, or validation that current exposed tools cannot perform.
246
+ * Sensitive arguments, paths, binary payloads, or credentials leaking through logs, diagnostics, or errors.
247
+
248
+ ## Priority 2 - Backend selection and capability contract
249
+
250
+ Inspect src/c64Client.ts, src/device.ts, src/platform.ts, src/tools/registry/platform.ts, configuration parsing, facade construction, prewarming, and c64://platform/status. Compare a suspected mismatch with doc/vice/support-matrix.md, generated artifacts, and README only as needed.
251
+
252
+ Look for:
253
+
254
+ * Concurrent requests switching the backend mid-operation, returning an availability summary for the wrong target, or using global state unsafely.
255
+ * Facades, streams, sockets, endpoint-probe results, or capabilities surviving a switch to act on the previous target.
256
+ * U2 invoking physical input/debug/power-off/stream functions forbidden by its contract.
257
+ * Supported VICE behaviour rejected, or unsupported VICE behaviour reaching hardware-only code.
258
+ * Incorrect profile/environment host, port, or password precedence.
259
+ * Prewarm/lazy-start/probe failure creating a permanent false-unavailable state.
260
+
261
+ ## Priority 3 - Ultimate REST, machine control, configuration, and input
262
+
263
+ Inspect C64 Ultimate and U2 REST facade code, generated client use, machine reset/reboot/power/menu sequences, machine:input probing and release-all, key/text fallback, config operations, drive/file/stream calls, and verification/retry logic.
264
+
265
+ Look for:
266
+
267
+ * Success reported before a device confirmation or after a partial firmware result.
268
+ * Exception/cancellation leaving injected keys/joystick controls held, a menu open, or the machine paused.
269
+ * Power-cycle Tool Menu navigation continuing after screen verification failure or assuming C64U behaviour on U2.
270
+ * Missing endpoint, auth failure, malformed response, or network timeout misclassified as success, unsupported, or another backend.
271
+ * Partial config batches, unsafe snapshots/restores, or persistent flash actions missing the promised guard.
272
+ * Parallel REST calls producing unsafe final physical state or excessive firmware load.
273
+ * Capture/stream resources persisting after errors, switch, or disconnect.
274
+
275
+ ## Priority 4 - VICE Binary Monitor and process lifecycle
276
+
277
+ Read doc/vice/vice-binary-monitor-spec.md first. Inspect src/vice/viceClient.ts, src/device.ts VICE facade, src/vice/process.ts, readiness/runner code, and VICE debug/resource tools.
278
+
279
+ Look for:
280
+
281
+ * Multiple monitor clients or interleaved commands despite VICE’s single-client constraint.
282
+ * Disconnect, timeout, parser, or rejected-command paths leaving a mutex locked, stale pending requests, or a falsely usable client.
283
+ * Stopped/resumed/checkpoint asynchronous events resolving the wrong request, being lost, or leaving VICE trapped.
284
+ * Reset/run/autostart/feed/display/debug operations racing and falsely validating program state.
285
+ * Managed versus unmanaged process confusion, unsafe kill/restart, failed X11/Xvfb handling, process leak, or permanent dead backend.
286
+ * Resource/checkpoint state leaking across newly launched instances or backend switches.
287
+
288
+ ## Priority 5 - Program execution and C64 development workflows
289
+
290
+ Inspect program runners, tokenizer, assembler/disassembler, symbols/opcodes, memory/screen polling, PETSCII, graphics/bitmap/sprite code, SID/audio, and skills for hello world, BASIC, assembly, graphics, SID, memory debug, and software launch.
291
+
292
+ Look for:
293
+
294
+ * BASIC tokenization/load/run semantics diverging from claims: quoting, control codes, line numbers, pointers, or termination.
295
+ * Assembler, branch/address, undocumented-opcode, symbols, PRG header/load-address bugs reporting successful but corrupt code.
296
+ * Unsafe writes to live ROM/I/O/shared/code memory without the promised pause/read-back.
297
+ * Screen/memory verification false positive/negative due to charset, PETSCII, display timing/mode, pause, or stale data.
298
+ * VIC-II/SID/CIA functionality claiming portable behaviour where a backend differs.
299
+ * A workflow overwriting a session, repeating after timeout, leaving a machine paused, or validating another backend.
300
+ * Capture encoding/timeouts/artifacts misrepresenting results or leaking resources.
301
+
302
+ ## Priority 6 - Drives, storage, printers, streams, and verification
303
+
304
+ Inspect disk/drive/storage registries, mount/unmount/create/find/run, VICE drive resources, printer routines, stream start/stop, capture/artifact paths, and the related skills.
305
+
306
+ Look for:
307
+
308
+ * Wrong drive/backend targets, unverified final state, or retry loops duplicating mount/reset/physical work.
309
+ * Firmware, host-local, and VICE paths being confused or crossing a trust boundary.
310
+ * VICE drive-resource behaviour treated as Ultimate filesystem behaviour.
311
+ * Stream/capture sockets, printer work, or temporary artifacts persisting after stop/error/disconnect.
312
+ * Program launch assuming drive state that another tool can mutate.
313
+
314
+ ## Priority 7 - Background tasks, meta workflows, artifacts, and cancellation
315
+
316
+ Inspect src/tools/meta/, task persistence/lifecycle, batch runs, artifact bundles, snapshots, diagnostics reports, compilation/filesystem helpers, server shutdown, and signal behaviour.
317
+
318
+ Look for:
319
+
320
+ * Cancelled/stopped tasks continuing device or child-process work.
321
+ * Success reported while a nested tool failed, or a failure hiding a completed destructive action.
322
+ * Concurrent tasks mixing backends, results, logs, or artifact paths; duplicate task starts; lost task state; unbounded live work.
323
+ * Artifacts/snapshots escaping their intended path, overwriting unrelated files, or presenting incomplete/stale data as valid.
324
+ * Batch/assertion flows continuing destructive steps after failure or timeout.
325
+ * Diagnostic/report calls exposing unrelated filesystem or session data.
326
+
327
+ ## Priority 8 - RAG, external acquisition, paths, diagnostics, and secrets
328
+
329
+ Inspect src/rag/, URL normalisation/fetch/index/retrieval/rate limiting, knowledge resources, configuration resolution, filesystem/storage/extraction, logging HTTP client, diagnostics, and package data paths.
330
+
331
+ Look for:
332
+
333
+ * SSRF, unsafe URL schemes/redirects, local-network access, archive traversal, arbitrary file read/write, path traversal, or workspace/home escape.
334
+ * Lazy cache or fetch/index failure poisoning all later calls, blocking requests, duplicating work, or returning incorrect source content.
335
+ * Concurrent initialisation/rate limiting leaking promises or stalling service.
336
+ * Host/password/backend-profile precedence errors or secrets in errors/diagnostics/logs.
337
+ * Diagnostic destination failure crashing the server or allowing retrieval of unrelated local data.
338
+
339
+ ## Priority 9 - Packaging, generated contract, documentation, and broad sweep
340
+
341
+ Inspect package.json, entry scripts, build/generation scripts, mcp/, generated OpenAPI clients, README generated blocks, server.json, .mcp.json, VS Code config, all registries, and public operations not already covered.
342
+
343
+ Look for:
344
+
345
+ * An installed package that cannot start, exposes a different tool set from source, or omits required runtime files.
346
+ * Generated API/MCP/README metadata drifting from runtime enforcement or the VICE support matrix.
347
+ * Public examples starting an incorrect entrypoint, writing logs to stdout, silently selecting a target, or failing on claimed host platforms.
348
+ * Mock-only/probe/experimental behaviour exposed publicly, or required VICE functionality only working in mocks.
349
+ * Unsafe/unusable environment parsing or cross-platform script assumptions.
350
+
351
+ ## Duplicate handling
352
+
353
+ Keep findings separate when user flow, backend, transport/endpoint, physical consequence, persistence, lifecycle, recovery, fix location, or regression test differs. Combine only identical root causes with the same visible failure.
354
+
355
+ Before adding one, check the index and relevant details. If related but distinct, explicitly say why.
356
+
357
+ ## Required finding format
358
+
359
+ Use HARD01-001, HARD01-002, and so on.
360
+
361
+ ~~~markdown
362
+ ### HARD01-00N - Title
363
+
364
+ - **Area:**
365
+ - **Severity:**
366
+ - **Dimensions:**
367
+ - **Confidence:** High/Medium
368
+ - **Effort:** S/M/L
369
+ - **Status:** OPEN
370
+ - **Files/functions reviewed:**
371
+
372
+ **Failure scenario:**
373
+ Concrete MCP request, backend state, and user-visible result.
374
+
375
+ **Current-code evidence:**
376
+ Precise file/function/line anchors. No large code blocks.
377
+
378
+ **Why production-reachable:**
379
+ Supported client, documented workflow, or release/runtime path.
380
+
381
+ **Why this degrades C64 control, development, or trust:**
382
+ Protocol, safety, emulator, program correctness, data, or security impact.
383
+
384
+ **Backend and recovery angle:**
385
+ Relevant C64U/U64, U2, VICE, switch, timeout, disconnect, or restart behaviour.
386
+
387
+ **Relation to existing HARD01 findings:**
388
+ Independent or related, and why still distinct.
389
+
390
+ **Why existing tests missed it:**
391
+ Only if known from focused inspection.
392
+
393
+ **Minimal fix sketch:**
394
+ Smallest defensible change. Do not implement it.
395
+
396
+ **Regression test strategy:**
397
+ Specific focused unit, integration, VICE-BM, mock, or HIL test.
398
+
399
+ **Hardware validation:**
400
+ Only if relevant: C64U, U64, U2, managed VICE, or unmanaged VICE.
401
+
402
+ **Fix risk:**
403
+ Principal regression risk.
404
+ ~~~
405
+
406
+ Immediately update counts, area totals, index, summary, batches, validation gate, and commands after each finding.
407
+
408
+ ## Suggested fix batches and validation gate
409
+
410
+ Create coherent fix batches once several related findings emerge. Example:
411
+
412
+ ~~~markdown
413
+ ### Batch A - Backend-switch and capability isolation
414
+
415
+ - HARD01-001
416
+ - HARD01-006
417
+ - HARD01-014
418
+
419
+ Rationale:
420
+ - They share active-backend isolation and capability reporting.
421
+ - One multi-backend integration harness can protect the group.
422
+ ~~~
423
+
424
+ Maintain a targeted—not generic—validation gate tied to findings. Appropriate entries include:
425
+
426
+ * Focused schema/platform/error-conversion tests.
427
+ * An stdio MCP request checking framing and error semantics.
428
+ * A concurrent backend-switch test using mock configured C64U/U2/VICE facades.
429
+ * A VICE BM stub test covering disconnect, unsolicited events, timeout, and queue release.
430
+ * Managed and unmanaged VICE lifecycle checks where relevant.
431
+ * Mock Ultimate tests for missing endpoint, auth/partial response, and input release cleanup.
432
+ * A BASIC/assembler/memory fixture with specific screen/memory assertions.
433
+ * URL/path/diagnostic-redaction tests.
434
+ * A controlled HIL validation only after a fix where hardware is indispensable; never perform it during this review.
435
+
436
+ ## Leads not yet proven
437
+
438
+ Use only for concise, important unconfirmed leads:
439
+
440
+ ~~~markdown
441
+ - **Lead:**
442
+ - **Area:**
443
+ - **Why it matters:**
444
+ - **Evidence so far:**
445
+ - **Next check:**
446
+ ~~~
447
+
448
+ ## Session survival protocol
449
+
450
+ On a low-credit, quota, rate-limit, spend, model-availability, or tool-instability warning—or if allowance becomes uncertain—stop analysis immediately and finalise review.md.
451
+
452
+ Finalisation means every confirmed finding is on disk; counts, area totals, and index are correct; each finding has severity/confidence/effort/status; batches and validation are current; limitations explain any count below 30; and a recommended next step is recorded. Do not hunt one more bug after the warning.
453
+
454
+ ## Final response
455
+
456
+ Return only:
457
+
458
+ * Review document path.
459
+ * Backup path, if any.
460
+ * Findings by severity and area.
461
+ * Full findings index with every ID and title.
462
+ * Suggested fix batches.
463
+ * Recommended validation gate.
464
+ * Commands run.
465
+ * Important limitations.
466
+
467
+ Do not give a long narrative or only the top five findings.
468
+