Answer stability round 1: 0 🔴, 6 🟡; name no rung without evidence, test the prompt's task, premises and records and the replay's edges, and name a copy and its outcomes file in one module

This commit is contained in:
2026-10-15 09:16:11 +02:00
parent 5d49c24397
commit 015e39ae97
13 changed files with 94 additions and 36 deletions
+13
View File
@@ -5,6 +5,9 @@ import typing
from claude_code.transcript import first_timestamped_line
from project_key import project_key
# What an outcomes file's name ends with, in place of its transcript copy's .jsonl.
FILE_SUFFIX = ".outcomes.md"
def archive_root(home: pathlib.Path, env: typing.Mapping[str, str]) -> pathlib.Path:
"""Where loop-claude archives every project's chunks."""
@@ -18,3 +21,13 @@ def project_archive(checkout_root: str, home: pathlib.Path, env: typing.Mapping[
def chunk_folder(project_archive: pathlib.Path, transcript: bytes) -> pathlib.Path:
# Each chunk's first timestamped line is its own: a finished chunk's session is deleted, so the next chunk's transcript starts afresh.
return project_archive / hashlib.sha256(first_timestamped_line(transcript)).hexdigest()
def outcomes_of(copy: pathlib.Path) -> pathlib.Path:
"""The outcomes file beside a transcript copy; transcript_of is its inverse."""
return copy.with_suffix(FILE_SUFFIX)
def transcript_of(outcomes: pathlib.Path) -> pathlib.Path:
"""The transcript copy an outcomes file sits beside; outcomes_of is its inverse."""
return outcomes.with_name(outcomes.name.removesuffix(FILE_SUFFIX) + ".jsonl")
-2
View File
@@ -3,8 +3,6 @@ import re
from markdown_text import quoted
from utc_stamp import STAMPED
# What an outcomes file's name ends with, in place of its transcript copy's .jsonl.
FILE_SUFFIX = ".outcomes.md"
TASK = "Task: "
FINISHED = "Verdict: finished"
UNFINISHED = "Verdict: unfinished"
+2 -7
View File
@@ -1,9 +1,9 @@
import dataclasses
import pathlib
from transcript_archive.location import chunk_folder
from transcript_archive.location import chunk_folder, FILE_SUFFIX, transcript_of
from failure import Failure
from transcript_archive.outcomes import FILE_SUFFIX, FINISHED_AT, workers
from transcript_archive.outcomes import FINISHED_AT, workers
@dataclasses.dataclass(frozen=True)
@@ -41,11 +41,6 @@ def chunk_outcomes(folder: pathlib.Path) -> list[pathlib.Path]:
return sorted(folder.glob(f"*{FILE_SUFFIX}"))
def transcript_of(outcomes: pathlib.Path) -> pathlib.Path:
"""The transcript copy an outcomes file sits beside."""
return outcomes.with_name(outcomes.name.removesuffix(FILE_SUFFIX) + ".jsonl")
def read_threads(chunk: FinishedChunk) -> list[bytes] | Failure:
"""The worker's transcript, then each subagent's."""
try:
+3 -3
View File
@@ -3,11 +3,11 @@ import os
import pathlib
import sys
from transcript_archive.location import chunk_folder
from transcript_archive.location import chunk_folder, outcomes_of
from failure import Failure
from transcript_archive.outcomes import FILE_SUFFIX, TASK
from file_writes import make_private, replace_file
from claude_code.session import session_files
from transcript_archive.outcomes import TASK
from utc_stamp import utc
@@ -23,7 +23,7 @@ def archive(project_archive: pathlib.Path, path: str, task: str, outcome: str, a
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"
outcomes = copy.with_suffix(FILE_SUFFIX)
outcomes = outcomes_of(copy)
stamped = f"{utc(at)} {outcome}"
if copy.exists() and outcomes.exists():
return add_outcome(outcomes, stamped)