Files

31 lines
2.1 KiB
Python

"""The archive of loop-claude's transcripts: where each file lives, what it holds, and when a copy is replaced.
<archive root>/<project key>/<chunk>/<sha256>.jsonl
<archive root>/<project key>/<chunk>/<sha256>.outcomes.md
<archive root>/<project key>/<chunk>/session/...
<archive root>/<project key>/<chunk>/judge/<sha256>.json
- The archive root is $LOOP_CLAUDE_TRANSCRIPTS, or ~/.claude/loop-claude-transcripts (location.archive_root).
- The project key is the checkout's path relative to ~/code, or to / outside it (project_key.project_key).
- <chunk> is the hash of the transcript's first line with a timestamp (location.chunk_folder). It is the
same for every cycle of a chunk, and differs between chunks, since a finished chunk's session is deleted
and the next chunk's transcript starts afresh.
- <sha256>.jsonl is a copy of the session's transcript, named by the hash of its bytes, so each distinct
transcript is kept once.
- <sha256>.outcomes.md sits beside the copy and holds the task, then each outcome opened by its UTC time (outcomes.py).
A verdict, an interrupt or a quoted answer also records the setup that ran it, what was spent since the
previous outcome that recorded a spend, and any reversal the judge quoted (outcomes.Annotation).
- session/ holds every other file of the session, such as the subagents' transcripts, which Claude
Code keeps in a folder named after the session, beside the transcript. A file there is replaced only by a version that
grew from it. A file Claude Code rewrote whole lands beside its copy as <name>.<hash of its content>
(write.copy_for).
- judge/ holds each judge run an outcome names on its `Judge run:` line: the prompt the judge read and claude's
json reply, named by the hash of that content (judge_run.JudgeRun). judge-replay reads the prompt back.
compress-archives gzips each .jsonl 30 days after it last changed, as <name>.jsonl.gz beside its plain name,
and every reader reads it by that name (text_files.compressed); a plain file beside its gzip is the newer.
write.archive writes the layout, at every interrupt and as every cycle ends. read.py and the tools that
measure finished chunks read it.
"""