Answer architecture round 4: give the figures their own docs/reading-cost.md, and package the tool as bin/reading-cost with one module that reads loop-claude's archive
This commit is contained in:
@@ -0,0 +1,20 @@
|
||||
import pathlib
|
||||
import typing
|
||||
|
||||
from failure import Failure
|
||||
from loop_claude.transcript_archive import finished_chunks, FinishedChunk, utc
|
||||
from loop_claude.paths import paths_from
|
||||
from loop_claude.project.checkout import project_key
|
||||
|
||||
|
||||
def project_archive(checkout_root: str, home: pathlib.Path, env: typing.Mapping[str, str]) -> pathlib.Path:
|
||||
paths = paths_from(home, env)
|
||||
return paths.transcript_archive / project_key(checkout_root, paths.code)
|
||||
|
||||
|
||||
def read_threads(chunk: FinishedChunk) -> list[bytes] | Failure:
|
||||
"""The worker's transcript, then each subagent's."""
|
||||
try:
|
||||
return [path.read_bytes() for path in (chunk.transcript, *chunk.subagents)]
|
||||
except OSError as failure:
|
||||
return Failure(f"could not read {failure.filename}: {failure.strerror}")
|
||||
Reference in New Issue
Block a user