From 550fca6d6e3c06e8453c77d5744b781fc033a504 Mon Sep 17 00:00:00 2001 From: Lilleman auf Larv Date: Wed, 14 Oct 2026 23:36:18 +0200 Subject: [PATCH] Fix the stale reload comment and README's bin layout, rename the archive folder in run_loop, and file item 137 for the archived route's string contract --- README.md | 2 +- bin/loop_claude/loop/main.py | 16 ++++++++-------- bin/loop_claude/loop/reload.py | 2 +- todo.md | 7 ++++++- 4 files changed, 16 insertions(+), 11 deletions(-) diff --git a/README.md b/README.md index 2dcf8ef2..eb513ae2 100644 --- a/README.md +++ b/README.md @@ -91,7 +91,7 @@ pytest_add_cli_args=-k Then, in the copy: `uvx --with pytest 'mutmut>=3,<4' run && uvx --with pytest 'mutmut>=3,<4' results`, and `uvx --with pytest 'mutmut>=3,<4' show ` to see a mutant's change. The config keys are mutmut 3's. -`bin/` is the import root: each launcher puts it on `sys.path`, so a module imports another by its path under `bin/`, such as `from claude_code.entries import parse_entry`. Each tool's package holds its tests; `rank_todo.py` and `statusline.py` are tools of one file each, tested beside them, `rule_hook` imports `rank_todo.py`'s check, and `score_outcomes` imports `reading_cost`'s record path. The other non-test modules at `bin/`'s root, `claude_code/` and `transcript_archive/` serve more than one tool. `test_env.py` serves the tests, and `repo_checks/` tests the repo itself. +`bin/` is the import root: each launcher puts it on `sys.path`, so a module imports another by its path under `bin/`, such as `from claude_code.entries import parse_entry`. Each tool's package holds its tests; `rank_todo.py` and `statusline.py` are tools of one file each, tested beside them, `rule_hook` imports `rank_todo.py`'s check, and `score_outcomes` imports `reading_cost`'s record path. The other non-test modules at `bin/`'s root, `claude_code/` and `transcript_archive/` serve more than one tool; `model_routing/` holds the routing ladder, which loop-claude reads. `test_env.py` serves the tests, and `repo_checks/` tests the repo itself. ## Tracking a new file diff --git a/bin/loop_claude/loop/main.py b/bin/loop_claude/loop/main.py index 4a9493f1..b48c05e7 100644 --- a/bin/loop_claude/loop/main.py +++ b/bin/loop_claude/loop/main.py @@ -132,7 +132,7 @@ def run_loop(argv: list[str], env: typing.Mapping[str, str], paths: Paths, launc return loop_run baseline = fingerprint(launcher) key = project_key(loop_run.root, paths.home) - archive = project_archive(loop_run.root, paths.home, env) + archive_folder = project_archive(loop_run.root, paths.home, env) # "A " is the human's cue in the session picker that the session is the loop's. session = session_named(f"A {key} loop-claude", paths.claude_code_transcripts) while True: @@ -150,14 +150,14 @@ def run_loop(argv: list[str], env: typing.Mapping[str, str], paths: Paths, launc return models anchor = project_rung(models.worker) root = loop_run.root - loop_run = routed(loop_run, anchor, lambda: archived_route(archive, session), lambda: plan_item(root)) + loop_run = routed(loop_run, anchor, lambda: archived_route(archive_folder, session), lambda: plan_item(root)) route = loop_run.route or Route(Rung(models.worker)) print(f"\n=== cycle {loop_run.cycle_number}, worker on {route.rung} ===", flush=True) - verdict = run_cycle(Cycle(effects=effects, judge_model=models.judge, paths=paths, premises=premises, project_archive=archive, records=records, root=loop_run.root, route=route, session=session, task=loop_run.task, unfinished_evidence=loop_run.unfinished_evidence)) + verdict = run_cycle(Cycle(effects=effects, judge_model=models.judge, paths=paths, premises=premises, project_archive=archive_folder, records=records, root=loop_run.root, route=route, session=session, task=loop_run.task, unfinished_evidence=loop_run.unfinished_evidence)) if isinstance(verdict, Stop): return verdict before, loop_run = loop_run.route, after_verdict(loop_run, anchor, verdict) - if stop := archive_step(archive, session, loop_run, before, effects): + if stop := archive_step(archive_folder, session, loop_run, before, effects): return stop @@ -177,19 +177,19 @@ def after_verdict(loop_run: LoopRun, anchor: Rung | None, verdict: Finished | Un return dataclasses.replace(loop_run, route=route, unfinished_evidence=verdict.evidence) -def archive_step(project_archive: pathlib.Path, session: Session, loop_run: LoopRun, before: Route | None, effects: Effects) -> Stop | None: +def archive_step(archive_folder: pathlib.Path, session: Session, loop_run: LoopRun, before: Route | None, effects: Effects) -> Stop | None: """Archives the rung an unfinished verdict stepped the chunk up to; the verdict itself names the rung its cycle ran on.""" if not (before and loop_run.route) or loop_run.route.rung == before.rung: return None path = transcript_file(session) - failure = archive(project_archive, path, loop_run.task, outcomes.stepped_up(str(loop_run.route)), effects.now()) if path else None + failure = archive(archive_folder, path, loop_run.task, outcomes.stepped_up(str(loop_run.route)), effects.now()) if path else None return Stop(1, failure.reason) if failure else None -def archived_route(archive: pathlib.Path, session: Session) -> Route | None: +def archived_route(archive_folder: pathlib.Path, session: Session) -> Route | None: """The route the latest verdict archived for the session's open chunk names; None for a chunk not yet judged.""" transcript = transcript_file(session) - worker = latest_worker(archive, transcript) if transcript else None + worker = latest_worker(archive_folder, transcript) if transcript else None if isinstance(worker, Failure): print(f"routing the chunk afresh: {worker.reason}", file=sys.stderr) return None diff --git a/bin/loop_claude/loop/reload.py b/bin/loop_claude/loop/reload.py index 31e7f818..a6379b3b 100644 --- a/bin/loop_claude/loop/reload.py +++ b/bin/loop_claude/loop/reload.py @@ -14,7 +14,7 @@ RELOAD_FLAG = "--reloaded" T = typing.TypeVar("T") -# A field change stops a running loop at its next reload: the new script rejects the old fields. +# A field removed, renamed or retyped stops a running loop at its next reload: the new script rejects the old fields. A new field with a default does not. @dataclasses.dataclass(frozen=True) class LoopRun: """What a reload hands the edited script, as JSON on argv.""" diff --git a/todo.md b/todo.md index 223e5f0d..e5fbb8b4 100644 --- a/todo.md +++ b/todo.md @@ -6,7 +6,7 @@ `Bar = 9` -`Next ID = 137` +`Next ID = 138` | Goal | W | |---|---| @@ -54,6 +54,7 @@ Release 0.2.0 takes items 125, 114 and 124 first, whatever their scores: Shape i | 124 | 0.2.0 | decision | **Group the shared modules at `bin/`'s root into packages named by purpose, so the root holds only launchers and stand-alone tools.** | 3 | 6 | 3 | 3 | 5 | 1.1 | 11.4 | | 118 | 0.2.0 | | **Have `score-outcomes` count review rounds only from chunks merged after 2026-10-13, when review passes were narrowed, so C's medians compare chunks reviewed under one rule.** | 2 | 2 | 3 | 3 | 4 | 1.4 | 11.2 | | 130 | 0.2.0 | | **Move the vote counting out of `bin/larv_review/ruling.py`'s `votes`, so reading a votes file decides nothing.** | 2 | 3 | 3 | 3 | 4 | 1.1 | 11.2 | +| 137 | 0.2.0 | | **Archive a chunk's route as a record loop-claude reads back field by field, in place of the `Worker:` prose `ROUTED` parses, and name `stepped` and the judge's `bundled` by what they do.** | 2 | 3 | 3 | 3 | 4 | 1.1 | 11.2 | | 129 | 0.2.0 | | **Explain `bin/rule_hook/rules.py`'s `OVERRIDE` pattern beside it: why the reason is lazy, what the lookahead splits and why `-->` is stripped.** | 1 | 1 | 1 | 2 | 4 | 1.1 | 10.7 | | 135 | 0.2.0 | | **Fingerprint only the modules loop-claude imports, so editing another tool's code no longer reloads a running loop.** | 3 | 3 | 4 | 3 | 4 | 1.1 | 10.2 | | 1 | 0.3.0 | question | **Say in README → Install how the transcript archive is backed up, once bender-infra backs up ai-sandbox's data volume.** | 3 | 5 | 2 | 8 | 9 | 3, 4 | 27.0 | @@ -206,6 +207,10 @@ Since 2026-10-13 (`docs/decisions.md` → "review: stability and product-owner r Mid A of PR #257's scoring run named `bin/larv_review/ruling.py:8` `votes`. It calls `counted` while validating, to reject the maintainability senior's and Junior A's lines when Mid A and the inherited architect already agree overall: a ruling hidden in a parser. The counting rule is spread over `seats.py`, `ruling.py`, `comprehension_history.place_dimensions` and the help. Make `votes` easier to read. +### 137. Archive a chunk's route as a record loop-claude reads back field by field, in place of the `Worker:` prose `ROUTED` parses, and name `stepped` and the judge's `bundled` by what they do. + +PR #262's paired ruling found the project reads worse: a rerun resumes on its rung only by parsing `Rung.__str__`'s and `Route.__str__`'s wording back with `bin/loop_claude/routing.py`'s `ROUTED`, a string contract over four files, where a reword silently routes afresh. Write the route as a structured line, such as JSON after `Worker:`, that `transcript_archive` reads into fields. `stepped` both raises to a bundled item's rung and counts towards a one-rung step; `Reply.bundled` names neither R + C nor highest. Make `bin/loop_claude/loop/main.py`'s `run_loop` easier to read where it threads the route. + ### 129. Explain `bin/rule_hook/rules.py`'s `OVERRIDE` pattern beside it: why the reason is lazy, what the lookahead splits and why `-->` is stripped. The maintainability senior of PR #257's scoring run named `bin/rule_hook/rules.py:49` `OVERRIDE`: nothing in the code explains the pattern. Make `OVERRIDE` easier to read.