Gzip loop-claude's archive and the review folders 30 days after each file was last written, and read gzipped files by their plain name
CI / tests (pull_request) Failing after 2m59s
CI / tests (pull_request) Failing after 2m59s
This commit is contained in:
+16
-1
@@ -12,6 +12,7 @@ Each project principle states one rule that the decisions below apply; their ent
|
||||
|
||||
# Decisions no project principle covers
|
||||
|
||||
- archives: loop-claude's archive and the review folders keep every file, and gzip each one 30 days after it was last written
|
||||
- bin/: a test parametrizes its cases with `subTest`, since pytest's `parametrize` doesn't reach a unittest `TestCase`
|
||||
- bin/: the tools run on the host's Python, with no container, and so do their tests outside CI
|
||||
- bin/: the tools send no OTLP traces, logs or metrics, and loop-claude's archive holds the trace of each cycle
|
||||
@@ -58,6 +59,20 @@ Settling a call is the human's. The chunk that settles the calls cites, in `docs
|
||||
|
||||
# Decisions
|
||||
|
||||
## archives: loop-claude's archive and the review folders keep every file, and gzip each one 30 days after it was last written
|
||||
|
||||
2026-11-17, the worker of todo item 306. Serves goal 3, backing up the transcripts, and goal 1, whose measures read them: the routing figures, `reading-cost`, `score-outcomes` and both replays rest on the whole archive, so nothing is pruned. Measured on 2026-11-11, the archive held 6.3 GB and `~/.local/state/larv-review` 997 MB, both growing with every chunk.
|
||||
|
||||
- **What.** `compress-archives`, run daily from the crontab line in `README.md` → "Install", gzips each file last written over 30 days ago, as `<name>.gz` beside its plain name with the same times. In the archive it takes the transcripts, `*.jsonl`, which held 7.8 GB of its 7.9 GB on 2026-11-17; the outcomes files stay plain, since loop-claude appends to them every cycle. In the review folders it takes every file, since the probes' build output fills most of them.
|
||||
- **Safely.** It writes the gzip, reads it back, and removes the plain file only once the gzip reads back the same bytes and the plain file is unchanged since it was read. At the first failure it stops and exits 1, keeping that file plain, as a failed archive stops loop-claude.
|
||||
- **Readers.** Every tool reads a file by its plain name through `bin/text_files/compressed.py`, and a plain file beside its gzip wins, since it was written later. A session file that grows after its copy was compressed lands plain beside the gzip, which holds a prefix of it, so the next run's gzip loses nothing. A file rewritten whole in a review folder replaces what it held, as it did before.
|
||||
- **Why gzip.** Python 3.14's `compression.zstd` needs a Python built with libzstd, and this machine's lacks `_zstd`; gzip is in every build (goal 2). On 400 archived transcripts older than 30 days it kept 23% of their 609 MB, at about 29 MB a second.
|
||||
- **Why 30 days.** A chunk's files stop changing once it merges, and chunks run for hours or days. Since every reader reads both forms, the threshold sets only how long a file stays plain.
|
||||
- **Backup.** Both folders sit under `$HOME`, on the filesystem that holds `~/code` and `~/.claude` (ai-sandbox's `/dev/vda3` on 2026-11-17), so backing that volume up, as item 1 waits for, covers both. `README.md` → "Install" names them, since the review folders lie outside `~/.claude`.
|
||||
- **One writer.** Each file keeps one writer: the plain file the tool that writes it, its gzip `compress-archives`.
|
||||
|
||||
Valid while every reader of the two folders reads through `text_files/compressed.py`.
|
||||
|
||||
## bin/: a test parametrizes its cases with `subTest`, since pytest's `parametrize` doesn't reach a unittest `TestCase`
|
||||
|
||||
2026-11-12, lilleman, from the release review of 0.9.0. Applies `principles/technical-principles.md` → "Most code should have automated tests", whose "parametrize the cases" asks for one reported result per case. The tests are plain unittest, run by pytest, and pytest's `parametrize` doesn't work on a `TestCase` method; `subTest` is the unittest mechanism that does: each case reports and fails on its own, with its parameters named. A test that loops over its cases itself, outside `subTest`, or holds a branch, is still a breach. Valid while the tests stay in plain unittest.
|
||||
@@ -184,7 +199,7 @@ Valid while claude takes `--session-id` and resumes by it, and the human runs lo
|
||||
|
||||
## loop-claude: the archive keeps the raw transcript and each judge run, and a failed archive stops the loop
|
||||
|
||||
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. The judge's runs are archived too, as `judge/<sha256>.json` in the chunk's folder: the prompt it read and its json reply. Together they are its whole transcript, since it runs with no tools and one turn. A run is kept whole and deduplicated by hash, and the outcome of the verdict, interrupt or rejected reply it produced names it on a `Judge run:` line. Keeping it whole costs little: a prompt is at most `JUDGE_PROMPT_CHARS`, 400,000 characters. Measured 2026-11-17, the archive's 911 judge lines come to at most 0.36 GB of prompts, against 3.5 GB in its 1,211 transcript copies, the largest 23.4 MB. The judge is still priced from its `Judge cost:` line, which is claude's own total for the run, and the Spent block counts the live reply's tokens; the archived reply keeps its `usage` for a later reader, and nothing reads it back. `judge-replay` replays a verdict on its archived prompt where there is one. Valid while transcripts, and the judge's prompts, stay small enough to copy whole.
|
||||
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. The judge's runs are archived too, as `judge/<sha256>.json` in the chunk's folder: the prompt it read and its json reply. Together they are its whole transcript, since it runs with no tools and one turn. A run is kept whole and deduplicated by hash, and the outcome of the verdict, interrupt or rejected reply it produced names it on a `Judge run:` line. Keeping it whole costs little: a prompt is at most `JUDGE_PROMPT_CHARS`, 400,000 characters. Measured 2026-11-17, the archive's 911 judge lines come to at most 0.36 GB of prompts, against 3.5 GB in its 1,211 transcript copies, the largest 23.4 MB. The judge is still priced from its `Judge cost:` line, which is claude's own total for the run, and the Spent block counts the live reply's tokens; the archived reply keeps its `usage` for a later reader, and nothing reads it back. `judge-replay` replays a verdict on its archived prompt where there is one. Valid while transcripts, and the judge's prompts, stay small enough to copy whole; `archives: loop-claude's archive and the review folders keep every file, and gzip each one 30 days after it was last written` keeps the copies small on disk.
|
||||
|
||||
## loop-claude: each verdict records the claude-config release and commit that ran it, the raw tokens each thread spent by model and kind since the previous outcome that recorded a spend, and the human's typed answer the judge quotes as reversing a choice the worker took on its own recommendation
|
||||
|
||||
|
||||
Reference in New Issue
Block a user