Answer principles round 1: 0 🔴, 9 🟡 (0 misread); name the 200k window's compaction point, read a compaction summary as Claude Code's, remove item 231, refresh items 234, 235, 52 and 102, file item 237
This commit is contained in:
+9
-7
@@ -72,24 +72,26 @@ The cap is 5, `bin/todo_table.py`'s `BUNDLE_MAX_R`, from the same chunks: by the
|
||||
|
||||
2026-09-28, lilleman. Serves goals 1 and 3: saving each transcript locally is the first step of backing it up, and it shows afterwards what an unattended run did. A copy of the `.jsonl`, deduplicated by content hash, with its outcomes beside it; a rendering drops tool results, and a second-resolution stamp names two states within one second as one file. A failed archive exits 1, since a loop that loses its record silently fails the backup goal. Valid while transcripts stay small enough to copy whole.
|
||||
|
||||
## loop-claude: the worker's claude compacts its context above 200k tokens, and `CLAUDE.md` → "Compact instructions" says what the summary keeps
|
||||
## loop-claude: the worker's claude compacts its context before it fills a 200k window, at about 170k tokens, and `CLAUDE.md` → "Compact instructions" says what the summary keeps
|
||||
|
||||
2026-10-27, claude through todo item 231, awaiting lilleman's yes. Serves goal 1.4, under goal 1.1's counter-signal. Item 231 asked for the best means to lower what a chunk spends on context, in dollars, then hours, with no loss of quality.
|
||||
2026-10-27, claude through todo item 231, awaiting lilleman's yes before the merge. Serves goal 1.4, under goal 1.1's counter-signal. Item 231 asked for the best means to lower what a chunk spends on context, in dollars, then hours, with no loss of quality.
|
||||
|
||||
Measured from loop-claude's archive over the 90 chunks with messages after the routing figures' reset of 2026-10-21, at the list prices read on 2026-10-26 (Opus 5.5: $4 per million input tokens, $5 and $8 for 5-minute and 1-hour cache writes, $0.20 for cache reads, $20 for output; no model but Haiku 5.5 charges more above 200k): $1,215, which is 0.86 of what the chunks' `cost-state` entries sum to, since some chunks' subagent transcripts are not in the archive. Worker main threads cost $375 (31%): 1-hour cache writes $149, cache reads $153, output $74. Subagents cost $840: 5-minute cache writes $379, output $274, cache reads $187, with the principles auditors at $274 over 342 runs, the stability reviewers $179 and general-purpose subagents $192. A worker starts at 41k tokens of context and peaks at a median 167k, one in ten past 358k, the largest at 848k: Claude Code compacts a model with a native 1M window at about 967k. The worker's messages above 200k were 32% of its messages and 55% of its cost.
|
||||
|
||||
Each option item 231 named, on those chunks:
|
||||
|
||||
- Compaction. Compacting the worker above 200k saves $78 of the workers' $375, 6% of all spend, at 0.5 compactions per chunk; above 150k $75 at 1.0; above 300k $54 at 0.2. It also bounds at 200k the 36 re-writes of a whole context, up to 785k tokens, after a gap longer than the cache's hour or a change of rung, which cost $62. Compacting subagents above 150k costs more than it saves, since a compaction reads the context once more and writes a summary, and subagents are short. A 200k window through `CLAUDE_CODE_DISABLE_1M_CONTEXT` would compact at the same point and also narrow every interactive session.
|
||||
- Compaction. Compacting the worker at 167k to 180k saves $77 to $78 of the workers' $375, 6% of all spend, at 0.7 to 0.8 compactions per chunk; at 150k $75 at 1.0, at 200k $78 at 0.5, at 300k $54 at 0.2. It also caps the 36 re-writes of a whole context after a gap longer than the cache's hour or a change of rung, $61 at up to 785k tokens each, at about $34. Compacting subagents at 150k costs more than it saves, since a compaction reads the context once more and writes a summary, and subagents are short. A 200k window through `CLAUDE_CODE_DISABLE_1M_CONTEXT` would compact at the same point and also narrow every interactive session.
|
||||
- A fresh context for the review phase, handed 60k tokens of facts, saves $39, which compaction covers, and loop-claude would need a second session per chunk.
|
||||
- Read with an offset and a limit, or Grep, in place of `cat`, `sed` and `head`: the worker's tool results were 13.2M characters, 65% of them Bash reads, but only 13% whole files; the rest were ranges. A character a worker reads costs about $8 per million tokens to write to the 1-hour cache and $0.20 per million at each later turn, so all the worker's reads cost about $45 and the whole-file ones about $6. A rule would change the tool, not how much is read.
|
||||
- Code-intelligence tooling: the `LSP` tool, with a language server per language on PATH, replaces a grep and the reads of candidate files with one lookup. Its ceiling is the same $45, and each machine would need a server per language (goal 2). Not tried.
|
||||
- Code-intelligence tooling: the `LSP` tool, with a language server per language on PATH, replaces a grep and the reads of candidate files with one lookup. Its ceiling is the same $45, and each machine would need a server per language (goal 2). Not tried, and not worth an item while the worker's reads stay under 4% of spend.
|
||||
- What a reviewer reads: the auditors read the project whole by design. Of their 🔴 and 🟡 findings since the reset, 47% named a file the chunk edited and 51% another file, so reading only the change would drop half of them; item 236 asks lilleman about that scope, and item 233 has one auditor read the project once per round.
|
||||
- The base context: every thread starts with `~/.claude/CLAUDE.md` (19k characters), `~/.claude/AGENTS.md` (11k, this repo's decisions, which Claude Code loads as user instructions into every project's sessions; item 52), the project's `AGENTS.md`, and, for the worker and general-purpose subagents, the skill listing (18k) and the agent listing (12k). Subagents' first messages wrote $97 of it; trimming the listings would save about $20.
|
||||
- The base context: every thread starts with `~/.claude/CLAUDE.md` (19k characters), `~/.claude/AGENTS.md` (11k, this repo's decisions, which Claude Code loads as user instructions into every project's sessions; item 52), the project's `AGENTS.md`, and, for the worker and general-purpose subagents, the skill listing (18k) and the agent listing (12k). Subagents' first messages wrote $97 of it; trimming the listings would save about $20, 2%, and is not worth an item: `disableBundledSkills` would also drop `/security-review`, the security pass of record.
|
||||
|
||||
Quality. 19 chunks compacted between 2026-10-10 and 2026-10-22, at 214k to 972k tokens, the windows Claude Code tuned then. Per 100 worker messages they took a median 3.6 review rounds past each pass's first against 4.0 for the 68 uncompacted chunks of 100 messages or more, and 13.9 🔴 and 🟡 findings against 16.6. 4 of 19 had an unfinished verdict against 3 of 68, each 8 to 10 hours after the compaction and followed by a finished verdict within minutes. Two summaries read whole kept the chunk's intent, files, errors and next step in 12k to 20k characters, and the worker resumed without re-reading. A compaction takes 51 to 83 seconds, under a minute per chunk at 0.5 each.
|
||||
Quality. 19 chunks compacted between 2026-10-10 and 2026-10-22, at 214k to 972k tokens, the windows Claude Code tuned then. Per 100 worker messages they took a median 3.6 review rounds past each pass's first against 4.0 for the 68 uncompacted chunks of 100 messages or more, and 13.9 🔴 and 🟡 findings against 16.6. 4 of 19 had an unfinished verdict against 3 of 68, each 8 to 10 hours after the compaction and followed by a finished verdict within minutes; the judge quoted the worker's own passages and the human's typed answers in them, never a summary. One cause was possible and is closed here: Claude Code writes the summary as a user entry, which `bin/claude_code/entries.py` read as the human's words, so the judge would see a `[human]` line of thousands of words and `/talk` would count it as typed; it now reads as Claude Code's. Whether compaction raises unfinished verdicts stays open until item 235 measures it. Two summaries read whole kept the chunk's intent, files, errors and next step in 12k to 20k characters, and the worker resumed without re-reading.
|
||||
|
||||
The window is handed to the worker, and the session /talk opens, as `CLAUDE_CODE_AUTO_COMPACT_WINDOW` (`bin/loop_claude/cycle/worker.py`), not set in `settings.json`: the archive measured loop-claude's workers, and interactive sessions are lilleman's. Subagents inherit it, and at 200k almost none compacts. A probe on 2026-10-27 showed that a `Compact instructions` section in a CLAUDE.md shapes the summary: a session whose CLAUDE.md asked the summary to end with its secret word did. So `CLAUDE.md` → "Compact instructions" names what a worker's summary keeps. Path-scoped rules leave the context at a compaction and return at the next matching read, and rule-hook holds each review launch to its rung whatever the summary keeps. Item 235 compares the first 20 chunks under the window with the 20 before.
|
||||
Hours. A chunk ran a median 0.7 hours from its first message to its last, one in ten past 12 hours, mostly waiting for the human or a usage limit. No option here changes that: a compaction takes 51 to 83 seconds, under a minute per chunk at 0.7 each, and a smaller context makes a turn no faster to notice. The hours lever is item 232, since waiting on subagents took 66% of a worker's active time.
|
||||
|
||||
The window is handed to the worker, and the session /talk opens, as `CLAUDE_CODE_AUTO_COMPACT_WINDOW=200000` (`bin/loop_claude/cycle/worker.py`), not set in `settings.json`: the archive measured loop-claude's workers, and interactive sessions are lilleman's. Claude Code compacts before a window fills: a 1M window at about 967k, and in a probe on 2026-10-27 a 100k window at 65k and 80k, so a 200k window compacts at about 170k. Subagents inherit it, and at 170k few compact. Another probe that day showed that a `Compact instructions` section in a CLAUDE.md shapes the summary: a session whose CLAUDE.md asked the summary to end with its secret word did. So `CLAUDE.md` → "Compact instructions" names what a worker's summary keeps. Path-scoped rules leave the context at a compaction and return at the next matching read, and rule-hook holds each review launch to its rung whatever the summary keeps. Item 235 compares the first 20 chunks under the window with the 20 before.
|
||||
|
||||
Valid while cache reads cost a twentieth of input and Claude Code's compaction keeps the worker's task.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user