Answer the prose review's first round

This commit is contained in:
2026-10-02 16:09:39 +02:00
parent 8aa09a8f2b
commit 236ee08a59
6 changed files with 13 additions and 10 deletions
+1 -1
View File
@@ -16,6 +16,6 @@
- `loop-claude` retries a failed worker within its cycle.
- `loop-claude` counts an interrupt reply starting with `<` as typed.
- `loop-claude`'s judge sees a reply the human types while claude works, and an interrupt counts one as typed.
- `loop-claude` archives the raw `.jsonl` transcript at every interrupt and as every cycle ends, Ctrl-C and a failure included: one copy per distinct transcript, named by its SHA-256, with the verdict or the stop beside it in `<sha256>.verdict.md`, and the session folder's files, the subagents' transcripts among them, in `<session id>/` beside them; a transcript it cannot archive exits 1.
- `loop-claude` archives the raw `.jsonl` transcript at every interrupt and as every cycle ends, Ctrl-C and failures included. Each distinct transcript is kept once, named by its SHA-256, with `<sha256>.verdict.md` beside it holding the verdict or why the loop stopped. The subagents' transcripts and the session's other files go in `<session id>/` beside them. `loop-claude` exits 1 when it cannot archive.
- `loop-claude` exits 1 when it cannot delete a finished chunk's session, naming what to delete before rerunning; the next chunk would otherwise resume it.
- `loop-claude` keeps the mode of `~/.claude.json` and of its models file when it rewrites them, and creates the models file 0600.
+1 -1
View File
@@ -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
+2 -2
View File
@@ -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()
+5 -4
View File
@@ -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
+2 -2
View File
@@ -157,7 +157,7 @@ class Cycles(unittest.TestCase):
self.assertEqual(self.archived_verdicts(), ["Task: Do it.\n\nVerdict: finished\n"])
self.assertIsNone(session.transcript_file(self.session))
def test_an_unfinished_chunk_is_archived_and_keeps_its_session_and_the_next_cycle_resumes_it(self):
def test_an_unfinished_chunks_transcript_is_archived_and_the_next_cycle_resumes_its_session(self):
fake = FakeEffects(streams=[Worker(self.paths.claude_code_transcripts.parent)] * 2, claude=[judged("unfinished")] * 2)
self.assertIsNone(run.run_cycle(self.cycle(fake)))
self.assertTrue(session.transcript_file(self.session))
@@ -167,7 +167,7 @@ class Cycles(unittest.TestCase):
self.assertIn("--resume", workers[1])
self.assertEqual(self.archived_verdicts(), ["Task: Do it.\n\nVerdict: unfinished\n"] * 2)
def test_a_stopped_or_interrupted_cycle_archives_what_its_session_holds(self):
def test_a_cycle_stopped_by_a_failure_or_ctrl_c_archives_what_its_session_holds(self):
fake = FakeEffects(streams=[Worker(self.paths.claude_code_transcripts.parent)], claude=[ran(code=1)] * 3)
self.assertEqual(run.run_cycle(self.cycle(fake)).code, 1)
fake = FakeEffects(streams=[Worker(self.paths.claude_code_transcripts.parent)], claude=[KeyboardInterrupt()])
+2
View File
@@ -58,4 +58,6 @@
- **Clean up the rules, skills, agents, plan and decision log.** Goal 4.1.
- `docs/decisions.md`: order the entries and the `AGENTS.md` index by one key.
- `docs/decisions.md`: give the comprehension-floor and vocabulary entries a premise that has not expired. Both say "Valid until the next scoring run", and every run since has passed it. Put the floor's rule first and its runs' scores in a table.
- `docs/decisions.md`: have "the archive keeps the raw transcript" cover the session-folder copy, which keeps files by name and replaces one only with a version that grew from it.
- `session.py`: say in `delete_session`'s comment that the `.superseded-*` and `.orphaned-*` names come from older Claude Code versions.
- `systems-architect.md`: cut the "one home" line, and break Reasonability Review's steps 4 and 5 into shorter points each.