Make the judge's prompt readable on its own, ask once before the full scan, and sort imports by their first binding
This commit is contained in:
@@ -3,11 +3,11 @@ import os
|
||||
import pathlib
|
||||
import sys
|
||||
|
||||
from loop_claude.claude_code.session import session_files
|
||||
from loop_claude.claude_code.transcript import first_timestamped_line
|
||||
from loop_claude.failure import Failure
|
||||
from loop_claude.claude_code.transcript import first_timestamped_line
|
||||
from loop_claude.file_writes import make_private, replace_file
|
||||
from loop_claude.paths import Paths
|
||||
from loop_claude.claude_code.session import session_files
|
||||
|
||||
|
||||
def archive(project_key: str, path: str, task: str, outcome: str, paths: Paths) -> Failure | None:
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
import sys
|
||||
import uuid
|
||||
|
||||
from loop_claude.claude_code.transcript import human_turns, read_transcript
|
||||
from loop_claude.claude_code.trust import trust
|
||||
from loop_claude.effects import Effects
|
||||
from loop_claude.failure import Failure
|
||||
from loop_claude.claude_code.transcript import human_turns, read_transcript
|
||||
from loop_claude.stop import needs_human, needs_terminal, Stop
|
||||
from loop_claude.paths import Paths
|
||||
from loop_claude.claude_code.trust import trust
|
||||
from loop_claude.project.checkout import worktrees
|
||||
from loop_claude.stop import Stop, needs_human, needs_terminal
|
||||
|
||||
ANSWER_QUESTION = "answer the question above"
|
||||
|
||||
|
||||
@@ -3,12 +3,12 @@ import json
|
||||
import re
|
||||
import typing
|
||||
|
||||
from loop_claude.effects import Effects
|
||||
from loop_claude.failure import Failure
|
||||
from loop_claude.cycle.verdicts import Finished, Interrupt, QuotedAnswer, Unfinished, Verdict
|
||||
from loop_claude.claude_code.entries import hit_limit, limit_said, parse_entry, structured_output
|
||||
from loop_claude.cycle.limited import Limited
|
||||
from loop_claude.cycle.retry import retried
|
||||
from loop_claude.cycle.verdicts import Finished, Interrupt, QuotedAnswer, Unfinished, Verdict
|
||||
from loop_claude.effects import Effects
|
||||
from loop_claude.failure import Failure
|
||||
from loop_claude.stop import Stop
|
||||
|
||||
# At 3 to 4 characters a token, 100,000 to 133,000 tokens, which leaves a 200,000-token context room for the reply; the largest session rendered here was 364,000 characters on 2026-10-03.
|
||||
@@ -21,9 +21,9 @@ JUDGE_RULES = (
|
||||
"- it carried on under an assumption that decides the deliverable, that the human could "
|
||||
"reasonably reject and that neither README.md nor the project's records settle; a caveat about "
|
||||
"transient state it then handled is not one\n"
|
||||
"- it is blocked on something only the human can supply: a credential, a version bump, a release "
|
||||
"ready to cut, a choice outside the repo\n"
|
||||
"- it flags that the goals, the plan or the task itself is unclear, missing or in need of change\n"
|
||||
"- it is blocked on something only the human can supply: a credential, a version bump, the go-ahead "
|
||||
"to publish a release, a choice outside the repo\n"
|
||||
"- it flags that the goals, the plan in todo.md or the task itself is unclear, missing or in need of change\n"
|
||||
"- it chose between alternatives that neither README.md nor the project's records discriminate "
|
||||
"between - neither rules the rejected one out - and the choice materially changes the deliverable\n"
|
||||
"interrupt=false otherwise. Bookkeeping the agent settled silently - what to document, wording, "
|
||||
@@ -36,6 +36,7 @@ JUDGE_RULES = (
|
||||
"Where README.md or the project's records answer the agent's own question and no [loop] line has "
|
||||
"quoted that answer yet, set interrupt=false, put that question in question and quote the passage that answers it in answer, verbatim; the agent is "
|
||||
"then given that passage in place of the human's reply.\n"
|
||||
"The chunk is the one piece of work the task asks for, shipped as one pull request. "
|
||||
"finished=true when the chunk is complete: merged, or nothing remains that the agent could do on "
|
||||
"its own. finished=false when work remains that a further run can continue: an open PR, a review "
|
||||
"not yet run, CI not yet reported."
|
||||
@@ -60,6 +61,7 @@ JUDGE_SCHEMA = {
|
||||
|
||||
|
||||
def judge(root: str, task: str, premises: str, records: str, rendered_transcript: str, model: str, effects: Effects) -> Verdict | Stop:
|
||||
# --json-schema has claude check its reply against the schema and return it as the json result's structured_output.
|
||||
# No tools, so the verdict rests on the transcript grounded() checks it against; no persistence, so its runs stay out of the session picker.
|
||||
args = [
|
||||
"-p",
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import sys
|
||||
import typing
|
||||
|
||||
from loop_claude.cycle.limited import Limited
|
||||
from loop_claude.effects import Effects
|
||||
from loop_claude.failure import Failure
|
||||
from loop_claude.cycle.limited import Limited
|
||||
from loop_claude.stop import Stop
|
||||
|
||||
T = typing.TypeVar("T")
|
||||
|
||||
@@ -1,20 +1,20 @@
|
||||
import dataclasses
|
||||
import typing
|
||||
|
||||
from loop_claude.claude_code.session import Session, delete_session, session_open, transcript_file
|
||||
from loop_claude.claude_code.transcript import read_transcript, render
|
||||
from loop_claude.cycle.states import Active, Archived, Closing, Ended, Event, HumanAnswered, Interrupting, Judging, Ruled, State, transition, WorkerRan, Working
|
||||
from loop_claude.cycle.archive import archive
|
||||
from loop_claude.cycle.interrupt import interrupt
|
||||
from loop_claude.cycle.judge import judge
|
||||
from loop_claude.cycle.retry import retried
|
||||
from loop_claude.cycle.states import Active, Archived, Closing, Ended, Event, HumanAnswered, Interrupting, Judging, Ruled, State, WorkerRan, Working, transition
|
||||
from loop_claude.cycle.verdicts import Finished, QuotedAnswer, Unfinished
|
||||
from loop_claude.cycle.worker import run_worker, worker_args
|
||||
from loop_claude.claude_code.session import delete_session, Session, session_open, transcript_file
|
||||
from loop_claude.effects import Effects
|
||||
from loop_claude.failure import Failure
|
||||
from loop_claude.paths import Paths
|
||||
from loop_claude.cycle.verdicts import Finished, QuotedAnswer, Unfinished
|
||||
from loop_claude.cycle.interrupt import interrupt
|
||||
from loop_claude.cycle.judge import judge
|
||||
from loop_claude.project.model_choice import Models
|
||||
from loop_claude.paths import Paths
|
||||
from loop_claude.project.records import QUOTE_SOURCES
|
||||
from loop_claude.claude_code.transcript import read_transcript, render
|
||||
from loop_claude.cycle.retry import retried
|
||||
from loop_claude.cycle.worker import run_worker, worker_args
|
||||
from loop_claude.stop import Stop
|
||||
|
||||
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
from loop_claude.claude_code.entries import assistant_parts, ends_stream, hit_limit, limit_said, parse_entry, rejected_until
|
||||
from loop_claude.claude_code.session import Session
|
||||
from loop_claude.claude_code.transcript import part_line
|
||||
from loop_claude.cycle.limited import Limited
|
||||
from loop_claude.cycle.verdicts import QuotedAnswer
|
||||
from loop_claude.effects import Effects
|
||||
from loop_claude.failure import Failure
|
||||
from loop_claude.cycle.limited import Limited
|
||||
from loop_claude.claude_code.transcript import part_line
|
||||
from loop_claude.project.records import QUOTE_SOURCES
|
||||
from loop_claude.cycle.verdicts import QuotedAnswer
|
||||
from loop_claude.claude_code.session import Session
|
||||
|
||||
PRINTED_TOOL_INPUT = 160
|
||||
|
||||
@@ -46,6 +46,7 @@ def worker_args(task: str, session: Session, model: str, resuming: bool, answere
|
||||
start = ["-p", "Continue the task; the previous run stopped before it was finished.", "--resume", str(session.id)]
|
||||
else:
|
||||
start = ["-p", f"{task}\n\nContinue any open draft PR or worktree for the chunk before creating a new one.", "--name", session.name, "--session-id", str(session.id)]
|
||||
# --session-id starts a session under the id loop-claude keeps, which --resume continues; -p needs --verbose for stream-json, one JSON event a line, the last a result event.
|
||||
return [
|
||||
*start,
|
||||
"--output-format", "stream-json",
|
||||
|
||||
Reference in New Issue
Block a user