Answer the prose review's first round
This commit is contained in:
@@ -47,7 +47,7 @@ def mirror(source: pathlib.Path, dest: pathlib.Path) -> Failure | None:
|
||||
return None
|
||||
|
||||
|
||||
# Every chunk of a project reuses its session id, so a name can recur with other content: only a file that grew from its copy replaces it.
|
||||
# Every chunk of a project reuses its session id, so an earlier chunk's file can share a name with this one's.
|
||||
def copy_for(copy: pathlib.Path, data: bytes) -> pathlib.Path | None:
|
||||
if not copy.is_file():
|
||||
return copy
|
||||
|
||||
@@ -45,7 +45,7 @@ def run_cycle(cycle: Cycle) -> Stop | None:
|
||||
def stopped(cycle: Cycle, stop: Stop) -> Stop:
|
||||
path = transcript_file(cycle.session)
|
||||
failure = archive(cycle.project_key, path, f"Task: {cycle.task}\n\nStopped: {'Ctrl-C' if stop.code == 130 else stop.reason}", cycle.paths) if path else None
|
||||
# A stop for a failed archive has just failed the same way again.
|
||||
# When the stop is itself a failed archive, archiving again fails the same way: say it once.
|
||||
return Stop(1, f"{failure.reason}\n{stop.reason}".rstrip()) if failure and failure.reason != stop.reason else stop
|
||||
|
||||
|
||||
@@ -80,7 +80,7 @@ def rule(cycle: Cycle, transcript_path: str) -> Ruled | Stop:
|
||||
|
||||
|
||||
def ask(cycle: Cycle, transcript_path: str, question: str) -> Answered | Stop:
|
||||
# Archived before the interrupt appends to the transcript, so the copy carries the question beside it.
|
||||
# Archived now, so the transcript the question was asked on is kept with it; the interrupt appends the answer.
|
||||
if failure := archive(cycle.project_key, transcript_path, f"Task: {cycle.task}\n\nVerdict: interrupt\n\n{question}", cycle.paths):
|
||||
return Stop(1, failure.reason)
|
||||
return interrupt(cycle.root, cycle.session.id, cycle.models.worker, transcript_path, question, cycle.paths, cycle.effects) or Answered()
|
||||
|
||||
@@ -14,10 +14,11 @@ Each project has one session, named "A <key> loop-claude", where <key> is the ch
|
||||
relative to ~/code, or to / outside it. The session is deleted when its chunk finishes. At every
|
||||
interrupt, and as every cycle ends, Ctrl-C and a failure included, the session's transcript is
|
||||
copied to $LOOP_CLAUDE_TRANSCRIPTS/<key>/<sha256>.jsonl (default ~/.claude/loop-claude-transcripts),
|
||||
the verdict or the stop beside it in <sha256>.verdict.md, and the files of its session folder, the
|
||||
subagents' transcripts among them, to <key>/<session id>/; a file that does not extend its earlier
|
||||
copy, such as one an earlier chunk left, lands beside it as <name>.<sha256>, and <name> keeps the
|
||||
first copy.
|
||||
named by its hash. Beside it, <sha256>.verdict.md holds the verdict, or why the loop stopped.
|
||||
Claude Code keeps a folder per session beside its transcript, holding the subagents' transcripts
|
||||
among other files; those files are copied to <key>/<session id>/. A file there is replaced only by
|
||||
a version that grew from it. A file with other content under the same name, such as one an earlier
|
||||
chunk left, lands beside it as <name>.<hash of its content>.
|
||||
|
||||
Every claude loop-claude starts runs the project's model, saved per <key> in
|
||||
~/.claude/loop-claude-models.json and read each cycle; a project without an entry, as on its first
|
||||
|
||||
Reference in New Issue
Block a user