Answer prose round 1: 0 🔴, 13 🟡; split the exit-2 line, stop calling the claude session the interrupt, reword the interrupt's definition, the release_ready comment, the changelog and items 180 and 182, and file items 183 and 184

This commit is contained in:
2026-10-17 23:55:59 +02:00
parent 062af261d8
commit 023380f5a5
12 changed files with 41 additions and 32 deletions
+2 -2
View File
@@ -12,7 +12,7 @@ from claude_code.trust import trust
from loop_claude.project.checkout import worktrees
ANSWER_QUESTION = "answer the question above"
# The word and the line were picked on 2026-10-17 by a bench of three readers seated as the README's audience, as ~/.claude/CLAUDE.md → "Working loop" → "Bench a syntax with the people who write it." has it.
# TALK and ASK_ANSWER were picked on 2026-10-17 by a bench of three readers seated as the README's audience, as ~/.claude/CLAUDE.md → "Working loop" → "Bench a syntax with the people who write it." has it.
TALK = "/talk"
ASK_ANSWER = f"Answer ({TALK} opens claude, Enter stops the loop): "
@@ -27,7 +27,7 @@ def put_question(question: str, answer_here: bool, effects: Effects) -> str | Ta
print(f"\n{question}", file=sys.stderr)
if stop := needs_terminal(ANSWER_QUESTION, effects.on_terminal()):
return stop
# Keys typed while the worker ran wait on the terminal, so they would answer a question no one has read, here or in claude's session, which reads them too. A paste's lines after the first are dropped with them at the next question, never taken as its answer; a longer answer goes through TALK.
# Keys typed while the worker ran wait on the terminal, and would answer a question no one has read, here or in claude's session, which reads them too. Of a pasted answer, input takes the first line; the rest wait, and the next question drops them. A longer answer goes through TALK.
effects.discard_typed()
if not answer_here:
return Talk()
+3 -4
View File
@@ -19,7 +19,6 @@ from claude_code.entries import structured_output
# 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.
JUDGE_PROMPT_CHARS = 400000
# The rules close the judge's prompt, in three parts: when to interrupt and what to ask; when README.md or the records answer the agent in the human's place; and when the chunk is finished.
INTERRUPT_RULES = (
"Decide whether the human must now be interrupted. interrupt=true when any of these appear:\n"
"- the agent asks the human anything, seeks approval, or says a decision is the human's, and neither "
@@ -72,8 +71,8 @@ class Reply:
finished: bool = dataclasses.field(metadata={"description": "Whether the chunk is finished."})
interrupt: bool = dataclasses.field(metadata={"description": "Whether the human must now be interrupted."})
question: str = dataclasses.field(metadata={"description": "With interrupt true, the single question to put to the human. With a quoted answer, the agent's question that the answer field answers. Empty otherwise."})
# Opens claude's session for the human at once, in place of asking for a one-line answer: run.ask. The judge decides it, not the plan's standing (todo_table.chunk_item), which loop-claude computes only as a chunk on the ladder is routed afresh, so a release ready to cut in a resumed chunk, or off the ladder, would be missed. A wrong ruling costs the human one typed /talk, or a session they leave.
release_ready: bool = dataclasses.field(metadata={"description": "Whether interrupt is true for a release ready to cut, which only the human may publish."})
# True opens claude's session at once, in place of the one-line answer (run.ask). The judge decides it, since loop-claude computes the plan's standing (todo_table.chunk_item) only when it routes a chunk on the ladder afresh: it would miss a release ready to cut in a resumed chunk or off the ladder. A wrong ruling costs the human one typed /talk, or answering in claude, which stops the loop if they leave it with nothing typed.
release_ready: bool = dataclasses.field(metadata={"description": "With interrupt true, whether the question is about a release ready to cut, which only the human may publish. False otherwise."})
REPLY_TYPES = typing.get_type_hints(Reply)
@@ -178,7 +177,7 @@ def judge_args(rung: Rung) -> list[str]:
def run_judge(root: str, args: list[str], prompt: str, shown: str, quotable: str, effects: Effects) -> Verdict | Failure | Limited:
"""One judge run. Each quote in its verdict is checked word for word, since stitched fragments can say what their source does not:
- the evidence, against shown, the transcript as the judge saw it, fragment by fragment in order: a misquote is Rejected, which judge retries;
- the evidence, against shown (the transcript as the judge saw it), its fragments in order: a misquote is Rejected, which judge retries;
- a quoted answer, against quotable: a misquote puts the question to the human;
- an escalation, against shown: a misquote drops it, so the worker's rung holds.
quotes_checked checks the last two. Neither misquote is a Failure, which would otherwise exit an unattended loop.
+4 -4
View File
@@ -130,16 +130,16 @@ def answered(question: str, answer: str, route: Route, anchor: Rung | None, step
def typed(question: str, answer: str, route: Route, anchor: Rung | None, stepped: bool) -> str:
"""Resumes the worker with the human's answer to an interrupt. answer is one line, as the terminal reads it."""
"""The prompt that resumes the worker with the human's answer to an interrupt. answer is one line, as the terminal reads it."""
return f"{TYPED_HERE}\n{answer}\n\nYour question was: {question}\n\nContinue the task. The chunk is finished only once {ANSWERS_RECORDED}.{stepped_to(route, anchor, stepped)}"
# Opens typed's prompt, and the answer is the line after it, so typed_answer reads the answer from the prompt's start alone.
# Opens typed's prompt, with the answer on the line after it, so typed_answer finds the answer at the prompt's start, whatever the question holds.
TYPED_HERE = "The human answered your question at loop-claude's terminal:"
def typed_answer(prompt: str) -> Typed | None:
"""The answer typed put in prompt, and the rest of that prompt, so the judge reads the answer as the human's; None for any other prompt."""
"""Splits a prompt from typed() into its answer and the rest, so the judge reads the answer as the human's; None for any other prompt."""
opening = f"{TYPED_HERE}\n"
if not prompt.startswith(opening):
return None
@@ -148,7 +148,7 @@ def typed_answer(prompt: str) -> Typed | None:
def stepped_to(route: Route, anchor: Rung | None, stepped: bool) -> str:
"""Where the ruling that brought the answer stepped the worker up, names its new rung, as resumed does."""
"""The sentences naming the worker's new rung, as resumed has them, where the ruling that brought the answer stepped the worker up; empty otherwise."""
return f" Your request for a higher rung went through: loop-claude runs you on {route.rung}.{rungs_held(route, anchor)} A further request for a higher rung steps you up no more in this cycle." if stepped else ""
+2 -2
View File
@@ -74,12 +74,12 @@ class HumanTyped:
@dataclasses.dataclass(frozen=True)
class TalkChosen:
"""The human typed /talk, or the question is a release ready to cut, which only the human may cut."""
"""The human typed /talk, or the interrupt is for a release ready to cut."""
@dataclasses.dataclass(frozen=True)
class HumanTalked:
"""The human typed in the interrupt's claude session."""
"""The human typed in the worker's claude session."""
@dataclasses.dataclass(frozen=True)