From 28b714d5cac6ed90771a14041f4642a79114a910 Mon Sep 17 00:00:00 2001 From: Lilleman auf Larv Date: Fri, 30 Oct 2026 21:31:44 +0100 Subject: [PATCH 1/7] Record the reading cost of the last chunk --- docs/reading-cost.md | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/docs/reading-cost.md b/docs/reading-cost.md index f33bd0d6..eb85f763 100644 --- a/docs/reading-cost.md +++ b/docs/reading-cost.md @@ -940,3 +940,20 @@ Read most (opens and searches): - `bin/loop_claude/test_black_box.py` 2 - `bin/loop_inbox/main.py` 2 - `bin/loop_inbox/test_loop_inbox.py` 2 + +## Reading cost, chunk 856cc431e771, finished 2026-10-30T12:23:00Z + +65006 new input tokens before the first commit. + +Read most (opens and searches): + +- `todo.md` 4 +- `README.md` 3 +- `bin/rule_hook/test_rule_hook.py` 3 +- `docs/decisions.md` 3 +- `CHANGELOG.md` 2 +- `settings.json` 2 +- `AGENTS.md` 1 +- `bin/model_routing/ladder.py` 1 +- `bin/model_routing/worker_rungs.py` 1 +- `bin/rule_hook/call.py` 1 -- 2.52.0 From 0a0a2207c9babb9a5d71e9f6a490f784c18a4d3c Mon Sep 17 00:00:00 2001 From: Lilleman auf Larv Date: Fri, 30 Oct 2026 21:31:44 +0100 Subject: [PATCH 2/7] Open claude on a terminal with CLAUDE_CODE_SANDBOXED set, and stop writing ~/.claude.json --- AGENTS.md | 2 +- CHANGELOG.md | 1 + bin/claude_code/test_claude_code.py | 11 +----- bin/claude_code/trust.py | 38 ------------------ bin/loop_claude/cycle/interrupt.py | 2 +- bin/loop_claude/hand_over.py | 14 +++---- bin/loop_claude/loop/main.py | 4 +- bin/loop_claude/loop/routing_check.py | 2 +- bin/loop_claude/paths.py | 2 - bin/loop_claude/project/checkout.py | 4 -- bin/loop_claude/test_black_box.py | 56 +++------------------------ bin/loop_claude/test_loop_claude.py | 6 --- bin/loop_inbox/main.py | 2 +- docs/decisions.md | 8 ++-- todo.md | 5 --- 15 files changed, 22 insertions(+), 135 deletions(-) delete mode 100644 bin/claude_code/trust.py diff --git a/AGENTS.md b/AGENTS.md index 4feb90b9..29d55ab9 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -11,7 +11,7 @@ Decisions live in `docs/decisions.md`: - larv-review: within a chunk lifting a project towards the comprehension floor, work on the project's lowest-scoring dimension comes first, and the floor doesn't block anything - loop-claude: a `claude` that cannot start is a failed worker run, retried - loop-claude: a judge decides each interrupt and each quoted answer from the transcript, the README's premises, `AGENTS.md`, `docs/decisions.md`, `~/.claude/CLAUDE.md`, `~/.claude/rules/` and larv-review's standards, and holds a chunk open while an answer the human typed in it is recorded nowhere; the worker's own account of which goal settles a choice decides nothing -- loop-claude: before it or loop-inbox opens claude on a terminal, it marks the checkout and each of its worktrees trusted in `~/.claude.json` +- loop-claude: every claude it or loop-inbox opens on a terminal has `CLAUDE_CODE_SANDBOXED` set, so Claude Code skips its trust dialog, and loop-claude doesn't write `~/.claude.json` - loop-claude: each project's model lives in `~/.claude/loop-claude-models.json`, which only loop-claude writes - loop-claude: every claude it starts bypasses permissions inside its sandbox - loop-claude: one session per project, its id derived from the checkout's path relative to `~/code`, or to `/` outside it diff --git a/CHANGELOG.md b/CHANGELOG.md index 5d69ee03..153c6e1f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,7 @@ - A release review now fixes the findings of its architecture and principles passes in the release it reviews. Before, it filed each one in `todo.md`, so the release held the drift the review had found. It files only three kinds of finding, each under the release being reviewed: one whose fix needs a human answer, marked `question`; one whose fix adds a feature; and one whose fix the five rounds cannot finish. Until each is done, the release isn't ready to cut. - In a repo with no tag yet, `chunk-preflight` now calls a release finished once `todo.md` files no item under it: its release review is due, and no later release's item is taken. Before, it lost sight of such a release. - In a run `loop-claude` started, `rule-hook` now refuses a `/security-review` or `/claude-security` Skill call that the worker makes in its own context on a rung below the project's. It also refuses one from any subagent whose prompt doesn't open with `You are the security pass for this chunk.`, since that subagent's rung is unchecked. The refusal says to invoke the skill from a subagent on the project's rung, its prompt opening with that sentence. Before, only an Agent call that launched the security pass was held to that rung. +- `loop-claude` and `loop-inbox` no longer write `~/.claude.json`. Each claude they open on a terminal, for `/talk`, a release ready to cut or a routing call, now has `CLAUDE_CODE_SANDBOXED=1` set, so Claude Code skips its trust dialog. Before, loop-claude marked the checkout and each worktree trusted in that file, and a write Claude Code made at the same moment could be lost. Claude Code doesn't document the variable: where a version drops it, the trust dialog comes back. ## 0.4.0 diff --git a/bin/claude_code/test_claude_code.py b/bin/claude_code/test_claude_code.py index d672029b..e0331503 100644 --- a/bin/claude_code/test_claude_code.py +++ b/bin/claude_code/test_claude_code.py @@ -6,7 +6,7 @@ import unittest sys.path.insert(0, str(pathlib.Path(__file__).resolve().parents[1])) -from claude_code import entries, reply, transcript, trust +from claude_code import entries, reply, transcript from failure import Failure @@ -132,14 +132,5 @@ class ClaudeReply(unittest.TestCase): self.assertEqual(reply.claude_reply(self.claude(FileNotFoundError(2, "No such file or directory")), [], "/r", "p", "claude"), Failure("could not start claude: No such file or directory")) -class MarkTrusted(unittest.TestCase): - def test_returns_the_updated_config_and_leaves_the_one_it_was_handed(self): - config = {"other": 1, "projects": {"/a": {"hasTrustDialogAccepted": True}, "/b": {"kept": True}}} - handed = json.dumps(config) - self.assertEqual(trust.mark_trusted(config, ["/a", "/b", "/c"]), ({"other": 1, "projects": {"/a": {"hasTrustDialogAccepted": True}, "/b": {"hasTrustDialogAccepted": True, "kept": True}, "/c": {"hasTrustDialogAccepted": True}}}, ["/b", "/c"])) - self.assertEqual(json.dumps(config), handed) - self.assertEqual(trust.mark_trusted({}, ["/a"]), ({"projects": {"/a": {"hasTrustDialogAccepted": True}}}, ["/a"])) - - if __name__ == "__main__": unittest.main() diff --git a/bin/claude_code/trust.py b/bin/claude_code/trust.py deleted file mode 100644 index 12e12d61..00000000 --- a/bin/claude_code/trust.py +++ /dev/null @@ -1,38 +0,0 @@ -import json -import pathlib -import typing - -from failure import Failure -from file_writes import replace_json - - -# A failure only warns: claude still opens, and the human answers Claude Code's trust dialog. -def trust(config: pathlib.Path, roots: list[str], note: typing.Callable[[str], None]) -> None: - try: - with open(config, encoding="utf-8") as handle: - data = json.load(handle) - except (OSError, ValueError) as failure: - note(f"could not read {config}: {getattr(failure, 'strerror', failure)}") - return - marked = mark_trusted(data, roots) - if isinstance(marked, Failure): - note(f"could not read {config}: {marked.reason}") - return - updated, untrusted = marked - if not untrusted: - return - if unwritten := replace_json(config, updated, indent=2): - note(f"could not write {config}: {unwritten.reason}") - return - note("trusted for the interrupt: " + ", ".join(untrusted)) - - -# Claude Code's config: {"projects": {"/home/me/code/log": {"hasTrustDialogAccepted": true, ...}}, ...} -def mark_trusted(config: object, roots: list[str]) -> tuple[dict, list[str]] | Failure: - if not isinstance(config, dict) or not isinstance(projects := config.get("projects", {}), dict): - return Failure('not an object whose "projects" is an object') - if (wrong := next((path for path, settings in projects.items() if not isinstance(settings, dict)), None)) is not None: - return Failure(f"projects[{json.dumps(wrong)}] is not an object") - untrusted = [path for path in roots if not projects.get(path, {}).get("hasTrustDialogAccepted")] - marked = {path: {**projects.get(path, {}), "hasTrustDialogAccepted": True} for path in untrusted} - return {**config, "projects": {**projects, **marked}}, untrusted diff --git a/bin/loop_claude/cycle/interrupt.py b/bin/loop_claude/cycle/interrupt.py index aa231f5a..8798892d 100644 --- a/bin/loop_claude/cycle/interrupt.py +++ b/bin/loop_claude/cycle/interrupt.py @@ -82,7 +82,7 @@ def claude_open(ask: Ask, where: OpenOnTerminal | OpenInInbox, session: WorkerSe match where: case OpenOnTerminal(): shown(paths.waiting, dataclasses.replace(ask, state=where), effects) - if unstarted := hand_over(session.claude_command(), paths, effects): + if unstarted := hand_over(session.claude_command(), effects): return Stop(1, f"could not start claude for the interrupt: {unstarted.reason}") case OpenInInbox(pid): make_way(paths.waiting, ask, pid, effects) diff --git a/bin/loop_claude/hand_over.py b/bin/loop_claude/hand_over.py index 9e7658dd..336e1762 100644 --- a/bin/loop_claude/hand_over.py +++ b/bin/loop_claude/hand_over.py @@ -1,12 +1,9 @@ """Opens claude on the terminal for the human. It sits outside cycle/, since loop-inbox's /talk and the loop's routing calls open claude too.""" import dataclasses -from loop_claude.effects import Effects, say +from loop_claude.effects import Effects from failure import Failure -from loop_claude.paths import Paths from model_routing.ladder import Rung -from claude_code.trust import trust -from loop_claude.project.checkout import worktrees @dataclasses.dataclass(frozen=True) @@ -21,11 +18,12 @@ def claude_args(rung: Rung, args: list[str]) -> list[str]: return [*rung.flags(), "--permission-mode", "bypassPermissions", *args] -def hand_over(command: ClaudeCommand, paths: Paths, effects: Effects) -> Failure | None: - """Marks trusted the checkout that command runs in, and each of its worktrees, then runs claude on the terminal as command says; the failure is why claude could not start.""" - trust(paths.claude_json, worktrees(command.cwd, effects), lambda text: say(text, effects)) +# 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 or loop-inbox 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; the failure is why claude could not start.""" try: - effects.claude_on_terminal(command.args, command.cwd, command.env) + 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 diff --git a/bin/loop_claude/loop/main.py b/bin/loop_claude/loop/main.py index 68586f51..5759b7cf 100644 --- a/bin/loop_claude/loop/main.py +++ b/bin/loop_claude/loop/main.py @@ -30,8 +30,8 @@ interrupts of every loop on the machine. The first answer counts, from either pl discuss first. Once that claude exits, the judge rules on what was typed there. - Enter alone, on loop-claude's terminal: stops the loop. A release ready to cut opens that session on the terminal at once, since only the human may cut it; -loop-inbox lists it too. Before claude opens, the checkout and each of its worktrees are marked -trusted in ~/.claude.json. While claude is open, Ctrl-C reaches it alone, and the loop goes on. +loop-inbox lists it too. That claude opens without Claude Code's trust dialog. While claude is +open, Ctrl-C reaches it alone, and the loop goes on. While it runs, loop-claude also lists itself in loop-inbox, with the todo.md items its chunk takes, as bin/loop_claude/running_loops.py describes. diff --git a/bin/loop_claude/loop/routing_check.py b/bin/loop_claude/loop/routing_check.py index 793faebc..75c07afa 100644 --- a/bin/loop_claude/loop/routing_check.py +++ b/bin/loop_claude/loop/routing_check.py @@ -55,7 +55,7 @@ def raise_calls(root: pathlib.Path, checkout: str, session: str, new: list[str], prompt = f"Put these calls for a routing change from loop-claude's figures to the human, and change nothing until they answer:\n{bullets}The figures are in {root / archive.FIGURES}. The ladder, its steps and the delegation rule are docs/decisions.md → `routing:`, and a change to them is the human's. Record what they decide as ~/.claude/CLAUDE.md says; the next chunk of this repo files the plan item for these calls." ask = Ask(effects.new_id(), session, checkout, question, effects.now(), OpenOnTerminal()) with listed(paths.waiting, ask, effects): - unstarted = hand_over(ClaudeCommand(claude_args(rung, [prompt]), str(paths.claude_dir), {}), paths, effects) + unstarted = hand_over(ClaudeCommand(claude_args(rung, [prompt]), str(paths.claude_dir), {}), effects) if unstarted: return Stop(1, f"could not start claude for the routing calls: {unstarted.reason}") # Raised once the human has seen them, answered or not: an unanswered call reaches the plan through AGENTS.md, so it is not asked twice. diff --git a/bin/loop_claude/paths.py b/bin/loop_claude/paths.py index c4981e26..39ffc562 100644 --- a/bin/loop_claude/paths.py +++ b/bin/loop_claude/paths.py @@ -6,7 +6,6 @@ import pathlib class Paths: claude_code_transcripts: pathlib.Path claude_dir: pathlib.Path - claude_json: pathlib.Path home: pathlib.Path model_catalog: pathlib.Path models_file: pathlib.Path @@ -19,7 +18,6 @@ def paths_from(home: pathlib.Path) -> Paths: return Paths( claude_code_transcripts=claude / "projects", claude_dir=claude, - claude_json=home / ".claude.json", home=home, model_catalog=claude / "cache" / "model-catalog", models_file=claude / "loop-claude-models.json", diff --git a/bin/loop_claude/project/checkout.py b/bin/loop_claude/project/checkout.py index cbbf01a8..3fcd46a8 100644 --- a/bin/loop_claude/project/checkout.py +++ b/bin/loop_claude/project/checkout.py @@ -11,7 +11,3 @@ def checkout_root(cwd: pathlib.Path, effects: Effects) -> str | Stop: return Stop(1, found.reason) if isinstance(found, Failure) else found.strip() -def worktrees(root: str, effects: Effects) -> list[str]: - listing = effects.git("worktree", "list", "--porcelain", cwd=root) - listed = [] if isinstance(listing, Failure) else [line.split(" ", 1)[1] for line in listing.splitlines() if line.startswith("worktree ")] - return sorted({root, *listed}) diff --git a/bin/loop_claude/test_black_box.py b/bin/loop_claude/test_black_box.py index 07b56c1a..a96e6ceb 100644 --- a/bin/loop_claude/test_black_box.py +++ b/bin/loop_claude/test_black_box.py @@ -39,7 +39,7 @@ argv = sys.argv[1:] role = "judge" if "--json-schema" in argv else "worker" if "-p" in argv else "interrupt" scenario = pathlib.Path(os.environ["FAKE_CLAUDE_SCENARIO"]) steps = json.loads(scenario.read_text()) -call = {{"argv": argv, "cwd": os.getcwd(), "role": role, "ctrl_c_ignored": signal.getsignal(signal.SIGINT) == signal.SIG_IGN}} +call = {{"argv": argv, "cwd": os.getcwd(), "role": role, "ctrl_c_ignored": signal.getsignal(signal.SIGINT) == signal.SIG_IGN, "sandboxed": os.environ.get("CLAUDE_CODE_SANDBOXED")}} # The items each loop lists in loop-inbox as this claude starts. call["running"] = [json.loads(path.read_text())["items"] for path in sorted((pathlib.Path.home() / ".local" / "state" / "loop-claude").glob("*.running"))] if role == "judge": @@ -776,9 +776,8 @@ class Interrupt(unittest.TestCase): def test_hands_the_terminal_over_and_exits_2_when_nothing_is_typed(self): checkout = Checkout(self) checkout.git("commit", "--allow-empty", "--quiet", "-m", "start") - checkout.git("worktree", "add", "--quiet", str(checkout.home / "code" / "proj-wt")) - checkout.claude_json().write_text(json.dumps({"other": 1, "projects": {str(checkout.root): {"kept": True}}})) - checkout.claude_json().chmod(0o644) + claude_json = json.dumps({"projects": {str(checkout.root): {"kept": True}}}) + checkout.claude_json().write_text(claude_json) asked = [worker(say="Shall I use A or B?"), judge(interrupt=True, evidence="Shall I use A or B?", question="A or B?")] (checkout.root / "sub").mkdir() run = checkout.run([*asked, interrupt(type="B"), judge(evidence="B"), worker()], cwd=checkout.root / "sub", terminal_input="/talk\n", before_typing=ANSWERING) @@ -790,12 +789,8 @@ class Interrupt(unittest.TestCase): self.assertEqual(argument(run.calls[2], "--model"), "worker-model") self.assertNotIn("-p", handed) self.assertIn("[human] B", run.calls[3]["stdin"]) - trusted = json.loads(checkout.claude_json().read_text()) - self.assertEqual(trusted["other"], 1) - self.assertEqual(trusted["projects"][str(checkout.root)], {"hasTrustDialogAccepted": True, "kept": True}) - self.assertEqual(trusted["projects"][str(checkout.home / "code" / "proj-wt")], {"hasTrustDialogAccepted": True}) - self.assertEqual(stat.S_IMODE(checkout.claude_json().stat().st_mode), 0o644) - self.assertIn(f"trusted for the interrupt: {checkout.root}, {checkout.home / 'code' / 'proj-wt'}\n", run.stderr) + self.assertEqual(run.calls[2]["sandboxed"], "1") + self.assertEqual(checkout.claude_json().read_text(), claude_json) for transcript in checkout.transcripts(): transcript.unlink() @@ -815,47 +810,6 @@ class Interrupt(unittest.TestCase): self.assertFalse(run.calls[2]["ctrl_c_ignored"]) self.assertIn("[human] B", run.calls[3]["stdin"]) - def test_says_why_the_trust_file_cannot_be_read_and_leaves_it_as_it_was(self): - checkout = Checkout(self) - asked = [worker(say="A or B?"), judge(interrupt=True, evidence="A or B?", question="A or B?"), interrupt()] - root = json.dumps(str(checkout.root)) - shapes = { - None: "No such file or directory", - "{": "Expecting property name enclosed in double quotes: line 1 column 2 (char 1)", - "[]": 'not an object whose "projects" is an object', - '{"projects": []}': 'not an object whose "projects" is an object', - f'{{"projects": {{{root}: 1}}}}': f"projects[{root}] is not an object", - } - for text, said in shapes.items(): - with self.subTest(said=said): - checkout.claude_json().unlink(missing_ok=True) - if text is not None: - checkout.claude_json().write_text(text) - run = checkout.run(asked, terminal_input="/talk\n", before_typing=ANSWERING) - self.assertEqual(run.code, 2) - self.assertIn(f"could not read {checkout.claude_json()}: {said}\n", run.stderr) - self.assertEqual(checkout.claude_json().read_text() if checkout.claude_json().exists() else None, text) - - trusted = json.dumps({"projects": {str(checkout.root): {"hasTrustDialogAccepted": True}}}) - checkout.claude_json().write_text(trusted) - run = checkout.run(asked, terminal_input="/talk\n", before_typing=ANSWERING) - self.assertNotIn(str(checkout.claude_json()), run.stderr) - self.assertNotIn("trusted for the interrupt", run.stderr) - self.assertEqual(checkout.claude_json().read_text(), trusted) - - @unittest.skipIf(os.geteuid() == 0, "root writes into a read-only directory") - def test_says_why_the_trust_file_cannot_be_written(self): - checkout = Checkout(self) - checkout.claude_json().write_text("{}") - asked = [worker(say="A or B?"), judge(interrupt=True, evidence="A or B?", question="A or B?"), interrupt()] - checkout.run(asked[:2]) - checkout.home.chmod(0o500) - self.addCleanup(checkout.home.chmod, 0o700) - run = checkout.run([worker(), *asked[1:]], terminal_input="/talk\n", before_typing=ANSWERING) - self.assertEqual(run.code, 2) - self.assertIn(f"could not write {checkout.claude_json()}: Permission denied\n", run.stderr) - self.assertEqual(checkout.claude_json().read_text(), "{}") - @unittest.skipIf(os.geteuid() == 0, "root reads an unreadable file") def test_exits_1_when_the_transcript_cannot_be_read_after_the_interrupt(self): checkout = Checkout(self) diff --git a/bin/loop_claude/test_loop_claude.py b/bin/loop_claude/test_loop_claude.py index cbfbc795..43a69fec 100644 --- a/bin/loop_claude/test_loop_claude.py +++ b/bin/loop_claude/test_loop_claude.py @@ -1890,11 +1890,5 @@ class JudgeFailures(unittest.TestCase): self.assertEqual([clause for *_, clause in clauses if clause not in judge_clause], []) -class Worktrees(unittest.TestCase): - def test_lists_the_root_alone_when_git_cannot_start(self): - fake = FakeEffects(git=[Failure("git worktree list --porcelain could not start: [Errno 2] No such file or directory: 'git'")]) - self.assertEqual(checkout.worktrees("/r", fake.effects()), ["/r"]) - - if __name__ == "__main__": unittest.main() diff --git a/bin/loop_inbox/main.py b/bin/loop_inbox/main.py index 0a6f112e..722495b8 100644 --- a/bin/loop_inbox/main.py +++ b/bin/loop_inbox/main.py @@ -168,7 +168,7 @@ def opened(screen_off: typing.Callable[[], typing.ContextManager[None]], paths: return f"Could not open claude for {ask.root}: the loop was answered elsewhere or stopped, or didn't respond within {MAKE_WAY_SECONDS:g} s. If it is still listed, pick it again." with screen_off(): try: - unstarted = hand_over(ask.state.talk, paths, effects) + unstarted = hand_over(ask.state.talk, effects) finally: unsent = send(folder, ask, ClaudeEnded()) # The loop goes on only where the human typed in the worker's session, as interrupt.human_typed checks. diff --git a/docs/decisions.md b/docs/decisions.md index 6ca14814..d15ca2e3 100644 --- a/docs/decisions.md +++ b/docs/decisions.md @@ -54,13 +54,11 @@ The cap is 5, `bin/todo_table.py`'s `BUNDLE_MAX_R`, from the same chunks: by the 2026-10-17, lilleman, todo item 168. The human answers an interrupt on loop-claude's terminal, and the worker resumes headless with the answer in a `-p` prompt. The judge reads that answer as a `[human]` line, not a `[loop]` one, so it holds the chunk open until the answer is recorded, as it does for an answer typed in claude. -## loop-claude: before it or loop-inbox opens claude on a terminal, it marks the checkout and each of its worktrees trusted in `~/.claude.json` +## loop-claude: every claude it or loop-inbox opens on a terminal has `CLAUDE_CODE_SANDBOXED` set, so Claude Code skips its trust dialog, and loop-claude doesn't write `~/.claude.json` -2026-09-21, lilleman. Serves goal 1. `claude --resume` re-enters the worktree the worker last entered, recorded in the transcript's `worktree-state` entry, and Claude Code asks trust per path, so trusting the checkout alone still lands the human in the dialog. Trusting every worktree `git worktree list` names spares reading which one from the transcript. Since the human answers an interrupt on loop-claude's own terminal (todo item 168), claude opens there only for `/talk`, a release ready to cut and the routing calls, and the trust is marked only then. Valid while resume re-enters a recorded worktree and trust is kept per path. +2026-09-21, lilleman. Serves goal 1. `claude --resume` re-enters the worktree the worker last entered, recorded in the transcript's `worktree-state` entry, and Claude Code asks trust per path, so a claude opened on the checkout alone still lands the human in the trust dialog. Since the human answers an interrupt on loop-claude's own terminal (todo item 168), claude opens there only for `/talk`, a release ready to cut and the routing calls. -2026-09-30, lilleman. A write by another claude inside `trust`'s read-modify-write window is lost, a risk larv-review accepted on 2026-09-24. Claude Code owns and writes `~/.claude.json`, so `loop-claude` is to move out of it, bringing each case that must stay to the human. Stands until `todo.md` item 6 ends it. - -2026-10-28, lilleman, todo item 243. `/talk` from loop-inbox opens claude in loop-inbox's terminal, through loop-claude's `hand_over`, which marks the trust just before. It adds a second writer to `~/.claude.json`, under the same risk, until item 6 ends it. +2026-10-30, lilleman, todo item 6. Serves goal 1. Until then loop-claude marked each worktree trusted in `~/.claude.json`, reading the file, changing it and writing it back. Claude Code owns and writes that file, so a write it made in between was lost. Claude Code 2.1.314 treats every folder as trusted while `CLAUDE_CODE_SANDBOXED` is set, and doesn't persist that trust: a claude opened so in a new folder showed no dialog, and Claude Code recorded the folder untrusted. `hand_over` sets it for every claude it opens. The variable is true here, since loop-claude runs only in the sandbox README → Install names (`loop-claude: every claude it starts bypasses permissions inside its sandbox`). Claude Code doesn't document it. Where a later version drops it, the dialog comes back on those terminals, and nothing is lost. Valid while Claude Code honours `CLAUDE_CODE_SANDBOXED`. ## loop-claude: each project's model lives in `~/.claude/loop-claude-models.json`, which only loop-claude writes diff --git a/todo.md b/todo.md index 1fb66d17..519483e6 100644 --- a/todo.md +++ b/todo.md @@ -12,7 +12,6 @@ | ID | Release | Blocked by | Exempt | Item | L | E | I | R | S | Moves | Score | |---|---|---|---|---|---|---|---|---|---|---|---| -| 6 | 0.5.0 | | decision | **Move what `loop-claude` writes out of `~/.claude.json`, and ask the human about each write that must stay.** | 3 | 3 | 3 | 7 | 3 | 1.1 by 5 | 5.3 | | 257 | 0.5.0 | | | **Make `chunk-preflight` create the item's worktree and branch only when loop-claude starts a worker on it, so a run for the facts alone leaves nothing to remove.** | 3 | 2 | 3 | 6 | 4 | 1.5 by 2 | 1.3 | | 226 | 0.6.0 | | question | **Answer whether rule-hook's `run-heavy` rule should also catch a mutation run or docker build behind `uv run`, `poetry run`, `python3 -m`, `sudo`, `docker image build` and `docker compose up --build`, or narrow the `machine load:` decision's wording.** | 2 | 2 | 3 | 5 | 3 | 1.2 by 2, 1.5 by 2 | 4.0 | | 248 | 0.6.0 | | question | **Answer whether the `rule-hook:` decision should name every rule that takes no override, `repeat-read`, `reviewer-report` and `reviewer-rung`, with each one's reason.** | 1 | 2 | 1 | 2 | 1 | 1.2 by 2 | 3.3 | @@ -76,10 +75,6 @@ ## Details -### 6. Move what `loop-claude` writes out of `~/.claude.json`, and ask the human about each write that must stay. - -Claude Code owns that file and writes it. `trust` reads it, changes it and writes it back, so a write that lands in between is lost. - ### 257. Make `chunk-preflight` create the item's worktree and branch only when loop-claude starts a worker on it, so a run for the facts alone leaves nothing to remove. Found in fejkdata.dev on 2026-10-29 and 2026-10-30. Two runs of `chunk-preflight` by hand, made to read its facts and not to start a chunk, each added the sibling worktree `fejkdata.dev-item-20` and the branch `item-20` at `origin/main`, and the session had to remove both. `bin/chunk_preflight/main.py` makes the worktree whenever the plan has an item, since loop-claude runs it as a chunk starts (`bin/loop_claude/loop/main.py` → `chunk_start`) and the worker then works in that worktree. It takes no argument and exits 1 on one, so a caller cannot ask for the facts alone. Make the worktree, `reading-cost`, `larv-review places` and the other tools it runs in the worktree opt-in, loop-claude's call asking for them; a bare run prints the facts and says no worktree was made. Update `--help`, the docstring and the worker prompt that tells the worker its worktree exists. Item 256 removes the case that made most of these worktrees, a pick the worker must not take. -- 2.52.0 From 6ffe432dba5f0c66b3467fdb53ed64cdcc7793b8 Mon Sep 17 00:00:00 2001 From: Lilleman auf Larv Date: Fri, 30 Oct 2026 21:32:21 +0100 Subject: [PATCH 3/7] Expect CLAUDE_CODE_SANDBOXED in the terminal claude's environment --- bin/loop_claude/test_loop_claude.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/bin/loop_claude/test_loop_claude.py b/bin/loop_claude/test_loop_claude.py index 43a69fec..f7656094 100644 --- a/bin/loop_claude/test_loop_claude.py +++ b/bin/loop_claude/test_loop_claude.py @@ -305,7 +305,7 @@ class Cycles(unittest.TestCase): cycle = dataclasses.replace(self.cycle(fake), project=Rung("claude-opus-5-5", "medium"), route=Route(Rung("claude-haiku-5-5", "max"), 163, 1, 5)) with contextlib.redirect_stderr(io.StringIO()): self.assertEqual(run.run_cycle(cycle).verdict, Finished("working")) - self.assertEqual(fake.terminal_environments, fake.worker_environments) + self.assertEqual(fake.terminal_environments, [{**environment, "CLAUDE_CODE_SANDBOXED": "1"} for environment in fake.worker_environments]) self.assertEqual(fake.terminal_environments[0]["LOOP_CLAUDE_WORKER_RUNG"], "claude-haiku-5-5 at max effort") def test_an_unfinished_chunks_transcript_is_archived_and_the_next_cycle_resumes_its_session_with_the_judges_evidence(self): @@ -824,7 +824,7 @@ class Interrupts(unittest.TestCase): def test_hands_the_claude_that_takes_the_terminal_the_workers_environment(self): fake = FakeEffects(inputs=["/talk"], on_terminal_claude=[0], git=[""]) self.put(fake) - self.assertEqual(fake.terminal_environments, [{"LOOP_CLAUDE_WORKER_RUNG": "m at high effort"}]) + self.assertEqual(fake.terminal_environments, [{"LOOP_CLAUDE_WORKER_RUNG": "m at high effort", "CLAUDE_CODE_SANDBOXED": "1"}]) class RoutingCheck(unittest.TestCase): @@ -890,7 +890,7 @@ class RoutingCheck(unittest.TestCase): ((args),) = fake.made("claude_on_terminal") self.assertEqual(args[:6], ["--model", "m", "--effort", "high", "--permission-mode", "bypassPermissions"]) self.assertIn(f"change nothing until they answer:\n- {call}", args[6]) - self.assertEqual(fake.terminal_environments, [{}]) + self.assertEqual(fake.terminal_environments, [{"CLAUDE_CODE_SANDBOXED": "1"}]) (self.root / "routing-figures.md").write_text("Measured x, at cycle 0 across") self.assertEqual(self.check(FakeEffects(git=[UNREAD]))[0], None) self.assertNotIn(call, self.check(FakeEffects())[1]) -- 2.52.0 From fd878353bc04785678ce9dcd47c25664a376e15c Mon Sep 17 00:00:00 2001 From: Lilleman auf Larv Date: Fri, 30 Oct 2026 21:37:25 +0100 Subject: [PATCH 4/7] =?UTF-8?q?Answer=20security=20round=201:=200=20?= =?UTF-8?q?=F0=9F=94=B4,=200=20=F0=9F=9F=A1=20(0=20misread);=20clean?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit -- 2.52.0 From 4a6cad05eab8bafbb3bc96a00e4684f598eccbdd Mon Sep 17 00:00:00 2001 From: Lilleman auf Larv Date: Fri, 30 Oct 2026 21:53:49 +0100 Subject: [PATCH 5/7] =?UTF-8?q?Answer=20stability=20round=201:=200=20?= =?UTF-8?q?=F0=9F=94=B4,=204=20=F0=9F=9F=A1=20(0=20misread);=20drop=20the?= =?UTF-8?q?=20stale=20worktree=20git=20answers,=20assert=20the=20routing?= =?UTF-8?q?=20claude's=20folder,=20keep=20the=20host's=20CLAUDE=5FCODE=5FS?= =?UTF-8?q?ANDBOXED=20out=20of=20the=20tests,=20delete=20the=20docstring's?= =?UTF-8?q?=20trust=20sentence?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- bin/loop_claude/test_loop_claude.py | 27 +++++++++++++++------------ bin/test_env.py | 5 +++-- 2 files changed, 18 insertions(+), 14 deletions(-) diff --git a/bin/loop_claude/test_loop_claude.py b/bin/loop_claude/test_loop_claude.py index f7656094..f5c05ce8 100644 --- a/bin/loop_claude/test_loop_claude.py +++ b/bin/loop_claude/test_loop_claude.py @@ -88,6 +88,7 @@ class FakeEffects: self.terminal = on_terminal self.worker_environments = [] self.terminal_environments = [] + self.terminal_folders = [] def effects(self): return Effects( @@ -124,6 +125,7 @@ class FakeEffects: def on_terminal_claude(self, args, cwd, env): self.terminal_environments.append(env) + self.terminal_folders.append(cwd) return self.answer("claude_on_terminal", args) def stream(self, args, cwd, env): @@ -301,7 +303,7 @@ class Cycles(unittest.TestCase): with open(session.transcript_file(self.session), "a") as handle: handle.write(json.dumps(human("the second")) + "\n") return 0 - fake = FakeEffects(streams=[Worker(self.paths.claude_code_transcripts.parent)], claude=[judged("interrupt"), judged("finished")], inputs=["/talk"], on_terminal_claude=[answer], git=[""]) + fake = FakeEffects(streams=[Worker(self.paths.claude_code_transcripts.parent)], claude=[judged("interrupt"), judged("finished")], inputs=["/talk"], on_terminal_claude=[answer]) cycle = dataclasses.replace(self.cycle(fake), project=Rung("claude-opus-5-5", "medium"), route=Route(Rung("claude-haiku-5-5", "max"), 163, 1, 5)) with contextlib.redirect_stderr(io.StringIO()): self.assertEqual(run.run_cycle(cycle).verdict, Finished("working")) @@ -397,7 +399,7 @@ class Cycles(unittest.TestCase): with open(session.transcript_file(self.session), "a") as handle: handle.write(json.dumps(human("the second")) + "\n") return 0 - fake = FakeEffects(streams=[Worker(self.paths.claude_code_transcripts.parent)], claude=[judged("interrupt"), judged("unfinished")], inputs=["/talk"], on_terminal_claude=[answer], git=[""]) + fake = FakeEffects(streams=[Worker(self.paths.claude_code_transcripts.parent)], claude=[judged("interrupt"), judged("unfinished")], inputs=["/talk"], on_terminal_claude=[answer]) with contextlib.redirect_stderr(io.StringIO()): self.assertEqual(run.run_cycle(self.cycle(fake)).verdict, Unfinished("working", entries_read=4)) self.assertEqual(self.archived_outcomes(), [f"Task: Do it.\n\n2026-09-21T14:13:20Z Verdict: interrupt\n\nWhich one?\n\nEvidence:\n> working\n\nJudge: judge-model\nWorker: {OFF_LADDER}\n", f"Task: Do it.\n\n2026-09-21T14:13:20Z Verdict: unfinished\n\nEvidence:\n> working\n\nJudge: judge-model\nWorker: {OFF_LADDER}\n"]) @@ -521,7 +523,7 @@ class Cycles(unittest.TestCase): with open(session.transcript_file(self.session), "a") as handle: handle.write(json.dumps(human("cut")) + "\n") return 0 - fake = FakeEffects(streams=[Worker(self.paths.claude_code_transcripts.parent)], claude=[judged("interrupt", release_ready=True), judged("finished")], on_terminal_claude=[answer], git=[""]) + fake = FakeEffects(streams=[Worker(self.paths.claude_code_transcripts.parent)], claude=[judged("interrupt", release_ready=True), judged("finished")], on_terminal_claude=[answer]) with contextlib.redirect_stderr(io.StringIO()): self.assertEqual(run.run_cycle(self.cycle(fake)).verdict, Finished("working")) self.assertEqual(fake.made("input"), []) @@ -725,7 +727,7 @@ class Interrupts(unittest.TestCase): def test_talks_on_talk_or_at_once_where_the_answer_is_not_asked_for_here(self): for typed, answer_here in (([" /talk "], True), ([], False)): with self.subTest(typed=typed): - fake = FakeEffects(inputs=typed, on_terminal_claude=[self.typed_there], git=[""]) + fake = FakeEffects(inputs=typed, on_terminal_claude=[self.typed_there]) self.assertEqual(self.put(fake, answer_here)[0], interrupt.Talked()) self.assertEqual(len(fake.made("input")), len(typed)) self.assertEqual(fake.calls[0], ("discard_typed", None)) @@ -761,7 +763,7 @@ class Interrupts(unittest.TestCase): answer, said = self.put(FakeEffects(inputs=["Use B."])) self.assertEqual(answer, "Use B.") self.assertIn(f"loop-inbox cannot show this question: cannot make {self.paths.waiting}: File exists", said) - stop, _ = self.put(FakeEffects(inputs=["/talk"], on_terminal_claude=[0], git=[""])) + stop, _ = self.put(FakeEffects(inputs=["/talk"], on_terminal_claude=[0])) self.assertEqual(stop, Stop(2, "the human is needed to answer the question above, but the interrupt ended with nothing typed")) def test_makes_way_only_warns_where_loop_inbox_cannot_list_the_open_claude(self): @@ -810,19 +812,19 @@ class Interrupts(unittest.TestCase): def ran(args): self.assertEqual(self.asked(), [self.ask("Cut 0.4.0?", OpenOnTerminal())]) return 0 - fake = FakeEffects(inputs=typed, on_terminal_claude=[ran], git=[""]) + fake = FakeEffects(inputs=typed, on_terminal_claude=[ran]) self.put(fake, answer_here, question="Cut 0.4.0?") self.assertEqual(len(fake.made("claude_on_terminal")), 1) self.assertEqual(asks_and_answers(self.paths.waiting), []) def test_stops_when_nothing_was_typed_in_the_session(self): - fake = FakeEffects(inputs=["/talk"], on_terminal_claude=[0], git=[""]) + fake = FakeEffects(inputs=["/talk"], on_terminal_claude=[0]) stop, _ = self.put(fake) self.assertEqual(fake.made("claude_on_terminal")[0][:4], ["--model", "m", "--effort", "high"]) self.assertEqual(stop, Stop(2, "the human is needed to answer the question above, but the interrupt ended with nothing typed")) def test_hands_the_claude_that_takes_the_terminal_the_workers_environment(self): - fake = FakeEffects(inputs=["/talk"], on_terminal_claude=[0], git=[""]) + fake = FakeEffects(inputs=["/talk"], on_terminal_claude=[0]) self.put(fake) self.assertEqual(fake.terminal_environments, [{"LOOP_CLAUDE_WORKER_RUNG": "m at high effort", "CLAUDE_CODE_SANDBOXED": "1"}]) @@ -861,7 +863,7 @@ class RoutingCheck(unittest.TestCase): def ran(args): self.assertEqual(waiting(self.paths.waiting), [Ask(ASK_ID, "s1", "/code/log", question, NOW, OpenOnTerminal())]) return 0 - self.check(FakeEffects(on_terminal_claude=[ran], git=[UNREAD, ""])) + self.check(FakeEffects(on_terminal_claude=[ran], git=[UNREAD])) self.assertEqual(asks_and_answers(self.paths.waiting), []) def test_measures_once_20_cycles_have_closed_since_the_last_measurement(self): @@ -881,7 +883,7 @@ class RoutingCheck(unittest.TestCase): def test_hands_the_terminal_over_once_for_each_new_call(self): self.chunks(5, 4) - fake = FakeEffects(on_terminal_claude=[0], git=[UNREAD, ""]) + fake = FakeEffects(on_terminal_claude=[0], git=[UNREAD]) stop, said = self.check(fake) self.assertIsNone(stop) call = "Explore subagents' reports took more of the worker's context than their searches would have." @@ -891,6 +893,7 @@ class RoutingCheck(unittest.TestCase): self.assertEqual(args[:6], ["--model", "m", "--effort", "high", "--permission-mode", "bypassPermissions"]) self.assertIn(f"change nothing until they answer:\n- {call}", args[6]) self.assertEqual(fake.terminal_environments, [{"CLAUDE_CODE_SANDBOXED": "1"}]) + self.assertEqual(fake.terminal_folders, [str(self.home / ".claude")]) (self.root / "routing-figures.md").write_text("Measured x, at cycle 0 across") self.assertEqual(self.check(FakeEffects(git=[UNREAD]))[0], None) self.assertNotIn(call, self.check(FakeEffects())[1]) @@ -898,7 +901,7 @@ class RoutingCheck(unittest.TestCase): def test_stamps_the_figures_and_the_calls_raised_when_it_measures(self): self.chunks(5, 4) (self.root / "routing-calls-raised.md").write_text("# Routing calls raised\n\n- 2026-10-14T10:02:00Z Reset\n") - self.check(FakeEffects(on_terminal_claude=[0], git=[UNREAD, ""])) + self.check(FakeEffects(on_terminal_claude=[0], git=[UNREAD])) figures = (self.root / "routing-figures.md").read_text() self.assertIn(f"Measured {utc(NOW)}, at cycle 20 across", figures) self.assertIn("that finished after the reset of 2026-10-14T10:02:00Z", figures) @@ -924,7 +927,7 @@ class RoutingCheck(unittest.TestCase): def test_stops_when_claude_cannot_start_for_the_calls(self): self.chunks(5, 4) - stop, _ = self.check(FakeEffects(on_terminal_claude=[OSError(2, "No such file or directory")], git=[UNREAD, ""])) + stop, _ = self.check(FakeEffects(on_terminal_claude=[OSError(2, "No such file or directory")], git=[UNREAD])) self.assertEqual(stop, Stop(1, "could not start claude for the routing calls: No such file or directory")) self.assertEqual(asks_and_answers(self.paths.waiting), []) diff --git a/bin/test_env.py b/bin/test_env.py index 92b56e93..528ac255 100644 --- a/bin/test_env.py +++ b/bin/test_env.py @@ -1,6 +1,7 @@ import os -# A git hook's GIT_DIR, the host's LOOP_CLAUDE_* or PYTHONPATH would point the program under test at the host's own state. +# A git hook's GIT_DIR, the host's LOOP_CLAUDE_* or PYTHONPATH would point the program under test at the host's own state, +# and the host's CLAUDE_CODE_SANDBOXED would hide whether loop-claude sets it. def isolated_env() -> dict[str, str]: - return {name: value for name, value in os.environ.items() if not name.startswith(("GIT_", "LOOP_CLAUDE_", "PYTHON"))} + return {name: value for name, value in os.environ.items() if not name.startswith(("GIT_", "LOOP_CLAUDE_", "PYTHON")) and name != "CLAUDE_CODE_SANDBOXED"} -- 2.52.0 From 87a555b7cd8e680b3d9a051419154adbab34a194 Mon Sep 17 00:00:00 2001 From: Lilleman auf Larv Date: Fri, 30 Oct 2026 21:53:49 +0100 Subject: [PATCH 6/7] =?UTF-8?q?Answer=20prose=20round=201:=200=20?= =?UTF-8?q?=F0=9F=94=B4,=204=20=F0=9F=9F=A1=20(0=20misread);=20restore=20t?= =?UTF-8?q?he=20decision's=20first=20entry,=20say=20what=20the=20variable?= =?UTF-8?q?=20claims,=20name=20both=20tools=20in=20the=20title=20and=20cha?= =?UTF-8?q?ngelog?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- AGENTS.md | 2 +- CHANGELOG.md | 2 +- bin/loop_claude/hand_over.py | 4 ++-- bin/loop_claude/loop/main.py | 3 +-- docs/decisions.md | 6 +++--- 5 files changed, 8 insertions(+), 9 deletions(-) diff --git a/AGENTS.md b/AGENTS.md index 29d55ab9..5b798b0f 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -11,7 +11,7 @@ Decisions live in `docs/decisions.md`: - larv-review: within a chunk lifting a project towards the comprehension floor, work on the project's lowest-scoring dimension comes first, and the floor doesn't block anything - loop-claude: a `claude` that cannot start is a failed worker run, retried - loop-claude: a judge decides each interrupt and each quoted answer from the transcript, the README's premises, `AGENTS.md`, `docs/decisions.md`, `~/.claude/CLAUDE.md`, `~/.claude/rules/` and larv-review's standards, and holds a chunk open while an answer the human typed in it is recorded nowhere; the worker's own account of which goal settles a choice decides nothing -- loop-claude: every claude it or loop-inbox opens on a terminal has `CLAUDE_CODE_SANDBOXED` set, so Claude Code skips its trust dialog, and loop-claude doesn't write `~/.claude.json` +- loop-claude: every claude it or loop-inbox opens on a terminal has `CLAUDE_CODE_SANDBOXED` set, so Claude Code skips its trust dialog, and neither tool writes `~/.claude.json` - loop-claude: each project's model lives in `~/.claude/loop-claude-models.json`, which only loop-claude writes - loop-claude: every claude it starts bypasses permissions inside its sandbox - loop-claude: one session per project, its id derived from the checkout's path relative to `~/code`, or to `/` outside it diff --git a/CHANGELOG.md b/CHANGELOG.md index 153c6e1f..9d3edcb0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,7 +5,7 @@ - A release review now fixes the findings of its architecture and principles passes in the release it reviews. Before, it filed each one in `todo.md`, so the release held the drift the review had found. It files only three kinds of finding, each under the release being reviewed: one whose fix needs a human answer, marked `question`; one whose fix adds a feature; and one whose fix the five rounds cannot finish. Until each is done, the release isn't ready to cut. - In a repo with no tag yet, `chunk-preflight` now calls a release finished once `todo.md` files no item under it: its release review is due, and no later release's item is taken. Before, it lost sight of such a release. - In a run `loop-claude` started, `rule-hook` now refuses a `/security-review` or `/claude-security` Skill call that the worker makes in its own context on a rung below the project's. It also refuses one from any subagent whose prompt doesn't open with `You are the security pass for this chunk.`, since that subagent's rung is unchecked. The refusal says to invoke the skill from a subagent on the project's rung, its prompt opening with that sentence. Before, only an Agent call that launched the security pass was held to that rung. -- `loop-claude` and `loop-inbox` no longer write `~/.claude.json`. Each claude they open on a terminal, for `/talk`, a release ready to cut or a routing call, now has `CLAUDE_CODE_SANDBOXED=1` set, so Claude Code skips its trust dialog. Before, loop-claude marked the checkout and each worktree trusted in that file, and a write Claude Code made at the same moment could be lost. Claude Code doesn't document the variable: where a version drops it, the trust dialog comes back. +- `loop-claude` and `loop-inbox` no longer write `~/.claude.json`. Each claude they open on a terminal, for `/talk`, a release ready to cut or a routing call, now has `CLAUDE_CODE_SANDBOXED=1` set, so Claude Code skips its trust dialog. Before, they marked the checkout and each worktree trusted in that file, and a write Claude Code made at the same moment could be lost. Claude Code doesn't document the variable: where a version drops it, the trust dialog comes back. ## 0.4.0 diff --git a/bin/loop_claude/hand_over.py b/bin/loop_claude/hand_over.py index 336e1762..7a32ac13 100644 --- a/bin/loop_claude/hand_over.py +++ b/bin/loop_claude/hand_over.py @@ -19,9 +19,9 @@ def claude_args(rung: Rung, args: list[str]) -> list[str]: # 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 or loop-inbox opens on a terminal has CLAUDE_CODE_SANDBOXED set, …`. +# docs/decisions.md → `loop-claude: every claude it or loop-inbox 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; the failure is why claude could not start.""" + """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: diff --git a/bin/loop_claude/loop/main.py b/bin/loop_claude/loop/main.py index 5759b7cf..a772cbbc 100644 --- a/bin/loop_claude/loop/main.py +++ b/bin/loop_claude/loop/main.py @@ -30,8 +30,7 @@ interrupts of every loop on the machine. The first answer counts, from either pl discuss first. Once that claude exits, the judge rules on what was typed there. - Enter alone, on loop-claude's terminal: stops the loop. A release ready to cut opens that session on the terminal at once, since only the human may cut it; -loop-inbox lists it too. That claude opens without Claude Code's trust dialog. While claude is -open, Ctrl-C reaches it alone, and the loop goes on. +loop-inbox lists it too. While claude is open, Ctrl-C reaches it alone, and the loop goes on. While it runs, loop-claude also lists itself in loop-inbox, with the todo.md items its chunk takes, as bin/loop_claude/running_loops.py describes. diff --git a/docs/decisions.md b/docs/decisions.md index d15ca2e3..070883f4 100644 --- a/docs/decisions.md +++ b/docs/decisions.md @@ -54,11 +54,11 @@ The cap is 5, `bin/todo_table.py`'s `BUNDLE_MAX_R`, from the same chunks: by the 2026-10-17, lilleman, todo item 168. The human answers an interrupt on loop-claude's terminal, and the worker resumes headless with the answer in a `-p` prompt. The judge reads that answer as a `[human]` line, not a `[loop]` one, so it holds the chunk open until the answer is recorded, as it does for an answer typed in claude. -## loop-claude: every claude it or loop-inbox opens on a terminal has `CLAUDE_CODE_SANDBOXED` set, so Claude Code skips its trust dialog, and loop-claude doesn't write `~/.claude.json` +## loop-claude: every claude it or loop-inbox opens on a terminal has `CLAUDE_CODE_SANDBOXED` set, so Claude Code skips its trust dialog, and neither tool writes `~/.claude.json` -2026-09-21, lilleman. Serves goal 1. `claude --resume` re-enters the worktree the worker last entered, recorded in the transcript's `worktree-state` entry, and Claude Code asks trust per path, so a claude opened on the checkout alone still lands the human in the trust dialog. Since the human answers an interrupt on loop-claude's own terminal (todo item 168), claude opens there only for `/talk`, a release ready to cut and the routing calls. +2026-09-21, lilleman. Serves goal 1. `claude --resume` re-enters the worktree the worker last entered, recorded in the transcript's `worktree-state` entry, and Claude Code asks trust per path, so trusting the checkout alone would still land the human in the trust dialog. -2026-10-30, lilleman, todo item 6. Serves goal 1. Until then loop-claude marked each worktree trusted in `~/.claude.json`, reading the file, changing it and writing it back. Claude Code owns and writes that file, so a write it made in between was lost. Claude Code 2.1.314 treats every folder as trusted while `CLAUDE_CODE_SANDBOXED` is set, and doesn't persist that trust: a claude opened so in a new folder showed no dialog, and Claude Code recorded the folder untrusted. `hand_over` sets it for every claude it opens. The variable is true here, since loop-claude runs only in the sandbox README → Install names (`loop-claude: every claude it starts bypasses permissions inside its sandbox`). Claude Code doesn't document it. Where a later version drops it, the dialog comes back on those terminals, and nothing is lost. Valid while Claude Code honours `CLAUDE_CODE_SANDBOXED`. +2026-10-30, lilleman, todo item 6. Serves goal 1. Until then loop-claude marked each worktree trusted in `~/.claude.json`, reading the file, changing it and writing it back. Claude Code owns and writes that file, so a write it made in between could be lost. Claude Code 2.1.314 treats every folder as trusted while `CLAUDE_CODE_SANDBOXED` is set, and doesn't persist that trust. A claude started in a new folder with the variable set showed no dialog, and Claude Code recorded the folder untrusted. `hand_over` sets the variable for every claude it opens on a terminal: for `/talk`, a release ready to cut and the routing calls. The variable tells Claude Code it runs inside a sandbox, which holds here: loop-claude runs only in the sandbox README → Install names (`loop-claude: every claude it starts bypasses permissions inside its sandbox`). Claude Code doesn't document the variable. Where a later version drops it, the trust dialog comes back on those claudes, and nothing is lost. Valid while Claude Code honours `CLAUDE_CODE_SANDBOXED`. ## loop-claude: each project's model lives in `~/.claude/loop-claude-models.json`, which only loop-claude writes -- 2.52.0 From 43682c819ad59d45b179593f20d6adfaab6d8568 Mon Sep 17 00:00:00 2001 From: Lilleman auf Larv Date: Fri, 30 Oct 2026 21:53:49 +0100 Subject: [PATCH 7/7] =?UTF-8?q?Answer=20product-owner=20round=201:=200=20?= =?UTF-8?q?=F0=9F=94=B4,=200=20=F0=9F=9F=A1=20(0=20misread);=20its=20?= =?UTF-8?q?=F0=9F=9F=A2=20is=20superseded=20by=20stability's=20deletion=20?= =?UTF-8?q?of=20the=20docstring=20sentence?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit -- 2.52.0