Merge remote-tracking branch 'origin/main' into item-306
CI / tests (pull_request) Successful in 3m6s

This commit is contained in:
2026-11-17 02:50:24 +01:00
13 changed files with 312 additions and 38 deletions
+1
View File
@@ -2,6 +2,7 @@
## Unreleased
- review-replay and judge-replay keep each run, with its prompt, claude's exit code and stream, and the report they print, in a `replays/<tool>-<arguments>-<UTC stamp>/` folder of loop-claude's archive, so a replay that decided a rung can be checked and re-priced later; claude's json replies are now stream-json, whose last line is the reply.
- loop-claude's archive keeps each judge run's prompt and json reply in a judge/ folder beside its chunk's transcripts, and names the run on a `Judge run:` line of the outcome it produced; judge-replay replays a verdict on its archived prompt where the archive holds one.
- A plan kept as a Jira epic takes no changelog bullet: `todo-item finish` there needs neither `--changelog` nor `--no-changelog`, and refuses `--changelog`, since the issues' history is the changelog.
+1 -1
View File
@@ -228,7 +228,7 @@ Install puts only `loop-claude` on `PATH`; call the others by their path, such a
- `rest_client/` sends a JSON request to a REST API and reads its credentials from an env file, for `notifier`, `atlassian` and `record_store`.
- `review_rules/` holds the larv-review rules that several tools apply: its passes, its review folder, its round commit titles and the comprehension history's format.
- `routing_figures/` measures loop-claude's archive, and each of its projects' default branches, for loop-claude's routing calls.
- `rung_replay/` holds what `judge_replay` and `review_replay` share: the parallel replay runner, the argument reader, the candidate rungs and the exits, and `judge_replay`'s rung search. It reads `loop_claude`'s retry count and models file, and finds that file through `loop_state`'s paths.
- `rung_replay/` holds what `judge_replay` and `review_replay` share: the parallel replay runner, the argument reader, the candidate rungs and the exits, and `judge_replay`'s rung search. It reads `loop_claude`'s retry count and models file, and finds that file through `loop_state`'s paths. Its `archive.py` keeps each replay's runs and its report in a `replays/` folder of loop-claude's archive.
- `test_env.py` serves the tests.
- `text_files/` reads a Markdown file's `##` sections, quotes a passage and joins names into a list, stamps times in UTC, replaces a file in one step, private where it is new, and gzips a file beside its plain name, by which it reads it afterwards.
- `transcript_archive/` stores loop-claude's transcripts. Its `project_key.py` names each project's archive folder, loop-claude session and models-file entry.
+8 -7
View File
@@ -1,4 +1,4 @@
"""One `claude -p --output-format json` run, as loop-claude's judge and the replays start it."""
"""One `claude -p --output-format stream-json` run, as loop-claude's judge and the replays start it."""
import dataclasses
import subprocess
import typing
@@ -17,22 +17,23 @@ class Limited:
said: str
# The json reply claude_reply parses; no persistence, so its runs stay out of the session picker; no permission prompt, as no one answers it.
HEADLESS = ["--no-session-persistence", "--output-format", "json", "--permission-mode", "bypassPermissions"]
# No persistence, so these runs stay out of the session picker; Claude Code then writes no transcript, so stream-json, which prints one, lets a caller keep it. claude_reply reads the reply from the stream's last line. -p needs --verbose with stream-json. No permission prompt, as no one answers it.
HEADLESS = ["--no-session-persistence", "--output-format", "stream-json", "--verbose", "--permission-mode", "bypassPermissions"]
def claude_reply(claude: Claude, args: list[str], cwd: str, prompt: str, who: str) -> dict | Failure | Limited:
"""claude's json reply to `claude -p <args>` and HEADLESS, or why there is none; who, such as "the judge", names the run in the message for a non-zero exit or a reply that is no json."""
"""claude's reply to `claude -p <args>` and HEADLESS, the result event that ends its stream, or why there is none; who, such as "the judge", names the run in the message for a non-zero exit or a last line that isn't a json object."""
try:
proc = claude(["-p", *args, *HEADLESS], cwd, prompt)
except OSError as failure:
return Failure(f"could not start claude: {failure.strerror}")
reply = json_object(proc.stdout)
# The json output names the reset only in prose, such as "resets 7:40pm (Europe/Stockholm)", so its limit carries no reset time.
last = proc.stdout.strip().rpartition("\n")[2]
reply = json_object(last)
# The result event names the reset only in prose, such as "resets 7:40pm (Europe/Stockholm)", so its limit carries no reset time; the stream's rate_limit_event holds it as a time, which nothing reads here yet.
if reply is not None and hit_limit(reply):
return Limited(None, limit_said(reply))
if proc.returncode != 0:
return Failure(proc.stderr.strip() or f"{who} exited {proc.returncode}")
if reply is None:
return Failure(f"{who} printed no json reply; it printed: {proc.stdout.strip() or 'nothing'}")
return Failure(f"{who} printed no json reply; its last line was: {last or 'nothing'}")
return reply
+10 -3
View File
@@ -199,12 +199,19 @@ class ClaudeReply(unittest.TestCase):
return subprocess.CompletedProcess(args, 0, "{}", "")
reply.claude_reply(run, ["--tools", ""], "/r", "p", "the judge")
self.assertEqual(asked, [(["-p", "--tools", "", "--no-session-persistence", "--output-format", "json", "--permission-mode", "bypassPermissions"], "/r", "p")])
self.assertEqual(asked, [(["-p", "--tools", "", "--no-session-persistence", "--output-format", "stream-json", "--verbose", "--permission-mode", "bypassPermissions"], "/r", "p")])
def test_reads_the_reply_from_the_streams_last_line(self):
stream = "\n".join(json.dumps(event) for event in ({"type": "system", "subtype": "init"}, {"type": "assistant"}, {"type": "result", "result": "ok"}))
self.assertEqual(reply.claude_reply(self.claude((0, stream + "\n", "")), [], "/r", "p", "the judge"), {"type": "result", "result": "ok"})
def test_a_stream_that_ends_in_no_json_names_only_its_last_line(self):
self.assertEqual(reply.claude_reply(self.claude((0, '{"type": "system"}\nWarning: bye\n', "")), [], "/r", "p", "the judge"), Failure("the judge printed no json reply; its last line was: Warning: bye"))
def test_returns_the_json_reply_a_usage_limit_whatever_the_exit_code_or_why_there_is_none(self):
self.assertEqual(reply.claude_reply(self.claude((0, '{"result": "ok"}', "")), [], "/r", "p", "the judge"), {"result": "ok"})
self.assertEqual(reply.claude_reply(self.claude((0, "Warning: hook said hi\n", "")), [], "/r", "p", "the judge"), Failure("the judge printed no json reply; it printed: Warning: hook said hi"))
self.assertEqual(reply.claude_reply(self.claude((0, "", "")), [], "/r", "p", "the judge"), Failure("the judge printed no json reply; it printed: nothing"))
self.assertEqual(reply.claude_reply(self.claude((0, "Warning: hook said hi\n", "")), [], "/r", "p", "the judge"), Failure("the judge printed no json reply; its last line was: Warning: hook said hi"))
self.assertEqual(reply.claude_reply(self.claude((0, "", "")), [], "/r", "p", "the judge"), Failure("the judge printed no json reply; its last line was: nothing"))
limit = json.dumps({"type": "result", "api_error_status": 429, "result": "You've hit your limit"})
self.assertEqual(reply.claude_reply(self.claude((1, limit, "")), [], "/r", "p", "the judge"), reply.Limited(None, "You've hit your limit"))
self.assertEqual(reply.claude_reply(self.claude((2, "", " ")), [], "/r", "p", "the judge"), Failure("the judge exited 2"))
+10 -2
View File
@@ -5,7 +5,7 @@ usage: judge-replay <model>
<model> is a project model on the routing ladder this setup ships, such as claude-opus-5-5. The tool replays the
verdicts archived for the projects that ~/.claude/loop-claude-models.json runs on it: the latest
15 of each kind, finished, unfinished, interrupt and quoted answer. Where the archive kept the judge's own
prompt (docs/decisions.md → `loop-claude: the archive keeps the raw transcript and each judge run`), the
prompt (docs/decisions.md → `loop-claude: the archive keeps the raw transcript and each judge run, …`), the
replay hands the judge that prompt, which holds what the judge read then. For a verdict from before the
archive kept it, the replay builds the prompt from the transcript copy beside the verdict, with the task,
premises and records each project holds now.
@@ -27,6 +27,11 @@ JUDGE_REPLAYED in bin/loop_claude/routing.py, which routes that model's judge. j
keeps the judge to its own model's rungs; a rung above them that misses no interrupt is the
evidence to let the judge climb onto it.
It keeps each run and the report it prints in loop-claude's archive, in
replays/judge-replay-<model>-<UTC stamp>/ under ~/.claude/loop-claude-transcripts or $LOOP_CLAUDE_TRANSCRIPTS.
A run's .jsonl file starts with a line holding claude's arguments, working directory, prompt, exit code and
stderr, then holds claude's stream-json output; result.md holds the report.
Like the loop, it tries a judge three times running before it counts the reply as failed. A
verdict whose project, transcript or archived judge run cannot be read replays as failed too. Exit 1, saying why, on
bad arguments, an unreadable archive or models file, no archived verdict of the model's projects,
@@ -37,6 +42,7 @@ import typing
from transcript_archive.location import archive_root, transcript_of
from transcript_archive.read import archived_outcomes
from rung_replay.archive import archiving, print_report, replay_folder
from rung_replay.command import arguments_or_exit, down_from, failed, limited_exit, projects_on
from loop_claude.cycle.judge import Brief, judge_archived, judge_once
from judge_replay.replay import Case, case_from, Kind, report, reproduced, sample, verdict_kind
@@ -75,12 +81,14 @@ def main(argv: list[str], env: typing.Mapping[str, str], home: pathlib.Path, eff
if not cases:
return failed(TOOL, f"no archived verdicts of projects on {project.model} in {archive_root(home, env)}; run loop-claude on a project on that model first")
cases = sample(cases, PER_KIND)
folder = replay_folder(archive_root(home, env), TOOL, argv, effects.now())
effects = archiving(effects, folder)
reference = Rung(project.model, REFERENCE_EFFORT)
# The candidates stop at the lowest rung a worker routes to: no route uses a rung below it for the judge.
replay = replayed(cases, reference, down_from(ladder, project, ladder.lowest_worker_rung(project)), lambda found, rung: rule(found, rung, home, effects), reproduced, "verdicts", climbs(ladder, project, reference))
if isinstance(replay, Limited):
return limited_exit(TOOL, replay)
print(report(project.model, reference, cases, replay))
print_report(folder, report(project.model, reference, cases, replay))
return 0
+10 -2
View File
@@ -140,7 +140,7 @@ class Main(unittest.TestCase):
result = reply(Rung(args[args.index("--model") + 1], args[args.index("--effort") + 1]), "said Verdict: interrupt" in prompt.rsplit("latest last:", 1)[-1])
return subprocess.CompletedProcess(args, 0, json.dumps(result), "")
effects = Effects(claude=claude, claude_on_terminal=unused, discard_typed=unused, dm=unused, execv=unused, git=unused, input=unused, local_time=unused, memory=unused, now=unused, on_terminal=unused, python=unused, sleep=unused, stream_claude=unused, tmux=unused, tmux_on_terminal=unused)
effects = Effects(claude=claude, claude_on_terminal=unused, discard_typed=unused, dm=unused, execv=unused, git=unused, input=unused, local_time=unused, memory=unused, now=lambda: 1790000000.0, on_terminal=unused, python=unused, sleep=unused, stream_claude=unused, tmux=unused, tmux_on_terminal=unused)
out, err = io.StringIO(), io.StringIO()
with contextlib.redirect_stdout(out), contextlib.redirect_stderr(err):
code = main.main(argv, {}, self.home, effects)
@@ -175,6 +175,14 @@ class Main(unittest.TestCase):
# The replay shows the judge the whole transcript, with no step-up marked in it.
self.assertNotIn("[step]", self.prompts[0])
def test_keeps_each_run_and_the_printed_report_in_one_folder_of_the_archive_beside_the_projects(self):
code, out, err = self.run_main(["claude-opus-5-5"], lambda rung, interrupted: self.verdict(interrupted, f"said {INTERRUPTED if interrupted else FINISHED}"))
self.assertEqual(code, 0, err)
folder = self.home / ".claude" / "loop-claude-transcripts" / "replays" / "judge-replay-claude-opus-5-5-20260921T141320Z"
self.assertEqual((folder / "result.md").read_text(encoding="utf-8"), out)
runs = [json.loads(path.read_text(encoding="utf-8").splitlines()[0]) for path in folder.glob("*.jsonl")]
self.assertEqual({run["prompt"] for run in runs}, set(self.prompts))
def test_hands_the_judge_the_prompt_the_archive_kept_and_rebuilds_the_prompt_of_a_verdict_with_none(self):
kept = self.home / ".claude" / "loop-claude-transcripts" / "proj" / "c1"
prompt = "From the goals file, OLD premises\n\nThe records: none\n\nThe task the worker was given:\nDo it.\n\nWhat the worker did and said, what the human typed on [human] lines and what loop-claude told it on [loop] lines, latest last:\nsaid Verdict: finished\n\nOLD rules"
@@ -294,7 +302,7 @@ class JudgeArchivedRuns(unittest.TestCase):
cwds.append(cwd)
return subprocess.CompletedProcess(args, 0, json.dumps({"type": "result", "structured_output": output, "total_cost_usd": 0.25}), "")
effects = Effects(claude=claude, claude_on_terminal=unused, discard_typed=unused, dm=unused, execv=unused, git=unused, input=unused, local_time=unused, memory=unused, now=unused, on_terminal=unused, python=unused, sleep=unused, stream_claude=unused, tmux=unused, tmux_on_terminal=unused)
effects = Effects(claude=claude, claude_on_terminal=unused, discard_typed=unused, dm=unused, execv=unused, git=unused, input=unused, local_time=unused, memory=unused, now=lambda: 1790000000.0, on_terminal=unused, python=unused, sleep=unused, stream_claude=unused, tmux=unused, tmux_on_terminal=unused)
grounds = grounds_of(prompt, self.ENTRIES)
return (grounds if isinstance(grounds, Failure) else judge_archived("/code/p", prompt, grounds, len(self.ENTRIES), REFERENCE, effects)), cwds
+1 -1
View File
@@ -699,7 +699,7 @@ class Cycles(unittest.TestCase):
self.assertEqual(run.roles(), ["worker", "judge", "judge", "judge"])
self.assertEqual(run.sleeps, [60, 60])
self.assertIn("retrying the judge in a minute: judge down", run.stderr)
self.assertIn("retrying the judge in a minute: the judge printed no json reply; it printed: nothing\n", run.stderr)
self.assertIn("retrying the judge in a minute: the judge printed no json reply; its last line was: nothing\n", run.stderr)
self.assertEqual(run.stderr.strip().splitlines()[-1], 'the judge failed three times running: the judge\'s reply has no answer of type string')
def test_waits_out_a_usage_limit_which_ends_a_run_of_failures(self):
+10 -2
View File
@@ -45,6 +45,11 @@ replay, and runs no SubagentStart hook there. So the replay without CLAUDE.md tu
instruction files off in its settings and opens the prompt with what the hook hands a reviewer, and
closes it with the header's line on the project principles.
It keeps each run, a reviewer's tool calls included, and the report it prints in loop-claude's archive, in
replays/review-replay-<pass>-<model>[-omit-claude-md]-<UTC stamp>/ under ~/.claude/loop-claude-transcripts
or $LOOP_CLAUDE_TRANSCRIPTS. A run's .jsonl file starts with a line holding claude's arguments, working
directory, prompt, exit code and stderr, then holds claude's stream-json output; result.md holds the report.
Like the loop, it tries claude three times running before it counts a reply as failed. A failed
review or match leaves its round out, except on a rung below the project's, where it finds
none. Exit 1, saying why, on bad arguments, an unreadable archive or models file, no archived
@@ -56,6 +61,7 @@ import typing
from transcript_archive.location import archive_root
from review_replay.rounds import archived_rounds, Round, sample
from rung_replay.archive import archiving, print_report, replay_folder
from rung_replay.command import arguments_or_exit, failed, limited_exit
from review_replay.replay import codes_found, findings_replayed
from review_replay.omit_comparison import compared
@@ -89,11 +95,13 @@ def main(argv: list[str], env: typing.Mapping[str, str], home: pathlib.Path, eff
if not codes:
return failed(TOOL, f"no archived {reviewed} round of projects on {project.model} in {archive_root(home, env)} holds a 🔴 or 🟡 on code it can find")
chosen = sample(list(codes), LATEST)
folder = replay_folder(archive_root(home, env), TOOL, argv, effects.now())
effects = archiving(effects, folder)
if without:
report = compared(reviewed, project, chosen, lambda found, bare: findings_replayed(found, codes[found], project, project, home, effects, bare))
if isinstance(report, Limited):
return limited_exit(TOOL, report)
print(report)
print_report(folder, report)
return 0
def replay_one(found: Round, rung: Rung) -> set[int] | Failure | Limited:
@@ -105,7 +113,7 @@ def main(argv: list[str], env: typing.Mapping[str, str], home: pathlib.Path, eff
recall = recalled(chosen, ladder, project, replay_one, f"{reviewed} rounds")
if isinstance(recall, Limited):
return limited_exit(TOOL, recall)
print(recall_report(reviewed, project, recall))
print_report(folder, recall_report(reviewed, project, recall))
return 0
+11 -1
View File
@@ -268,12 +268,22 @@ class Main(unittest.TestCase):
result = result if "api_error_status" in result else {"type": "result", "structured_output": {"found": [n + 1 for n in result["found"]]}}
return subprocess.CompletedProcess(args, 0, json.dumps(result), "")
effects = Effects(claude=claude, claude_on_terminal=unused, discard_typed=unused, dm=unused, execv=unused, git=system_effects().git, input=unused, local_time=unused, memory=unused, now=unused, on_terminal=unused, python=unused, sleep=unused, stream_claude=unused, tmux=unused, tmux_on_terminal=unused)
effects = Effects(claude=claude, claude_on_terminal=unused, discard_typed=unused, dm=unused, execv=unused, git=system_effects().git, input=unused, local_time=unused, memory=unused, now=lambda: 1790000000.0, on_terminal=unused, python=unused, sleep=unused, stream_claude=unused, tmux=unused, tmux_on_terminal=unused)
out, err = io.StringIO(), io.StringIO()
with contextlib.redirect_stdout(out), contextlib.redirect_stderr(err):
code = main.main(argv, {}, self.home, effects)
return code, out.getvalue(), err.getvalue()
def test_keeps_each_reviewer_and_match_run_and_the_printed_report_in_one_folder_of_the_archive(self):
code, out, err = self.run_main(["stability", "claude-opus-5-5"], lambda rung: {"found": [0, 1]})
self.assertEqual(code, 0, err)
folder = self.home / ".claude" / "loop-claude-transcripts" / "replays" / "review-replay-stability-claude-opus-5-5-20260921T141320Z"
self.assertEqual((folder / "result.md").read_text(encoding="utf-8"), out)
runs = [json.loads(path.read_text(encoding="utf-8").splitlines()[0]) for path in folder.glob("*.jsonl")]
# A run that repeats another word for word, as the fakes' do, is kept once.
self.assertEqual({run["prompt"] for run in runs if "--agent" in run["args"]}, {prompt for *_, prompt, _ in self.reviews})
self.assertTrue(any("--json-schema" in run["args"] for run in runs))
def test_without_claude_md_replays_each_round_three_times_with_it_and_once_without_on_the_project_rung(self):
finds = iter(([0, 1], [0], [0, 1], [1]))
code, out, err = self.run_main(["stability", "claude-opus-5-5", "--omit-claude-md"], lambda rung: {"found": next(finds)})
+48
View File
@@ -0,0 +1,48 @@
"""Keeps each run of judge-replay and review-replay, and the report each prints, in loop-claude's archive: docs/decisions.md → `loop-claude: the archive keeps the raw transcript and each judge run, …`."""
import dataclasses
import hashlib
import json
import pathlib
import re
import subprocess
import sys
import time
from loop_effects.effects import Effects
# The type of the first line of a run's file, which holds what the stream lacks: claude's arguments, working directory, prompt, exit code and stderr. No event claude writes has this type.
HEADER = "replay_run"
RESULT = "result.md"
def replay_folder(root: pathlib.Path, tool: str, argv: list[str], now: float) -> pathlib.Path:
"""The folder a replay of tool, run with argv at now, keeps its runs and its result in, under the archive at root. It holds no outcomes file, so no reader of loop-claude's archive takes it for a chunk's."""
name = "-".join([tool, *(arg.lstrip("-") for arg in argv), time.strftime("%Y%m%dT%H%M%SZ", time.gmtime(now))])
return root / "replays" / re.sub(r"[^A-Za-z0-9._-]", "_", name)
def archiving(effects: Effects, folder: pathlib.Path) -> Effects:
"""effects whose claude also writes each run into folder: a header line, then the stream claude printed. A run is kept whether it failed or not, and a run that repeats another word for word is kept once. A folder that can't be written is reported on stderr, and the replay goes on."""
claude = effects.claude
def run(args: list[str], cwd: str, prompt: str) -> subprocess.CompletedProcess[str]:
proc = claude(args, cwd, prompt)
content = "\n".join([json.dumps({"type": HEADER, "args": args, "cwd": cwd, "prompt": prompt, "returncode": proc.returncode, "stderr": proc.stderr}, ensure_ascii=False), proc.stdout])
try:
folder.mkdir(mode=0o700, parents=True, exist_ok=True)
(folder / f"{hashlib.sha256(content.encode()).hexdigest()}.jsonl").write_text(content, encoding="utf-8")
except OSError as failure:
print(f"could not keep the run in {folder}: {failure}", file=sys.stderr, flush=True)
return proc
return dataclasses.replace(effects, claude=run)
def print_report(folder: pathlib.Path, report: str) -> None:
"""Prints the report a replay ends with, and keeps it in folder, beside the runs."""
print(report)
try:
folder.mkdir(mode=0o700, parents=True, exist_ok=True)
(folder / RESULT).write_text(report + "\n", encoding="utf-8")
except OSError as failure:
print(f"could not keep the result in {folder}: {failure}", file=sys.stderr, flush=True)
+89
View File
@@ -1,12 +1,17 @@
import contextlib
import io
import json
import pathlib
import subprocess
import sys
import tempfile
import unittest
sys.path.insert(0, str(pathlib.Path(__file__).resolve().parents[1]))
from rung_replay.archive import archiving, print_report, replay_folder
from rung_replay.command import down_from
from loop_effects.effects import Effects
from failure import Failure
from rung_replay.search import first_reply, Miss, Replay, replayed, Tried
from claude_code.reply import Limited
@@ -79,5 +84,89 @@ class DownFrom(unittest.TestCase):
self.assertEqual(down_from(LADDER, REFERENCE, MIDDLE), [REFERENCE, MIDDLE])
def effects(claude):
return Effects(claude=claude, **{name: unused for name in Effects.__dataclass_fields__ if name != "claude"})
def unused(*_):
raise AssertionError("not called")
class ArchivedRuns(unittest.TestCase):
def setUp(self):
self.folder = pathlib.Path(self.enterContext(tempfile.TemporaryDirectory())) / "replays" / "tool-1"
def run_archived(self, replies):
return archiving(effects(lambda args, cwd, prompt: replies.pop(0)), self.folder).claude
def kept(self):
return sorted(self.folder.glob("*.jsonl"))
def test_keeps_each_run_as_the_prompt_it_read_then_the_stream_it_printed_and_returns_claudes_process_as_it_was(self):
stream = '{"type": "system"}\n{"type": "result", "result": "ok"}\n'
proc = subprocess.CompletedProcess(["claude"], 0, stream, "")
run = self.run_archived([proc, subprocess.CompletedProcess(["claude"], 0, stream, "")])
self.assertIs(run(["-p", "--agent", "prose-reviewer"], "/clone", "Review it."), proc)
run(["-p", "--agent", "prose-reviewer"], "/clone", "Review that.")
first, second = (path.read_text(encoding="utf-8").splitlines() for path in self.kept())
prompts = sorted((json.loads(lines[0]) for lines in (first, second)), key=lambda header: header["prompt"])
self.assertEqual(prompts, [
{"type": "replay_run", "args": ["-p", "--agent", "prose-reviewer"], "cwd": "/clone", "prompt": prompt, "returncode": 0, "stderr": ""} for prompt in ("Review it.", "Review that.")
])
self.assertEqual(first[1:], stream.splitlines())
def test_keeps_the_runs_private_and_the_prompt_readable(self):
self.run_archived([subprocess.CompletedProcess(["claude"], 0, "{}", "")])([], "/r", "Läs den.")
self.assertEqual(self.folder.stat().st_mode & 0o777, 0o700)
self.assertIn("Läs den.", self.kept()[0].read_text(encoding="utf-8"))
def test_keeps_a_run_that_failed_and_a_run_repeated_once(self):
failed = subprocess.CompletedProcess(["claude"], 1, "half a stream", "boom")
run = self.run_archived([failed, failed])
run([], "/r", "p")
run([], "/r", "p")
self.assertEqual(len(self.kept()), 1)
kept = self.kept()[0].read_text(encoding="utf-8").splitlines()
self.assertEqual((json.loads(kept[0])["returncode"], json.loads(kept[0])["stderr"], kept[1]), (1, "boom", "half a stream"))
def test_keeps_nothing_where_claude_did_not_start_and_says_where_it_could_not_keep_a_run(self):
def missing(args, cwd, prompt):
raise FileNotFoundError(2, "No such file or directory")
with self.assertRaises(FileNotFoundError):
archiving(effects(missing), self.folder).claude([], "/r", "p")
self.assertFalse(self.folder.exists())
# A file where the folder's parent should be.
self.folder.parent.parent.mkdir(exist_ok=True)
self.folder.parent.write_text("")
proc = subprocess.CompletedProcess(["claude"], 0, "{}", "")
err = io.StringIO()
with contextlib.redirect_stderr(err):
self.assertIs(self.run_archived([proc])([], "/r", "p"), proc)
self.assertIn(f"could not keep the run in {self.folder}: ", err.getvalue())
def test_prints_the_report_and_keeps_it_beside_the_runs(self):
out = io.StringIO()
with contextlib.redirect_stdout(out):
print_report(self.folder, "The report.")
self.assertEqual(out.getvalue(), "The report.\n")
self.assertEqual((self.folder / "result.md").read_text(encoding="utf-8"), "The report.\n")
self.assertEqual(self.folder.stat().st_mode & 0o777, 0o700)
def test_says_on_stderr_where_it_could_not_keep_the_report_and_still_prints_it(self):
self.folder.parent.parent.mkdir(exist_ok=True)
self.folder.parent.write_text("")
out, err = io.StringIO(), io.StringIO()
with contextlib.redirect_stdout(out), contextlib.redirect_stderr(err):
print_report(self.folder, "The report.")
self.assertEqual(out.getvalue(), "The report.\n")
self.assertIn(f"could not keep the result in {self.folder}: ", err.getvalue())
def test_names_the_folder_by_the_tool_its_arguments_and_the_second_in_utc_under_replays(self):
root = pathlib.Path("/archive")
self.assertEqual(replay_folder(root, "review-replay", ["stability", "claude-opus-5-5", "--omit-claude-md"], 1790000000.0), root / "replays" / "review-replay-stability-claude-opus-5-5-omit-claude-md-20260921T141320Z")
self.assertEqual(replay_folder(root, "judge-replay", ["a/b c"], 0.0), root / "replays" / "judge-replay-a_b_c-19700101T000000Z")
if __name__ == "__main__":
unittest.main()
+9 -1
View File
@@ -198,10 +198,18 @@ Valid while `~/.claude` is a checkout of this repo.
Valid while claude takes `--session-id` and resumes by it, and the human runs loop-claude where tmux is installed.
## loop-claude: the archive keeps the raw transcript and each judge run, and a failed archive stops the loop
## loop-claude: the archive keeps the raw transcript and each judge run, a failed archive stops the loop, and a replay keeps its runs and report in a replays/ folder of the archive
2026-09-28, lilleman. Serves goals 1 and 3: saving each transcript locally is the first step of backing it up, and it shows afterwards what an unattended run did. A copy of the `.jsonl`, deduplicated by content hash, with its outcomes beside it; a rendering drops tool results, and a second-resolution stamp names two states within one second as one file. A failed archive exits 1, since a loop that loses its record silently fails the backup goal. The judge's runs are archived too, as `judge/<sha256>.json` in the chunk's folder: the prompt it read and its json reply. Together they are its whole transcript, since it runs with no tools and one turn. A run is kept whole and deduplicated by hash, and the outcome of the verdict, interrupt or rejected reply it produced names it on a `Judge run:` line. Keeping it whole costs little: a prompt is at most `JUDGE_PROMPT_CHARS`, 400,000 characters. Measured 2026-11-17, the archive's 911 judge lines come to at most 0.36 GB of prompts, against 3.5 GB in its 1,211 transcript copies, the largest 23.4 MB. The judge is still priced from its `Judge cost:` line, which is claude's own total for the run, and the Spent block counts the live reply's tokens; the archived reply keeps its `usage` for a later reader, and nothing reads it back. `judge-replay` replays a verdict on its archived prompt where there is one. Valid while transcripts, and the judge's prompts, stay small enough to copy whole; `archives: gzip each transcript in loop-claude's archive and each file in the review folders 30 days after it last changed, keeping all of them` keeps the copies small on disk.
2026-11-17, lilleman, todo item 304. Serves goals 1.4 and 3. `judge-replay` and `review-replay` each decide which rung a review pass or the judge may run on, so their runs stay checkable and re-priceable once a decision is questioned. They keep their runs in `replays/<tool>-<arguments>-<UTC stamp>/` in the archive's root:
- One `<sha256>.jsonl` file per run, whether it failed or not. It starts with a header line holding claude's arguments, working directory, prompt, exit code and stderr, and goes on with claude's stream-json output as printed, whose last line is the reply the replay read. A reviewer's tool calls are in it.
- `result.md`, the report the tool printed.
- A run that repeats another word for word is kept once. A folder that can't be written is reported on stderr and doesn't stop the replay.
`claude_reply` reads stream-json for every caller, so the judge's runs are streams too; the archive's `JudgeRun` stays as it was, since a judge has no tools and one turn. Valid while transcripts stay small enough to copy whole.
## loop-claude: each verdict records the claude-config release and commit that ran it, the raw tokens each thread spent by model and kind since the previous outcome that recorded a spend, and the human's typed answer the judge quotes as reversing a choice the worker took on its own recommendation
2026-11-12, lilleman, todo item 305. Serves goals 1, 1.2 and 1.4. A change to the setup can be judged only by comparing chunks run before it with chunks run after, so each verdict, interrupt and quoted answer in loop-claude's archive records three things beside its judge lines.
+104 -18
View File
@@ -13,7 +13,6 @@
| ID | Release | Blocked by | Exempt | Item | L | E | I | R | S | Moves | Score |
|---|---|---|---|---|---|---|---|---|---|---|---|
| 306 | 0.12.0 | | | **Set a strategy that keeps loop-claude's archive and larv-review's review folders backed up and small over the years, compressing older entries without losing any.** | 3 | 2 | 4 | 7 | 5 | 3 by 5 | 3.9 |
| 304 | 0.12.0 | | defect | **Archive each review-replay and judge-replay run's transcript beside its result, so a replay that decided a rung can be checked and re-priced later.** | 2 | 2 | 2 | 4 | 3 | 1.4 by 2, 3 by 2 | 3.8 |
| 387 | 0.12.0 | | | **Bind a project's rung to its ladder in one value, so the routing functions and `Cycle` take one argument for both.** | 3 | 1 | 3 | 5 | 5 | code health by 3 | 2.9 |
| 338 | 0.12.0 | | owner | **Script each step that 0.9.0's chunks repeated by hand and a program can compute, filing one item per step, and file this audit again for the next release.** | 1 | 2 | 1 | 2 | 2 | 1.4 by 3, 1.5 by 3 | 2.3 |
| 288 | 0.12.0 | | | **Point the two reading-cost decisions at code health and goal 1.4's counter-signal, in place of the goal 1.1 they cite.** | 1 | 2 | 1 | 2 | 1 | code health by 1, 1.4 by 1 | 2.2 |
@@ -98,22 +97,6 @@ Touches:
- `skills/larv-review/SKILL.md`: `## 6. Wrap up` (small)
- `README.md`: `## Install` (small)
### 304. Archive each review-replay and judge-replay run's transcript beside its result, so a replay that decided a rung can be checked and re-priced later.
Today `review-replay` and `judge-replay` leave no transcript: both run claude through `claude_reply` in `bin/claude_code/reply.py`, whose `--no-session-persistence` makes Claude Code write no session file, as item 303 describes for the judge. A replay decides which rung a review pass or the judge may run on (`routing: a review pass runs below the project's rung only on a rung that a replay of its rounds shows…`, and the judge's rung on `JUDGE_REPLAYED`), so the runs behind a routing decision can't be read again, re-priced or re-scored once the decision is questioned. Goal 3 asks for the transcripts of unattended runs, the bench's included, to be backed up; `workflow-bench/bench.py` already keeps its claude stream in `logs/`.
Unlike the judge, a replayed reviewer uses tools over several turns, so its transcript is more than its prompt and reply. Recommended: have `claude_reply` take `--output-format stream-json --verbose` in place of `json`, keep `--no-session-persistence`, write the stream where the replay keeps its result, and read the reply from the stream's last `result` event. That also gives item 303 the judge's stream for free, so build on 303's archive layout and do both callers through the one runner.
Touches:
- `bin/claude_code/reply.py`: `claude_reply`
- `bin/claude_code/test_claude_code.py`
- `bin/review_replay/replay.py`: `reviewed_in`, `match`, `copy_reports`
- `bin/review_replay/test_review_replay.py`
- `bin/judge_replay/main.py`: `rule`
- `bin/judge_replay/test_judge_replay.py`
- `bin/loop_claude/cycle/judge.py`: `judge_args`, `run_judge` (small)
### 387. Bind a project's rung to its ladder in one value, so the routing functions and `Cycle` take one argument for both.
Filed by PR #553, which made the routing ladder a file a project may replace. Its stability round 1 found two places the comprehension seats name as hard, touched and no easier to read: `bin/loop_claude/routing.py` `unfinished_route` took `ladder` as a fourth parameter, and `Cycle` in `bin/loop_claude/cycle/run.py` gained the field `ladder`. The patch threaded the ladder as an argument, since a wider change did not fit a patch cut during an outage.
@@ -153,12 +136,26 @@ Both `docs/decisions.md` entries under `reading cost: a rise is …` and `readin
Open before building: the lossless markdown is less readable than the portable one (upstream larvit/adf-codec#185), and agents and the judge read the plan's details from it. Decide how a detail stays readable, for example by reading lossless and showing a person a portable view. Test that an unedited issue and page save back identical. The item ships alone because its R is above 5.
Touches:
- `bin/plan_store/jira_epic.py`: `JiraPlan` (small), `description_of` (small)
- `bin/record_store/confluence_page.py`: `ConfluencePage` (small)
- `bin/plan_store/test_jira_epic.py`: `Editing`, `Filing`
- `bin/record_store/test_confluence_page.py`: `ConfluencePageTest`
### 319. Start a fresh session with a brief of the chunk when a rung step changes the worker's model, in place of resuming the old session.
On SWE-bench Verified with Haiku 4.5 and Opus 4.7, handing the strong model the weak model's transcript solved 69.2% at $1.61 a task; starting the strong model fresh solved 79.2% at $0.90 (arXiv 2608.24358, The Handoff Tax). A model switch also rereads the whole context uncached (Claude Code prompt caching docs). A worker that steps from Sonnet 5.5 to Opus 5.5 by `--resume` is the raw handoff; an effort-only step within one model keeps the cache and isn't. The escalated subagent, which starts fresh with the trigger's evidence, already follows the pattern that won.
Bench it first on `workflow-bench`: resume against a fresh start with a brief. The brief is the chunk's item, its branch and diff, open findings and the trigger. lilleman approved on 2026-11-11. Revise the decision `routing: a worker whose run ends asking for a higher rung…`.
Touches:
- `bin/loop_claude/cycle/run.py`: `Cycle`, `run_cycle`, `worker_start`
- `bin/loop_claude/cycle/prompts.py`: `resumed`, `stepped_to`
- `bin/loop_claude/cycle/worker.py`: `worker_args`
- `bin/loop_claude/cycle/states.py`
- `bin/loop_claude/test_loop_claude.py`: `Cycles`, `WorkerArgs`
- `workflow-bench/bench.py`: `run`, `main`
### 309. Run a scoring run's second pass on one head with two seats in place of four, once `larv-review agreement` shows the seats agree with each other more than a run agrees with its rerun.
Seats cost $1,143 of the $9,154 measured from 2026-09-30 to 2026-11-11 (12.5%), scoring runs $470 of that. A scoring run today is four seats, run twice on one head: eight seat runs. Two seats on the second pass make it six, and two on both passes four.
@@ -167,24 +164,65 @@ Why it should hold quality: the seats are one model with different personas, so
Decide once `agreement` has its 10 commits scored twice. Keep four seats on any pass that files a floor item, since its places come from seat reports. Revise the decision `review: the comprehension check records how hard a project is to read…`, which names the four-seat run.
Touches:
- `bin/larv_review/seats.py`: `SCORING_SEATS`, `scores`
- `bin/larv_review/history_commands.py`: `record_scoring`
- `bin/larv_review/scoring_setup.py`: `SEATS`, `prepare_scoring`
- `bin/larv_review/main.py`: `(module)` (small)
- `bin/larv_review/test_larv_review.py`
- `bin/larv_review/test_scoring_setup.py`
- `skills/larv-review/SKILL.md`: `### Comprehension check`
- `skills/comprehension-panel/SKILL.md`: `## The scoring run` (small)
### 299. Replay the archived judge verdicts through code rules and a classifier trained locally on the archive, and file an item for each verdict kind one of them decides with no missed interrupt.
The judge's LLM still decides three things: the verdict kind, the escalation it quotes, and whether a release is ready to cut (`docs/decisions.md` → `routing: loop-claude reads the items a chunk takes …`). This item replays the verdict kind. No single rule found so far separates interrupts: a "?" in the worker's final message appears in 48 interrupts and misses 66. A smaller LLM already failed the replay (`docs/decisions.md` → `routing: on a model judge-replay covered, …`: Sonnet returned another kind on 3 interrupts, Haiku missed 7). Untested are combined code rules, a decision table, and a small classifier trained and run on this machine on the archived verdicts (372 finished, 234 interrupt, 42 unfinished, 20 quoted). Run each offline, nothing sent to an outside service (goal 4), and count disagreements by kind; the bar is zero missed interrupts. A hosted decision model is out of scope, since it would send transcripts to an outside service.
Touches:
- `bin/judge_replay/main.py`: `main`, `archived_cases` (small)
- `bin/judge_replay/replay.py`: `Case`, `verdict_kind`, `report`
- `bin/judge_replay/test_judge_replay.py`
### 311. Hand each worker's claude a Bash output ceiling that saves longer output to a file, and refuse a Read of a session transcript under `~/.claude/projects`.
Workers took 7,870 Bash results over 3,000 characters, $305 of carried context, against the reading rule in their prompt; stability reviewers another $145. `BASH_MAX_OUTPUT_LENGTH` (or `bashOutputMaxChars`) makes Claude Code save a longer result to a file and hand the model its path and the first 2,000 characters. loop-claude can hand it as it hands `CLAUDE_CODE_AUTO_COMPACT_WINDOW`. A ceiling of 6,000 characters would have removed $228 of carried output, 10,000 characters $122. Reads of old session transcripts cost $46; a rule-hook rule can refuse them, but not a Read of the files Claude Code saves a long Bash result to: they sit under `~/.claude/projects/<project>/<session>/tool-results/`, the archive holds 85 of them (item 312's round, 2026-11-12), and the saved-to-file ceiling hands the model their path to read.
Subagents inherit the variable, and the decision of 2026-10-27 found a 12k cap cost stability reviewers a finding (3 of 6 against 4 of 6). That cap left no file to read, and the difference is inside the noise that decision reports. So keep the ceiling only where a replay of the archived stability rounds finds what two baseline replays find, and join item 260's comparison.
Touches:
- `bin/loop_claude/cycle/worker.py`: `COMPACT_WINDOW` (small)
- `bin/loop_claude/cycle/run.py`: `worker_environment` (small)
- `bin/loop_claude/loop/usage.py`: `HELP` (small)
- `bin/rule_hook/rules.py`: `RuleName` (small), `RULES` (small)
- `bin/rule_hook/main.py`: `breaches_of` (small)
- `bin/rule_hook/test_rule_hook.py`: `RuleNames` (small)
- `bin/review_replay/replay.py`: `launch` (small)
- `bin/loop_claude/test_loop_claude.py`: `Cycles` (small), `HelpLimits` (small)
### 316. Launch comprehension seats as an agent type of their own under `agents/`, without `CLAUDE.md` and the skill and agent listings a general-purpose subagent carries.
Seats run as general-purpose subagents, so each starts with the skill and agent listings, about 7,500 tokens, at $9.00 per 1,000 prefix tokens over the archive measured from 2026-09-30 to 2026-11-11: about 1.3% of spend. An agent under `agents/` with Read, Grep, Glob and Bash, `omitClaudeMd: true`, and the seat's persona in its prompt drops both; a seat reads the project as a newcomer does, which is what it simulates. Keep each seat's prompt from `skills/comprehension-panel/seat-prompts.md`. Check that a scoring run's scores on one head stay within the spread two runs of today's seats show. lilleman approved on 2026-11-11.
Touches:
- `agents/comprehension-seat.md`
- `bin/rule_hook/reviewer_rung.py`: `SEAT`, `review_kind`
- `bin/larv_review/scoring_setup.py`: `SEATS`, `prepare_scoring`
- `bin/loop_claude/cycle/prompts.py`: `review_launches` (small)
- `skills/comprehension-panel/seat-prompts.md`: `## Opening`, `(top)` (small)
- `skills/comprehension-panel/SKILL.md`: `## The scoring run` (small)
- `skills/larv-review/SKILL.md`: `### Comprehension check` (small)
- `bin/rule_hook/test_rule_hook.py`: `ReviewerRung`
- `bin/larv_review/test_scoring_setup.py`
### 339. Lower the reading cost of the files a chunk reads most before its first commit.
`reading-cost` printed `Rising:` on 2026-11-12: the last 5 chunks' median is 128,199 new input tokens before their first commit, the 5 before them 101,795. Read most over the last 5, as opens and searches: `todo.md` 34, `docs/decisions.md` 26, `README.md` 19, `skills/larv-review/SKILL.md` 13, `bin/loop_claude/routing.py` 8, `CHANGELOG.md` 6. The chunk that ships this runs `reading-cost --reset`.
Touches:
- `README.md`
- `skills/larv-review/SKILL.md`
- `bin/loop_claude/routing.py`
### 341. Hand each worker's claude a lower Read limit through `CLAUDE_CODE_FILE_READ_MAX_OUTPUT_TOKENS`, kept only where replays of the archived review rounds find what two unchanged replays find.
Raised by item 312's research round, 2026-11-12. Over the 53 chunks archived since 2026-09-30, Read results held about 3.17M tokens (characters / 4) in 1,617 reads. Results over 20,000 characters, about 5,000 tokens, held 479k tokens beyond that size in 115 reads: prose reviewers 144k, stability reviewers 119k, product-owner reviewers 102k, general-purpose subagents 65k, principles auditors 28k, architects 21k. Workers had none, under the reading rule in their prompt. Measured with a script over loop-claude's archive that sums each Read tool_result's characters by the subagent's `agentType`. The decision of 2026-10-27 found Read results out of a PostToolUse hook's reach; this variable reaches them.
@@ -195,6 +233,15 @@ loop-claude can hand it as it hands `CLAUDE_CODE_AUTO_COMPACT_WINDOW`, and subag
The replay: give `review-replay` a way to set the variable, then replay the archived prose, stability, product-owner and principles rounds at 5,000 tokens, beside two unchanged replays of the same rounds. Keeps quality where each pass finds every finding the two unchanged replays both find, or misses no more than the most an unchanged replay misses, as `review-replay --omit-claude-md` counts it. Keep it only where the replays' Read characters also fall; item 311's stability replay can share the baseline runs.
Touches:
- `bin/loop_claude/cycle/worker.py`: `COMPACT_WINDOW` (small)
- `bin/loop_claude/cycle/run.py`: `worker_environment` (small)
- `bin/loop_claude/loop/usage.py`: `HELP` (small)
- `bin/review_replay/main.py`: `(module)` (small), `main`
- `bin/review_replay/replay.py`: `launch`, `NO_CLAUDE_MD` (small)
- `bin/review_replay/test_review_replay.py`
- `bin/loop_claude/test_loop_claude.py`: `Cycles` (small), `HelpLimits` (small)
### 310. Compact a waiting worker's session shortly before its prompt cache expires, only when the human has not answered an interrupt by then.
281 worker resumes after the 1-hour cache expired rewrote a whole context, $379 of the $9,154 measured from 2026-09-30 to 2026-11-11 (4.1%). A compaction while the cache is warm reads the context at a twentieth of the input price and leaves about 20k tokens to rewrite later.
@@ -203,16 +250,40 @@ lilleman, 2026-11-11: do it on a timer, so an answer that comes in time doesn't
Probe first that `claude -p "/compact" --resume <id>` compacts a session: the Agent SDK documents `/compact` as a prompt, the CLI pages don't show it. Claude Code compacts idle interactive sessions itself ("Compacted while idle"), but not `-p` runs. Check: the cost entries of 20 chunks with an interrupt, before and after.
Touches:
- `bin/loop_claude/cycle/interrupt.py`: `interrupt`, `answered`, `typed_answer`, `WorkerSession`
- `bin/loop_effects/effects.py`: `Effects`, `system_effects`
- `bin/claude_code/tokens.py`: `tokens_of` (small)
- `bin/claude_code/reply.py`: `claude_reply` (small)
- `bin/loop_claude/loop/usage.py`: `HELP` (small)
- `bin/loop_claude/test_loop_claude.py`: `FakeEffects`, `Interrupts`
- `bin/loop_effects/test_effects.py`
### 393. Step an L 3 worker one rung up and an L 4 worker two up from the project's rung, as lilleman ruled on 2026-11-14.
lilleman ruled on 2026-11-14 (`docs/decisions.md` → the routing ladder entry, the 2026-11-14 note) that an L 3 task steps one rung up from the project's rung and an L 4 task two up, in every project and for delegated subagents. `bin/model_routing/ladder.py`'s `WORKER_STEPS` still reads `{1: -1, 2: -1, 3: 0, 4: 1}`. The 0.11.0 release review's principles pass found the gap, and lilleman chose on 2026-11-16 to file it for 0.12.0.
Set `WORKER_STEPS` to `{1: -1, 2: -1, 3: 1, 4: 2}`. Then re-derive, from the ruling, the expected rungs of the 26 routing tests that pin the old steps: `bin/model_routing/test_ladder.py`, `bin/subagent_rung/test_subagent_rung.py`, and the routing, step and worker-argument tests in `bin/loop_claude/test_loop_claude.py` and `bin/loop_claude/test_black_box.py`. On an Opus 5.5 project, an L 3 worker or subagent then runs on Fable 5.2 at low, and an escalation stops without lilleman's yes at Opus 5.5 at xhigh; an L 4 one runs on Fable 5.2 at medium, and stops at Fable 5.2 at high. Reword the 2026-11-14 note's "hold until" sentence once the steps change, and cite the routing figures' stamp 2026-11-14T00:59:50Z in `routing-calls-raised.md` as settled.
Touches:
- `bin/model_routing/ladder.py`: `WORKER_STEPS` (small)
- `bin/model_routing/test_ladder.py`: `Ladder`
- `bin/subagent_rung/test_subagent_rung.py`: `SubagentRung`
- `bin/loop_claude/test_loop_claude.py`: `Routing`, `Steps`, `WorkerArgs`
- `bin/loop_claude/test_black_box.py`: `Models`
### 298. Send the judge only the decision entries and the transcript tail a verdict needs, and keep the cut only where `judge-replay` changes no verdict kind.
153 `Judge cost:` entries total $109.76, a median of about $0.76 a verdict at every rung, and the cost follows the size of the records, not the transcript: about 76k characters in log and 188k in claude-config. In 224 of 251 recent verdicts (89%) the evidence sits in the worker's final message. A missed interrupt is the costly error, so the bar is zero changed interrupts and zero new rejections across the replay. The judge is about 4.5% of dollars, so the saving is small; each cycle also gets faster.
Touches:
- `bin/loop_claude/cycle/judge.py`: `Brief`, `judge_prompt`, `JUDGE_PROMPT_CHARS`
- `bin/loop_claude/project/records.py`: `read_records`
- `bin/judge_replay/main.py`: `rule` (small)
- `bin/judge_replay/replay.py`: `case_from` (small)
- `bin/loop_claude/test_loop_claude.py`: `JudgePrompt`, `Records`
- `bin/judge_replay/test_judge_replay.py`
### 331. Reword four decisions to expire when the rungs their replays tested change, not whenever a model joins the ladder.
The architect's 🔀 answer on PR #493 (item 292): four decisions expire "when a new model joins the ladder". Fable 5.2 joined above every project model's rung, and none of these replays tested a rung above the project's, so the event fired with nothing new to test. Every later ladder rebuild would fire all four again.
@@ -228,6 +299,10 @@ lilleman approved rewording all four as above on 2026-11-12.
The product-owner pass of item 373's chunk asked it, 2026-11-15: `bin/touch_predictions/prediction.py` → `predicted` needs a line that is exactly `Touches:` and bullets that open `- `. A Jira issue's description reaches it through `bin/adf_codec/`, whose library chooses the bullet marker and may escape backticks or a trailing colon. No test shows that a list written in Jira comes out in that shape. Where it doesn't, read the shape the codec writes too.
Touches:
- `bin/touch_predictions/prediction.py`: `predicted` (small), `bullet` (small)
- `bin/touch_predictions/test_touch_predictions.py`: `PredictedTest`
### 327. Have `larv-review` print a round commit's title prefix, counted from the round's report, and have rule-hook refuse a round title whose counts differ from it.
The 0.8.0 audit (item 284) measured, over the 35 chunks that shipped 0.7.0: 72 commit calls in 33 chunks titled `Answer <pass> round <n>: R 🔴, Y 🟡 (K misread); <what changed>`, about 11k command tokens, most of them the summary. Each worker counts R, Y and K by hand. All three are in the round's report, `<pass>-round-<n>.md` in the review folder: R and Y are its finding headings, and K counts the findings the reviewer marked `[misread]`, as `bin/review_rules/round_titles.py` says. That module parses the counts for `score-outcomes`, which reports them as goal 1.1's signal, and rule-hook's `round_cap.py` checks only the round number, so nothing checks today that the counts match the report. Of the 8 titles whose report the audit could match, none miscounted; one report wrote its markers at line start rather than in `###` headings, so the reports' format varies by reviewer.
@@ -236,6 +311,17 @@ Add a `larv-review` subcommand that prints a round title's prefix, up to and inc
Left with the model: the summary after the `;`, and answering the findings.
Touches:
- `bin/larv_review/main.py`: `(module)` (small), `COMMANDS` (small)
- `bin/review_rules/round_titles.py`
- `bin/rule_hook/rules.py`: `title_breaches`, `RULES` (small)
- `bin/rule_hook/test_rule_hook.py`: `Commits`
- `bin/larv_review/test_larv_review.py`
- `bin/review_rules/test_round_titles.py`
- `skills/larv-review/review-findings.md`: `## Report` (small)
- `skills/larv-review/SKILL.md`: `## 3. Passes` (small)
- `README.md`: `## Tools` (small)
### 389. Set a Jira issue's "is blocked by" links from `todo-item edit --blocked-by`, on an issue the loop filed.
Filed by item 382's chunk on 2026-11-16. `JiraPlan.edit` refuses an edit of Blocked by, saying to link the issue in Jira, so a worker cannot mark an item it filed as blocked once it exists. Read each link's id from the search's `issuelinks`, make a link per new blocker as `add` does, and delete one per blocker removed, after `missing_blocker`'s check. Say in `docs/decisions.md` whether the loop may link an issue a person filed; the decision on the Jira epic as a plan says the loop writes only the scores of such an issue.
@@ -243,7 +329,7 @@ Filed by item 382's chunk on 2026-11-16. `JiraPlan.edit` refuses an edit of Bloc
Touches:
- `bin/plan_store/jira_epic.py`: `Issue`, `issue_of`, `JiraPlan.edit`, `revision_of`
- `bin/plan_store/test_jira_epic.py`: `Editing`
- `bin/todo_item/main.py`: the help
- `bin/todo_item/main.py`: lines 1-77 (small)
### 365. Have `score-outcomes` read the finished and dropped items of a plan outside the checkout, from the project repo's history or from Jira's issue changelogs.