Answer principles round 1: 0 🔴, 9 🟡 (0 misread); name the 200k window's compaction point, read a compaction summary as Claude Code's, remove item 231, refresh items 234, 235, 52 and 102, file item 237

This commit is contained in:
2026-10-27 00:32:10 +01:00
parent f2e239d111
commit 14736e8e6e
11 changed files with 48 additions and 63 deletions
+3 -3
View File
@@ -5,7 +5,7 @@ import typing
from loop_claude.cycle.states import Active, Archived, Closing, Ended, Event, HumanTalked, HumanTyped, Interrupting, Judging, QUOTED_ANSWERS_PER_CYCLE, Ruled, State, TalkChosen, Talking, transition, TypedAnswer, WorkerRan, Working
from loop_claude.routing import after_ruling, judge_rung
from transcript_archive.write import archive
from loop_claude.cycle.worker import AUTO_COMPACT_WINDOW, COMPACT_ABOVE, run_worker, worker_args
from loop_claude.cycle.worker import AUTO_COMPACT_WINDOW, COMPACT_WINDOW, run_worker, worker_args
from claude_code.session import delete_session, Session, session_open, transcript_file
from loop_claude.effects import Effects
from failure import Failure
@@ -116,8 +116,8 @@ def work(cycle: Cycle, answered: QuotedAnswer | TypedAnswer | None, step_up: Ste
def worker_environment(cycle: Cycle) -> dict[str, str]:
"""The rungs the worker's claude is handed, which rule-hook holds its review launches to, and the context size above which it compacts."""
return {**worker_rungs.environment(cycle.project, cycle.route), AUTO_COMPACT_WINDOW: str(COMPACT_ABOVE)}
"""The rungs the worker's claude is handed, which rule-hook holds its review launches to, and the auto-compact window of its context."""
return {**worker_rungs.environment(cycle.project, cycle.route), AUTO_COMPACT_WINDOW: str(COMPACT_WINDOW)}
def worker_start(cycle: Cycle, answered: QuotedAnswer | TypedAnswer | None, step_up: StepUp | None) -> list[str]:
+2 -2
View File
@@ -12,9 +12,9 @@ from claude_code.session import Session
PRINTED_TOOL_INPUT = 160
# Seconds between reads of the machine's memory while too little of it is available to start a worker.
MEMORY_POLL = 60
# The context size, in tokens, above which the worker's claude compacts, handed to it in this variable: docs/decisions.md → `loop-claude: the worker's claude compacts its context above 200k tokens`.
# The auto-compact window, in tokens, handed to the worker's claude in this variable. Claude Code compacts before the window fills, at about 170k: docs/decisions.md → `loop-claude: the worker's claude compacts its context before it fills a 200k window`.
AUTO_COMPACT_WINDOW = "CLAUDE_CODE_AUTO_COMPACT_WINDOW"
COMPACT_ABOVE = 200_000
COMPACT_WINDOW = 200_000
def run_worker(root: str, args: list[str], env: dict[str, str], effects: Effects) -> Failure | Limited | None: