Answer the prose pass: name README.md beside the records, one idea per sentence in --help and the judge's rules, date the decision's revision
This commit is contained in:
@@ -14,8 +14,8 @@ from loop_claude.stop import Stop
|
||||
JUDGE_PROMPT_CHARS = 400000
|
||||
|
||||
JUDGE_RULES = (
|
||||
"Decide whether the agent has something open that the human, or README.md and the project's records, "
|
||||
"must answer. interrupt=true when any of these appear:\n"
|
||||
"Decide whether the agent has something open that the human must answer, or that README.md or the "
|
||||
"project's records answer. interrupt=true when any of these appear:\n"
|
||||
"- the agent asks the human anything, seeks approval, or says a decision is the human's\n"
|
||||
"- 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 "
|
||||
@@ -28,12 +28,12 @@ JUDGE_RULES = (
|
||||
"interrupt=false otherwise. Bookkeeping the agent settled silently - what to document, wording, "
|
||||
"where a note goes - is not on its own a reason to interrupt. The human may have replied inside the transcript, on a [human] line: judge only what "
|
||||
"is still open, never a question they already answered there. A [loop] line is what loop-claude told "
|
||||
"the agent, such as an answer quoted from README.md or the project's records; a question it answered "
|
||||
"is no longer open, unless the agent asks it again: then it is the human's, with answer empty.\n"
|
||||
"the agent, such as an answer quoted from README.md or the project's records. A question a [loop] "
|
||||
"line answered is no longer open. If the agent asks it again, put it to the human, with answer empty.\n"
|
||||
"Where the agent asked or flagged something itself, the question is that one, in the agent's own "
|
||||
"wording; never construct another from facts it stated.\n"
|
||||
"Where README.md or the project's records answer that question, quote the passage that answers it "
|
||||
"in answer, verbatim; the agent is then given that passage in place of the human's reply.\n"
|
||||
"in answer, verbatim, with interrupt=true; the agent is then given that passage in place of the human's reply.\n"
|
||||
"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."
|
||||
|
||||
@@ -66,7 +66,7 @@ def step(cycle: Cycle, state: Active) -> Event | Stop:
|
||||
|
||||
def work(cycle: Cycle, answered: AnsweredFromRecords | None) -> WorkerRan | Stop:
|
||||
if answered is not None:
|
||||
print(f"\n=== the records answered: {answered.question} ===\n{answered.answer}", flush=True)
|
||||
print(f"\n=== README.md or the records answered: {answered.question} ===\n{answered.answer}", flush=True)
|
||||
# session_open runs inside the lambda: a failed attempt may have opened the session.
|
||||
if stop := retried("worker", lambda: run_worker(cycle.root, worker_args(cycle.task, cycle.session, cycle.models.worker, session_open(cycle.session), answered), cycle.effects), cycle.effects):
|
||||
return stop
|
||||
|
||||
@@ -2,20 +2,20 @@ import dataclasses
|
||||
|
||||
from loop_claude.cycle.verdicts import AnsweredFromRecords, Finished, Interrupt, Unfinished, Verdict
|
||||
|
||||
# A backstop for what the judge misses, such as a reworded repeat, so the worker cannot loop unattended on the records' answers.
|
||||
# A backstop for what the judge misses, such as a reworded repeat, so the worker cannot loop unattended on answers quoted from README.md or the records.
|
||||
RECORDS_ANSWERS_PER_CYCLE = 3
|
||||
|
||||
|
||||
@dataclasses.dataclass(frozen=True)
|
||||
class Working:
|
||||
"""The worker runs, resumed with the records' answer when there is one."""
|
||||
"""The worker runs, resumed with an answer quoted from README.md or the records when there is one."""
|
||||
answered: AnsweredFromRecords | None = None
|
||||
records_answers: int = 0
|
||||
|
||||
|
||||
@dataclasses.dataclass(frozen=True)
|
||||
class Judging:
|
||||
"""The judge rules; records_answers counts the questions the records answered this cycle."""
|
||||
"""The judge rules; records_answers counts the questions README.md or the records answered this cycle."""
|
||||
transcript_path: str
|
||||
records_answers: int = 0
|
||||
|
||||
@@ -72,7 +72,7 @@ def transition(state: State, event: Event) -> State:
|
||||
case Judging(_, records_answers), Ruled(AnsweredFromRecords() as answered) if records_answers < RECORDS_ANSWERS_PER_CYCLE:
|
||||
return Working(answered, records_answers + 1)
|
||||
case Judging(transcript_path, records_answers), Ruled(AnsweredFromRecords(question=question, answer=answer)):
|
||||
return Interrupting(transcript_path, f"{question}\n\nREADME.md or the project's records say:\n{answer}\n\nThe records answered {records_answers} questions this cycle, so this one comes to you.", records_answers)
|
||||
return Interrupting(transcript_path, f"{question}\n\nREADME.md or the project's records say:\n{answer}\n\nREADME.md or the records answered {records_answers} questions this cycle, so this one comes to you.", records_answers)
|
||||
case Judging(transcript_path, records_answers), Ruled(Interrupt(question=question)):
|
||||
return Interrupting(transcript_path, question, records_answers)
|
||||
case Judging(transcript_path, _), Ruled(Finished() | Unfinished() as verdict):
|
||||
|
||||
@@ -3,13 +3,14 @@
|
||||
usage: loop-claude <task>
|
||||
|
||||
Run it anywhere inside a project checkout whose README.md has ## Goals and ## Audience, the
|
||||
premises; the task runs at the checkout root. Each cycle a worker runs the task; a judge then reads
|
||||
as much of the transcript's end as fits a 400,000-character prompt against the premises and the
|
||||
project's records, AGENTS.md and docs/decisions.md where they exist, and rules whether the chunk,
|
||||
the work of one PR, is finished. A choice the worker made that the premises or the records settle is
|
||||
not asked about. When the worker asks a question they answer, the judge quotes the answer, printed
|
||||
on stdout, and the worker resumes with it, up to three times a cycle; a question asked again after
|
||||
its answer goes to the human, and a fourth with the quote.
|
||||
premises; the task runs at the checkout root. Each cycle a worker runs the task. A judge then reads
|
||||
the transcript's end, the premises, and the project's records: AGENTS.md and docs/decisions.md,
|
||||
where they exist. It rules whether the chunk, the work of one PR, is finished. A choice the worker
|
||||
made that the premises or the records settle is not asked about. When the worker asks a question
|
||||
they answer, the judge quotes the answer, loop-claude prints it, and the worker resumes with it. A
|
||||
quote they do not hold word for word is dropped, and the question goes to the human. So does a
|
||||
question asked again after its answer, and the fourth question they answer in one cycle, with the
|
||||
quote.
|
||||
A question only the human can answer, or a release ready to cut, is an interrupt: `claude --resume`
|
||||
on the terminal, every worktree first marked trusted in ~/.claude.json. An unfinished chunk resumes
|
||||
its session next cycle; the next chunk starts a fresh session.
|
||||
@@ -51,12 +52,11 @@ Exit 1, saying why, when:
|
||||
- the worker or the judge fails three times running, retried a minute apart within the cycle. A
|
||||
worker fails when claude cannot start, exits non-zero, is killed, or ends without a result event;
|
||||
a judge when claude cannot start or exits non-zero, or its reply misses or mistypes a field,
|
||||
interrupts without a question, or quotes a line the transcript does not hold; an answer it quotes
|
||||
that the premises and the records do not hold is dropped, and the question goes to the human. A
|
||||
usage limit is not a failure, and restarts the count of three: the worker or the judge is retried
|
||||
2 minutes after the limit resets, or every 10 minutes when the reset time is unknown or more than
|
||||
2 minutes past. The judge's reply gives its reset time only as text, so the judge is always
|
||||
retried every 10 minutes. stderr says when the next try is due.
|
||||
interrupts without a question, or quotes a line the transcript does not hold. A usage limit is not
|
||||
a failure, and restarts the count of three: the worker or the judge is retried 2 minutes after the
|
||||
limit resets, or every 10 minutes when the reset time is unknown or more than 2 minutes past. The
|
||||
judge's reply gives its reset time only as text, so the judge is always retried every 10 minutes.
|
||||
stderr says when the next try is due.
|
||||
|
||||
Exit 2, when the human is needed and cannot answer:
|
||||
- stdin or stdout is not a terminal, when a model must be picked or an interrupt answered
|
||||
|
||||
Reference in New Issue
Block a user