Answer stability round 1: 0 🔴, 2 🟡 (0 misread); move hand_over into loop_claude and correct items 51 and 197

This commit is contained in:
2026-11-13 23:34:24 +01:00
parent c1924e51ef
commit aa0c7970bd
6 changed files with 6 additions and 7 deletions
+1 -1
View File
@@ -1,4 +1,4 @@
"""What loop-claude and the tools that replay its runs share: where its files are (paths.py), and how it opens claude for the human on its terminal (hand_over.py).
"""Where loop-claude keeps its files (paths.py), which the tools that replay its runs read too.
It doesn't import anything from loop_claude/.
"""
-29
View File
@@ -1,29 +0,0 @@
"""Opens claude on the terminal for the human."""
import dataclasses
from loop_effects.effects import Effects
from failure import Failure
from model_routing.ladder import Rung
@dataclasses.dataclass(frozen=True)
class ClaudeCommand:
"""How claude opens on a terminal: its arguments, its folder and what it adds to the environment."""
args: list[str]
cwd: str
env: dict[str, str]
def claude_args(rung: Rung, args: list[str]) -> list[str]:
return [*rung.flags(), "--permission-mode", "bypassPermissions", *args]
# CLAUDE_CODE_SANDBOXED, which Claude Code doesn't document, skips its trust dialog without writing ~/.claude.json:
# docs/decisions.md → `loop-claude: every claude it opens on a terminal has CLAUDE_CODE_SANDBOXED set`.
def hand_over(command: ClaudeCommand, effects: Effects) -> Failure | None:
"""Runs claude on the terminal as command says, with CLAUDE_CODE_SANDBOXED=1 added to its environment; the failure is why claude could not start."""
try:
effects.claude_on_terminal(command.args, command.cwd, {**command.env, "CLAUDE_CODE_SANDBOXED": "1"})
except OSError as failure:
return Failure(str(failure.strerror))
return None