Answer principles round 1: 1 🔴, 6 🟡 (0 misread); end the AGENTS.md decision with item 585, send the routing calls once where no development clone exists, and file five principle findings as items 591 to 595

This commit is contained in:
2026-12-04 10:34:22 +01:00
parent 6bc91f700a
commit 1048e7a40a
5 changed files with 131 additions and 14 deletions
+11 -6
View File
@@ -55,22 +55,27 @@ def new_calls(root: pathlib.Path, paths: Paths, env: Mapping[str, str], effects:
def raise_calls(root: pathlib.Path, new: list[Call], rung: Rung, loop: Loop) -> Stop | None:
"""Puts the calls to the human through a claude in this setup's development clone, where the routing decision is changed. Off a terminal, or on a machine without that clone, they are only said, and stay in the figures, raised at the next measurement that has both."""
"""Puts the calls to the human through a claude in this setup's development clone, where the routing decision is changed. Off a terminal they are only said, and stay in the figures, raised at the next measurement on one. On a machine without that clone they are said and sent as the DM, the only way that machine has to put them to the human, and marked raised, so they are not sent again every measurement."""
bullets = "".join(f"- {call.sentence()}\n" for call in new)
question = f"build-release's routing figures call for a routing change:\n{bullets}The figures: {root / archive.FIGURES}"
say(f"\n{question}", loop.effects)
tell(f"build-release in {loop.root} asks:\n\n{question}", loop.effects)
if not loop.paths.config_clone.is_dir():
say(f"No development clone at {loop.paths.config_clone}, where the routing decision is changed: the calls stay in the figures.", loop.effects)
keep_raised(root, new, loop)
return None
if not loop.effects.on_terminal():
say("Not on a terminal: the calls are raised again at the next measurement.", loop.effects)
return None
if not loop.paths.config_clone.is_dir():
say(f"No development clone at {loop.paths.config_clone}: the calls are raised again at the next measurement.", loop.effects)
return None
prompt = f"Put these calls for a routing change from build-release's figures to the human, and don't change anything 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 in this checkout, the development clone, as the setup's CLAUDE.md says; the next chunk of this repo files the plan item for these calls."
unstarted = hand_over(ClaudeCommand(claude_args(rung, [prompt]), str(loop.paths.config_clone), {}), loop.effects)
if unstarted:
return Stop(1, f"could not start claude for the routing calls in {loop.paths.config_clone}, the setup's development clone: {unstarted.reason}")
# Raised once the human has seen them, answered or not: an unanswered call reaches the plan through docs/decisions.md → "Working rules", so it is not asked twice.
keep_raised(root, new, loop)
return None
def keep_raised(root: pathlib.Path, new: list[Call], loop: Loop) -> None:
"""Raised once the human has seen them, answered or not: an unanswered call reaches the plan through docs/decisions.md → "Working rules", so it is not asked twice. Without a development clone the DM is how they saw them."""
if unmarked := state.mark_raised(root, new, utc(loop.effects.now()), loop.effects.replace_file):
say(f"routing figures: {unmarked.reason}", loop.effects)
return None
+10 -5
View File
@@ -117,17 +117,22 @@ class RoutingCheck(unittest.TestCase):
self.assertIsNone(state.mark_measured(self.root, 0))
self.assertIn("Not on a terminal", self.check(FakeEffects(on_terminal=False, git=[UNREAD] * 3))[1])
def test_goes_on_where_the_machine_has_no_development_clone_and_raises_the_call_again_next_time(self):
"""A release's clone holds only a release, so a machine without `~/code/dev-factory` has nowhere to change the routing decision."""
def test_sends_the_calls_once_where_the_machine_has_no_development_clone_even_off_a_terminal(self):
"""A release's clone holds only a release, so a machine without `~/code/dev-factory` has nowhere to change the routing decision: the DM is how the human sees the calls, and they are not sent again at each measurement."""
self.chunks(5, 4)
shutil.rmtree(self.paths.config_clone)
fake = FakeEffects(on_terminal_claude=[0], git=[UNREAD] * 3)
fake = FakeEffects(on_terminal=False, git=[UNREAD] * 3)
stop, said = self.check(fake)
self.assertIsNone(stop)
self.assertEqual(fake.made("claude_on_terminal"), [])
self.assertIn(f"No development clone at {self.paths.config_clone}: the calls are raised again at the next measurement.", said)
self.assertIn(f"No development clone at {self.paths.config_clone}, where the routing decision is changed: the calls stay in the figures.", said)
self.assertEqual(len(fake.dms), 1)
self.assertIn("Explore subagents' reports took more of the worker's context", (self.root / "routing-figures.md").read_text())
self.assertFalse((self.root / "routing-calls-raised.md").exists())
self.assertIn(f"- {utc(NOW)} Explore subagents'", (self.root / "routing-calls-raised.md").read_text())
self.assertIsNone(state.mark_measured(self.root, 0))
again = FakeEffects(on_terminal=False, git=[UNREAD] * 3)
self.assertEqual(self.check(again), (None, ""))
self.assertEqual(again.dms, [])
def test_leaves_the_measuring_to_a_loop_holding_the_lock(self):
self.chunks(5, 4)
+1 -1
View File
@@ -2,7 +2,7 @@
A subagent inherits both variables, so the ceiling reaches every reviewer the worker launches."""
# Claude Code saves a Bash result longer than this many characters to a file, and hands the model the file's path and the first 2,000 characters. The file sits under ~/.claude/projects/<project>/<session>/tool-results/.
# Claude Code saves a Bash result longer than this many characters to a file, and hands the model the file's path and the first 2,000 characters. The file sits under projects/<project>/<session>/tool-results/ in the claude's home.
BASH_CEILING = "BASH_MAX_OUTPUT_LENGTH"
BASH_CEILING_CHARACTERS = 6_000
# A Read of more than this many tokens fails and asks for an offset and a limit; Claude Code's default is 25,000.
+1 -1
View File
@@ -157,7 +157,7 @@ The cap is 5, `bin/plan/todo_table.py`'s `BUNDLE_MAX_R`, from the same chunks: b
2026-11-11, lilleman through item 314. Serves goal 1.4. Claude Code loaded `~/.claude/AGENTS.md` into every other project's sessions, and each 1,000 tokens every thread starts with cost $68.60 of the $9,154 spent from 2026-09-30 to 2026-11-11: the 14.4 KB file cost about 2.1% of spend, and put this repo's rules in front of other projects. Other projects keep the name `AGENTS.md`, so the setup stays portable to other harnesses. The working rules sit there too, rather than in `.claude/rules/`, since build-release's judge reads the decision log and no project's `.claude/rules/`. In the clone, the release's `~/.claude/CLAUDE.md` and the clone's both loaded, about 0.9% of spend; the exclude drops the release's, so a chunk runs under the rules it is changing. A session working in `~/.claude` itself loads no `CLAUDE.md`, since there both are the same file; none works there, as the entry above says.
Valid while `~/.claude` is a checkout of this repo.
Valid while `~/.claude` is a checkout of this repo. Item 585 ends it: from 0.18.0 `~/.claude` is an install and the loop's Claude home links no `AGENTS.md`, so the reason is gone, and the item gives this repo an `AGENTS.md` and drops this entry.
## deploy: `cut-release` cuts a release through a pull request merged fast-forward only, then tags the merged commit, and `--patch` tags a patch of the newest tag beside `main`, then merges the tag back; the human runs both
+108 -1
View File
@@ -6,15 +6,20 @@
`Bar = 0.1`
`Next ID = 591`
`Next ID = 596`
## Items
| ID | Release | Blocked by | Exempt | Item | L | E | I | R | S | Moves | Score |
|---|---|---|---|---|---|---|---|---|---|---|---|
| 586 | 0.19.0 | | | **Keep the person's own skills, agents and commands out of the loop's Claude home where `HOME` names the home folder through a symlink.** | 2 | 3 | 2 | 5 | 3 | 3 by 4 | 5.0 |
| 594 | 0.19.0 | | principle | **Return a `Failure` from the loop's Claude home build where the clone's `settings.json` is malformed or lacks a marketplace, or a file stands where a link belongs, so `unready` prints one line instead of a traceback.** | 2 | 1 | 3 | 4 | 3 | code health by 3 | 3.8 |
| 585 | 0.19.0 | | | **Give this repo an `AGENTS.md` like any project, and drop the decision and the rule that say it keeps none.** | 3 | 1 | 3 | 5 | 4 | code health by 3 | 3.1 |
| 592 | 0.19.0 | | principle | **Wait on an event in the tests that poll with sleeps or assert on the wall clock, in `loop_effects`, `cut_release` and `mutate_changes`, with a timeout that only fails the test.** | 3 | 2 | 1 | 4 | 5 | code health by 3, 1.5 by 2 | 2.7 |
| 591 | 0.19.0 | | principle | **Let an environment variable name the setup's development clone, with `~/code/dev-factory` as its default, documented in README's Install and build-release's `--help`.** | 2 | 1 | 2 | 3 | 3 | code health by 2 | 2.5 |
| 595 | 0.19.0 | | principle | **Move the five dated study folders at the repo's root under one folder named for what it holds, so the root shows the entry points first.** | 3 | 1 | 2 | 4 | 5 | code health by 3 | 2.3 |
| 580 | 0.19.0 | | | **Call no scoring run for a release already cut whose last item the chunk moved to a later release.** | 2 | 2 | 3 | 5 | 3 | 1.4 by 3, 1.5 by 3 | 1.6 |
| 593 | 0.19.0 | | principle | **Pin hard tabs for the tracked `settings.json` in the settings check, or record the decision that keeps its spaces, and report each failing case of the check's loops through `subTest`.** | 1 | 1 | 1 | 1 | 2 | code health by 1 | 1.4 |
| 589 | 0.19.0 | | | **Count every turn of a bench run in its figures: sum the tokens and turns of each `result` event in the stream, and time the run from its first event to its last.** | 2 | 2 | 1 | 3 | 2 | 1.1 by 3 | 1.0 |
| 590 | 0.19.0 | 589 | | **Report beside each bench run how far its change reached: the files and lines it changed, the files it changed outside the bug's file, and, for a bug, whether it restored the line the mutant changed.** | 2 | 2 | 1 | 3 | 4 | 1.1 by 4 | 1.0 |
| 487 | 0.20.0 | | owner | **Run larv-review's passes from a program that picks them from the diff and the item, counts rounds against the cap and decides each rerun, with each reviewer returning its findings as JSON against a schema.** | 4 | 2 | 3 | 7 | 8 | 1.1 by 5, 1.4 by 5 | 0.4 |
@@ -111,6 +116,23 @@ Touches:
- `bin/claude_home/home.py`: `settings_written` (small)
- `first-chunk-e2e/first_chunk.py`
### 594. Return a `Failure` from the loop's Claude home build where the clone's `settings.json` is malformed or lacks a marketplace, or a file stands where a link belongs, so `unready` prints one line instead of a traceback.
Principle: `principles/technical-principles.md` → "Errors as values, with one error channel". From the principles pass of 0.18.0's release review.
Evidence, in `bin/claude_home/home.py`:
- :92-99 `linked` is typed `-> Failure | None` but always returns None; its `symlink_to` raises FileExistsError where a file or folder stands at the link's place.
- :104 `settings_written` and :134-137 `plugins_installed` call `json.loads` on the clone's `settings.json`, and the latter indexes `settings["extraKnownMarketplaces"][name]["source"]["repo"]`: a malformed file raises ValueError, a missing key KeyError.
- :42 `unready` catches only `(OSError, subprocess.TimeoutExpired)`, so ValueError and KeyError escape as a traceback instead of the `Failure` its callers handle.
Return a `Failure` for each case, and make `linked`'s `Failure` real or drop it from the type. I 3, since every loop builds the home before it starts.
Touches:
- `bin/claude_home/home.py`: `linked`, `settings_written` (small), `plugins_installed` (small)
- `bin/claude_home/test_home.py`: `Home`
### 585. Give this repo an `AGENTS.md` like any project, and drop the decision and the rule that say it keeps none.
Answer to question item 584: the decision "deploy: this repo keeps no `AGENTS.md`, since `~/.claude` is its checkout" lost its reason with item 483. A release is a clone anywhere, and the loop's Claude home links only `CLAUDE.md`, `rules/`, `agents/` and `skills/`, so an `AGENTS.md` here no longer loads into another project's session. Without the reason, the special case only costs: each rule that names a project's `AGENTS.md` needs a second reading for this repo. The loop took the recommended option, as "Ask, don't guess" allows for a choice the goals don't reserve; the human unmarks or drops this item to reverse it.
@@ -130,6 +152,76 @@ Touches:
- `bin/review_rules/test_reviewer_context.py`
- `bin/review_replay/test_review_replay.py`
### 592. Wait on an event in the tests that poll with sleeps or assert on the wall clock, in `loop_effects`, `cut_release` and `mutate_changes`, with a timeout that only fails the test.
Principle: `principles/technical-principles.md`, the tests bullets: a test neither sleeps nor asserts on the wall clock, and waits for a signal the code under test or its fake sends, with a timeout whose only effect is to fail the test. From the principles pass of 0.18.0's release review.
Evidence:
- `bin/loop_effects/test_effects.py:39-45`: `wait_until` loops on `time.sleep(0.05)`, and :483 sleeps again.
- `bin/cut_release/test_cut_release.py`: asserts `time.monotonic() - began < 20` at :706, :719 and :733, and polls at :391-393, :710-712 and :726-727.
- `bin/mutate_changes/test_mutate_changes.py:372-386`: `interrupted` and `assert_ends` poll with sleeps.
- `bin/mutate_changes/test_mutate_changes_runs.py:299, 306` poll with sleeps.
The tests are slow and flake on a loaded runner. Wait on an event instead: `os.pidfd_open` with `select`, or a pipe the child writes to, and `Popen.wait(timeout=...)` only as the backstop that fails the test. Items 102 and 456 cover other places: test_black_box.py's `sitecustomize` swaps and the `ChildShells` race.
L 3, since the change spans three packages and brings a new waiting pattern. E 2, since a wait that still races shows only under load.
Touches:
- `bin/loop_effects/test_effects.py`: `wait_until`, `Timer.test_stopping_a_timer_whose_action_runs_waits_for_the_action_to_end` (small)
- `bin/cut_release/test_cut_release.py`: `Cut.test_a_cut_stopped_by_ctrl_c_ends_its_trace_saying_so` (small), `PatchCi.test_the_runner_stops_a_ci_sh_that_hangs_with_what_it_started_and_says_so` (small), `PatchCi.test_the_runner_kills_a_stopped_ci_sh_that_ignores_the_interrupt_once_its_grace_has_passed` (small), `PatchCi.test_the_runner_stops_ci_sh_and_removes_its_container_where_the_cut_is_interrupted` (small)
- `bin/mutate_changes/test_mutate_changes.py`: `ToolProcess.interrupted`, `ToolProcess.assert_ends`
- `bin/mutate_changes/test_mutate_changes_runs.py`: `MutateChangesRuns.test_a_signal_that_ends_the_run_ends_the_tool_and_removes_the_scratch_copy` (small)
### 591. Let an environment variable name the setup's development clone, with `~/code/dev-factory` as its default, documented in README's Install and build-release's `--help`.
Principle: `principles/technical-principles.md` → "Sane defaults": config is never hardcoded, and a documented option changes it. From the principles pass of 0.18.0's release review.
Evidence: `bin/loop_state/paths.py:92` sets `config_clone=home / "code" / "dev-factory"` with no override. README's Install says only to develop "in a clone under ~/code", and `usage.py:162` names the path. A clone kept under another name or folder reads as absent, so `routing_check.py` never puts its routing calls to a claude.
Read the path from an environment variable, as `paths.py` reads the XDG folders, and name the variable where the path is named today. The variable's name is a spelling users write: a panel picks it, as `CLAUDE.md` → "Working loop", "Bench a syntax with the people who write it" asks.
Touches:
- `bin/loop_state/paths.py`: `paths_from` (small)
- `bin/loop_state/test_paths.py`: `SetupFolders` (small)
- `bin/build_release/loop/usage.py`: `HELP` (small)
- `README.md`: `## Install` (small)
### 595. Move the five dated study folders at the repo's root under one folder named for what it holds, so the root shows the entry points first.
Principle: `principles/technical-principles.md` → "About seven things per level" and "Entry point first". From the principles pass of 0.18.0's release review.
Evidence: the root holds about 14 folders and 9 files. Five are dated one-off studies: `workflow-bench/`, `reviewer-merge-trials/`, `judge-field-trials/`, `stability-skip-count/` and `presentation/`. A newcomer sorts past them to reach `bin/`, `ci.sh` and the README.
Move the five under one folder named for what is inside, such as `studies/`, and update every path that names them. Item 392 regroups only `bin/`, and item 68 only tests workflow-bench.
L 3, since the paths are named across several packages, and I 2, since `review_passes.py` reads `workflow-bench/*-prompt.md` as instruction files when it picks a chunk's passes. The trials scripts that import from `bin/` find it by their own path, which moves one level down. Every file under the five folders moves; the list names the files that change beside them.
Touches:
- `README.md`: `(top)` (small)
- `.gitignore`
- `bin/review_rules/review_passes.py`: `INSTRUCTION_FILES` (small)
- `bin/review_rules/test_review_passes.py`
- `bin/chunk_driver/test_prompts.py`: `MARKDOWN` (small)
- `bin/rule_hook/test_rule_hook.py`
- `bin/repo_checks/test_trials_imports.py`: `TRIALS` (small)
- `bin/repo_checks/test_gitignore.py`
- `bin/repo_checks/test_setup_files_named.py`: `HISTORY` (small)
- `bin/repo_checks/test_headless_mcp.py`: `HeadlessMcp` (small)
- `bin/repo_checks/test_no_patched_globals.py`: `NoPatchedGlobals` (small)
- `skills/larv-review/SKILL.md`
- `reviewer-merge-trials/analyze.py`
- `reviewer-merge-trials/collect.py`
- `reviewer-merge-trials/counts.py`
- `reviewer-merge-trials/driver.py`
- `judge-field-trials/cases.py`
- `judge-field-trials/escalations.py`
- `judge-field-trials/items.py`
- `judge-field-trials/release_ready.py`
### 580. Call no scoring run for a release already cut whose last item the chunk moved to a later release.
When a chunk's first change moves its plan item out of a release already cut into the next one, as `CLAUDE.md` → "Working loop" asks, `larv-review needs-scoring-run <ID>` and `scoring-run-owed` still say the chunk "leaves release 0.17.0 with no plan item". The chunk then owes two scoring runs: eight seat launches and a task-bench run, hours of work. Item 579, a one-line change to an agent file, ran the full scoring twice for this reason.
@@ -146,6 +238,21 @@ Touches:
- `bin/larv_review/test_larv_review.py`: `ScoringRunDue`, `LarvReviewTool`
- `bin/larv_review/main.py`: `(module)` (small)
### 593. Pin hard tabs for the tracked `settings.json` in the settings check, or record the decision that keeps its spaces, and report each failing case of the check's loops through `subTest`.
Principle: `principles/technical-principles.md` → "Indent with hard tabs", unless a tool setting and a decision override it. From the principles pass of 0.18.0's release review.
Evidence: `bin/repo_checks/test_settings.py:20` requires `json.dumps(indent=2, sort_keys=True)`. The repo has no `.editorconfig`, and no decision mentions indentation, while `routing-ladder.json` and the Python are tab-indented: the check enforces the opposite of the principle with no reason recorded.
Pin `indent="\t"` and re-indent `settings.json`. Where something needs the spaces, such as a tool that rewrites the file, keep them and record that decision instead.
The report's 🟢 goes with it: the tests at :22 and :34 loop over cases without `subTest`, so the first failure hides the rest.
Touches:
- `bin/repo_checks/test_settings.py`: `Settings.test_the_tracked_settings_hold_no_model_and_sorted_keys` (small), `Settings.test_every_hook_runs_a_tool_of_the_clone` (small), `Settings.test_every_enabled_plugins_marketplace_names_the_repo_the_home_adds_it_from` (small)
- `settings.json`
### 589. Count every turn of a bench run in its figures: sum the tokens and turns of each `result` event in the stream, and time the run from its first event to its last.
Today `figures` in `bin/task_bench/figures/run_figures.py` reads only the last `result` event of a run's stream. Where Haiku starts a background task, such as a long `go test`, Claude Code ends the first turn with a result, then starts another turn when the task finishes and ends that with a second result. The bench then records only that second turn.