From 4fbe529cfe1e6490ad668224b14e76baa31c8ef3 Mon Sep 17 00:00:00 2001 From: Lilleman auf Larv Date: Wed, 21 Oct 2026 21:26:40 +0200 Subject: [PATCH 01/15] Record the reading cost of the last finished chunk --- docs/reading-cost.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/docs/reading-cost.md b/docs/reading-cost.md index bcaff283..a4ec8c4e 100644 --- a/docs/reading-cost.md +++ b/docs/reading-cost.md @@ -693,3 +693,7 @@ Read most (opens and searches): Read most (opens and searches): - `rules/todo-items.md` 1 + +## Reading cost, chunk dd5ad8ab4fdf, finished 2026-10-21T18:27:48Z + +58208 new input tokens before the first commit. -- 2.52.0 From 7c3800337a21c60739020ad01a815ba6fc144d04 Mon Sep 17 00:00:00 2001 From: Lilleman auf Larv Date: Wed, 21 Oct 2026 21:26:40 +0200 Subject: [PATCH 02/15] Give settings.json's model one writer per machine, and sort its keys --- .gitattributes | 1 + .gitignore | 2 ++ AGENTS.md | 3 +- CHANGELOG.md | 3 ++ README.md | 13 ++++++-- bin/repo_checks/test_types.py | 2 +- bin/settings_filter.py | 20 ++++++++++++ bin/test_settings_filter.py | 55 +++++++++++++++++++++++++++++++++ docs/decisions.md | 4 +++ settings.json | 57 +++++++++++++++++------------------ todo.md | 7 ----- 11 files changed, 127 insertions(+), 40 deletions(-) create mode 100644 .gitattributes create mode 100755 bin/settings_filter.py create mode 100644 bin/test_settings_filter.py diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 00000000..0cf88d34 --- /dev/null +++ b/.gitattributes @@ -0,0 +1 @@ +settings.json filter=settings diff --git a/.gitignore b/.gitignore index 34af3235..a95dd537 100644 --- a/.gitignore +++ b/.gitignore @@ -4,6 +4,7 @@ # un-ignore authored config only. * +!.gitattributes !.gitignore !AGENTS.md !CHANGELOG.md @@ -67,6 +68,7 @@ !bin/score_outcomes/ !bin/score_outcomes/*.py !bin/shell_command.py +!bin/settings_filter.py !bin/statusline.py !bin/subagent-rung !bin/subagent_rung/ diff --git a/AGENTS.md b/AGENTS.md index 05335592..ce97866d 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -26,6 +26,7 @@ Decisions live in `docs/decisions.md`: - review: the premises chunk's whole review is the human's approval - workflow-bench/: the remote may show the bench cases' names and commit SHAs - settings.json: Claude Code runs in auto mode with the dangerous-mode prompt skipped +- settings.json: each machine owns its model, and git's clean filter `bin/settings_filter.py` keeps it, and Claude Code's key order, out of every commit - the repo may name bender, bender-infra and ai-sandbox - todo.md: one table of items, scored by the formula it states, held to its bar and ranked by `bin/rank_todo.py`, which ranks each blocker above the items it blocks; each achieve goal weighs by its position, code health first and four times as heavy while the comprehension panel's overall is under 7.0 or unmeasured, then README.md's goals; the table's order is the plan's only order - todo.md: only a session or subagent on the project's rung or above scores or reshapes the plan; one below it drafts new items and changes to filed ones for a subagent at or above that rung to apply and score, and removes finished ones @@ -52,7 +53,7 @@ Decisions live in `docs/decisions.md`: ## Working rules - `routing-calls-raised.md` sits at the root of loop-claude's archive (`$LOOP_CLAUDE_TRANSCRIPTS`, default `~/.claude/loop-claude-transcripts`). Each of its lines is a call or a `Reset`, with a stamp. A call is new when it is stamped after the latest `Reset` and after the latest stamp that `todo.md` or `docs/decisions.md` → `routing:` cites. When there are new calls, file one `todo.md` item to settle them, or refresh the item already filed. Its detail quotes those calls with their stamps, and the routed-chunks table of `routing-figures.md` beside it, never the project names its other tables hold. A change to the ladder, its steps or the delegation rule is the human's. The chunk that settles the calls cites the latest stamp it settled in `docs/decisions.md` → `routing:`, whatever the human decided, so they are not filed again. Once a chunk that changes the ladder, its steps or the delegation rule has merged, append `- Reset` to `routing-calls-raised.md`: the figures then count only chunks finished after it, and its calls may be raised again. -- When `~/.claude/settings.json` has uncommitted changes, commit them on a branch of their own and merge them through a PR: Claude Code writes that file from any session. Read their diff first. When it holds a credential, such as a token in `env` or `mcpServers`, ask the human to move it out of the file, and commit only once it is gone. A token in `env` moves to the shell profile; a server in `mcpServers` moves to `~/.claude.json` with `claude mcp add --scope user`. +- When `~/.claude/settings.json` has uncommitted changes, commit them on a branch of their own and merge them through a PR: Claude Code writes that file from any session. Read their diff first: an empty one is a model pick, which `git add settings.json` clears. When it holds a credential, such as a token in `env` or `mcpServers`, ask the human to move it out of the file, and commit only once it is gone. A token in `env` moves to the shell profile; a server in `mcpServers` moves to `~/.claude.json` with `claude mcp add --scope user`. ## Scoring run diff --git a/CHANGELOG.md b/CHANGELOG.md index 881b3087..c87e6b53 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,9 @@ ## Unreleased +- `settings.json` no longer carries a model: each machine keeps the one you pick with `/model`. Git's clean filter `bin/settings_filter.py` drops `"model"` and sorts the keys, so neither a pick nor Claude Code's key order can reach a commit. After a pick, `git status` may still list `settings.json`; `git add settings.json` clears it, with nothing to commit. An update to a release that changes `settings.json` drops the machine's model. On upgrade, on each machine: + 1. Turn the filter on in `~/.claude`: `git config filter.settings.clean bin/settings_filter.py`. + 2. Pick a model with `/model`. Until you do, Claude Code runs its default model, where this repo set `opus` before. - larv-review's "Re-entry" is now one table of which passes a fix reruns, and the pass table's triggers say only when a pass first runs. The rule is unchanged; a fix for a 🟢, a ā“ or a prose finding still reruns no pass. ## 0.2.0 diff --git a/README.md b/README.md index 45d33306..73bb069a 100644 --- a/README.md +++ b/README.md @@ -54,11 +54,19 @@ claude plugin install code-review@claude-plugins-official claude plugin install rust-analyzer-lsp@claude-plugins-official ``` +Have git store `settings.json` without `"model"`, so a model you pick with `/model` stays on this machine and never reaches a commit: + +```sh +git config filter.settings.clean bin/settings_filter.py +``` + +After a pick, `git status` may still list `settings.json`, and `git pull` refuses to update it. `git add settings.json` clears that, with nothing to commit. + Link `loop-claude` onto `PATH`: `ln -s ~/.claude/bin/loop-claude ~/.local/bin/loop-claude`. Run `loop-claude` only in a sandbox with no direct access to a production environment, such as a dedicated VM: every claude it starts, the interactive ones included, skips every permission prompt. ## Update -Move a machine that takes tagged releases to the latest tag. The move discards every uncommitted change to a file the latest tag tracks, such as a `settings.json` Claude Code wrote. List the uncommitted changes to files the checkout tracks, and the tag it is on: +Move a machine that takes tagged releases to the latest tag. The move discards every uncommitted change to a file the latest tag tracks, such as a hook Claude Code wrote into `settings.json`. Where the tag changes `settings.json`, the move also drops this machine's model; pick it again with `/model`. List the uncommitted changes to files the checkout tracks, and the tag it is on: ```sh cd ~/.claude @@ -92,6 +100,7 @@ Install puts only `loop-claude` on `PATH`; call the others by their path, such a - `review-replay ` replays a review pass's archived rounds from the projects run on the model, on the code each reviewed, and prints the lowest rung below the project's that, like each rung above it, finds every šŸ”“ and 🟔 the project's rung finds again; `review-replay --help` states the replay. Run it only in a sandbox, like loop-claude: each replayed reviewer skips every permission prompt, stability-reviewer has Bash, and an archived prompt may name paths on the host. - `rule-hook [overrides]` blocks a tool call that breaks a rule a program can check, unless the call overrides the rule; `settings.json` → `hooks` runs it before each Bash, Edit, MultiEdit, Write and Agent call, and `rule-hook --help` states the rules and the override. - `score-outcomes [L E I S]` lists the finished items whose guessed scores sit nearest the given ones, and the shipped items the project's `docs/score-anchors.md` names for each level of L, E and I, each with what its chunk measured; then the median outcome at each guessed R and S, and how well L, E and I each order the chunks by review rounds and šŸ”“ findings; `score-outcomes --help` states the measures. +- `settings_filter.py` is git's clean filter for `settings.json`: it drops `"model"` and sorts the keys. `.gitattributes` names it, and Install turns it on. - `statusline.py` renders Claude Code's status line; `settings.json` → `statusLine` runs it. - `subagent-rung [--plan] ` prints the Agent tool's model and effort for a subagent's task, picked by its L from the project's model, and with `--plan` never below the project's rung; `subagent-rung --help` states the rule. @@ -110,7 +119,7 @@ pytest_add_cli_args=-k Then, in the copy: `uvx --with pytest 'mutmut>=3,<4' run && uvx --with pytest 'mutmut>=3,<4' results`, and `uvx --with pytest 'mutmut>=3,<4' show ` to see a mutant's change. The config keys are mutmut 3's. -`bin/` is the import root: each launcher puts it on `sys.path`, so a module imports another by its path under `bin/`, such as `from claude_code.entries import parse_entry`. Each tool's package holds its tests; `rank_todo.py` and `statusline.py` are tools of one file each, tested beside them, `rule_hook` imports `rank_todo.py`'s check, `larv_review` imports `rank_todo.py`'s ranking, `score_outcomes` imports `reading_cost`'s record path, `judge_replay` imports `loop_claude`'s judge, and `loop_claude` runs `chunk-preflight` as a process of its own. `judge_replay` and `review_replay` share `rung_replay/`: the rung search, the argument reader, the candidate rungs and the exits. `rung_replay/` reads `loop_claude`'s retry count and models file. The other non-test modules at `bin/`'s root, `claude_code/` and `transcript_archive/` serve more than one tool; `model_routing/` holds the routing ladder, which loop-claude, `rule_hook`, both replay tools and `subagent-rung` read. `routing_figures/` measures loop-claude's archive for loop-claude's routing calls. `test_env.py` serves the tests, and `repo_checks/` tests the repo itself. +`bin/` is the import root: each launcher puts it on `sys.path`, so a module imports another by its path under `bin/`, such as `from claude_code.entries import parse_entry`. Each tool's package holds its tests; `rank_todo.py`, `settings_filter.py` and `statusline.py` are tools of one file each, tested beside them, `rule_hook` imports `rank_todo.py`'s check, `larv_review` imports `rank_todo.py`'s ranking, `score_outcomes` imports `reading_cost`'s record path, `judge_replay` imports `loop_claude`'s judge, and `loop_claude` runs `chunk-preflight` as a process of its own. `judge_replay` and `review_replay` share `rung_replay/`: the rung search, the argument reader, the candidate rungs and the exits. `rung_replay/` reads `loop_claude`'s retry count and models file. The other non-test modules at `bin/`'s root, `claude_code/` and `transcript_archive/` serve more than one tool; `model_routing/` holds the routing ladder, which loop-claude, `rule_hook`, both replay tools and `subagent-rung` read. `routing_figures/` measures loop-claude's archive for loop-claude's routing calls. `test_env.py` serves the tests, and `repo_checks/` tests the repo itself. ## Tracking a new file diff --git a/bin/repo_checks/test_types.py b/bin/repo_checks/test_types.py index feaacce9..161ab8f3 100644 --- a/bin/repo_checks/test_types.py +++ b/bin/repo_checks/test_types.py @@ -15,5 +15,5 @@ class Types(unittest.TestCase): self.assertIsNotNone(floor, "README.md's Install names `Python 3.N or newer`") if shutil.which("uv") is None: self.fail("uv on PATH fetches mypy; see README.md's Test line") - ran = subprocess.run(["uv", "tool", "run", "--python", "%d.%d" % floor, "mypy==2.3.1", "--cache-dir=/dev/null", "--check-untyped-defs", "--disallow-untyped-defs", "--exclude", "/test_", "-p", "chunk_preflight", "-p", "claude_code", "-m", "comprehension_history", "-m", "git_repo", "-p", "judge_replay", "-p", "larv_review", "-p", "loop_claude", "-m", "markdown_text", "-p", "metric_bench", "-m", "project_key", "-m", "rank_todo", "-m", "round_titles", "-p", "reading_cost", "-p", "review_replay", "-p", "rule_hook", "-p", "rung_replay", "-p", "score_outcomes", "-p", "subagent_rung", "-m", "shell_command", "-m", "statusline", "-m", "todo_table", "-p", "transcript_archive", "-m", "utc_stamp"], capture_output=True, cwd=ROOT / "bin", text=True) + ran = subprocess.run(["uv", "tool", "run", "--python", "%d.%d" % floor, "mypy==2.3.1", "--cache-dir=/dev/null", "--check-untyped-defs", "--disallow-untyped-defs", "--exclude", "/test_", "-p", "chunk_preflight", "-p", "claude_code", "-m", "comprehension_history", "-m", "git_repo", "-p", "judge_replay", "-p", "larv_review", "-p", "loop_claude", "-m", "markdown_text", "-p", "metric_bench", "-m", "project_key", "-m", "rank_todo", "-m", "round_titles", "-p", "reading_cost", "-p", "review_replay", "-p", "rule_hook", "-p", "rung_replay", "-p", "score_outcomes", "-p", "subagent_rung", "-m", "settings_filter", "-m", "shell_command", "-m", "statusline", "-m", "todo_table", "-p", "transcript_archive", "-m", "utc_stamp"], capture_output=True, cwd=ROOT / "bin", text=True) self.assertEqual(ran.returncode, 0, ran.stdout + ran.stderr) diff --git a/bin/settings_filter.py b/bin/settings_filter.py new file mode 100755 index 00000000..b532462c --- /dev/null +++ b/bin/settings_filter.py @@ -0,0 +1,20 @@ +#!/usr/bin/env python3 +"""Git's clean filter for settings.json: drop "model" and sort every key. + +Claude Code rewrites settings.json, in its own key order, whenever a model is +picked or a plugin installed. Each machine owns its model, so git stores the +file without it, and neither write shows as a change. +""" +import json +import sys + + +def main() -> None: + settings = json.load(sys.stdin) + settings.pop("model", None) + json.dump(settings, sys.stdout, ensure_ascii=False, indent=2, sort_keys=True) + sys.stdout.write("\n") + + +if __name__ == "__main__": + main() diff --git a/bin/test_settings_filter.py b/bin/test_settings_filter.py new file mode 100644 index 00000000..7b126235 --- /dev/null +++ b/bin/test_settings_filter.py @@ -0,0 +1,55 @@ +import json +import pathlib +import subprocess +import sys +import tempfile +import unittest + +BIN = pathlib.Path(__file__).resolve().parent +ROOT = BIN.parent +FILTER = BIN / "settings_filter.py" +INSTALL = "git config filter.settings.clean bin/settings_filter.py" + + +def cleaned(text): + return subprocess.run([sys.executable, FILTER], input=text, capture_output=True, check=True, text=True).stdout + + +class Clean(unittest.TestCase): + def test_drops_the_model_and_sorts_every_key(self): + written = '{"theme": "dark", "model": "opus[1m]", "env": {"B": "1", "A": "2"}}' + self.assertEqual(cleaned(written), '{\n "env": {\n "A": "2",\n "B": "1"\n },\n "theme": "dark"\n}\n') + + def test_the_tracked_settings_hold_no_model_and_sorted_keys(self): + tracked = (ROOT / "settings.json").read_text(encoding="utf-8") + self.assertEqual(tracked, cleaned(tracked)) + + def test_the_readme_installs_the_filter_git_attributes_name(self): + self.assertIn(f"{INSTALL}\n", (ROOT / "README.md").read_text(encoding="utf-8")) + self.assertIn("settings.json filter=settings\n", (ROOT / ".gitattributes").read_text(encoding="utf-8")) + + +class Checkout(unittest.TestCase): + def test_a_model_pick_and_claude_codes_key_order_leave_nothing_to_commit(self): + with tempfile.TemporaryDirectory() as repo: + def git(*args): + return subprocess.run(["git", "-C", repo, *args], capture_output=True, check=True, text=True).stdout + + git("init", "-q") + (pathlib.Path(repo) / "bin").mkdir() + (pathlib.Path(repo) / "bin" / "settings_filter.py").symlink_to(FILTER) + (pathlib.Path(repo) / ".gitattributes").write_text("settings.json filter=settings\n") + git(*INSTALL.split()[1:]) + settings = pathlib.Path(repo) / "settings.json" + settings.write_text(cleaned('{"env": {}, "theme": "dark"}')) + git("add", ".") + git("-c", "user.name=t", "-c", "user.email=t@t", "commit", "-qm", "settings") + settings.write_text(json.dumps({"theme": "dark", "model": "opus[1m]", "env": {}}, indent=2)) + self.assertEqual(git("diff"), "") + # git status lists a file whose size changed until it is staged; staging adds no change. + git("add", "settings.json") + self.assertEqual(git("status", "--porcelain"), "") + + +if __name__ == "__main__": + unittest.main() diff --git a/docs/decisions.md b/docs/decisions.md index d29f5f5c..74266912 100644 --- a/docs/decisions.md +++ b/docs/decisions.md @@ -162,6 +162,10 @@ Three places carry the rule. `rules/todo-items.md` states it and loads with `tod 2026-10-04, lilleman, answering the principles audit of PR #215. Serves goal 1: this setup is meant to run in a sandbox and to work autonomously, so tool access is granted by the sandbox, as "Always grant explicit access to data" in `principles/technical-principles.md` asks. Valid while every machine taking this checkout is such a sandbox. +## settings.json: each machine owns its model, and git's clean filter `bin/settings_filter.py` keeps it, and Claude Code's key order, out of every commit + +2026-10-21, lilleman. Serves goal 2: Claude Code rewrites `"model"` in `settings.json` on every `/model` and plugin install, so a tracked model let one machine's pick override every other's. lilleman chose a model per machine over a synced one in `env.ANTHROPIC_MODEL`, which `/model` could not outlast past one session: it is simpler, and loop-claude picks each project's model in `~/.claude/loop-claude-models.json` anyway. The filter also sorts the keys, since each write puts them back in Claude Code's order. Git still lists `settings.json` after a pick that changes the file's size, and `git pull` refuses to update it, until `git add settings.json`, which stages no change. An Update to a tag that changes `settings.json` drops the machine's model. Valid while Claude Code writes the model it picks into `settings.json`. + ## the repo may name bender, bender-infra and ai-sandbox 2026-10-04, lilleman, answering the principles audit of PR #215. Serves goal 4, which keeps credentials, transcripts and memory files off the remote; the names of the host, its infrastructure project and the sandbox VM are none of those. Valid while the repo names them without their addresses or credentials. diff --git a/settings.json b/settings.json index 28436f68..a700479e 100644 --- a/settings.json +++ b/settings.json @@ -1,63 +1,62 @@ { - "env": { - "CLAUDE_SECURITY_SCAN_TIP": "off" - }, "attribution": { "sessionUrl": false }, - "includeCoAuthoredBy": false, - "permissions": { - "defaultMode": "auto", - "additionalDirectories": [ - "~/.local/state/larv-review", - "~/code" - ] - }, - "model": "opus", + "awaySummaryEnabled": false, "disableClaudeAiConnectors": true, - "statusLine": { - "type": "command", - "command": "~/.claude/bin/statusline.py", - "refreshInterval": 30 - }, + "effortLevel": "xhigh", "enabledPlugins": { "claude-security@claude-plugins-official": true, + "code-review@claude-plugins-official": true, "frontend-design@claude-plugins-official": false, - "rust-analyzer-lsp@claude-plugins-official": true, - "code-review@claude-plugins-official": true + "rust-analyzer-lsp@claude-plugins-official": true + }, + "env": { + "CLAUDE_SECURITY_SCAN_TIP": "off" }, "extraKnownMarketplaces": { "claude-plugins-official": { "source": { - "source": "github", - "repo": "anthropics/claude-plugins-official" + "repo": "anthropics/claude-plugins-official", + "source": "github" } } }, "hooks": { "PreToolUse": [ { - "matcher": "Bash|Edit|MultiEdit|Write|Agent", "hooks": [ { - "type": "command", "command": "~/.claude/bin/rule-hook", - "timeout": 30 + "timeout": 30, + "type": "command" } - ] + ], + "matcher": "Bash|Edit|MultiEdit|Write|Agent" } ] }, - "effortLevel": "xhigh", + "includeCoAuthoredBy": false, + "mcpServers": {}, "modelSettings": { "claude-fable-5-1": { "effortLevel": "high" } }, - "awaySummaryEnabled": false, - "tui": "fullscreen", + "permissions": { + "additionalDirectories": [ + "~/.local/state/larv-review", + "~/code" + ], + "defaultMode": "auto" + }, "skipDangerousModePermissionPrompt": true, "skipWorkflowUsageWarning": true, + "statusLine": { + "command": "~/.claude/bin/statusline.py", + "refreshInterval": 30, + "type": "command" + }, "theme": "dark", - "mcpServers": {} + "tui": "fullscreen" } diff --git a/todo.md b/todo.md index d902cefd..e65f39e9 100644 --- a/todo.md +++ b/todo.md @@ -12,7 +12,6 @@ | ID | Release | Blocked by | Exempt | Item | L | E | I | R | S | Moves | Score | |---|---|---|---|---|---|---|---|---|---|---|---| -| 21 | 0.3.0 | | defect | **Give `settings.json`'s model one writer, and sort its keys.** | 3 | 3 | 3 | 7 | 3 | 2 by 5 | 22.5 | | 29 | 0.3.0 | | | **Make the contributor a standing member of every project's audience, unless its README voids code health.** | 2 | 2 | 3 | 5 | 2 | 1.1 by 5, 1.4 by 5 | 13.7 | | 199 | 0.3.0 | | defect | **Start loop-claude's worker with `ScheduleWakeup` disallowed, so a worker that ends its turn on a question exits and the judge runs.** | 2 | 1 | 3 | 4 | 2 | 1.5 by 6, 1.2 by 3 | 11.8 | | 170 | 0.3.0 | | decision | **Re-tune `WORKER_STEPS` and `REVIEW_STEPS` once 10 chunks have shipped under them, from how well L, E and I order their review rounds and šŸ”“ findings.** | 2 | 2 | 3 | 5 | 2 | 1.1 by 3, 1.4 by 5 | 10.9 | @@ -92,12 +91,6 @@ ## Details -### 21. Give `settings.json`'s model one writer, and sort its keys. - -A defect: goal 2, keeping the setup shareable between computers, does not hold while one machine's model choice overwrites every other's. Claude Code rewrites `"model"` in this tracked file whenever a model is picked, so one `/model` dirties the checkout and overrides the synced choice. - -Every write Claude Code makes to the file rewrites `"model"`, `claude plugin install` included: Claude Code 2.1.288 turned `"opus"` into `"opus[1m]"`. Each write also puts the keys back in Claude Code's own order, so a sorted file stays sorted only until the next write. - ### 29. Make the contributor a standing member of every project's audience, unless its README voids code health. State that in `~/.claude/rules/goals-and-audience.md` → "Goals and Audience", and have larv-review's comprehension check name the contributor as the reader it serves. The `**Void:** code health` line (`~/.claude/CLAUDE.md` → "Shared goal") is the one place a project says maintainability does not matter: it drops the contributor. A project that opts out of the comprehension check must already write that line. -- 2.52.0 From 7665087e1e0355b1a8d5451626c2c0cb93923013 Mon Sep 17 00:00:00 2001 From: Lilleman auf Larv Date: Wed, 21 Oct 2026 21:38:50 +0200 Subject: [PATCH 03/15] =?UTF-8?q?Answer=20architecture=20round=201:=201=20?= =?UTF-8?q?=F0=9F=94=B4,=202=20=F0=9F=9F=A1;=20split=20the=20filter's=20pu?= =?UTF-8?q?re=20core=20out=20of=20main,=20stage=20settings.json=20before?= =?UTF-8?q?=20Update's=20move,=20read=20the=20stored=20settings=20in=20a?= =?UTF-8?q?=20repo=20check?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CHANGELOG.md | 2 +- README.md | 5 ++-- bin/repo_checks/test_settings.py | 21 +++++++++++++++++ bin/settings_filter.py | 12 ++++++---- bin/test_settings_filter.py | 39 ++++++++++++++++---------------- docs/decisions.md | 2 +- 6 files changed, 54 insertions(+), 27 deletions(-) create mode 100644 bin/repo_checks/test_settings.py diff --git a/CHANGELOG.md b/CHANGELOG.md index c87e6b53..b23d6c5b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,7 +2,7 @@ ## Unreleased -- `settings.json` no longer carries a model: each machine keeps the one you pick with `/model`. Git's clean filter `bin/settings_filter.py` drops `"model"` and sorts the keys, so neither a pick nor Claude Code's key order can reach a commit. After a pick, `git status` may still list `settings.json`; `git add settings.json` clears it, with nothing to commit. An update to a release that changes `settings.json` drops the machine's model. On upgrade, on each machine: +- `settings.json` no longer carries a model: each machine keeps the one you pick with `/model`. Git's clean filter `bin/settings_filter.py` drops `"model"` and sorts the keys, so neither a pick nor Claude Code's key order can reach a commit. After a pick, `git status` may still list `settings.json`; `git add settings.json` clears it, with nothing to commit. Update now starts with that `git add`: without it, the move drops the machine's model. An update to a release that changes `settings.json` drops the model either way. On upgrade, on each machine: 1. Turn the filter on in `~/.claude`: `git config filter.settings.clean bin/settings_filter.py`. 2. Pick a model with `/model`. Until you do, Claude Code runs its default model, where this repo set `opus` before. - larv-review's "Re-entry" is now one table of which passes a fix reruns, and the pass table's triggers say only when a pass first runs. The rule is unchanged; a fix for a 🟢, a ā“ or a prose finding still reruns no pass. diff --git a/README.md b/README.md index 73bb069a..543bee77 100644 --- a/README.md +++ b/README.md @@ -60,16 +60,17 @@ Have git store `settings.json` without `"model"`, so a model you pick with `/mod git config filter.settings.clean bin/settings_filter.py ``` -After a pick, `git status` may still list `settings.json`, and `git pull` refuses to update it. `git add settings.json` clears that, with nothing to commit. +After a pick, `git status` may still list `settings.json`, and `git pull` refuses to update it. `git add settings.json` clears that, with nothing to commit. A pull that changes `settings.json` then drops the model; pick it again with `/model`. Link `loop-claude` onto `PATH`: `ln -s ~/.claude/bin/loop-claude ~/.local/bin/loop-claude`. Run `loop-claude` only in a sandbox with no direct access to a production environment, such as a dedicated VM: every claude it starts, the interactive ones included, skips every permission prompt. ## Update -Move a machine that takes tagged releases to the latest tag. The move discards every uncommitted change to a file the latest tag tracks, such as a hook Claude Code wrote into `settings.json`. Where the tag changes `settings.json`, the move also drops this machine's model; pick it again with `/model`. List the uncommitted changes to files the checkout tracks, and the tag it is on: +Move a machine that takes tagged releases to the latest tag. The move discards every uncommitted change to a file the latest tag tracks, such as a hook Claude Code wrote into `settings.json`. Git counts a model pick as such a change until `git add settings.json`, so stage it first. Where the tag changes `settings.json`, the move still drops this machine's model; pick it again with `/model`. List the uncommitted changes to files the checkout tracks, and the tag it is on: ```sh cd ~/.claude +git add settings.json git fetch --tags origin git status ``` diff --git a/bin/repo_checks/test_settings.py b/bin/repo_checks/test_settings.py new file mode 100644 index 00000000..bd83f2ed --- /dev/null +++ b/bin/repo_checks/test_settings.py @@ -0,0 +1,21 @@ +import pathlib +import sys +import unittest + +sys.path.insert(0, str(pathlib.Path(__file__).resolve().parents[1])) + +from git_repo import git +from repo_checks.test_python_floor import ROOT +from settings_filter import cleaned + + +class Settings(unittest.TestCase): + def test_the_stored_settings_hold_no_model_and_sorted_keys(self): + # The index, not the working file: the working file holds this machine's model in Claude Code's key order. + stored = git("show", ":settings.json", cwd=str(ROOT)) + self.assertIsInstance(stored, str, stored) + self.assertEqual(stored, cleaned(stored)) + + def test_the_readme_installs_the_filter_git_attributes_name(self): + self.assertIn("settings.json filter=settings\n", (ROOT / ".gitattributes").read_text(encoding="utf-8")) + self.assertIn("git config filter.settings.clean bin/settings_filter.py\n", (ROOT / "README.md").read_text(encoding="utf-8")) diff --git a/bin/settings_filter.py b/bin/settings_filter.py index b532462c..b1c7b1ec 100755 --- a/bin/settings_filter.py +++ b/bin/settings_filter.py @@ -9,11 +9,15 @@ import json import sys -def main() -> None: - settings = json.load(sys.stdin) +def cleaned(written: str) -> str: + """settings.json as git stores it: without "model", every key sorted.""" + settings = json.loads(written) settings.pop("model", None) - json.dump(settings, sys.stdout, ensure_ascii=False, indent=2, sort_keys=True) - sys.stdout.write("\n") + return json.dumps(settings, ensure_ascii=False, indent=2, sort_keys=True) + "\n" + + +def main() -> None: + sys.stdout.write(cleaned(sys.stdin.read())) if __name__ == "__main__": diff --git a/bin/test_settings_filter.py b/bin/test_settings_filter.py index 7b126235..580b7f61 100644 --- a/bin/test_settings_filter.py +++ b/bin/test_settings_filter.py @@ -5,14 +5,11 @@ import sys import tempfile import unittest -BIN = pathlib.Path(__file__).resolve().parent -ROOT = BIN.parent -FILTER = BIN / "settings_filter.py" -INSTALL = "git config filter.settings.clean bin/settings_filter.py" +sys.path.insert(0, str(pathlib.Path(__file__).resolve().parent)) +from settings_filter import cleaned -def cleaned(text): - return subprocess.run([sys.executable, FILTER], input=text, capture_output=True, check=True, text=True).stdout +FILTER = pathlib.Path(__file__).resolve().parent / "settings_filter.py" class Clean(unittest.TestCase): @@ -20,35 +17,39 @@ class Clean(unittest.TestCase): written = '{"theme": "dark", "model": "opus[1m]", "env": {"B": "1", "A": "2"}}' self.assertEqual(cleaned(written), '{\n "env": {\n "A": "2",\n "B": "1"\n },\n "theme": "dark"\n}\n') - def test_the_tracked_settings_hold_no_model_and_sorted_keys(self): - tracked = (ROOT / "settings.json").read_text(encoding="utf-8") - self.assertEqual(tracked, cleaned(tracked)) - - def test_the_readme_installs_the_filter_git_attributes_name(self): - self.assertIn(f"{INSTALL}\n", (ROOT / "README.md").read_text(encoding="utf-8")) - self.assertIn("settings.json filter=settings\n", (ROOT / ".gitattributes").read_text(encoding="utf-8")) + def test_keeps_text_outside_ascii(self): + self.assertEqual(cleaned('{"name": "Lilleman pĆ„ Larv"}'), '{\n "name": "Lilleman pĆ„ Larv"\n}\n') class Checkout(unittest.TestCase): - def test_a_model_pick_and_claude_codes_key_order_leave_nothing_to_commit(self): + def test_a_model_pick_in_claude_codes_key_order_leaves_nothing_to_commit_and_outlasts_an_update(self): with tempfile.TemporaryDirectory() as repo: def git(*args): - return subprocess.run(["git", "-C", repo, *args], capture_output=True, check=True, text=True).stdout + return subprocess.run(["git", "-C", repo, "-c", "user.name=t", "-c", "user.email=t@t", *args], capture_output=True, check=True, text=True).stdout git("init", "-q") (pathlib.Path(repo) / "bin").mkdir() (pathlib.Path(repo) / "bin" / "settings_filter.py").symlink_to(FILTER) (pathlib.Path(repo) / ".gitattributes").write_text("settings.json filter=settings\n") - git(*INSTALL.split()[1:]) + git("config", "filter.settings.clean", "bin/settings_filter.py") settings = pathlib.Path(repo) / "settings.json" settings.write_text(cleaned('{"env": {}, "theme": "dark"}')) git("add", ".") - git("-c", "user.name=t", "-c", "user.email=t@t", "commit", "-qm", "settings") - settings.write_text(json.dumps({"theme": "dark", "model": "opus[1m]", "env": {}}, indent=2)) + git("commit", "-qm", "settings") + git("tag", "v1") + (pathlib.Path(repo) / "other").write_text("") + git("add", "other") + git("commit", "-qm", "a tag that leaves settings.json alone") + git("tag", "v2") + git("checkout", "-q", "v1") + picked = json.dumps({"theme": "dark", "model": "opus[1m]", "env": {}}, indent=2) + settings.write_text(picked) self.assertEqual(git("diff"), "") - # git status lists a file whose size changed until it is staged; staging adds no change. + # README → Update: git status lists a file whose size changed until it is staged; staging adds no change, and keeps the model through the move. git("add", "settings.json") self.assertEqual(git("status", "--porcelain"), "") + git("checkout", "-q", "-f", "v2") + self.assertEqual(settings.read_text(), picked) if __name__ == "__main__": diff --git a/docs/decisions.md b/docs/decisions.md index 74266912..e2ee8ecf 100644 --- a/docs/decisions.md +++ b/docs/decisions.md @@ -164,7 +164,7 @@ Three places carry the rule. `rules/todo-items.md` states it and loads with `tod ## settings.json: each machine owns its model, and git's clean filter `bin/settings_filter.py` keeps it, and Claude Code's key order, out of every commit -2026-10-21, lilleman. Serves goal 2: Claude Code rewrites `"model"` in `settings.json` on every `/model` and plugin install, so a tracked model let one machine's pick override every other's. lilleman chose a model per machine over a synced one in `env.ANTHROPIC_MODEL`, which `/model` could not outlast past one session: it is simpler, and loop-claude picks each project's model in `~/.claude/loop-claude-models.json` anyway. The filter also sorts the keys, since each write puts them back in Claude Code's order. Git still lists `settings.json` after a pick that changes the file's size, and `git pull` refuses to update it, until `git add settings.json`, which stages no change. An Update to a tag that changes `settings.json` drops the machine's model. Valid while Claude Code writes the model it picks into `settings.json`. +2026-10-21, lilleman. Serves goal 2: Claude Code rewrites `"model"` in `settings.json` on every `/model` and plugin install, so a tracked model let one machine's pick override every other's. lilleman chose a model per machine over a synced one in `env.ANTHROPIC_MODEL`, which `/model` could not outlast past one session: it is simpler, and loop-claude picks each project's model in `~/.claude/loop-claude-models.json` anyway. The filter also sorts the keys, since each write puts them back in Claude Code's order. Git still lists `settings.json` after a pick that changes the file's size, and `git pull` refuses to update it, until `git add settings.json`, which stages no change. Until then, Update's `git checkout -f` rewrites the file and drops the model, so Update stages it first. A move or pull that changes `settings.json` drops the machine's model either way. The effort keys, `effortLevel` and `modelSettings`, stay synced: the routing decision on a chunk's worker rung relies on "`settings.json` runs Opus 5.5 at xhigh". Valid while Claude Code writes the model it picks into `settings.json`. ## the repo may name bender, bender-infra and ai-sandbox -- 2.52.0 From d18b064e43d1460da7ff2e3d9d6416e7fc88b749 Mon Sep 17 00:00:00 2001 From: Lilleman auf Larv Date: Wed, 21 Oct 2026 21:41:31 +0200 Subject: [PATCH 04/15] =?UTF-8?q?Answer=20architecture=20round=202:=200=20?= =?UTF-8?q?=F0=9F=94=B4,=200=20=F0=9F=9F=A1;=20cite=20the=20synced=20effor?= =?UTF-8?q?t=20without=20the=20model?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/decisions.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/decisions.md b/docs/decisions.md index e2ee8ecf..d12f75df 100644 --- a/docs/decisions.md +++ b/docs/decisions.md @@ -164,7 +164,7 @@ Three places carry the rule. `rules/todo-items.md` states it and loads with `tod ## settings.json: each machine owns its model, and git's clean filter `bin/settings_filter.py` keeps it, and Claude Code's key order, out of every commit -2026-10-21, lilleman. Serves goal 2: Claude Code rewrites `"model"` in `settings.json` on every `/model` and plugin install, so a tracked model let one machine's pick override every other's. lilleman chose a model per machine over a synced one in `env.ANTHROPIC_MODEL`, which `/model` could not outlast past one session: it is simpler, and loop-claude picks each project's model in `~/.claude/loop-claude-models.json` anyway. The filter also sorts the keys, since each write puts them back in Claude Code's order. Git still lists `settings.json` after a pick that changes the file's size, and `git pull` refuses to update it, until `git add settings.json`, which stages no change. Until then, Update's `git checkout -f` rewrites the file and drops the model, so Update stages it first. A move or pull that changes `settings.json` drops the machine's model either way. The effort keys, `effortLevel` and `modelSettings`, stay synced: the routing decision on a chunk's worker rung relies on "`settings.json` runs Opus 5.5 at xhigh". Valid while Claude Code writes the model it picks into `settings.json`. +2026-10-21, lilleman. Serves goal 2: Claude Code rewrites `"model"` in `settings.json` on every `/model` and plugin install, so a tracked model let one machine's pick override every other's. lilleman chose a model per machine over a synced one in `env.ANTHROPIC_MODEL`, which `/model` could not outlast past one session: it is simpler, and loop-claude picks each project's model in `~/.claude/loop-claude-models.json` anyway. The filter also sorts the keys, since each write puts them back in Claude Code's order. Git still lists `settings.json` after a pick that changes the file's size, and `git pull` refuses to update it, until `git add settings.json`, which stages no change. Until then, Update's `git checkout -f` rewrites the file and drops the model, so Update stages it first. A move or pull that changes `settings.json` drops the machine's model either way. The effort keys, `effortLevel` and `modelSettings`, stay synced: the routing decision on a chunk's worker rung relies on `settings.json` running every interactive session at xhigh effort. Valid while Claude Code writes the model it picks into `settings.json`. ## the repo may name bender, bender-infra and ai-sandbox -- 2.52.0 From b57704d237aff76095ac20777aedce71b941af24 Mon Sep 17 00:00:00 2001 From: Lilleman auf Larv Date: Wed, 21 Oct 2026 21:59:53 +0200 Subject: [PATCH 05/15] =?UTF-8?q?Answer=20stability=20round=201:=202=20?= =?UTF-8?q?=F0=9F=94=B4,=203=20=F0=9F=9F=A1;=20anchor=20.gitattributes=20t?= =?UTF-8?q?o=20the=20root=20settings.json,=20sort=20the=20new=20imports,?= =?UTF-8?q?=20isolate=20the=20checkout=20tests=20from=20the=20host's=20git?= =?UTF-8?q?,=20start=20a=20new=20install's=20Update=20at=20git=20fetch,=20?= =?UTF-8?q?fix=20the=20filter's=20docstring?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitattributes | 2 +- .gitignore | 2 +- AGENTS.md | 2 +- README.md | 4 +- bin/repo_checks/test_settings.py | 14 ++++-- bin/repo_checks/test_types.py | 2 +- bin/settings_filter.py | 18 +++++-- bin/test_settings_filter.py | 82 +++++++++++++++++++++----------- 8 files changed, 83 insertions(+), 43 deletions(-) diff --git a/.gitattributes b/.gitattributes index 0cf88d34..d996d049 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1 +1 @@ -settings.json filter=settings +/settings.json filter=settings diff --git a/.gitignore b/.gitignore index a95dd537..ea57c2a8 100644 --- a/.gitignore +++ b/.gitignore @@ -67,8 +67,8 @@ !bin/score-outcomes !bin/score_outcomes/ !bin/score_outcomes/*.py -!bin/shell_command.py !bin/settings_filter.py +!bin/shell_command.py !bin/statusline.py !bin/subagent-rung !bin/subagent_rung/ diff --git a/AGENTS.md b/AGENTS.md index ce97866d..f50aab7a 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -53,7 +53,7 @@ Decisions live in `docs/decisions.md`: ## Working rules - `routing-calls-raised.md` sits at the root of loop-claude's archive (`$LOOP_CLAUDE_TRANSCRIPTS`, default `~/.claude/loop-claude-transcripts`). Each of its lines is a call or a `Reset`, with a stamp. A call is new when it is stamped after the latest `Reset` and after the latest stamp that `todo.md` or `docs/decisions.md` → `routing:` cites. When there are new calls, file one `todo.md` item to settle them, or refresh the item already filed. Its detail quotes those calls with their stamps, and the routed-chunks table of `routing-figures.md` beside it, never the project names its other tables hold. A change to the ladder, its steps or the delegation rule is the human's. The chunk that settles the calls cites the latest stamp it settled in `docs/decisions.md` → `routing:`, whatever the human decided, so they are not filed again. Once a chunk that changes the ladder, its steps or the delegation rule has merged, append `- Reset` to `routing-calls-raised.md`: the figures then count only chunks finished after it, and its calls may be raised again. -- When `~/.claude/settings.json` has uncommitted changes, commit them on a branch of their own and merge them through a PR: Claude Code writes that file from any session. Read their diff first: an empty one is a model pick, which `git add settings.json` clears. When it holds a credential, such as a token in `env` or `mcpServers`, ask the human to move it out of the file, and commit only once it is gone. A token in `env` moves to the shell profile; a server in `mcpServers` moves to `~/.claude.json` with `claude mcp add --scope user`. +- When `~/.claude/settings.json` has uncommitted changes, commit them on a branch of their own and merge them through a PR: Claude Code writes that file from any session. Read their diff first with `git diff HEAD -- settings.json`, which shows staged changes too: an empty one is a model pick, which `git add settings.json` clears. When it holds a credential, such as a token in `env` or `mcpServers`, ask the human to move it out of the file, and commit only once it is gone. A token in `env` moves to the shell profile; a server in `mcpServers` moves to `~/.claude.json` with `claude mcp add --scope user`. ## Scoring run diff --git a/README.md b/README.md index 543bee77..4b589776 100644 --- a/README.md +++ b/README.md @@ -43,7 +43,7 @@ git init git remote add origin ssh://git@gitea.larvit.se:21022/lilleman/claude-config.git ``` -Then run Update's commands. +Then run Update's commands, from `git fetch` on: a new checkout has no model pick to stage. Have Python 3.11 or newer as `python3` on `PATH`, and for Rust projects `rust-analyzer` on `PATH`, which the `rust-analyzer-lsp` plugin needs. Install every plugin `settings.json` enables: @@ -60,7 +60,7 @@ Have git store `settings.json` without `"model"`, so a model you pick with `/mod git config filter.settings.clean bin/settings_filter.py ``` -After a pick, `git status` may still list `settings.json`, and `git pull` refuses to update it. `git add settings.json` clears that, with nothing to commit. A pull that changes `settings.json` then drops the model; pick it again with `/model`. +After a pick, `git status` may still list `settings.json`, and `git pull` refuses to update it. `git add settings.json` clears that, with nothing to commit. A pull that changes `settings.json` then drops the model. Pick one with `/model` on each new machine, and again after such a pull. Link `loop-claude` onto `PATH`: `ln -s ~/.claude/bin/loop-claude ~/.local/bin/loop-claude`. Run `loop-claude` only in a sandbox with no direct access to a production environment, such as a dedicated VM: every claude it starts, the interactive ones included, skips every permission prompt. diff --git a/bin/repo_checks/test_settings.py b/bin/repo_checks/test_settings.py index bd83f2ed..e769a22a 100644 --- a/bin/repo_checks/test_settings.py +++ b/bin/repo_checks/test_settings.py @@ -1,12 +1,15 @@ +import json import pathlib import sys import unittest sys.path.insert(0, str(pathlib.Path(__file__).resolve().parents[1])) +from settings_filter import cleaned from git_repo import git from repo_checks.test_python_floor import ROOT -from settings_filter import cleaned + +INSTALL = "git config filter.settings.clean bin/settings_filter.py" class Settings(unittest.TestCase): @@ -14,8 +17,9 @@ class Settings(unittest.TestCase): # The index, not the working file: the working file holds this machine's model in Claude Code's key order. stored = git("show", ":settings.json", cwd=str(ROOT)) self.assertIsInstance(stored, str, stored) - self.assertEqual(stored, cleaned(stored)) + self.assertNotIn("model", json.loads(stored)) + self.assertEqual(stored, cleaned(stored), f"commit settings.json with the filter on: {INSTALL}") - def test_the_readme_installs_the_filter_git_attributes_name(self): - self.assertIn("settings.json filter=settings\n", (ROOT / ".gitattributes").read_text(encoding="utf-8")) - self.assertIn("git config filter.settings.clean bin/settings_filter.py\n", (ROOT / "README.md").read_text(encoding="utf-8")) + def test_the_readme_installs_the_filter_git_attributes_names_for_the_root_settings_only(self): + self.assertEqual("/settings.json filter=settings\n", (ROOT / ".gitattributes").read_text(encoding="utf-8")) + self.assertIn(f"{INSTALL}\n", (ROOT / "README.md").read_text(encoding="utf-8")) diff --git a/bin/repo_checks/test_types.py b/bin/repo_checks/test_types.py index 161ab8f3..cd8bd7a4 100644 --- a/bin/repo_checks/test_types.py +++ b/bin/repo_checks/test_types.py @@ -15,5 +15,5 @@ class Types(unittest.TestCase): self.assertIsNotNone(floor, "README.md's Install names `Python 3.N or newer`") if shutil.which("uv") is None: self.fail("uv on PATH fetches mypy; see README.md's Test line") - ran = subprocess.run(["uv", "tool", "run", "--python", "%d.%d" % floor, "mypy==2.3.1", "--cache-dir=/dev/null", "--check-untyped-defs", "--disallow-untyped-defs", "--exclude", "/test_", "-p", "chunk_preflight", "-p", "claude_code", "-m", "comprehension_history", "-m", "git_repo", "-p", "judge_replay", "-p", "larv_review", "-p", "loop_claude", "-m", "markdown_text", "-p", "metric_bench", "-m", "project_key", "-m", "rank_todo", "-m", "round_titles", "-p", "reading_cost", "-p", "review_replay", "-p", "rule_hook", "-p", "rung_replay", "-p", "score_outcomes", "-p", "subagent_rung", "-m", "settings_filter", "-m", "shell_command", "-m", "statusline", "-m", "todo_table", "-p", "transcript_archive", "-m", "utc_stamp"], capture_output=True, cwd=ROOT / "bin", text=True) + ran = subprocess.run(["uv", "tool", "run", "--python", "%d.%d" % floor, "mypy==2.3.1", "--cache-dir=/dev/null", "--check-untyped-defs", "--disallow-untyped-defs", "--exclude", "/test_", "-p", "chunk_preflight", "-p", "claude_code", "-m", "comprehension_history", "-m", "git_repo", "-p", "judge_replay", "-p", "larv_review", "-p", "loop_claude", "-m", "markdown_text", "-p", "metric_bench", "-m", "project_key", "-m", "rank_todo", "-p", "reading_cost", "-p", "review_replay", "-m", "round_titles", "-p", "rule_hook", "-p", "rung_replay", "-p", "score_outcomes", "-m", "settings_filter", "-m", "shell_command", "-m", "statusline", "-p", "subagent_rung", "-m", "todo_table", "-p", "transcript_archive", "-m", "utc_stamp"], capture_output=True, cwd=ROOT / "bin", text=True) self.assertEqual(ran.returncode, 0, ran.stdout + ran.stderr) diff --git a/bin/settings_filter.py b/bin/settings_filter.py index b1c7b1ec..4f9ab157 100755 --- a/bin/settings_filter.py +++ b/bin/settings_filter.py @@ -3,22 +3,30 @@ Claude Code rewrites settings.json, in its own key order, whenever a model is picked or a plugin installed. Each machine owns its model, so git stores the -file without it, and neither write shows as a change. +file without it, and neither write reaches a commit. """ import json import sys def cleaned(written: str) -> str: - """settings.json as git stores it: without "model", every key sorted.""" + """settings.json as git stores it: without "model", every key sorted. ValueError where it holds no JSON object.""" settings = json.loads(written) + if not isinstance(settings, dict): + raise ValueError("settings.json holds no JSON object") settings.pop("model", None) return json.dumps(settings, ensure_ascii=False, indent=2, sort_keys=True) + "\n" -def main() -> None: - sys.stdout.write(cleaned(sys.stdin.read())) +def main() -> int: + # On a non-zero exit git warns and stores the file as written. + try: + sys.stdout.write(cleaned(sys.stdin.read())) + except ValueError as error: + print(f"settings_filter.py: {error}", file=sys.stderr) + return 1 + return 0 if __name__ == "__main__": - main() + sys.exit(main()) diff --git a/bin/test_settings_filter.py b/bin/test_settings_filter.py index 580b7f61..0bfb633a 100644 --- a/bin/test_settings_filter.py +++ b/bin/test_settings_filter.py @@ -1,4 +1,5 @@ import json +import os import pathlib import subprocess import sys @@ -8,8 +9,11 @@ import unittest sys.path.insert(0, str(pathlib.Path(__file__).resolve().parent)) from settings_filter import cleaned +from test_env import isolated_env FILTER = pathlib.Path(__file__).resolve().parent / "settings_filter.py" +ROOT = FILTER.parents[1] +PICKED = json.dumps({"theme": "dark", "model": "opus[1m]", "env": {}}, indent=2) class Clean(unittest.TestCase): @@ -20,36 +24,60 @@ class Clean(unittest.TestCase): def test_keeps_text_outside_ascii(self): self.assertEqual(cleaned('{"name": "Lilleman pĆ„ Larv"}'), '{\n "name": "Lilleman pĆ„ Larv"\n}\n') + def test_refuses_json_that_is_no_object(self): + with self.assertRaises(ValueError): + cleaned("[]") + + def test_a_broken_file_exits_1_naming_the_tool(self): + ran = subprocess.run([sys.executable, FILTER], input="{", capture_output=True, text=True) + self.assertEqual((ran.returncode, ran.stdout), (1, "")) + self.assertIn("settings_filter.py: ", ran.stderr) + class Checkout(unittest.TestCase): - def test_a_model_pick_in_claude_codes_key_order_leaves_nothing_to_commit_and_outlasts_an_update(self): - with tempfile.TemporaryDirectory() as repo: - def git(*args): - return subprocess.run(["git", "-C", repo, "-c", "user.name=t", "-c", "user.email=t@t", *args], capture_output=True, check=True, text=True).stdout + """A repo as README → Install leaves it, at tag v1, and v2, which leaves settings.json alone.""" - git("init", "-q") - (pathlib.Path(repo) / "bin").mkdir() - (pathlib.Path(repo) / "bin" / "settings_filter.py").symlink_to(FILTER) - (pathlib.Path(repo) / ".gitattributes").write_text("settings.json filter=settings\n") - git("config", "filter.settings.clean", "bin/settings_filter.py") - settings = pathlib.Path(repo) / "settings.json" - settings.write_text(cleaned('{"env": {}, "theme": "dark"}')) - git("add", ".") - git("commit", "-qm", "settings") - git("tag", "v1") - (pathlib.Path(repo) / "other").write_text("") - git("add", "other") - git("commit", "-qm", "a tag that leaves settings.json alone") - git("tag", "v2") - git("checkout", "-q", "v1") - picked = json.dumps({"theme": "dark", "model": "opus[1m]", "env": {}}, indent=2) - settings.write_text(picked) - self.assertEqual(git("diff"), "") - # README → Update: git status lists a file whose size changed until it is staged; staging adds no change, and keeps the model through the move. - git("add", "settings.json") - self.assertEqual(git("status", "--porcelain"), "") - git("checkout", "-q", "-f", "v2") - self.assertEqual(settings.read_text(), picked) + def setUp(self): + temp = tempfile.TemporaryDirectory() + self.addCleanup(temp.cleanup) + self.repo = pathlib.Path(temp.name) + self.env = {**isolated_env(), "GIT_CONFIG_GLOBAL": os.devnull, "GIT_CONFIG_NOSYSTEM": "1"} + self.git("init", "-q") + (self.repo / "bin").mkdir() + (self.repo / "bin" / "settings_filter.py").symlink_to(FILTER) + (self.repo / ".gitattributes").write_text((ROOT / ".gitattributes").read_text()) + self.git("config", "filter.settings.clean", "bin/settings_filter.py") + self.settings = self.repo / "settings.json" + self.settings.write_text(cleaned('{"env": {}, "theme": "dark"}')) + (self.repo / ".claude").mkdir() + (self.repo / ".claude" / "settings.json").write_text('{\n "model": "claude-opus-5-5"\n}\n') + self.git("add", ".") + self.git("commit", "-qm", "settings") + self.git("tag", "v1") + (self.repo / "other").write_text("") + self.git("add", "other") + self.git("commit", "-qm", "a tag that leaves settings.json alone") + self.git("tag", "v2") + self.git("checkout", "-q", "v1") + + def git(self, *args): + return subprocess.run(["git", "-C", self.repo, "-c", "user.name=t", "-c", "user.email=t@t", *args], capture_output=True, check=True, env=self.env, text=True).stdout + + def test_a_model_pick_in_claude_codes_key_order_leaves_nothing_to_commit(self): + self.settings.write_text(PICKED) + self.assertEqual(self.git("diff"), "") + # git status lists a file whose size changed until it is staged; staging adds no change. + self.git("add", "settings.json") + self.assertEqual(self.git("status", "--porcelain"), "") + + def test_a_staged_pick_outlasts_an_update_to_a_tag_that_leaves_settings_json_alone(self): + self.settings.write_text(PICKED) + self.git("add", "settings.json") + self.git("checkout", "-q", "-f", "v2") + self.assertEqual(self.settings.read_text(), PICKED) + + def test_the_repos_own_harness_settings_keep_their_model(self): + self.assertEqual(self.git("show", ":.claude/settings.json"), '{\n "model": "claude-opus-5-5"\n}\n') if __name__ == "__main__": -- 2.52.0 From 1f8edb8e2e3d879bfa8261998a4fd53403f88786 Mon Sep 17 00:00:00 2001 From: Lilleman auf Larv Date: Wed, 21 Oct 2026 21:59:53 +0200 Subject: [PATCH 06/15] =?UTF-8?q?Answer=20principles=20round=201:=202=20?= =?UTF-8?q?=F0=9F=94=B4,=205=20=F0=9F=9F=A1;=20the=20stability=20round's?= =?UTF-8?q?=20commit=20holds=20the=20fixes,=20and=20the=20filter=20now=20e?= =?UTF-8?q?xits=201=20on=20a=20file=20that=20holds=20no=20JSON=20object,?= =?UTF-8?q?=20AGENTS.md=20reads=20staged=20changes=20too,=20and=20the=20my?= =?UTF-8?q?py=20targets=20are=20sorted?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit -- 2.52.0 From 80270c6b170b2fbff4eb7e4248ca102316a1c215 Mon Sep 17 00:00:00 2001 From: Lilleman auf Larv Date: Wed, 21 Oct 2026 21:59:53 +0200 Subject: [PATCH 07/15] =?UTF-8?q?Answer=20product-owner=20round=201:=201?= =?UTF-8?q?=20=F0=9F=94=B4,=201=20=F0=9F=9F=A1;=20the=20stability=20round'?= =?UTF-8?q?s=20commit=20holds=20the=20fixes,=20and=20Install=20now=20says?= =?UTF-8?q?=20to=20pick=20a=20model=20on=20each=20new=20machine?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit -- 2.52.0 From d08a128d0fd76cfa170477f2e1051206a3a78b00 Mon Sep 17 00:00:00 2001 From: Lilleman auf Larv Date: Wed, 21 Oct 2026 21:59:53 +0200 Subject: [PATCH 08/15] =?UTF-8?q?Answer=20security=20round=201:=200=20?= =?UTF-8?q?=F0=9F=94=B4,=200=20=F0=9F=9F=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit -- 2.52.0 From b7261987ad3884af4e86156ceadd5715c3798e3b Mon Sep 17 00:00:00 2001 From: Lilleman auf Larv Date: Wed, 21 Oct 2026 22:14:24 +0200 Subject: [PATCH 09/15] =?UTF-8?q?Answer=20principles=20round=202:=200=20?= =?UTF-8?q?=F0=9F=94=B4,=201=20=F0=9F=9F=A1;=20main=20parses=20and=20check?= =?UTF-8?q?s=20settings.json,=20so=20cleaned=20takes=20a=20dict=20and=20ne?= =?UTF-8?q?ver=20raises?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- bin/repo_checks/test_settings.py | 5 +++-- bin/settings_filter.py | 21 +++++++++++---------- bin/test_settings_filter.py | 21 +++++++++------------ 3 files changed, 23 insertions(+), 24 deletions(-) diff --git a/bin/repo_checks/test_settings.py b/bin/repo_checks/test_settings.py index e769a22a..debbcfca 100644 --- a/bin/repo_checks/test_settings.py +++ b/bin/repo_checks/test_settings.py @@ -17,8 +17,9 @@ class Settings(unittest.TestCase): # The index, not the working file: the working file holds this machine's model in Claude Code's key order. stored = git("show", ":settings.json", cwd=str(ROOT)) self.assertIsInstance(stored, str, stored) - self.assertNotIn("model", json.loads(stored)) - self.assertEqual(stored, cleaned(stored), f"commit settings.json with the filter on: {INSTALL}") + fix = f"commit settings.json with the filter on: {INSTALL}" + self.assertNotIn("model", json.loads(stored), fix) + self.assertEqual(stored, cleaned(json.loads(stored)), fix) def test_the_readme_installs_the_filter_git_attributes_names_for_the_root_settings_only(self): self.assertEqual("/settings.json filter=settings\n", (ROOT / ".gitattributes").read_text(encoding="utf-8")) diff --git a/bin/settings_filter.py b/bin/settings_filter.py index 4f9ab157..7c60b1cf 100755 --- a/bin/settings_filter.py +++ b/bin/settings_filter.py @@ -2,29 +2,30 @@ """Git's clean filter for settings.json: drop "model" and sort every key. Claude Code rewrites settings.json, in its own key order, whenever a model is -picked or a plugin installed. Each machine owns its model, so git stores the -file without it, and neither write reaches a commit. +picked or a plugin installed. Each machine owns its model, so neither the +model nor Claude Code's key order reaches a commit. """ import json import sys -def cleaned(written: str) -> str: - """settings.json as git stores it: without "model", every key sorted. ValueError where it holds no JSON object.""" - settings = json.loads(written) - if not isinstance(settings, dict): - raise ValueError("settings.json holds no JSON object") - settings.pop("model", None) - return json.dumps(settings, ensure_ascii=False, indent=2, sort_keys=True) + "\n" +def cleaned(settings: dict[str, object]) -> str: + """settings.json as git stores it: without "model", every key sorted.""" + kept = {key: value for key, value in settings.items() if key != "model"} + return json.dumps(kept, ensure_ascii=False, indent=2, sort_keys=True) + "\n" def main() -> int: # On a non-zero exit git warns and stores the file as written. try: - sys.stdout.write(cleaned(sys.stdin.read())) + settings = json.loads(sys.stdin.read()) except ValueError as error: print(f"settings_filter.py: {error}", file=sys.stderr) return 1 + if not isinstance(settings, dict): + print("settings_filter.py: settings.json holds no JSON object", file=sys.stderr) + return 1 + sys.stdout.write(cleaned(settings)) return 0 diff --git a/bin/test_settings_filter.py b/bin/test_settings_filter.py index 0bfb633a..d0d8cb28 100644 --- a/bin/test_settings_filter.py +++ b/bin/test_settings_filter.py @@ -18,24 +18,21 @@ PICKED = json.dumps({"theme": "dark", "model": "opus[1m]", "env": {}}, indent=2) class Clean(unittest.TestCase): def test_drops_the_model_and_sorts_every_key(self): - written = '{"theme": "dark", "model": "opus[1m]", "env": {"B": "1", "A": "2"}}' + written = {"theme": "dark", "model": "opus[1m]", "env": {"B": "1", "A": "2"}} self.assertEqual(cleaned(written), '{\n "env": {\n "A": "2",\n "B": "1"\n },\n "theme": "dark"\n}\n') def test_keeps_text_outside_ascii(self): - self.assertEqual(cleaned('{"name": "Lilleman pĆ„ Larv"}'), '{\n "name": "Lilleman pĆ„ Larv"\n}\n') + self.assertEqual(cleaned({"name": "Lilleman pĆ„ Larv"}), '{\n "name": "Lilleman pĆ„ Larv"\n}\n') - def test_refuses_json_that_is_no_object(self): - with self.assertRaises(ValueError): - cleaned("[]") - - def test_a_broken_file_exits_1_naming_the_tool(self): - ran = subprocess.run([sys.executable, FILTER], input="{", capture_output=True, text=True) - self.assertEqual((ran.returncode, ran.stdout), (1, "")) - self.assertIn("settings_filter.py: ", ran.stderr) + def test_a_file_that_holds_no_json_object_exits_1_naming_the_tool(self): + for written in ("{", "[]"): + ran = subprocess.run([sys.executable, FILTER], input=written, capture_output=True, text=True) + self.assertEqual((ran.returncode, ran.stdout), (1, ""), written) + self.assertIn("settings_filter.py: ", ran.stderr) class Checkout(unittest.TestCase): - """A repo as README → Install leaves it, at tag v1, and v2, which leaves settings.json alone.""" + """A repo as README → Install leaves it, checked out at tag v1; tag v2 doesn't change settings.json.""" def setUp(self): temp = tempfile.TemporaryDirectory() @@ -48,7 +45,7 @@ class Checkout(unittest.TestCase): (self.repo / ".gitattributes").write_text((ROOT / ".gitattributes").read_text()) self.git("config", "filter.settings.clean", "bin/settings_filter.py") self.settings = self.repo / "settings.json" - self.settings.write_text(cleaned('{"env": {}, "theme": "dark"}')) + self.settings.write_text(cleaned({"env": {}, "theme": "dark"})) (self.repo / ".claude").mkdir() (self.repo / ".claude" / "settings.json").write_text('{\n "model": "claude-opus-5-5"\n}\n') self.git("add", ".") -- 2.52.0 From 651695a6955a6b9a1beb2dfd942373a28d2cc0ba Mon Sep 17 00:00:00 2001 From: Lilleman auf Larv Date: Wed, 21 Oct 2026 22:14:24 +0200 Subject: [PATCH 10/15] =?UTF-8?q?Answer=20prose=20round=201:=200=20?= =?UTF-8?q?=F0=9F=94=B4,=208=20=F0=9F=9F=A1;=20one=20copy=20of=20the=20git?= =?UTF-8?q?=20steps,=20in=20README,=20true=20claims=20about=20the=20synced?= =?UTF-8?q?=20effort=20and=20the=20filter,=20and=20the=20trust=20entry=20a?= =?UTF-8?q?dded=20to=20item=20190?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- AGENTS.md | 2 +- CHANGELOG.md | 4 ++-- README.md | 12 +++++++----- docs/decisions.md | 4 ++-- todo.md | 6 +++--- 5 files changed, 15 insertions(+), 13 deletions(-) diff --git a/AGENTS.md b/AGENTS.md index f50aab7a..fbba6a54 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -53,7 +53,7 @@ Decisions live in `docs/decisions.md`: ## Working rules - `routing-calls-raised.md` sits at the root of loop-claude's archive (`$LOOP_CLAUDE_TRANSCRIPTS`, default `~/.claude/loop-claude-transcripts`). Each of its lines is a call or a `Reset`, with a stamp. A call is new when it is stamped after the latest `Reset` and after the latest stamp that `todo.md` or `docs/decisions.md` → `routing:` cites. When there are new calls, file one `todo.md` item to settle them, or refresh the item already filed. Its detail quotes those calls with their stamps, and the routed-chunks table of `routing-figures.md` beside it, never the project names its other tables hold. A change to the ladder, its steps or the delegation rule is the human's. The chunk that settles the calls cites the latest stamp it settled in `docs/decisions.md` → `routing:`, whatever the human decided, so they are not filed again. Once a chunk that changes the ladder, its steps or the delegation rule has merged, append `- Reset` to `routing-calls-raised.md`: the figures then count only chunks finished after it, and its calls may be raised again. -- When `~/.claude/settings.json` has uncommitted changes, commit them on a branch of their own and merge them through a PR: Claude Code writes that file from any session. Read their diff first with `git diff HEAD -- settings.json`, which shows staged changes too: an empty one is a model pick, which `git add settings.json` clears. When it holds a credential, such as a token in `env` or `mcpServers`, ask the human to move it out of the file, and commit only once it is gone. A token in `env` moves to the shell profile; a server in `mcpServers` moves to `~/.claude.json` with `claude mcp add --scope user`. +- When `~/.claude/settings.json` has uncommitted changes, commit them on a branch of their own and merge them through a PR: Claude Code writes that file from any session. Read their diff first: `git diff HEAD -- settings.json`, which shows staged changes too. An empty diff means only the model or the key order changed: `git add settings.json` takes the file off `git status`, with nothing to commit. When the diff holds a credential, such as a token in `env` or `mcpServers`, ask the human to move it out of the file, and commit only once it is gone. A token in `env` moves to the shell profile; a server in `mcpServers` moves to `~/.claude.json` with `claude mcp add --scope user`. ## Scoring run diff --git a/CHANGELOG.md b/CHANGELOG.md index b23d6c5b..bb79e7d8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,9 +2,9 @@ ## Unreleased -- `settings.json` no longer carries a model: each machine keeps the one you pick with `/model`. Git's clean filter `bin/settings_filter.py` drops `"model"` and sorts the keys, so neither a pick nor Claude Code's key order can reach a commit. After a pick, `git status` may still list `settings.json`; `git add settings.json` clears it, with nothing to commit. Update now starts with that `git add`: without it, the move drops the machine's model. An update to a release that changes `settings.json` drops the model either way. On upgrade, on each machine: +- `settings.json` no longer carries a model: each machine keeps the one you pick with `/model`. Git's clean filter `bin/settings_filter.py` drops `"model"` and sorts the keys, so neither a pick nor Claude Code's key order can reach a commit. Update now starts with `git add settings.json`: without it, Update's `git checkout -f` drops the machine's model. On upgrade, on each machine: 1. Turn the filter on in `~/.claude`: `git config filter.settings.clean bin/settings_filter.py`. - 2. Pick a model with `/model`. Until you do, Claude Code runs its default model, where this repo set `opus` before. + 2. Pick a model with `/model`. Until you do, Claude Code runs its default model; this repo set `opus` before. - larv-review's "Re-entry" is now one table of which passes a fix reruns, and the pass table's triggers say only when a pass first runs. The rule is unchanged; a fix for a 🟢, a ā“ or a prose finding still reruns no pass. ## 0.2.0 diff --git a/README.md b/README.md index 4b589776..2d9692d7 100644 --- a/README.md +++ b/README.md @@ -43,7 +43,7 @@ git init git remote add origin ssh://git@gitea.larvit.se:21022/lilleman/claude-config.git ``` -Then run Update's commands, from `git fetch` on: a new checkout has no model pick to stage. +Then run Update's commands, skipping `git add settings.json`: the new repository tracks no file yet. Have Python 3.11 or newer as `python3` on `PATH`, and for Rust projects `rust-analyzer` on `PATH`, which the `rust-analyzer-lsp` plugin needs. Install every plugin `settings.json` enables: @@ -60,13 +60,15 @@ Have git store `settings.json` without `"model"`, so a model you pick with `/mod git config filter.settings.clean bin/settings_filter.py ``` -After a pick, `git status` may still list `settings.json`, and `git pull` refuses to update it. `git add settings.json` clears that, with nothing to commit. A pull that changes `settings.json` then drops the model. Pick one with `/model` on each new machine, and again after such a pull. +Then pick a model with `/model`. + +After a pick, `git status` may list `settings.json`, and a `git pull` that changes the file refuses to run. `git add settings.json` stages no change and clears both. Once it is staged, such a pull goes through and drops the model: pick it again. Link `loop-claude` onto `PATH`: `ln -s ~/.claude/bin/loop-claude ~/.local/bin/loop-claude`. Run `loop-claude` only in a sandbox with no direct access to a production environment, such as a dedicated VM: every claude it starts, the interactive ones included, skips every permission prompt. ## Update -Move a machine that takes tagged releases to the latest tag. The move discards every uncommitted change to a file the latest tag tracks, such as a hook Claude Code wrote into `settings.json`. Git counts a model pick as such a change until `git add settings.json`, so stage it first. Where the tag changes `settings.json`, the move still drops this machine's model; pick it again with `/model`. List the uncommitted changes to files the checkout tracks, and the tag it is on: +Move a machine that takes tagged releases to the latest tag. The move discards every uncommitted change to a file the latest tag tracks, such as a hook Claude Code wrote into `settings.json`. Git counts a model pick as such a change until `git add settings.json`, so stage it first. List the uncommitted changes to files the checkout tracks, and the tag it is on: ```sh cd ~/.claude @@ -81,7 +83,7 @@ To keep an uncommitted change, merge it per `AGENTS.md` → "Working rules" and git checkout -f "$(git tag -l 'v*' --sort=-v:refname | head -n 1)" ``` -Then do what `CHANGELOG.md` asks of each version since the old tag, such as a new step under Install. +Then, where the tag changed `settings.json`, pick the model again with `/model`, and do what `CHANGELOG.md` asks of each version since the old tag, such as a new step under Install. ## Release @@ -101,7 +103,7 @@ Install puts only `loop-claude` on `PATH`; call the others by their path, such a - `review-replay ` replays a review pass's archived rounds from the projects run on the model, on the code each reviewed, and prints the lowest rung below the project's that, like each rung above it, finds every šŸ”“ and 🟔 the project's rung finds again; `review-replay --help` states the replay. Run it only in a sandbox, like loop-claude: each replayed reviewer skips every permission prompt, stability-reviewer has Bash, and an archived prompt may name paths on the host. - `rule-hook [overrides]` blocks a tool call that breaks a rule a program can check, unless the call overrides the rule; `settings.json` → `hooks` runs it before each Bash, Edit, MultiEdit, Write and Agent call, and `rule-hook --help` states the rules and the override. - `score-outcomes [L E I S]` lists the finished items whose guessed scores sit nearest the given ones, and the shipped items the project's `docs/score-anchors.md` names for each level of L, E and I, each with what its chunk measured; then the median outcome at each guessed R and S, and how well L, E and I each order the chunks by review rounds and šŸ”“ findings; `score-outcomes --help` states the measures. -- `settings_filter.py` is git's clean filter for `settings.json`: it drops `"model"` and sorts the keys. `.gitattributes` names it, and Install turns it on. +- `settings_filter.py` is git's clean filter for `settings.json`: it drops `"model"` and sorts the keys. `.gitattributes` sets the filter `settings` on `settings.json`, and Install's `git config` line makes this script that filter. - `statusline.py` renders Claude Code's status line; `settings.json` → `statusLine` runs it. - `subagent-rung [--plan] ` prints the Agent tool's model and effort for a subagent's task, picked by its L from the project's model, and with `--plan` never below the project's rung; `subagent-rung --help` states the rule. diff --git a/docs/decisions.md b/docs/decisions.md index d12f75df..d63ce45f 100644 --- a/docs/decisions.md +++ b/docs/decisions.md @@ -164,7 +164,7 @@ Three places carry the rule. `rules/todo-items.md` states it and loads with `tod ## settings.json: each machine owns its model, and git's clean filter `bin/settings_filter.py` keeps it, and Claude Code's key order, out of every commit -2026-10-21, lilleman. Serves goal 2: Claude Code rewrites `"model"` in `settings.json` on every `/model` and plugin install, so a tracked model let one machine's pick override every other's. lilleman chose a model per machine over a synced one in `env.ANTHROPIC_MODEL`, which `/model` could not outlast past one session: it is simpler, and loop-claude picks each project's model in `~/.claude/loop-claude-models.json` anyway. The filter also sorts the keys, since each write puts them back in Claude Code's order. Git still lists `settings.json` after a pick that changes the file's size, and `git pull` refuses to update it, until `git add settings.json`, which stages no change. Until then, Update's `git checkout -f` rewrites the file and drops the model, so Update stages it first. A move or pull that changes `settings.json` drops the machine's model either way. The effort keys, `effortLevel` and `modelSettings`, stay synced: the routing decision on a chunk's worker rung relies on `settings.json` running every interactive session at xhigh effort. Valid while Claude Code writes the model it picks into `settings.json`. +2026-10-21, lilleman. Serves goal 2: Claude Code rewrites `"model"` in `settings.json` on every `/model` and plugin install, so a tracked model let one machine's pick override every other's. lilleman chose a model per machine over one synced in `env.ANTHROPIC_MODEL`, which would override a `/model` pick from the next session on. A model per machine is simpler, and loop-claude picks each project's model in `~/.claude/loop-claude-models.json` anyway. The filter also sorts the keys, since each write puts them back in Claude Code's order. The cost: a move or pull that changes `settings.json` drops the machine's model. The effort keys, `effortLevel` and `modelSettings`, stay synced: the routing decision on a chunk's worker rung relies on the effort `settings.json` gives every interactive session. Valid while Claude Code writes the model it picks into `settings.json`. ## the repo may name bender, bender-infra and ai-sandbox @@ -272,7 +272,7 @@ Valid while the index ranks these models, and while no newer model joins the cat 2026-10-14, lilleman. Serves goals 1.1 and 1.4. -Only chunks run below the project's rung can prove that a cheaper worker holds quality (goal 1.1). So on 2026-10-14 lilleman chose a trial on real chunks: a replay of past chunks would spend on work that never ships (goal 1.4). Review holds quality meanwhile. While the worker runs below the project's rung, loop-claude's prompt has it launch each comprehension seat and the security pass's subagent on the project's rung, and each reviewer there too unless the highest E + I among its items picks a higher rung or a replay lowered its pass, through the Agent tool's model and effort. The worker runs a full scan only from such a subagent, because the `claude-security` plugin's researchers and verifiers inherit the model that starts them. A subagent that cannot run the scan leaves it unavailable, so larv-review runs `/security-review` in its place. lilleman chose the project's rung, medium, knowing `settings.json` runs Opus 5.5 at xhigh, so a routed worker runs below the effort an interactive session takes. +Only chunks run below the project's rung can prove that a cheaper worker holds quality (goal 1.1). So on 2026-10-14 lilleman chose a trial on real chunks: a replay of past chunks would spend on work that never ships (goal 1.4). Review holds quality meanwhile. While the worker runs below the project's rung, loop-claude's prompt has it launch each comprehension seat and the security pass's subagent on the project's rung, and each reviewer there too unless the highest E + I among its items picks a higher rung or a replay lowered its pass, through the Agent tool's model and effort. The worker runs a full scan only from such a subagent, because the `claude-security` plugin's researchers and verifiers inherit the model that starts them. A subagent that cannot run the scan leaves it unavailable, so larv-review runs `/security-review` in its place. lilleman chose the project's rung, medium, knowing `settings.json` then ran every interactive session on Opus 5.5 at xhigh, so a routed worker ran below the effort an interactive session took. While the worker runs above the project's rung, loop-claude's prompt has it launch the comprehension seats and the security pass's subagent on the project's rung too. So the seats score every chunk on one rung, and the security pass spends no more than the project chose. The prompt after each unfinished verdict repeats this, since a step-up may have taken the worker above the project's rung. The other reviewers never run below the worker's rung while it runs above the project's: a worker climbs because its chunk proved harder than its score said, which is when a cheaper reviewer is the bigger risk. A reviewer or seat that rules the work below standard may rerun one rung up: `review: a reviewer or comprehension seat that rules the work below standard`. diff --git a/todo.md b/todo.md index e65f39e9..c01e75c0 100644 --- a/todo.md +++ b/todo.md @@ -37,7 +37,7 @@ | 204 | 0.5.0 | | | **Read the status line's branch through `git_repo.git`, so no tool in `bin/` runs git outside it.** | 1 | 2 | 1 | 2 | 1 | code health by 3 | 21.6 | | 125 | 0.5.0 | | decision | **Give "record", "outcome" and "places" one meaning each across `bin/`, and rename `bin/larv_review/git.py` by what it holds.** | 3 | 1 | 3 | 5 | 5 | code health by 9, 1.4 by 9 | 19.7 | | 172 | 0.5.0 | | | **Name the project's rung `project` across `bin/loop_claude`, in place of `anchor`, as `bin/model_routing/ladder.py` names it.** | 2 | 1 | 3 | 4 | 3 | code health by 3, 1.4 by 3 | 16.5 | -| 190 | 0.5.0 | | | **Rewrite the `docs/decisions.md` entries `todo.md: one table …` and `loop-claude: a judge decides …` as the current state, so a reader no longer replays superseded paragraphs to learn what holds.** | 2 | 2 | 1 | 3 | 3 | code health by 3, 1.4 by 2 | 15.5 | +| 190 | 0.5.0 | | | **Rewrite the `docs/decisions.md` entries `todo.md: one table …`, `loop-claude: a judge decides …` and `loop-claude: before it opens claude …` as the current state, so a reader no longer replays superseded paragraphs to learn what holds.** | 2 | 2 | 1 | 3 | 3 | code health by 3, 1.4 by 2 | 15.5 | | 82 | 0.5.0 | | principle | **Sort `AGENTS.md`'s decision titles and `docs/decisions.md`'s entries by title.** | 2 | 2 | 1 | 3 | 4 | code health by 4, 1.4 by 4 | 14.6 | | 137 | 0.5.0 | | | **Archive a chunk's route as a record loop-claude reads back field by field, in place of the `Worker:` prose `ROUTED` parses, and name `stepped` and the judge's `bundled` by what they do.** | 4 | 2 | 3 | 7 | 4 | code health by 4, 1.4 by 4 | 14.6 | | 205 | 0.5.0 | | | **Rewrite the comprehension-floor decision's 2026-10-15 paragraph as the rule that holds, so it no longer scores G 9 after PR #283 replaced G.** | 1 | 2 | 1 | 2 | 1 | code health by 2 | 14.4 | @@ -197,9 +197,9 @@ The inherited architect of PR #257's scoring run named `bin/reading_cost/measure The architecture pass of PR #296 found one rung under two names: `bin/model_routing/ladder.py` calls it `project`, while `bin/loop_claude/routing.py`, `cycle/prompts.py`, `cycle/run.py`'s `Cycle.anchor` and `loop/main.py` call it `anchor`, and gloss it as "anchor, the project's rung" in docstring after docstring. A reader works out that the two are one rung each time. Make `bin/loop_claude/routing.py`'s `first_route` easier to read. -### 190. Rewrite the `docs/decisions.md` entries `todo.md: one table …` and `loop-claude: a judge decides …` as the current state, so a reader no longer replays superseded paragraphs to learn what holds. +### 190. Rewrite the `docs/decisions.md` entries `todo.md: one table …`, `loop-claude: a judge decides …` and `loop-claude: before it opens claude …` as the current state, so a reader no longer replays superseded paragraphs to learn what holds. -Found by the prose review of PR #312, which judged both entries to read as amendment logs, each paragraph correcting an earlier one. The rewrite keeps each paragraph's date and reason only where it still explains a rule that holds, and drops superseded states. It covers items 157 and 183, which reshape paragraphs of the same two entries. +Found by the prose review of PR #312, which judged both entries to read as amendment logs, each paragraph correcting an earlier one. The rewrite keeps each paragraph's date and reason only where it still explains a rule that holds, and drops superseded states. It covers items 157 and 183, which reshape paragraphs of the same two entries. The prose review of PR #335 found the trust entry, `loop-claude: before it opens claude …`, made of four dated paragraphs, and a 2026-10-21 paragraph on item 120 that records a move which changed no rule; drop that paragraph. ### 82. Sort `AGENTS.md`'s decision titles and `docs/decisions.md`'s entries by title. -- 2.52.0 From 250b29bc665d5bf5a2399c970d7f5dde30466b0b Mon Sep 17 00:00:00 2001 From: Lilleman auf Larv Date: Wed, 21 Oct 2026 22:14:24 +0200 Subject: [PATCH 11/15] =?UTF-8?q?Answer=20stability=20round=202:=200=20?= =?UTF-8?q?=F0=9F=94=B4,=200=20=F0=9F=9F=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit -- 2.52.0 From b580d3991e4a82e0cfb6bac340df54ed470f681d Mon Sep 17 00:00:00 2001 From: Lilleman auf Larv Date: Wed, 21 Oct 2026 22:14:24 +0200 Subject: [PATCH 12/15] =?UTF-8?q?Answer=20product-owner=20round=202:=200?= =?UTF-8?q?=20=F0=9F=94=B4,=200=20=F0=9F=9F=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit -- 2.52.0 From 8e0c2d50f852f29e620b5463f5eb75f1a1e0b41b Mon Sep 17 00:00:00 2001 From: Lilleman auf Larv Date: Wed, 21 Oct 2026 22:18:18 +0200 Subject: [PATCH 13/15] =?UTF-8?q?Answer=20principles=20round=203:=200=20?= =?UTF-8?q?=F0=9F=94=B4,=200=20=F0=9F=9F=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit -- 2.52.0 From 33645b00e4066427abc90683483b91dd6a325787 Mon Sep 17 00:00:00 2001 From: Lilleman auf Larv Date: Wed, 21 Oct 2026 22:18:18 +0200 Subject: [PATCH 14/15] =?UTF-8?q?Answer=20stability=20round=203:=200=20?= =?UTF-8?q?=F0=9F=94=B4,=200=20=F0=9F=9F=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit -- 2.52.0 From 1dd65de56f1dad776283aa8baa683425362178eb Mon Sep 17 00:00:00 2001 From: Lilleman auf Larv Date: Wed, 21 Oct 2026 22:20:15 +0200 Subject: [PATCH 15/15] Record the comprehension check: paired ruling better against dec19c5 --- docs/comprehension-history.md | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/docs/comprehension-history.md b/docs/comprehension-history.md index 7f941c45..c1eaf682 100644 --- a/docs/comprehension-history.md +++ b/docs/comprehension-history.md @@ -2462,3 +2462,27 @@ Inherited architect, decided by: - Self-sufficiency: `CLAUDE.md:105` "Vocabulary": defines the comprehension terms the charter used without defining, and rules.py's OVERRIDE gains its explanation - Self-sufficiency: `bin/metric_bench/main.py:114` `run_scores`: a small cost, "item 204's" points to a plan item a code reader can't resolve - Locality: `bin/rule_hook/git.py:7` `git`: a small cost, the guards no longer sit beside the hook that needs them, though both docstrings say why + +## 2026-10-21T20:20:12Z, PR #335 at 33645b0, against dec19c5 + +Ruling: better + +| Seat | Navigation | Locality | Shape | Self-sufficiency | Overall | +|---|---|---|---|---|---| +| Mid A | better | same | better | same | better | +| Inherited architect | better | same | better | same | better | + +Mid A, decided by: + +- Navigation, Shape: `skills/larv-review/SKILL.md:73` "Re-entry": one table now answers which passes a fix reruns, where five Trigger cells and three bullets did, with a worked example under it +- Shape: `skills/larv-review/SKILL.md:86` "What a round reviews": the round-2 scope left "Round cap", which now holds only counting and capping, as its name promises +- Locality: `bin/settings_filter.py:12` `cleaned`: hidden state, since the stored and the working file differ and a per-clone git setting turns the filter on, with an ordering rule for Update; it balances the Re-entry table's gain +- Self-sufficiency: `bin/settings_filter.py:2` module docstring: the tool explains itself, but the steps to run it live in README and AGENTS.md + +Inherited architect, decided by: + +- Navigation, Shape: `skills/larv-review/SKILL.md:73` "Re-entry": "which passes does this fix rerun" is answered in one table where it was split between Trigger-cell clauses and a Rerun bullet +- Shape: `skills/larv-review/SKILL.md:31` pass table's Trigger column: each cell now says only when the pass first runs +- Navigation: `skills/larv-review/SKILL.md:86` "What a round reviews": a named paragraph beside Re-entry, where a reader asking what round 2 looked at searches +- Locality: `.gitattributes:1` the settings filter: committed behaviour depends on an untracked per-machine git setting, and README's Install and Update steps work only in order +- Self-sufficiency: `bin/settings_filter.py:2` module docstring: the script stands alone, but cannot say it is inert unless Install's git config line ran -- 2.52.0