Files

25 lines
1.7 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/...
- 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).
write.archive writes the layout, at every interrupt and as every cycle ends. read.py and the tools that
measure finished chunks read it.
"""