c64bridge 0.5.1 → 0.6.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.
- package/README.md +17 -5
- package/data/assembly/assembly-spec.md +24 -0
- package/data/assembly/examples/video/hello_world.asm +39 -0
- package/data/basic/basic-pitfalls.md +236 -0
- package/data/basic/basic-spec.md +507 -198
- package/data/video/petscii-style-guide.md +105 -0
- package/data/video/sprite-charset-best-practices.md +292 -0
- package/dist/c64Client.js +1 -0
- package/dist/prompts/registry.js +10 -2
- package/dist/rag/knowledgeIndex.js +111 -24
- package/dist/rag/retriever.js +110 -4
- package/dist/tools/audio.js +26 -13
- package/dist/tools/developer.js +34 -0
- package/dist/tools/graphics.js +6 -5
- package/dist/tools/memory.js +1 -1
- package/dist/tools/pollValidator.js +256 -0
- package/dist/tools/programRunners.js +352 -12
- package/dist/tools/rag.js +1 -7
- package/doc/MCP_SETUP.md +7 -1
- package/doc/bun/baseline-metrics.md +16 -0
- package/doc/bun/migration-checklist.md +55 -0
- package/doc/bun/migration.md +83 -0
- package/doc/developer.md +72 -10
- package/doc/improve-knowledge/notes.md +29 -0
- package/doc/improve-knowledge/plan.md +28 -3
- package/doc/improve-knowledge/rollout.md +39 -5
- package/doc/meta-tools/README.md +101 -0
- package/doc/meta-tools/analysis.md +255 -0
- package/doc/{meta-tools.md → meta-tools/catalog.md} +2 -2
- package/doc/meta-tools/notes.md +174 -0
- package/doc/meta-tools/rollout.md +343 -0
- package/mcp.json +1 -1
- package/package.json +17 -10
- package/scripts/c64-cli.mjs +42 -7
- package/scripts/c64-tool.sh +7 -1
- package/scripts/check-node-compat.mjs +107 -0
- package/scripts/invoke-bun.mjs +58 -0
- package/scripts/rag-rebuild.mjs +11 -13
- package/scripts/run-mcp-check.sh +10 -2
- package/scripts/run-tests.mjs +3 -3
- package/scripts/run-tests.ts +187 -0
- package/scripts/start.mjs +3 -26
- package/scripts/update-readme.ts +17 -1
- package/scripts/verify-package.mjs +0 -1
- package/data/assembly/examples/effects/sinewave.asm +0 -5
- package/doc/meta-tools-rollout.md +0 -211
- package/scripts/register-ts-node.mjs +0 -6
- /package/data/assembly/examples/{graphics/sprite/mover.asm → video/sprite_mover.asm} +0 -0
|
@@ -0,0 +1,255 @@
|
|
|
1
|
+
# Meta Tools Impact Analysis
|
|
2
|
+
|
|
3
|
+
Purpose: Analyze unimplemented meta tools to identify high-impact, low-effort candidates that will most improve agent capabilities for BASIC/ASM coding, graphics generation, SID music composition, and C64 filesystem navigation.
|
|
4
|
+
|
|
5
|
+
## Current Implementation Status
|
|
6
|
+
|
|
7
|
+
### Implemented (Phase 0-1): 11 tools
|
|
8
|
+
- ✅ `firmware_info_and_healthcheck` — Verify firmware readiness
|
|
9
|
+
- ✅ `wait_for_screen_text` — Poll screen for text/regex matches
|
|
10
|
+
- ✅ `verify_and_write_memory` — Safe memory write with verification
|
|
11
|
+
- ✅ `start_background_task`, `stop_background_task`, `list_background_tasks`, `stop_all_background_tasks` — Background task orchestration
|
|
12
|
+
- ✅ `find_paths_by_name` — Container-aware file discovery
|
|
13
|
+
- ✅ `memory_dump_to_file` — Export memory ranges to files
|
|
14
|
+
- ✅ `config_snapshot_and_restore` — Configuration backup/restore
|
|
15
|
+
- ✅ `program_shuffle` — Run multiple programs sequentially
|
|
16
|
+
- ✅ `batch_run_with_assertions` — Run programs with validation
|
|
17
|
+
- ✅ `bundle_run_artifacts` — Collect run artifacts
|
|
18
|
+
- ✅ `compile_run_verify_cycle` — Complete build-test cycle
|
|
19
|
+
|
|
20
|
+
### Not Implemented: ~60 tools across multiple domains
|
|
21
|
+
|
|
22
|
+
## Impact Analysis for Agent Capabilities
|
|
23
|
+
|
|
24
|
+
### 1. C64 Filesystem Navigation & Program Discovery (CRITICAL)
|
|
25
|
+
|
|
26
|
+
**Problem**: Agents struggle to find and run programs in large C64 file collections (D64/D71/D81/T64 images)
|
|
27
|
+
|
|
28
|
+
**High-Impact Tools**:
|
|
29
|
+
|
|
30
|
+
- **`find_and_run_program_by_name`** ⭐⭐⭐⭐⭐ (Effort: 45min, Benefit: HIGH)
|
|
31
|
+
- Impact: Enables agents to search entire filesystem and run programs by name
|
|
32
|
+
- Use cases: "Run Archon from my games collection", "Load the demo called Boulder"
|
|
33
|
+
- Dependencies: `find_paths_by_name` (✅ implemented)
|
|
34
|
+
- **PRIORITY: #1** — Essential for effective C64 interaction
|
|
35
|
+
|
|
36
|
+
- **`filesystem_stats_by_extension`** ⭐⭐⭐ (Effort: 35min, Benefit: MEDIUM)
|
|
37
|
+
- Impact: Helps agents understand file collections and provide insights
|
|
38
|
+
- Use cases: "How many games do I have?", "List all PRG files"
|
|
39
|
+
- Dependencies: None
|
|
40
|
+
- **PRIORITY: #3** — Good context for navigation
|
|
41
|
+
|
|
42
|
+
- **`classify_prg_basic_or_mc`** ⭐⭐⭐ (Effort: 45min, Benefit: MEDIUM)
|
|
43
|
+
- Impact: Distinguishes BASIC from machine code programs
|
|
44
|
+
- Use cases: Better error messages, appropriate testing strategies
|
|
45
|
+
- Dependencies: `container_aware_walk_and_classify`
|
|
46
|
+
- **PRIORITY: #8** — Useful but not urgent
|
|
47
|
+
|
|
48
|
+
### 2. Graphics Generation & Extraction (HIGH)
|
|
49
|
+
|
|
50
|
+
**Problem**: Agents need better tools to create, manipulate, and extract C64 graphics
|
|
51
|
+
|
|
52
|
+
**High-Impact Tools**:
|
|
53
|
+
|
|
54
|
+
- **`extract_sprites_from_ram`** ⭐⭐⭐⭐ (Effort: 80min, Benefit: MEDIUM)
|
|
55
|
+
- Impact: Extract sprites from running programs for analysis/reuse
|
|
56
|
+
- Use cases: "Show me the sprites from this game", sprite library building
|
|
57
|
+
- Dependencies: `memory_dump_to_file` (✅ implemented)
|
|
58
|
+
- **PRIORITY: #5** — Moderate effort, good payoff for graphics work
|
|
59
|
+
|
|
60
|
+
- **`rip_charset_from_ram`** ⭐⭐⭐⭐ (Effort: 75min, Benefit: MEDIUM)
|
|
61
|
+
- Impact: Extract custom character sets for reuse/study
|
|
62
|
+
- Use cases: Font library creation, PETSCII art analysis
|
|
63
|
+
- Dependencies: `memory_dump_to_file` (✅ implemented)
|
|
64
|
+
- **PRIORITY: #6** — Similar to sprites, good for graphics
|
|
65
|
+
|
|
66
|
+
- **`screen_capture_timeline`** ⭐⭐⭐ (Effort: 50min, Benefit: MEDIUM)
|
|
67
|
+
- Impact: Record program execution over time
|
|
68
|
+
- Use cases: Demo capture, animation analysis, debugging
|
|
69
|
+
- Dependencies: `wait_for_screen_text` (✅ implemented)
|
|
70
|
+
- **PRIORITY: #9** — Nice to have but lower urgency
|
|
71
|
+
|
|
72
|
+
### 3. SID Music & Audio (HIGH)
|
|
73
|
+
|
|
74
|
+
**Problem**: Agents need better workflows for creating and testing SID music
|
|
75
|
+
|
|
76
|
+
**High-Impact Tools**:
|
|
77
|
+
|
|
78
|
+
- **`silence_and_verify`** ⭐⭐⭐⭐⭐ (Effort: 35min, Benefit: HIGH)
|
|
79
|
+
- Impact: Essential for reliable SID testing and music composition
|
|
80
|
+
- Use cases: Verify silence before playing, clean state for tests
|
|
81
|
+
- Dependencies: None
|
|
82
|
+
- **PRIORITY: #2** — Quick win, high value for music work
|
|
83
|
+
|
|
84
|
+
- **`music_compile_play_analyze`** ⭐⭐⭐⭐ (Effort: 90min, Benefit: HIGH)
|
|
85
|
+
- Impact: Complete music development workflow in one tool
|
|
86
|
+
- Use cases: "Create a C major scale and verify it plays correctly"
|
|
87
|
+
- Dependencies: `silence_and_verify`
|
|
88
|
+
- **PRIORITY: #4** — After silence_and_verify, excellent workflow tool
|
|
89
|
+
|
|
90
|
+
- **`sid_param_sweep`** ⭐⭐⭐ (Effort: 90min, Benefit: MEDIUM)
|
|
91
|
+
- Impact: Experiment with SID parameters systematically
|
|
92
|
+
- Use cases: Find best ADSR settings, explore waveforms
|
|
93
|
+
- Dependencies: `silence_and_verify`
|
|
94
|
+
- **PRIORITY: #10** — Advanced feature, implement later
|
|
95
|
+
|
|
96
|
+
### 4. Debug Streaming & Assembly Verification (COMPLEX)
|
|
97
|
+
|
|
98
|
+
**Problem**: Verifying assembly execution requires debug stream integration
|
|
99
|
+
|
|
100
|
+
**High-Impact Tools** (all require infrastructure):
|
|
101
|
+
|
|
102
|
+
- **`debug_stream_watch`** ⭐⭐⭐⭐⭐ (Effort: 55min, Benefit: MEDIUM)
|
|
103
|
+
- Impact: Foundation for all debug streaming features
|
|
104
|
+
- Use cases: Monitor CPU/VIC/1541 activity
|
|
105
|
+
- Dependencies: UDP ingest pipeline (NOT YET IMPLEMENTED)
|
|
106
|
+
- **PRIORITY: Post-GA** — Requires infrastructure work first
|
|
107
|
+
|
|
108
|
+
- **`debug_loop_run_and_capture`** ⭐⭐⭐⭐⭐ (Effort: 80min, Benefit: HIGH)
|
|
109
|
+
- Impact: Verify assembly programs by comparing expected vs actual execution
|
|
110
|
+
- Use cases: "Did my IRQ handler fire correctly?", "Verify timing"
|
|
111
|
+
- Dependencies: `debug_stream_watch` + infrastructure
|
|
112
|
+
- **PRIORITY: Post-GA** — Very valuable but infrastructure-gated
|
|
113
|
+
|
|
114
|
+
- **`verify_raster_irq_line`** ⭐⭐⭐⭐ (Effort: 70min, Benefit: HIGH)
|
|
115
|
+
- Impact: Critical for graphics programming verification
|
|
116
|
+
- Use cases: Validate IRQ setup in demos and games
|
|
117
|
+
- Dependencies: `debug_loop_run_and_capture`
|
|
118
|
+
- **PRIORITY: Post-GA** — Excellent feature but requires debug foundation
|
|
119
|
+
|
|
120
|
+
**Note**: All debug streaming tools are marked Post-GA because they require:
|
|
121
|
+
- UDP packet ingest pipeline with backpressure handling
|
|
122
|
+
- Sampling/windowing for high-rate streams
|
|
123
|
+
- Performance validation via load tests
|
|
124
|
+
- Observability infrastructure
|
|
125
|
+
|
|
126
|
+
### 5. Drive & Filesystem Management (MEDIUM)
|
|
127
|
+
|
|
128
|
+
**High-Impact Tools**:
|
|
129
|
+
|
|
130
|
+
- **`drive_mount_and_verify`** ⭐⭐⭐ (Effort: 45min, Benefit: MEDIUM)
|
|
131
|
+
- Impact: Reliable drive mounting with retry logic
|
|
132
|
+
- Use cases: Mount disk images for program loading
|
|
133
|
+
- Dependencies: `firmware_info_and_healthcheck` (✅ implemented)
|
|
134
|
+
- **PRIORITY: #7** — Good utility, implement after higher priorities
|
|
135
|
+
|
|
136
|
+
- **`create_and_mount_blank_d64`** ⭐⭐ (Effort: 35min, Benefit: MEDIUM)
|
|
137
|
+
- Impact: Create working disks for file operations
|
|
138
|
+
- Use cases: Save programs, create disk collections
|
|
139
|
+
- Dependencies: `drive_mount_and_verify`
|
|
140
|
+
- **PRIORITY: #11** — Lower priority, niche use case
|
|
141
|
+
|
|
142
|
+
### 6. Memory & Disassembly (MEDIUM)
|
|
143
|
+
|
|
144
|
+
**High-Impact Tools**:
|
|
145
|
+
|
|
146
|
+
- **`memory_snapshot_and_diff`** ⭐⭐⭐⭐ (Effort: 50min, Benefit: HIGH)
|
|
147
|
+
- Impact: Debug memory changes during program execution
|
|
148
|
+
- Use cases: "What changed after running this?", reverse engineering
|
|
149
|
+
- Dependencies: `memory_dump_to_file` (✅ implemented)
|
|
150
|
+
- **PRIORITY: #12** — Useful for advanced debugging
|
|
151
|
+
|
|
152
|
+
- **`disassemble_ram_region`** ⭐⭐⭐ (Effort: 60min, Benefit: MEDIUM)
|
|
153
|
+
- Impact: Understand machine code in memory
|
|
154
|
+
- Use cases: Reverse engineering, learning assembly
|
|
155
|
+
- Dependencies: None (agent-side disassembler)
|
|
156
|
+
- **PRIORITY: #13** — Nice to have, not urgent
|
|
157
|
+
|
|
158
|
+
## Reprioritized Rollout Order
|
|
159
|
+
|
|
160
|
+
Based on impact analysis focusing on:
|
|
161
|
+
1. **Immediate agent effectiveness** (find and run programs, compose music)
|
|
162
|
+
2. **Low-hanging fruit** (small effort, high impact)
|
|
163
|
+
3. **Foundation for future work** (enables other tools)
|
|
164
|
+
4. **Deferring complex infrastructure** (debug streaming to Post-GA)
|
|
165
|
+
|
|
166
|
+
### New High-Priority Sequence
|
|
167
|
+
|
|
168
|
+
#### Quick Wins (Phase 2a — High Impact, Low Effort)
|
|
169
|
+
1. **`find_and_run_program_by_name`** (45min) — Enables program discovery
|
|
170
|
+
2. **`silence_and_verify`** (35min) — Essential for SID work
|
|
171
|
+
3. **`filesystem_stats_by_extension`** (35min) — Context for file operations
|
|
172
|
+
4. **`music_compile_play_analyze`** (90min) — Complete music workflow
|
|
173
|
+
|
|
174
|
+
#### Graphics & Extraction (Phase 2b — Medium Effort, High Value)
|
|
175
|
+
5. **`extract_sprites_from_ram`** (80min) — Graphics extraction
|
|
176
|
+
6. **`rip_charset_from_ram`** (75min) — Character set extraction
|
|
177
|
+
7. **`drive_mount_and_verify`** (45min) — Reliable disk handling
|
|
178
|
+
|
|
179
|
+
#### Advanced Features (Phase 2c — Lower Priority)
|
|
180
|
+
8. **`classify_prg_basic_or_mc`** (45min) — Program classification
|
|
181
|
+
9. **`screen_capture_timeline`** (50min) — Timeline recording
|
|
182
|
+
10. **`sid_param_sweep`** (90min) — SID experimentation
|
|
183
|
+
11. **`create_and_mount_blank_d64`** (35min) — Disk creation
|
|
184
|
+
12. **`memory_snapshot_and_diff`** (50min) — Memory comparison
|
|
185
|
+
13. **`disassemble_ram_region`** (60min) — Disassembly
|
|
186
|
+
|
|
187
|
+
#### Container & Classification (Phase 3 — When Filesystem Work Needed)
|
|
188
|
+
- **`container_aware_walk_and_classify`** (60min)
|
|
189
|
+
- **`dedup_scan`** (60min)
|
|
190
|
+
- **`dedup_plan_and_apply`** (75min)
|
|
191
|
+
|
|
192
|
+
#### Debug Streaming (Phase 5 — Post Infrastructure)
|
|
193
|
+
- All debug stream tools deferred until UDP infrastructure is ready
|
|
194
|
+
- These are high-value but require significant foundation work
|
|
195
|
+
|
|
196
|
+
## Key Insights
|
|
197
|
+
|
|
198
|
+
### Why This Order?
|
|
199
|
+
|
|
200
|
+
1. **`find_and_run_program_by_name` is #1** because it's the most requested feature — agents need to find programs in disk collections. Without this, users must manually locate files.
|
|
201
|
+
|
|
202
|
+
2. **`silence_and_verify` is #2** because it's a quick win (35min) that unblocks all SID testing and music composition work. Currently, SID tests can be flaky without proper silence verification.
|
|
203
|
+
|
|
204
|
+
3. **Graphics tools (#5-6)** are grouped together because they share similar patterns (RAM scanning, pattern detection, export). Implementing them consecutively leverages shared code.
|
|
205
|
+
|
|
206
|
+
4. **Debug streaming deferred** because it needs infrastructure (UDP pipeline, backpressure, performance testing) that would take weeks to implement properly. Better to ship other high-value features first.
|
|
207
|
+
|
|
208
|
+
### Impact on Agent Capabilities
|
|
209
|
+
|
|
210
|
+
After implementing the Phase 2a quick wins, agents will be able to:
|
|
211
|
+
- ✅ Find and run any program in a C64 file collection by name
|
|
212
|
+
- ✅ Reliably test SID music with proper silence verification
|
|
213
|
+
- ✅ Understand file collection contents and statistics
|
|
214
|
+
- ✅ Create and verify complete music compositions in one workflow
|
|
215
|
+
|
|
216
|
+
After Phase 2b graphics tools:
|
|
217
|
+
- ✅ Extract sprites and character sets from running programs
|
|
218
|
+
- ✅ Build reusable graphics libraries
|
|
219
|
+
- ✅ Analyze and learn from existing C64 graphics
|
|
220
|
+
|
|
221
|
+
### ROI Summary
|
|
222
|
+
|
|
223
|
+
**Top 4 Quick Wins (Phase 2a)**: ~205 minutes (3.4 hours)
|
|
224
|
+
- Unlocks: Program discovery, music composition, file navigation
|
|
225
|
+
- Impact: Transforms agent from "follow instructions" to "find and create"
|
|
226
|
+
|
|
227
|
+
**Graphics Suite (Phase 2b)**: ~200 minutes (3.3 hours)
|
|
228
|
+
- Unlocks: Sprite/charset extraction, graphics analysis
|
|
229
|
+
- Impact: Enables graphics-focused workflows
|
|
230
|
+
|
|
231
|
+
**Total High-Priority Work**: ~6.7 hours for 11 tools
|
|
232
|
+
- Massive improvement in agent capabilities
|
|
233
|
+
- All low-risk (no infrastructure dependencies)
|
|
234
|
+
- Clear, testable outcomes
|
|
235
|
+
|
|
236
|
+
### Deferred Work: Debug Streaming
|
|
237
|
+
|
|
238
|
+
Debug streaming tools (Phase 5) are incredibly valuable but require:
|
|
239
|
+
- UDP packet ingest infrastructure (~40 hours)
|
|
240
|
+
- Performance validation (~8 hours)
|
|
241
|
+
- Observability & monitoring (~8 hours)
|
|
242
|
+
- Integration testing (~16 hours)
|
|
243
|
+
|
|
244
|
+
**Total infrastructure: ~72 hours** before first debug tool can ship (see `rollout.md` Phase 5 for detailed breakdown)
|
|
245
|
+
|
|
246
|
+
**Decision**: Ship high-value, low-complexity features first (Phases 2a-3), then revisit debug streaming as a separate project with dedicated infrastructure sprint.
|
|
247
|
+
|
|
248
|
+
## Recommendations
|
|
249
|
+
|
|
250
|
+
1. **Immediate**: Implement Phase 2a (quick wins) in next sprint
|
|
251
|
+
2. **Near-term**: Follow with Phase 2b (graphics) when graphics work is prioritized
|
|
252
|
+
3. **Medium-term**: Phase 2c and Phase 3 tools as needed based on user feedback
|
|
253
|
+
4. **Long-term**: Plan debug streaming infrastructure project, then implement Phase 5
|
|
254
|
+
|
|
255
|
+
This prioritization maximizes near-term agent effectiveness while deferring complex infrastructure work that would block faster progress.
|
|
@@ -168,8 +168,8 @@ Container-aware traversal: All tools in this group recurse into disk/tape contai
|
|
|
168
168
|
|
|
169
169
|
File-Type Determination (CBM directory and PRG content):
|
|
170
170
|
- Step 1: Fetch metadata/listing for host files; detect container types (`.d64/.d71/.d81/.t64`).
|
|
171
|
-
- Step 2: For containers, parse directory entries
|
|
172
|
-
- Step 3: If type is `PRG`, inspect first bytes of file data: load address, plausible next-line pointer, and presence of tokens ≥ $80 before `00 00`
|
|
171
|
+
- Step 2: For containers, parse directory entries: CBM file type byte at offset $02 (0x02 = SEQ, 0x82 = PRG, etc.) to classify `SEQ/PRG/USR/REL/UNKNOWN`.
|
|
172
|
+
- Step 3: If type is `PRG`, inspect first bytes of file data: load address, plausible next-line pointer, and presence of BASIC tokens (≥ $80) before `00 00` (end-of-program marker) → classify as `BASIC`; else `PRG-MC` (machine code).
|
|
173
173
|
- Practical note: When byte reads are not supported by firmware for host files, use `load_prg` (non-running) + `readmem` to examine the loaded header without executing.
|
|
174
174
|
|
|
175
175
|
- "dedup_scan"
|
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
# Meta Tools Implementation Notes
|
|
2
|
+
|
|
3
|
+
This document tracks observations, decisions, and learnings from the meta tools rollout.
|
|
4
|
+
|
|
5
|
+
## Overview
|
|
6
|
+
|
|
7
|
+
Meta tools are high-level orchestration tools that compose multiple MCP operations into single, stateful workflows. They reduce round-trips between client and server and enable complex agent behaviors.
|
|
8
|
+
|
|
9
|
+
## Current State (as of 2025-10-30)
|
|
10
|
+
|
|
11
|
+
### Implemented Tools (11)
|
|
12
|
+
- Phase 0 foundations: firmware_info_and_healthcheck, wait_for_screen_text, verify_and_write_memory, background task suite, find_paths_by_name, memory_dump_to_file, config_snapshot_and_restore
|
|
13
|
+
- Phase 1 orchestration: program_shuffle, batch_run_with_assertions, bundle_run_artifacts, compile_run_verify_cycle
|
|
14
|
+
|
|
15
|
+
### File Organization
|
|
16
|
+
- Source: `src/tools/meta/` with submodules by domain (diagnostics, screen, memory, background, filesystem, config, program, artifacts, compilation)
|
|
17
|
+
- Tests: Integrated into existing test suites, no dedicated meta/ test folder yet
|
|
18
|
+
- Docs: **Reorganized into `doc/meta-tools/`** (matching improve-knowledge pattern)
|
|
19
|
+
|
|
20
|
+
## Documentation Structure
|
|
21
|
+
|
|
22
|
+
Following the improve-knowledge precedent:
|
|
23
|
+
```
|
|
24
|
+
doc/meta-tools/
|
|
25
|
+
├── catalog.md (formerly meta-tools.md — comprehensive tool definitions)
|
|
26
|
+
├── rollout.md (formerly meta-tools-rollout.md — implementation checklist)
|
|
27
|
+
├── analysis.md (NEW — impact analysis and prioritization)
|
|
28
|
+
└── notes.md (this file — observations and decisions)
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
Benefits:
|
|
32
|
+
- Cleaner doc/ root folder
|
|
33
|
+
- Related documents grouped together
|
|
34
|
+
- Easier to find meta tools documentation
|
|
35
|
+
- Consistent with improve-knowledge structure
|
|
36
|
+
|
|
37
|
+
## Prioritization Rationale
|
|
38
|
+
|
|
39
|
+
### Why Reprioritize?
|
|
40
|
+
|
|
41
|
+
Original rollout followed dependency order and implementation phases. However, based on actual agent usage patterns, some unimplemented tools would provide much higher value:
|
|
42
|
+
|
|
43
|
+
1. **Filesystem discovery** — Agents frequently struggle to find programs in disk collections
|
|
44
|
+
2. **SID testing** — Current music workflows lack proper silence verification
|
|
45
|
+
3. **Graphics extraction** — Users want to analyze and reuse sprites/charsets from programs
|
|
46
|
+
4. **Debug streaming** — Highly valuable but requires significant infrastructure
|
|
47
|
+
|
|
48
|
+
### Decision: High-Impact, Low-Effort First
|
|
49
|
+
|
|
50
|
+
New approach prioritizes:
|
|
51
|
+
- Quick wins (35-45 minute tools with high impact)
|
|
52
|
+
- Foundation tools that enable agent creativity (find programs, compose music)
|
|
53
|
+
- Tools with clear, testable outcomes
|
|
54
|
+
- Deferring infrastructure-heavy work (debug streaming)
|
|
55
|
+
|
|
56
|
+
See `analysis.md` for detailed impact breakdown.
|
|
57
|
+
|
|
58
|
+
## Implementation Patterns
|
|
59
|
+
|
|
60
|
+
### Meta Tool Anatomy
|
|
61
|
+
|
|
62
|
+
Each meta tool typically:
|
|
63
|
+
1. **Composes** existing MCP tools (no direct REST calls when possible)
|
|
64
|
+
2. **Maintains state** agent-side (snapshots, buffers, registries)
|
|
65
|
+
3. **Provides retry logic** and error recovery
|
|
66
|
+
4. **Returns structured results** with metadata and URIs
|
|
67
|
+
5. **Respects hardware safeguards** (pause/resume, timeouts, mutual exclusion)
|
|
68
|
+
|
|
69
|
+
### Testing Strategy
|
|
70
|
+
|
|
71
|
+
- Unit tests for tool logic (parameter validation, error handling)
|
|
72
|
+
- Integration tests with mock C64Client
|
|
73
|
+
- No hardware required for CI/CD
|
|
74
|
+
- Real hardware testing manual (for now)
|
|
75
|
+
|
|
76
|
+
### Documentation Requirements
|
|
77
|
+
|
|
78
|
+
For each implemented tool:
|
|
79
|
+
- [ ] Entry in `catalog.md` with full specification
|
|
80
|
+
- [ ] Checkbox in `rollout.md` marked complete
|
|
81
|
+
- [ ] Tests covering happy path and one failure case
|
|
82
|
+
- [ ] Usage examples in tool description
|
|
83
|
+
- [ ] Dependencies clearly documented
|
|
84
|
+
|
|
85
|
+
## Technical Decisions
|
|
86
|
+
|
|
87
|
+
### Background Tasks Registry
|
|
88
|
+
|
|
89
|
+
**Decision**: In-memory registry with optional persistence to disk
|
|
90
|
+
**Rationale**: Simplicity for MVP; disk persistence can be added later if needed
|
|
91
|
+
**Trade-offs**: Tasks lost on restart, but acceptable for experimental features
|
|
92
|
+
|
|
93
|
+
### Container-Aware Filesystem Tools
|
|
94
|
+
|
|
95
|
+
**Decision**: Implement discovery that recurses into D64/D71/D81/T64 containers
|
|
96
|
+
**Rationale**: C64 programs are often stored in disk images, not loose files
|
|
97
|
+
**Implementation**: Use wildcards when firmware supports them; fall back to mount+BASIC scraping when necessary
|
|
98
|
+
|
|
99
|
+
### Debug Streaming Infrastructure
|
|
100
|
+
|
|
101
|
+
**Decision**: Defer all debug streaming tools to Post-GA
|
|
102
|
+
**Rationale**: Requires UDP ingest, backpressure handling, performance validation (~72 hours of infrastructure work)
|
|
103
|
+
**Alternative considered**: Implement basic version with TCP — rejected because packet loss handling is essential
|
|
104
|
+
**Next steps**: Plan dedicated infrastructure sprint before tackling Phase 5 debug tools
|
|
105
|
+
|
|
106
|
+
### File Organization
|
|
107
|
+
|
|
108
|
+
**Decision**: Keep meta tools in `src/tools/meta/` submodule structure
|
|
109
|
+
**Rationale**:
|
|
110
|
+
- Clear separation from core tools
|
|
111
|
+
- Easy to mark as experimental/beta
|
|
112
|
+
- Modular structure by domain (diagnostics, screen, memory, etc.)
|
|
113
|
+
- No impact on MCP tool registration (all tools exposed equally)
|
|
114
|
+
|
|
115
|
+
**Trade-offs**: Slightly deeper import paths, but better organization
|
|
116
|
+
|
|
117
|
+
## Lessons Learned
|
|
118
|
+
|
|
119
|
+
### From Phase 0-1 Implementation
|
|
120
|
+
|
|
121
|
+
1. **Background tasks are versatile** — Can schedule any tool, not just specific operations
|
|
122
|
+
2. **Verification patterns reusable** — verify_and_write_memory pattern applies to many tools
|
|
123
|
+
3. **Screen polling essential** — wait_for_screen_text foundation for many workflows
|
|
124
|
+
4. **Artifacts bundling popular** — bundle_run_artifacts frequently requested by users
|
|
125
|
+
|
|
126
|
+
### From Impact Analysis
|
|
127
|
+
|
|
128
|
+
1. **Filesystem navigation is critical** — Most common agent failure: "I can't find that program"
|
|
129
|
+
2. **SID testing needs improvement** — Silence verification missing causes flaky tests
|
|
130
|
+
3. **Debug streaming is desirable but complex** — High demand, but infrastructure not ready
|
|
131
|
+
4. **Graphics tools have broad appeal** — Sprite/charset extraction enables creative reuse
|
|
132
|
+
|
|
133
|
+
## Future Considerations
|
|
134
|
+
|
|
135
|
+
### Potential Improvements
|
|
136
|
+
|
|
137
|
+
1. **Meta tool composition** — Allow meta tools to call other meta tools
|
|
138
|
+
2. **Persistent background tasks** — Survive server restarts
|
|
139
|
+
3. **Progress callbacks** — Report progress during long-running operations
|
|
140
|
+
4. **Cancellation** — Abort in-progress meta tools gracefully
|
|
141
|
+
5. **Dry-run mode** — Preview actions without executing (especially for destructive ops)
|
|
142
|
+
|
|
143
|
+
### Infrastructure Needs
|
|
144
|
+
|
|
145
|
+
For debug streaming (Phase 5):
|
|
146
|
+
- UDP packet receiver with reassembly
|
|
147
|
+
- Backpressure and flow control
|
|
148
|
+
- Circular buffer for trace windows
|
|
149
|
+
- Packet loss detection and reporting
|
|
150
|
+
- Performance benchmarks and load tests
|
|
151
|
+
- Observability (metrics, logging, tracing)
|
|
152
|
+
|
|
153
|
+
### Documentation Gaps
|
|
154
|
+
|
|
155
|
+
- No architecture diagram for meta tool system
|
|
156
|
+
- Limited examples of meta tool composition patterns
|
|
157
|
+
- No performance guidelines (when to avoid meta tools)
|
|
158
|
+
- Testing best practices not documented
|
|
159
|
+
|
|
160
|
+
## Open Questions
|
|
161
|
+
|
|
162
|
+
1. **Should meta tools be separately versioned?** Currently experimental, but what's the graduation criteria?
|
|
163
|
+
2. **How to handle breaking changes?** Meta tools compose other tools — cascade impacts?
|
|
164
|
+
3. **Rate limiting?** Some meta tools could issue many requests — need throttling?
|
|
165
|
+
4. **Observability?** How to monitor meta tool usage and performance in production?
|
|
166
|
+
|
|
167
|
+
## References
|
|
168
|
+
|
|
169
|
+
- `catalog.md` — Full meta tool definitions with effort/benefit matrix
|
|
170
|
+
- `rollout.md` — Implementation checklist with dependencies
|
|
171
|
+
- `analysis.md` — Impact analysis and prioritization rationale
|
|
172
|
+
- `doc/improve-knowledge/` — Similar documentation structure pattern
|
|
173
|
+
- `doc/agent-state-spec.md` — Background task registry specification
|
|
174
|
+
- `src/tools/meta/` — Implementation source code
|