Move the transcript, the session and the worker into their own modules

This commit is contained in:
2026-09-28 16:24:26 +02:00
parent 60c949b732
commit dfb7ae294c
10 changed files with 245 additions and 178 deletions
+5 -4
View File
@@ -11,9 +11,10 @@ its session next cycle; the next chunk starts a fresh session.
Cycles continue until that interrupt or Ctrl-C. Words: ~/.claude/CLAUDE.md → "Vocabulary".
Exit 1: no task, not inside a checkout, no premises, a models file it cannot read or write, claude
leaves no transcript, a reload with unreadable state, or the worker or the judge fails three times
running. A worker fails when claude exits non-zero, is killed, or ends without a result event; a
judge when its verdict misses a field or quotes nothing in the transcript.
leaves no transcript or one it cannot read, a reload with unreadable state, or the worker or the
judge fails three times running. A worker fails when claude cannot start, exits non-zero, is killed,
or ends without a result event; a judge when its verdict misses a field or quotes nothing in the
transcript.
Exit 2: the human is needed, to pick the model or answer an interrupt, and stdin or stdout is not a
terminal, or the interrupt ended without them typing anything. Rerunning resumes any open session.
@@ -34,7 +35,7 @@ Claude Code internals this rests on, observed on 2.1.282, the model catalog on 2
- The transcript is ~/.claude/projects/*/<session-id>.jsonl, one JSON object per line. A <session-id>/
folder and <session-id>.superseded-*/ and .orphaned-*.jsonl siblings belong to the same session.
- Claude Code writes "user" entries of its own into the transcript, and a `claude -p` prompt lands as one
with promptSource "sdk"; typed() tells a human's from them.
with promptSource "sdk"; UserEntryKind in transcript.py tells a human's from them.
- An "assistant" entry, in the transcript and in --output-format stream-json, carries message.content
parts of type "text" (text) and "tool_use" (name, input); stream-json ends with a "result" event.
- `claude -p --output-format json --json-schema` returns the verdict under "structured_output".