From 15d53b37b8ebf71698cbb3d1821fdebff0c8fbb8 Mon Sep 17 00:00:00 2001 From: Lilleman auf Larv Date: Tue, 13 Oct 2026 00:31:24 +0200 Subject: [PATCH 1/4] Add the deep-modules principle, move functional core, imperative shell to second place, and point the architect at the principle --- CHANGELOG.md | 1 + agents/systems-architect.md | 2 +- principles/technical-principles.md | 15 ++++++++++----- 3 files changed, 12 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4e665343..074e66e6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,7 @@ ## Unreleased +- A technical principle, "Prefer deep modules": a small, intuitive interface in front of a lot of hidden work, which hides how it works but never what it depends on. It wins over "Explicit over implicit" unless it makes a call harder for someone new to the project to follow. "Functional core, imperative shell" moves up to second place and is enforced as strictly as "Compose, do not entangle". The systems architect holds modules to the principle instead of its own wording. - A hook blocks each Bash, Edit, MultiEdit and Write call that breaks a rule a program can check: a commit message that is not one line passed with `-m`, a Claude or Anthropic attribution, a container image short of a full patch version, an Action pinned to anything but a semver tag, an unsorted block in an ignore file, and a commit of a `todo.md` that `rank_todo.py --check` rejects. `CLAUDE.md` states those rules only where the hook cannot check them; `~/.claude/bin/rule-hook --help` states what it checks. A call overrides a rule with `# rule-override : `. larv-review's new overrides pass, run before stability, accepts or rejects each override the chunk logged, and the PR body lists each with its ruling; a rejected override means the chunk keeps the rule. An override that touches a credential, a security rule or a production system, or cannot be undone, is asked of you. - A project may opt out of larv-review's architect, product-owner pass or comprehension check in every chunk, through a `docs/decisions.md` entry titled `review opt-out: …` that names the goal that skipping them serves. A project without such an entry is reviewed as before. Opting out of the comprehension check also skips the scoring run due at a release's end, so the floor blocks nothing; the opt-out ends with a chunk that ships a plan item naming the floor, which removes the comprehension check from the entry. The principles audit always runs. - A README goal states the project's aim and intent, and no longer names a step of the work, such as "kill weak candidates early". Such steps go in a method section further down the README and name the goal they serve. diff --git a/agents/systems-architect.md b/agents/systems-architect.md index 93bdb44f..bf649be1 100644 --- a/agents/systems-architect.md +++ b/agents/systems-architect.md @@ -17,7 +17,7 @@ You are an elite Systems Architect with decades of experience designing software **Question the requirement, not just the structure.** Complexity with a reason is not automatically worth its cost. For every complexity hotspot — reasoned or not — name the requirement that forces it and sketch the simpler design that drops or relaxes it. When a near-equivalent solution achieves almost the same result far more simply, propose the trade and name the delta precisely ("drop per-source ordering → the entire reorder buffer disappears") so the owner can accept or reject it. A small, named loss of functionality bought with a large complexity reduction is one of the best wins available — surfacing that option is your job; deciding it is the owner's. -**Simple to reason about, not merely simple to call.** A clean external API over a core you cannot follow to the bottom is a shallow win. Trace the key data structures and core abstractions down to their foundation and confirm the core is genuinely simple to *understand*, not just convenient to *implement against*. In Ousterhout's terms: prefer deep modules (simple interface, real work hidden) over shallow ones; complexity is dependencies + obscurity, and it surfaces as change amplification (one change touches many places) and cognitive load (a reader must hold too much in their head). Hunt both, all the way down. +**Simple to reason about, not merely simple to call.** A clean external API over a core you cannot follow to the bottom is a shallow win. Trace the key data structures and core abstractions down to their foundation and confirm the core is genuinely simple to *understand*, not just convenient to *implement against*. Hold every module to "Prefer deep modules" in `~/.claude/principles/technical-principles.md`. Complexity is dependencies + obscurity, and it surfaces as change amplification (one change touches many places) and cognitive load (a reader must hold too much in their head). Hunt both, all the way down. **Be non-pragmatic about fundamentals.** You are deliberately uncompromising on architectural choices that shape the system for years. Do not bend on: - Functional core, imperative shell separation diff --git a/principles/technical-principles.md b/principles/technical-principles.md index 45dc9f70..9767f4b9 100644 --- a/principles/technical-principles.md +++ b/principles/technical-principles.md @@ -12,6 +12,16 @@ - Functions: a function takes what it needs as arguments and returns what it produces. One that works only after another has set up shared state, or leaves state for the next to find, is entangled with it. BANNED: `validate(conf)` that fills defaults `send(conf)` relies on. GOOD: `send(withDefaults(conf))`. - Tests and tooling: a test, script or pipeline stage that passes only because another ran first is entangled; it states what it needs and gets it. - Proximity is not a reason. Reusing a listener, config file, table, module or service because it is already there, when the new thing has no relationship to it, is how entanglement gets in. If you cannot name the seam, there is none. +* Functional core, imperative shell — enforced as strictly as "Compose, do not entangle". + - Decisions live in pure functions, data in and data out; the shell around them performs the effects and holds no branching of its own. + - Every side effect comes from outside: output, time, randomness, network and storage are injectable, so a test runs exactly the code production runs. + - BANNED: `new Date(entry.msTimestamp ?? Date.now())` in a formatter; a test swapping `globalThis.fetch`. GOOD: the clock is a parameter, defaulted to the system clock only where the program is wired together. + - Keep delivery-layer entrypoints thin: inject services, validate + hand off the request data, map the service's return to a response. An entrypoint reaching into a payload to decide *what to do* is the smell. BANNED: `if (body.tx.source === 'notification') { /* drop, skip enqueue */ }` in a route handler. GOOD: the entrypoint forwards `source` on the event → the service decides drop-vs-process and returns a result → the entrypoint maps that result to a status code. +* Prefer deep modules: a small, intuitive interface in front of a lot of hidden work. + - A caller should know what a call does and what it returns, without knowing how it does it. `fs.writeFile("notes.txt", data)` hides opening the file, encoding, buffering, permissions and the disk itself. Yet anyone reading that line knows the outcome: the data is written, or the call fails and says why. + - A module hides how it works, never what it depends on. The clock, randomness, data and storage still come in from outside, as "Functional core, imperative shell" requires. + - A shallow module costs more to learn than it saves. BANNED: a wrapper that only renames the function it calls; a module whose callers must make three calls in the right order. GOOD: one call that does the whole job and handles the order itself. + - When this pulls against "Explicit over implicit", the deep module wins, unless hiding the work makes it harder for someone new to the project to tell what the call does. * Make invalid states unrepresentable. - Example: using a time-only type in the database when we actually want to store a time of day introduces risk for errors. * Always store timestamps as full ISO datetime in UTC. @@ -51,11 +61,6 @@ - A default earns its place where most callers want the same value, a wrong guess does no harm, and the caller can see and change it through a `--help` line or a documented option. Anything else is asked for. - Defaults live at the program's edge: a CLI, a config file, a library's public API. A library still asks for every input that can change between runs, such as data, the clock and randomness; only the code that wires a program together, such as its CLI, defaults those, as "Functional core, imperative shell" asks. - BANNED: a CLI that refuses to run until given `--data-path` and `--seed`, when nearly every run wants the shipped data and fresh randomness. GOOD: it uses the shipped data and fresh randomness unless a flag overrides them, and `--help` names those flags. -* Functional core, imperative shell. - - Decisions live in pure functions, data in and data out; the shell around them performs the effects and holds no branching of its own. - - Every side effect comes from outside: output, time, randomness, network and storage are injectable, so a test runs exactly the code production runs. - - BANNED: `new Date(entry.msTimestamp ?? Date.now())` in a formatter; a test swapping `globalThis.fetch`. GOOD: the clock is a parameter, defaulted to the system clock only where the program is wired together. - - Keep delivery-layer entrypoints thin: inject services, validate + hand off the request data, map the service's return to a response. An entrypoint reaching into a payload to decide *what to do* is the smell. BANNED: `if (body.tx.source === 'notification') { /* drop, skip enqueue */ }` in a route handler. GOOD: the entrypoint forwards `source` on the event → the service decides drop-vs-process and returns a result → the entrypoint maps that result to a status code. * Deterministic order wherever order carries no meaning. - Sort it, on a key that does not move: the name a line introduces, never where it came from. A sorted list is searchable, its diff shows only what changed, and two edits to it conflict only where they mean to. - An import sorts on its first binding, not its path, so moving or renaming a module reorders nothing. Where lines already group by kind — type imports, host packages — the key sorts within each group. -- 2.52.0 From 42b6caf2dce085ef538661f4a28a55d1fca7aaf4 Mon Sep 17 00:00:00 2001 From: Lilleman auf Larv Date: Tue, 13 Oct 2026 00:31:42 +0200 Subject: [PATCH 2/4] Record the reading cost of the last finished chunk --- docs/reading-cost.md | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/docs/reading-cost.md b/docs/reading-cost.md index d946f179..7b19809e 100644 --- a/docs/reading-cost.md +++ b/docs/reading-cost.md @@ -111,3 +111,20 @@ Read most (opens and searches): - `skills/larv-review/SKILL.md` 1 - `skills/larv-review/review-findings.md` 1 - `todo.md` 1 + +## Reading cost, chunk 00ad6c532a93, finished 2026-10-12T22:15:42Z + +172162 new input tokens before the first commit. + +Read most (opens and searches): + +- `.gitignore` 2 +- `bin/loop_claude/cycle/prompts.py` 2 +- `bin/rank_todo.py` 2 +- `skills/larv-review/SKILL.md` 2 +- `.claude/settings.json` 1 +- `AGENTS.md` 1 +- `CHANGELOG.md` 1 +- `CLAUDE.md` 1 +- `README.md` 1 +- `bin/failure.py` 1 -- 2.52.0 From 9f9dfc7245aacc0730c4b381e0982c61474c3d22 Mon Sep 17 00:00:00 2001 From: Lilleman auf Larv Date: Tue, 13 Oct 2026 00:33:07 +0200 Subject: [PATCH 3/4] Answer prose round 1: functional core is a rule no other principle overrides, the banned call order is one only memory enforces, the changelog states the principle's exception as written, and one list of injected inputs --- CHANGELOG.md | 2 +- agents/systems-architect.md | 2 +- principles/technical-principles.md | 6 +++--- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 074e66e6..3e088e3c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,7 +2,7 @@ ## Unreleased -- A technical principle, "Prefer deep modules": a small, intuitive interface in front of a lot of hidden work, which hides how it works but never what it depends on. It wins over "Explicit over implicit" unless it makes a call harder for someone new to the project to follow. "Functional core, imperative shell" moves up to second place and is enforced as strictly as "Compose, do not entangle". The systems architect holds modules to the principle instead of its own wording. +- A technical principle, "Prefer deep modules": a module puts a small, intuitive interface in front of a lot of hidden work, and hides how it works but never what it depends on. It wins over "Explicit over implicit" unless hiding the work makes it harder for someone new to the project to tell what a call does. "Functional core, imperative shell" moves up to second place, a core rule beside "Compose, do not entangle" that no other principle overrides. The systems architect holds every module to it. - A hook blocks each Bash, Edit, MultiEdit and Write call that breaks a rule a program can check: a commit message that is not one line passed with `-m`, a Claude or Anthropic attribution, a container image short of a full patch version, an Action pinned to anything but a semver tag, an unsorted block in an ignore file, and a commit of a `todo.md` that `rank_todo.py --check` rejects. `CLAUDE.md` states those rules only where the hook cannot check them; `~/.claude/bin/rule-hook --help` states what it checks. A call overrides a rule with `# rule-override : `. larv-review's new overrides pass, run before stability, accepts or rejects each override the chunk logged, and the PR body lists each with its ruling; a rejected override means the chunk keeps the rule. An override that touches a credential, a security rule or a production system, or cannot be undone, is asked of you. - A project may opt out of larv-review's architect, product-owner pass or comprehension check in every chunk, through a `docs/decisions.md` entry titled `review opt-out: …` that names the goal that skipping them serves. A project without such an entry is reviewed as before. Opting out of the comprehension check also skips the scoring run due at a release's end, so the floor blocks nothing; the opt-out ends with a chunk that ships a plan item naming the floor, which removes the comprehension check from the entry. The principles audit always runs. - A README goal states the project's aim and intent, and no longer names a step of the work, such as "kill weak candidates early". Such steps go in a method section further down the README and name the goal they serve. diff --git a/agents/systems-architect.md b/agents/systems-architect.md index bf649be1..f8aac6ac 100644 --- a/agents/systems-architect.md +++ b/agents/systems-architect.md @@ -17,7 +17,7 @@ You are an elite Systems Architect with decades of experience designing software **Question the requirement, not just the structure.** Complexity with a reason is not automatically worth its cost. For every complexity hotspot — reasoned or not — name the requirement that forces it and sketch the simpler design that drops or relaxes it. When a near-equivalent solution achieves almost the same result far more simply, propose the trade and name the delta precisely ("drop per-source ordering → the entire reorder buffer disappears") so the owner can accept or reject it. A small, named loss of functionality bought with a large complexity reduction is one of the best wins available — surfacing that option is your job; deciding it is the owner's. -**Simple to reason about, not merely simple to call.** A clean external API over a core you cannot follow to the bottom is a shallow win. Trace the key data structures and core abstractions down to their foundation and confirm the core is genuinely simple to *understand*, not just convenient to *implement against*. Hold every module to "Prefer deep modules" in `~/.claude/principles/technical-principles.md`. Complexity is dependencies + obscurity, and it surfaces as change amplification (one change touches many places) and cognitive load (a reader must hold too much in their head). Hunt both, all the way down. +**Simple to reason about, not merely simple to call.** A clean external API over a core you cannot follow to the bottom is a hollow win. Trace the key data structures and core abstractions down to their foundation and confirm the core is genuinely simple to *understand*, not just convenient to *implement against*. Hold every module to "Prefer deep modules" in `~/.claude/principles/technical-principles.md`. Complexity is dependencies + obscurity, and it surfaces as change amplification (one change touches many places) and cognitive load (a reader must hold too much in their head). Hunt both, all the way down. **Be non-pragmatic about fundamentals.** You are deliberately uncompromising on architectural choices that shape the system for years. Do not bend on: - Functional core, imperative shell separation diff --git a/principles/technical-principles.md b/principles/technical-principles.md index 9767f4b9..7b006455 100644 --- a/principles/technical-principles.md +++ b/principles/technical-principles.md @@ -12,15 +12,15 @@ - Functions: a function takes what it needs as arguments and returns what it produces. One that works only after another has set up shared state, or leaves state for the next to find, is entangled with it. BANNED: `validate(conf)` that fills defaults `send(conf)` relies on. GOOD: `send(withDefaults(conf))`. - Tests and tooling: a test, script or pipeline stage that passes only because another ran first is entangled; it states what it needs and gets it. - Proximity is not a reason. Reusing a listener, config file, table, module or service because it is already there, when the new thing has no relationship to it, is how entanglement gets in. If you cannot name the seam, there is none. -* Functional core, imperative shell — enforced as strictly as "Compose, do not entangle". +* Functional core, imperative shell — a core rule beside "Compose, do not entangle": no other principle overrides it. - Decisions live in pure functions, data in and data out; the shell around them performs the effects and holds no branching of its own. - Every side effect comes from outside: output, time, randomness, network and storage are injectable, so a test runs exactly the code production runs. - BANNED: `new Date(entry.msTimestamp ?? Date.now())` in a formatter; a test swapping `globalThis.fetch`. GOOD: the clock is a parameter, defaulted to the system clock only where the program is wired together. - Keep delivery-layer entrypoints thin: inject services, validate + hand off the request data, map the service's return to a response. An entrypoint reaching into a payload to decide *what to do* is the smell. BANNED: `if (body.tx.source === 'notification') { /* drop, skip enqueue */ }` in a route handler. GOOD: the entrypoint forwards `source` on the event → the service decides drop-vs-process and returns a result → the entrypoint maps that result to a status code. * Prefer deep modules: a small, intuitive interface in front of a lot of hidden work. - A caller should know what a call does and what it returns, without knowing how it does it. `fs.writeFile("notes.txt", data)` hides opening the file, encoding, buffering, permissions and the disk itself. Yet anyone reading that line knows the outcome: the data is written, or the call fails and says why. - - A module hides how it works, never what it depends on. The clock, randomness, data and storage still come in from outside, as "Functional core, imperative shell" requires. - - A shallow module costs more to learn than it saves. BANNED: a wrapper that only renames the function it calls; a module whose callers must make three calls in the right order. GOOD: one call that does the whole job and handles the order itself. + - A module hides how it works, never what it depends on: what "Functional core, imperative shell" injects stays injected. + - A shallow module costs more to learn than it saves. BANNED: a wrapper that only renames the function it calls; a module whose callers must make three calls in an order nothing but their memory enforces. GOOD: one call that does the whole job and handles the order itself. - When this pulls against "Explicit over implicit", the deep module wins, unless hiding the work makes it harder for someone new to the project to tell what the call does. * Make invalid states unrepresentable. - Example: using a time-only type in the database when we actually want to store a time of day introduces risk for errors. -- 2.52.0 From be21dbc400d3179c2ce11034d9a61d1a30415964 Mon Sep 17 00:00:00 2001 From: Lilleman auf Larv Date: Tue, 13 Oct 2026 00:36:01 +0200 Subject: [PATCH 4/4] File item 100: the unsorted imports in override_log.py fail the test suite on main --- todo.md | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/todo.md b/todo.md index 17e4d9a7..083b9977 100644 --- a/todo.md +++ b/todo.md @@ -6,7 +6,7 @@ `Bar = 9` -`Next ID = 100` +`Next ID = 101` | Goal | W | |---|---| @@ -24,6 +24,7 @@ | ID | Release | Exempt | Item | R | S | A | G | Goals | Score | |---|---|---|---|---|---|---|---|---|---| +| 100 | 0.1.0 | defect | **Sort `bin/rule_hook/override_log.py`'s imports by their first binding, so the test suite passes again.** | 1 | 1 | 6 | 7 | 1.1 | 24.6 | | 95 | 0.1.0 | | **Make `CLAUDE.md` a short router: only the rules every session needs, and a pointer to where each topic's rules load.** | 6 | 6 | 8 | 8 | 1.1, 1.3, 1.4 | 24.3 | | 98 | 0.1.0 | | **Score R and S from a measurement wherever one exists, and calibrate each guessed score against the finished chunk's measured outcome.** | 2 | 5 | 6 | 7 | 1.1, 1.4 | 22.6 | | 99 | 0.1.0 | | **Drop the comprehension panel as a merge gate, and keep recording its scores and the places in the code its seats found hard, for later measurement and for other reviewers and agents to improve.** | 4 | 5 | 7 | 7 | 1.1, 1.4, 1.5 | 22.6 | @@ -63,6 +64,10 @@ ## Details +### 100. Sort `bin/rule_hook/override_log.py`'s imports by their first binding, so the test suite passes again. + +On `main` at 72fd688, `repo_checks/test_import_order` fails on line 10, `from failure import Failure`, which sorts before `from rule_hook.rules import Breach`, and `repo_checks/test_python_floor` fails with it, as it reruns the suite. 7598584 brought the order in. + ### 95. Make `CLAUDE.md` a short router: only the rules every session needs, and a pointer to where each topic's rules load. `CLAUDE.md` holds about 4,300 words and 150 or more rules, and every session loads it whole. Anthropic's memory docs (code.claude.com/docs/en/memory) say a longer file "reduce[s] adherence", and its best-practices page says to keep a line only if "removing this would cause Claude to make mistakes". IFScale (arxiv.org/abs/2507.11538) measures adherence falling as the instruction count grows, with earlier instructions followed more. Count instructions, not lines. -- 2.52.0