Skip to content

chore: context-efficiency — slim CLAUDE.md + cheaper HW captures#47

Merged
kfox merged 2 commits into
mainfrom
chore/context-efficiency
Jun 27, 2026
Merged

chore: context-efficiency — slim CLAUDE.md + cheaper HW captures#47
kfox merged 2 commits into
mainfrom
chore/context-efficiency

Conversation

@kfox

@kfox kfox commented Jun 27, 2026

Copy link
Copy Markdown
Owner

Reduces per-turn context cost from analysis of this project's Claude Code session history (164 sessions, ~8.5B cache-read tokens).

Changes

1. Split per-module internals out of CLAUDE.md → docs/architecture.md
CLAUDE.md is loaded into context on every turn of every session; it had grown to ~100 KB (~25K tokens). The directory map + operating rules stay; the per-module deep-dives (read like a design doc, needed only when touching a module) move to a read-on-demand companion. CLAUDE.md keeps the tree + a pointer.

  • CLAUDE.md ~99.5 KB → ~30.5 KB (~17K fewer tokens per turn).
  • Moved content's repo-relative links rewritten to ../-relative to match other docs/ files; [[memory-slug]] cross-links preserved.

2. Downscale HW-verification captures before write
Cam Link grabs 1080p, but the C64 active area is 320×200 — a ~960px frame still resolves glyphs/colour/tearing at a fraction of the image tokens. Captures were the single largest category of big tool results in the session history.

  • _diaglib.save_image(frame, path, max_width=…); hdmi_capture.py defaults to 960px, --width to override, --full for native pixel-peeking. Env C64_DIAG_VERIFY_WIDTH.

Verification

  • ruff check / ruff format / pyright / unittest all pass (pre-commit gate).
  • hdmi_capture.py --help confirms the new flags; docs/architecture.md links spot-checked to resolve.

kfox added 2 commits June 27, 2026 00:36
…ure.md

CLAUDE.md had grown to ~100 KB (~25K tokens) and is loaded into context on
every turn of every session. The directory map + operating rules (Running,
Configuration, Visual verification, Quirks) are what's needed turn-to-turn;
the per-module deep-dives read like a design doc and are needed only when
touching a specific module.

Move the `### <module>` deep-dive subsections (api/audio/sampler/video/modes/
scenes/.../control_plane) into a new docs/architecture.md, read on demand.
CLAUDE.md keeps the directory tree as a map plus a pointer to the companion
doc. Net: CLAUDE.md ~99.5 KB -> ~30.5 KB, cutting the always-loaded per-turn
baseline by ~17K tokens. Repo-relative links in the moved content are
rewritten to ../-relative to match the other docs/ files.
…ad back)

The Cam Link grabs 1080p, but the C64 active area is only 320x200 — a frame
scaled to ~960px still resolves glyphs / per-cell colour / tearing while
costing a fraction of the image tokens a full 1080p PNG does when an agent
reads it back into context (the project's captures were the single largest
category of big tool results).

Add _diaglib.save_image(frame, path, max_width=DEFAULT_VERIFY_WIDTH) and route
hdmi_capture.py through it: default 960px longest edge, --width to override,
--full for native (pixel-peeking fine bottom-row glyph shimmer). New capture
tools should write via save_image for the same default. Env override
C64_DIAG_VERIFY_WIDTH; README + tool table updated.
@kfox kfox merged commit ac0c58e into main Jun 27, 2026
6 checks passed
@kfox kfox deleted the chore/context-efficiency branch June 27, 2026 05:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant