From 36dbddfa0b70d1f4298c7f5072ca8a8c69b1f663 Mon Sep 17 00:00:00 2001 From: Lilleman auf Larv Date: Wed, 18 Nov 2026 23:04:27 +0100 Subject: [PATCH 1/8] Re-score item 413 to L 4: several components and a new filing command --- todo.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/todo.md b/todo.md index 7b8e0368..50ca2fac 100644 --- a/todo.md +++ b/todo.md @@ -14,7 +14,7 @@ |---|---|---|---|---|---|---|---|---|---|---|---| | 441 | 0.12.0 | | | **Move an epic's issue to done in Jira when its chunk finishes, so no finished chunk starts again and what it blocks starts.** | 2 | 2 | 2 | 4 | 3 | 1 by 6 | 2.3 | | 416 | 0.12.0 | | | **Finish an epic's repo item with a bullet under its repo's `CHANGELOG.md` → `## Unreleased`, or with none where the repo's plan is in Jira.** | 1 | 1 | 1 | 1 | 2 | 1 by 5 | 2.1 | -| 413 | 0.12.0 | | | **File a finding about an epic goal in the epic and one about a repo goal by that repo's rules, ask the human where unsure which, and give the judge the epic's records beside the repo's.** | 3 | 2 | 3 | 6 | 4 | 1 by 5 | 1.6 | +| 413 | 0.12.0 | | | **File a finding about an epic goal in the epic and one about a repo goal by that repo's rules, ask the human where unsure which, and give the judge the epic's records beside the repo's.** | 4 | 2 | 3 | 7 | 4 | 1 by 5 | 1.6 | | 415 | 0.12.0 | 413 | | **Finish an epic: run release-review passes on each repo it changed, work what they file, have the human confirm each goal, post a summary comment, and close the epic in Jira last.** | 3 | 2 | 3 | 6 | 5 | 1 by 5 | 1.2 | | 418 | 0.12.0 | 415 | | **Describe do-epic in `README.md`'s tools and setup, with its machine settings and `repo-rule.md`.** | 1 | 2 | 1 | 2 | 2 | 1 by 5 | 2.1 | | 420 | 0.12.0 | | | **End a worker that printed its final result and lingers, by killing the background shells it left, after a few minutes, and print each kill with its evidence on loop-claude's terminal.** | 2 | 2 | 2 | 4 | 3 | 1.5 by 6 | 2.0 | -- 2.52.0 From d0ecdd6359983814c0282905b6f768f6e7e55c5e Mon Sep 17 00:00:00 2001 From: Lilleman auf Larv Date: Wed, 18 Nov 2026 23:13:43 +0100 Subject: [PATCH 2/8] File a finding and record a decision in a do-epic epic, and give the judge the epic's records beside the repo's --- README.md | 4 +- bin/agent_cycle/judge.py | 4 +- bin/agent_cycle/run.py | 1 + bin/agent_cycle/worker_prompts.py | 2 + bin/do_epic/chunk_prompt.py | 13 +++- bin/do_epic/epic_record.py | 13 ++++ bin/do_epic/findings.py | 59 +++++++++++++++ bin/do_epic/main.py | 42 +++++++++-- bin/do_epic/test_findings.py | 111 ++++++++++++++++++++++++++++ bin/do_epic/test_main.py | 15 +++- bin/do_epic/test_scheduler.py | 2 +- bin/judge_replay/main.py | 4 +- bin/loop_claude/cycle/prompts.py | 15 +++- bin/loop_claude/project/records.py | 25 ++++--- bin/loop_claude/test_loop_claude.py | 35 ++++++--- bin/text_files/piped_text.py | 6 ++ bin/todo_item/main.py | 7 +- docs/reading-cost.md | 22 ++++++ skills/larv-review/SKILL.md | 1 + 19 files changed, 334 insertions(+), 47 deletions(-) create mode 100644 bin/do_epic/findings.py create mode 100644 bin/do_epic/test_findings.py create mode 100644 bin/text_files/piped_text.py diff --git a/README.md b/README.md index 1da63f00..7515b10d 100644 --- a/README.md +++ b/README.md @@ -216,7 +216,7 @@ Install puts only `loop-claude` on `PATH`; call the others by their path, such a - `branch_chunks/` cuts a default branch into chunks and finds, for each, the items it shipped and the later chunks that fixed its code, for `score_outcomes` and `routing_figures`. It imports `reading_cost`'s record path. - `command_lines/` reads a shell command: its simple commands, and a docker call's subcommand and memory limits, for `command_patterns`, `reading_cost`, `routing_figures`, `rule_hook` and `run_heavy`. - `deploy_release` imports `release_plan`'s `release_standing`. -- `do_epic/` holds `do-epic`, the tool that drives one Jira epic. `main.py` starts the epic's chunks and runs one chunk's cycles in its window, through `agent_cycle`. `scheduler.py` says which issues run now: as many as the epic's cap and each repo's `parallel-chunks` allow, and none in a repo where loop-claude runs chunks. Beside it, `chunk_prompt.py` words what a chunk's worker reads. `config.py` reads its machine-wide settings, importing `project_config`'s settings and `model_routing`'s ladder file, and `epic_record.py` reads and writes an epic's description by section, language line and cap line, through `record_store`'s `EpicDescription`. `repos.py` finds a repo's checkout and project config by its name, and clones a missing checkout from the host and owner of the epic's other repos, through `forge`'s `url_beside`. `repo_pick.py` asks claude, by `repo-rule.md`, where an epic item is worked, and records the answer as a label on the issue. `split.py` has claude predict from the code which repos an item changes, and files a sub-task per repo under it where there are several. `ranking.py` orders an epic's items by score over one chain of goals, the epic's, then code health, then the item's repo's, through `plan`'s ranking, and re-ranks the tracker's backlog to that order through `backend/`. `backend/` reads, files and ranks the epic's issues, adds the labels `repo_pick.py` and `split.py` record, and posts comments. +- `do_epic/` holds `do-epic`, the tool that drives one Jira epic. `main.py` starts the epic's chunks and runs one chunk's cycles in its window, through `agent_cycle`. `scheduler.py` says which issues run now: as many as the epic's cap and each repo's `parallel-chunks` allow, and none in a repo where loop-claude runs chunks. Beside it, `chunk_prompt.py` words what a chunk's worker reads. `findings.py` is what that worker writes into the epic: `do-epic --file` files a finding as an issue of the epic, and `--record-decision` appends a decision to its description. `config.py` reads its machine-wide settings, importing `project_config`'s settings and `model_routing`'s ladder file, and `epic_record.py` reads and writes an epic's description by section, language line and cap line, through `record_store`'s `EpicDescription`. `repos.py` finds a repo's checkout and project config by its name, and clones a missing checkout from the host and owner of the epic's other repos, through `forge`'s `url_beside`. `repo_pick.py` asks claude, by `repo-rule.md`, where an epic item is worked, and records the answer as a label on the issue. `split.py` has claude predict from the code which repos an item changes, and files a sub-task per repo under it where there are several. `ranking.py` orders an epic's items by score over one chain of goals, the epic's, then code health, then the item's repo's, through `plan`'s ranking, and re-ranks the tracker's backlog to that order through `backend/`. `backend/` reads, files and ranks the epic's issues, adds the labels `repo_pick.py` and `split.py` record, and posts comments. - `forge/` tells a GitHub origin from a Gitea one, names a repo beside an origin's and runs that forge's CLI (`commands.py`), and finds a pull request and waits for its checks (`pulls.py`), for `chunk_preflight`, `chunk_pr`, `deploy_release`, `do_epic` and `larv_review`. - `git_cli/` runs git for every tool (`git_repo.py`), and reads the git calls in a shell command (`git_command.py`). - `judge_replay` imports `agent_cycle`'s judge and verdicts, and `loop_claude`'s premises, records and `ANSWER_DESTINATIONS`. @@ -237,7 +237,7 @@ Install puts only `loop-claude` on `PATH`; call the others by their path, such a - `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 `agent_cycle`'s retry count and `loop_claude`'s 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. +- `text_files/` reads a Markdown file's `##` sections, quotes a passage and joins names into a list, reads the text piped into a command, 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. ## Test diff --git a/bin/agent_cycle/judge.py b/bin/agent_cycle/judge.py index 993ebf85..3591a649 100644 --- a/bin/agent_cycle/judge.py +++ b/bin/agent_cycle/judge.py @@ -141,6 +141,8 @@ class Brief(typing.NamedTuple): task: str premises: str records: str + # What the records are, in their order, as WorkerPrompts.records_named has it. + records_named: str # Where the worker may record an answer the human typed, as the entry point names it. answer_destinations: str entries: list[Entry] @@ -290,7 +292,7 @@ def judge_prompt(brief: Brief) -> tuple[str, Grounds]: """The prompt, and what the judge's quotes are checked against.""" head = ( f"From the goals file, {brief.premises}\n\n" - f"The records: the project's working rules and decisions, then the human's rules for every project:\n{brief.records or 'none'}\n\n" + f"The records: {brief.records_named}:\n{brief.records or 'none'}\n\n" f"{TASK_HEADING}{brief.task}\n\n" f"{transcript_heading(brief.driver)}" ) diff --git a/bin/agent_cycle/run.py b/bin/agent_cycle/run.py index 98bf2bf8..a836cb47 100644 --- a/bin/agent_cycle/run.py +++ b/bin/agent_cycle/run.py @@ -156,6 +156,7 @@ def rule(cycle: Cycle, transcript_path: str, quoted_answers: int) -> Ruled | Sto task=cycle.task, premises=cycle.premises, records=cycle.records, + records_named=cycle.prompts.records_named, answer_destinations=cycle.prompts.answer_destinations, entries=entries, escalated_at=cycle.route.escalated_at, diff --git a/bin/agent_cycle/worker_prompts.py b/bin/agent_cycle/worker_prompts.py index 25f9c931..9c070afb 100644 --- a/bin/agent_cycle/worker_prompts.py +++ b/bin/agent_cycle/worker_prompts.py @@ -45,6 +45,8 @@ class WorkerPrompts: quote_sources: str # Where the worker may record an answer the human typed. answer_destinations: str + # What the records the judge reads are, in the order it reads them. + records_named: str def answered(self, question: str, answer: str, route: Route, project: ProjectRung | None, stepped: bool) -> str: """stepped is whether the answer's ruling stepped the worker up.""" diff --git a/bin/do_epic/chunk_prompt.py b/bin/do_epic/chunk_prompt.py index 3de4876d..f2128c06 100644 --- a/bin/do_epic/chunk_prompt.py +++ b/bin/do_epic/chunk_prompt.py @@ -1,5 +1,8 @@ """What a do-epic cycle's worker is told: its task, from the issue, and its first prompt. The resumed prompt and the rung sentences are the ones loop-claude's cycles use, naming do-epic.""" from do_epic.backend.protocol import EpicIssue +from do_epic import findings +from loop_claude.project.records import HUMAN_RULE_NAMES, RECORD_FILES +from text_files.markdown_text import listed from model_routing.ladder import ProjectRung from loop_claude.cycle import prompts from model_routing.route import Route @@ -11,7 +14,7 @@ DRIVER = "do-epic" def task(issue: EpicIssue, epic: str, checkout: str | None) -> str: """The task of the chunk that works issue, of the epic with the key epic: in checkout, or without a repo where it is None.""" where = f"in the checkout {checkout}, on the branch {issue.key}" if checkout else "which changes no repo: work in the folder you start in" - return f"Work the Jira issue {issue.key} of the epic {epic} as one chunk, {where}. Its summary: {issue.summary}" + (f"\n\nIts description:\n\n{issue.detail}" if issue.detail else "") + return f"Work the Jira issue {issue.key} of the epic {epic} as one chunk, {where}. {findings.instructions(epic)} Its summary: {issue.summary}" + (f"\n\nIts description:\n\n{issue.detail}" if issue.detail else "") CODE_HEALTH = '~/.claude/CLAUDE.md → "Shared goal"' @@ -25,4 +28,10 @@ def fresh(task: str, premises: str, route: Route, project: ProjectRung | None, f # The worker names no plan items: the chunk's one item is its issue. -WORKER = prompts.worker_prompts(DRIVER, fresh, "") +# The epic's records come first, as its goals do; a chunk without a repo has only those and the human's rules. +NAMES = prompts.RecordNames( + quote_sources=listed(("the epic's description", "the repo's goals file's Goals and Audience", *RECORD_FILES, *HUMAN_RULE_NAMES), "or"), + answer_destinations="the epic's description under ## Decisions, the repo's goals file's Goals or Audience, " + ", ".join(RECORD_FILES) + ", the repo's plan or a comment", + records_named="the epic's scoring and decisions, then the repo's working rules and decisions, then the human's rules for every project", +) +WORKER = prompts.worker_prompts(DRIVER, fresh, "", NAMES) diff --git a/bin/do_epic/epic_record.py b/bin/do_epic/epic_record.py index fb302034..2e8b5490 100644 --- a/bin/do_epic/epic_record.py +++ b/bin/do_epic/epic_record.py @@ -110,6 +110,19 @@ class EpicRecord: """Writes body as the ## name section. approved says the human approved the change in an interrupt, which Goals and Audience need.""" return self.written(lambda text: with_section(text, name, body), frozenset({name}) if approved else frozenset()) + def append_decision(self, title: str, entry: str) -> Held | Failure: + """Adds entry under a ### title heading at the end of ## Decisions, leaving the decisions before it as they are.""" + if not title.strip() or "\n" in title: + return Failure("the title must be one line of text") + if not entry.strip(): + return Failure("pipe the decision's text in") + + def appended(text: str) -> str | Failure: + before = read_section(text, "Decisions") + return before if isinstance(before, Failure) else with_section(text, "Decisions", f"{before}\n\n### {title.strip()}\n\n{entry.strip()}".strip()) + + return self.written(appended, frozenset()) + def write_language(self, language: str) -> Held | Failure: return self.written(lambda text: with_language(text, language), frozenset()) diff --git a/bin/do_epic/findings.py b/bin/do_epic/findings.py new file mode 100644 index 00000000..d15cc7db --- /dev/null +++ b/bin/do_epic/findings.py @@ -0,0 +1,59 @@ +"""What a chunk's worker writes into its epic: a finding, filed as an issue, and a decision, appended to the description. + +A finding about one of the epic's goals is filed in the epic, and one about a repo's goals by that repo's rules (docs/decisions.md → `do-epic: drives one Jira epic …` → "Findings"). A decision that governs the epic goes under the description's ## Decisions, where the judge of each later chunk reads it.""" +import typing + +from do_epic.backend.protocol import EpicStore +from do_epic.epic_record import EpicRecord +from failure import Failure +from text_files.piped_text import piped + +# Three readers, seated as the human and as a chunk's worker, ranked four spellings of each flag: ` --file` came first, second and second, ahead of `--file `, `add` and `--finding`; `--record-decision` won 2-1 over `--decision`, since `--decide` reads as do-epic deciding. +FILE = "--file" +LABEL = "--label" +RECORD_DECISION = "--record-decision" +USAGE = f"""do-epic {FILE} [{LABEL}