Give record, verdict and judge one meaning each
This commit is contained in:
@@ -23,11 +23,11 @@ def archive(project_key: str, path: str, task: str, outcome: str, paths: Paths)
|
||||
if sibling != path and (unkept := mirror(pathlib.Path(sibling), folder / "session" / os.path.basename(sibling))):
|
||||
return unkept
|
||||
copy = folder / f"{hashlib.sha256(raw).hexdigest()}.jsonl"
|
||||
verdict = copy.with_suffix(".verdict.md")
|
||||
outcomes = copy.with_suffix(".outcomes.md")
|
||||
if copy.exists():
|
||||
return add_outcome(verdict, outcome)
|
||||
# The copy lands last, so a copy on disk always has its verdict and its session's files beside it.
|
||||
for dest, data in ((verdict, f"Task: {task}\n\n{outcome}\n".encode()), (copy, raw)):
|
||||
return add_outcome(outcomes, outcome)
|
||||
# The copy lands last, so a copy on disk always has its outcomes and its session's files beside it.
|
||||
for dest, data in ((outcomes, f"Task: {task}\n\n{outcome}\n".encode()), (copy, raw)):
|
||||
if unwritten := replace_file(dest, data):
|
||||
return unarchived(dest, unwritten.reason)
|
||||
print(f"transcript: {copy}", file=sys.stderr)
|
||||
@@ -38,13 +38,13 @@ def unarchived(where: object, why: str | None) -> Failure:
|
||||
return Failure(f"could not archive the transcript: {where}: {why}")
|
||||
|
||||
|
||||
def add_outcome(verdict: pathlib.Path, outcome: str) -> Failure | None:
|
||||
def add_outcome(outcomes: pathlib.Path, outcome: str) -> Failure | None:
|
||||
try:
|
||||
outcomes = verdict.read_bytes()
|
||||
kept = outcomes.read_bytes()
|
||||
except OSError as failure:
|
||||
return unarchived(failure.filename, failure.strerror)
|
||||
if unwritten := replace_file(verdict, outcomes + f"\n{outcome}\n".encode()):
|
||||
return unarchived(verdict, unwritten.reason)
|
||||
if unwritten := replace_file(outcomes, kept + f"\n{outcome}\n".encode()):
|
||||
return unarchived(outcomes, unwritten.reason)
|
||||
return None
|
||||
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@ relative to ~/code, or to / outside it. The session is deleted when its chunk fi
|
||||
interrupt, and as every cycle ends, Ctrl-C and a failure included, the session's transcript is
|
||||
copied to $LOOP_CLAUDE_TRANSCRIPTS/<key>/<chunk>/<sha256>.jsonl (default
|
||||
~/.claude/loop-claude-transcripts), named by its hash. <chunk> is the hash of the transcript's first
|
||||
line with a timestamp, the same for every cycle of a chunk. Beside the copy, <sha256>.verdict.md
|
||||
line with a timestamp, the same for every cycle of a chunk. Beside the copy, <sha256>.outcomes.md
|
||||
holds the verdict, and why the loop stopped. Claude Code keeps a folder per session beside its
|
||||
transcript, holding the subagents' transcripts among other files; that folder, and every other file
|
||||
named after the session except the transcript, are copied into <chunk>/session/. A file there is
|
||||
|
||||
Reference in New Issue
Block a user