From 3201ac7611bb5f413ab1ab41e2b2899617b4981b Mon Sep 17 00:00:00 2001 From: Lilleman auf Larv Date: Wed, 18 Nov 2026 20:54:06 +0100 Subject: [PATCH] Sort do-epic's imports and cite code health from one constant --- bin/do_epic/chunk_prompt.py | 8 ++++-- bin/do_epic/main.py | 48 ++++++++++++++++---------------- bin/do_epic/scheduler.py | 10 +++---- bin/do_epic/test_main.py | 14 +++++----- bin/do_epic/test_scheduler.py | 6 ++-- bin/loop_claude/cycle/prompts.py | 2 +- 6 files changed, 46 insertions(+), 42 deletions(-) diff --git a/bin/do_epic/chunk_prompt.py b/bin/do_epic/chunk_prompt.py index a23cba3a..6e842ace 100644 --- a/bin/do_epic/chunk_prompt.py +++ b/bin/do_epic/chunk_prompt.py @@ -1,7 +1,7 @@ """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 loop_claude.cycle import prompts from model_routing.ladder import ProjectRung +from loop_claude.cycle import prompts from model_routing.route import Route # The entry point's name as the worker, the judge and the human read it. @@ -14,11 +14,15 @@ def task(issue: EpicIssue, epic: str, checkout: str | None) -> str: 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 "") +# Where code health is stated. +CODE_HEALTH = '~/.claude/CLAUDE.md → "Shared goal"' + + def fresh(task: str, premises: str, route: Route, project: ProjectRung | None, facts: str) -> str: """A chunk's first prompt. facts is empty: do-epic runs no preflight.""" routed = f"{DRIVER} runs you on {route.rung}, routed by the issue's L of {route.likelihood}. Where a sentence below names item {route.item}, it means the issue." if route.item else "" opening = " ".join(filter(None, [routed, *prompts.rung_sentences(DRIVER, route, project)])) - return f"{task}\n\nContinue any open draft PR or worktree for the chunk before creating a new one. {prompts.READING_RULE}\n\n{opening and f'{opening}{chr(10)}{chr(10)}'}The issue sets the chunk's scope. The goals below choose between ways to deliver that scope, and never widen it: the epic's first, then code health (~/.claude/CLAUDE.md → \"Shared goal\"), then the repo's.\n\nFrom {premises}" + return f"{task}\n\nContinue any open draft PR or worktree for the chunk before creating a new one. {prompts.READING_RULE}\n\n{opening and f'{opening}{chr(10)}{chr(10)}'}The issue sets the chunk's scope. The goals below choose between ways to deliver that scope, and never widen it: the epic's first, then code health ({CODE_HEALTH}), then the repo's.\n\nFrom {premises}" # The worker names no plan items: the chunk's one item is its issue. diff --git a/bin/do_epic/main.py b/bin/do_epic/main.py index 1798ca29..1b18fad1 100644 --- a/bin/do_epic/main.py +++ b/bin/do_epic/main.py @@ -5,36 +5,36 @@ import dataclasses import pathlib import typing -from agent_cycle import tmux -from agent_cycle.direct_message import tell -from agent_cycle.routing import judge_rung -from agent_cycle.run import Cycle, run_cycle -from agent_cycle.stop import Stop -from agent_cycle.verdicts import Finished, TakenIn -from claude_code.session import session_named -from do_epic import chunk_prompt, scheduler -from do_epic.backend.jira import JiraEpic -from do_epic.backend.protocol import EpicIssue, EpicStore -from do_epic.config import DoEpicConfig, load -from do_epic.epic_record import EpicRecord -from do_epic.repo_pick import recorded, Repo -from do_epic.repos import locate -from failure import Failure from loop_claude.loop.chunk_start import archived_route, routed +from do_epic import chunk_prompt, scheduler from loop_claude.loop.close import closed_cycle -from loop_claude.loop.main import setup_version -from loop_claude.loop.reload import LoopRun -from loop_claude.loop.this_loop import Loop -from loop_claude.project.model_choice import get_or_ask_models, Models -from loop_claude.project.premises import read_premises -from loop_claude.project.records import read_records +from agent_cycle.run import Cycle, run_cycle +from do_epic.config import DoEpicConfig, load from loop_effects.effects import Effects, say -from loop_state.paths import Paths -from model_routing.ladder_file import project_ladder_file, read_ladder, SHIPPED -from plan_store.jira_epic import ISSUE_KEY from project_config.settings import Epic from record_store.jira_description import EpicDescription +from do_epic.backend.protocol import EpicIssue, EpicStore +from do_epic.epic_record import EpicRecord +from failure import Failure +from agent_cycle.verdicts import Finished, TakenIn +from loop_claude.project.model_choice import get_or_ask_models, Models +from plan_store.jira_epic import ISSUE_KEY +from do_epic.backend.jira import JiraEpic +from agent_cycle.routing import judge_rung +from do_epic.repos import locate +from loop_claude.loop.this_loop import Loop +from loop_claude.loop.reload import LoopRun +from loop_state.paths import Paths from transcript_archive.project_key import project_key +from model_routing.ladder_file import project_ladder_file, read_ladder, SHIPPED +from loop_claude.project.premises import read_premises +from loop_claude.project.records import read_records +from do_epic.repo_pick import recorded, Repo +from claude_code.session import session_named +from loop_claude.loop.main import setup_version +from agent_cycle.stop import Stop +from agent_cycle.direct_message import tell +from agent_cycle import tmux HELP = f"""usage: do-epic diff --git a/bin/do_epic/scheduler.py b/bin/do_epic/scheduler.py index 1cfbb1ca..c6ad7988 100644 --- a/bin/do_epic/scheduler.py +++ b/bin/do_epic/scheduler.py @@ -5,15 +5,15 @@ import dataclasses import pathlib import typing -from agent_cycle import tmux -from do_epic.backend.protocol import EpicIssue from do_epic.epic_record import CAP -from do_epic.repo_pick import HumanTask, recorded, Repo -from do_epic.split import SPLIT_LABEL -from failure import Failure from loop_claude.loop.chunk_windows import epic_chunks, HANDED, LOCK, project_lock, starting +from do_epic.backend.protocol import EpicIssue +from failure import Failure +from do_epic.repo_pick import HumanTask, recorded, Repo from project_config.settings import PARALLEL_CHUNKS from transcript_archive.project_key import project_key +from do_epic.split import SPLIT_LABEL +from agent_cycle import tmux # Under the home folder, a folder per epic key holds the epic's LOCK. A chunk without a repo works there. STATE = ".local/state/do-epic" diff --git a/bin/do_epic/test_main.py b/bin/do_epic/test_main.py index b17e33e3..07b7b7b5 100644 --- a/bin/do_epic/test_main.py +++ b/bin/do_epic/test_main.py @@ -8,20 +8,20 @@ import unittest sys.path.insert(0, str(pathlib.Path(__file__).resolve().parents[1])) -from agent_cycle import escalation_mark, judge, tmux from do_epic import chunk_prompt, main -from do_epic.backend.fake import MemoryEpic from do_epic.backend.protocol import EpicIssue from do_epic.epic_record import EpicRecord -from do_epic.test_do_epic import SETTINGS -from do_epic.test_scheduler import issue +from agent_cycle import escalation_mark, judge, tmux from failure import Failure -from loop_claude.loop.reload import LoopRun -from loop_claude.loop.this_loop import Loop from loop_claude.test_loop_claude import FakeEffects +from do_epic.test_scheduler import issue +from loop_claude.loop.this_loop import Loop +from loop_claude.loop.reload import LoopRun +from do_epic.backend.fake import MemoryEpic from loop_state.paths import paths_from -from model_routing.ladder import Rung from model_routing.route import Route +from model_routing.ladder import Rung +from do_epic.test_do_epic import SETTINGS DESCRIPTION = "**Max parallel chunks:** 2\n\n## Goals\nShip the import.\n\n## Audience\nThe client's team.\n" diff --git a/bin/do_epic/test_scheduler.py b/bin/do_epic/test_scheduler.py index c63e502e..9053f81b 100644 --- a/bin/do_epic/test_scheduler.py +++ b/bin/do_epic/test_scheduler.py @@ -6,11 +6,11 @@ import unittest sys.path.insert(0, str(pathlib.Path(__file__).resolve().parents[1])) -from agent_cycle import tmux +from do_epic.scheduler import Chunk, CHUNK_FLAG, chunks, Epic, refusal, RepoRoom, start_chunks, Started, Waits from do_epic.backend.protocol import EpicIssue -from do_epic.epic_record import parallel_chunks_in -from do_epic.scheduler import Chunk, chunks, CHUNK_FLAG, Epic, RepoRoom, refusal, start_chunks, Started, Waits from failure import Failure +from do_epic.epic_record import parallel_chunks_in +from agent_cycle import tmux def issue(key: str, *labels: str, done: bool = False, blockers: tuple[str, ...] = (), parent: str = "ABC-12") -> EpicIssue: diff --git a/bin/loop_claude/cycle/prompts.py b/bin/loop_claude/cycle/prompts.py index a1600abe..18384413 100644 --- a/bin/loop_claude/cycle/prompts.py +++ b/bin/loop_claude/cycle/prompts.py @@ -2,8 +2,8 @@ import functools import typing -from agent_cycle.escalation_mark import asks_higher_rung from agent_cycle.worker_prompts import answers_recorded, WorkerPrompts +from agent_cycle.escalation_mark import asks_higher_rung from model_routing.review_choice import chosen, ReviewChoice from loop_claude.cycle.chunk_items import CHUNK_ITEMS from model_routing.route import ESCALATION_MARKER, Route