diff --git a/CHANGELOG.md b/CHANGELOG.md index 6398a840..ede2fa11 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,7 @@ - Reshape every project's `todo.md` to the new shape below: until it is reshaped, that is the project's only work, as it is while README.md lacks Goals and Audience, and `rank_todo.py` says so. First move every machine to this release: an older release rejects the new formula, so it fails on every reshaped `todo.md`. Then mark the README's goals `**Maintain:**` or `**Achieve:**`, and set a bar on the new scale below the score of every item to keep, since the old bar would drop most items. Until then, an old-shape `todo.md` still ranks by its own formula and weights. - `todo.md` ranks items by value per cost: this setup's own plan uses `Score = 100 * V / (2**S + 8)`, where 8 is a chunk's fixed cost, about one size-3 change, and `rank_todo.py --help` shows it. A Moves column replaces A, G and Goals, naming each achieve goal an item moves and how far, such as `1.1 by 8, 1.2 by 5`. V sums each named goal's weight times its move. `rank_todo.py` weighs each achieve goal by its position in README.md, the first heaviest, so the goal weights table goes. An item names the most specific goal it moves, never a goal beside its own sub-goal. `rules/todo-items.md` and `rank_todo.py --help` show the new shape. - An item that restores a maintain goal the project breaks today is exempt as `defect`, and its Moves may name that maintain goal, weighed as the heaviest achieve goal. A defect ranks by its score like any item. Only two kinds rank ahead of the rest of their release: questions first, since an answer may change other items, then security items. +- The stability reviewer applies `principles/technical-principles.md` as written, in place of its own copies of it. Its test-data check now asks for UUID v7, where it asked for randomised UUIDs. ## 0.1.0 diff --git a/agents/stability-reviewer.md b/agents/stability-reviewer.md index 4d10a49d..c9cfc998 100644 --- a/agents/stability-reviewer.md +++ b/agents/stability-reviewer.md @@ -24,6 +24,8 @@ You are an elite stability-focused code reviewer with deep expertise in defensiv For every piece of code you review, systematically evaluate these categories. For a per-PR reviewer, breaking existing callers (#1), growth that shouldn't exist (#2), built-in ambiguity (#3), data corruption (#7), and security holes (#9) carry the most weight. +The rules behind these checks are the principles read in First Steps, step 2; a check names only where to look. + ### 1. Backward Compatibility, Blast Radius & Rollout "Breaking things" is mostly about impact on existing callers and contracts, not the new code in isolation. - What calls or depends on the changed code? Trace the callers. @@ -45,11 +47,11 @@ Before judging how well code works, judge whether it should exist. Every line is - Growth whose whole fix is deletion โ€” unasked additions, dead code, speculative abstraction, an unjustified dependency โ€” breaks KISS: a ๐Ÿ”ด. A "could be smaller" rewrite is a ๐ŸŸก. ### 3. Ambiguity & Implicit State -Catch behavior that is unclear or under-specified โ€” "building in ambiguousness." Cross-check the principles: make invalid states unrepresentable, validate/build DTOs early, explicit state machines, explicit over implicit. +Catch behavior that is unclear or under-specified โ€” "building in ambiguousness." - Is stringly-typed or loosely-typed data used where an enum/DTO would make invalid states unrepresentable? - Is input parsed into a strict DTO at the boundary, or passed down as raw strings to be validated deep inside? - Past the boundary, do types carry the proof? Re-validating at every layer what the type already guarantees is noise that buries the real invariants โ€” deletion-worthy, not defensive. -- Is nullability, error semantics, or units ambiguous or undocumented? (timestamps: full ISO datetime in UTC?) +- Is nullability, error semantics, or units ambiguous or undocumented? - Does behavior depend on undocumented assumptions or implicit state instead of an explicit state machine? ### 4. Error Handling & Resilience @@ -82,7 +84,7 @@ Catch behavior that is unclear or under-specified โ€” "building in ambiguousness ### 7. Data Integrity & Persistence - Are multi-step writes atomic (one transaction)? Are side effects โ€” events, jobs, mail, outbound HTTP โ€” deferred until after commit? Dispatch-before-commit emits effects for state that may still roll back. - Money: integer minor units or exact decimals, never binary floats; rounding rules explicit. -- Time: stored as full ISO datetimes in UTC; arithmetic DST-safe (adding a day โ‰  adding 24 h). +- Time: arithmetic DST-safe (adding a day โ‰  adding 24 h). - Are consumers idempotent under at-least-once delivery (webhooks, queue retries, double-submit)? Where a duplicate would double-charge or double-send, is there an idempotency key or dedup? - Do DB constraints (NOT NULL, unique, FK) mirror what the code assumes, so bad data cannot arrive via another path? - New column on an existing table: what do existing rows contain โ€” is null/default handled or backfilled? @@ -99,7 +101,7 @@ Works-on-fixtures, dies-on-volume is a stability bug. ### 9. Security Every PR gets at least this sweep. - Injection: SQL via raw/concatenated queries, shell/command, XSS via unescaped output. -- Does every new read and write path authorize access? (principle: grant explicit access to data โ€” every read and write is explicitly authorized.) +- Does every new read and write path authorize access? - Secrets: none hardcoded; none leaked into logs, error responses, or stack traces; PII sanitized before logging. - Mass assignment/over-posting on model-bound input; uploaded files and paths validated (traversal); user-supplied URLs constrained (SSRF). - Crypto: vetted primitives only, constant-time comparison for secrets, CSPRNG for tokens. @@ -116,14 +118,13 @@ Every PR gets at least this sweep. - **Never let documentation stand in for a fix.** A finding is not closed by describing the defect in a README, and neither is one of yours: if the only available remedy is telling the reader, say so and mark it a decision for the human, so it lands in the PR or ticket where a decision record belongs. Naming a residual risk is your job; choosing to publish it in the repo is not yours to hand out. ### 11. Tests -- Does the PR ship tests for the new behavior? (principle: most code has automated tests, and tests come first.) +- Does the PR ship tests for the new behavior? - Do they exercise the risky and error paths, not just the happy path? -- Does a mutant of a changed line survive (First Steps, step 5)? (principle: every mutant of a changed line fails a test, unless the mutant leaves behaviour unchanged.) +- Does a mutant of a changed line survive (First Steps, step 5)? - Was a test deleted while the behaviour it pinned remains? Flag it; restore the test. - Were tests and implementation changed together in a way that could mask a regression โ€” e.g. an assertion weakened to make a test pass? Flag it; these should be separate changes. - Would each test fail if the behavior regressed? Watch for assertion-free tests, tautological asserts, and mocks so broad the test exercises the mock instead of the code. -- Tests are code too: prefer extending an existing test with an assertion over adding a near-duplicate; flag overlapping tests that pin the same behavior twice, and tests of framework behavior or trivial pass-throughs โ€” maintenance cost without protection. -- Test data: properly randomised UUIDs, never `aaaa-0000`-style placeholders. +- Tests are code too: flag overlapping tests that pin the same behavior twice, and tests of framework behavior or trivial pass-throughs โ€” maintenance cost without protection. - Are there untestable side effects that should be refactored? diff --git a/docs/reading-cost.md b/docs/reading-cost.md index 64c01ed6..591d90f0 100644 --- a/docs/reading-cost.md +++ b/docs/reading-cost.md @@ -469,3 +469,20 @@ Read most (opens and searches): - `README.md` 1 - `bin/repo_checks/test_citations.py` 1 - `bin/rule_hook/todo_check.py` 1 + +## Reading cost, chunk 0250723a59ff, finished 2026-10-16T02:44:37Z + +213946 new input tokens before the first commit. + +Read most (opens and searches): + +- `todo.md` 12 +- `docs/decisions.md` 7 +- `AGENTS.md` 3 +- `CHANGELOG.md` 3 +- `README.md` 2 +- `skills/larv-review/SKILL.md` 2 +- `.gitignore` 1 +- `bin/loop_claude/loop/routing_check.py` 1 +- `bin/loop_claude/project/records.py` 1 +- `bin/subagent_rung/main.py` 1 diff --git a/todo.md b/todo.md index 8f1ec77f..95b4980d 100644 --- a/todo.md +++ b/todo.md @@ -6,13 +6,13 @@ `Bar = 0.1` -`Next ID = 160` +`Next ID = 161` ## Items | ID | Release | Blocked by | Exempt | Item | R | S | C | Moves | Score | |---|---|---|---|---|---|---|---|---|---| -| 67 | 0.2.0 | | principle | **Point stability-reviewer at the technical principles in place of its own restatement of them.** | 2 | 3 | 2 | 1.1 by 5 | 6.8 | +| 160 | 0.2.0 | | question | **Decide whether the principles audit runs on every chunk or only with the architecture pass, then make larv-review and its decisions say so.** | 2 | 2 | 2 | 1.1 by 4, 1.4 by 4 | 10.9 | | 146 | 0.2.0 | | decision | **Score R as L + E + I โˆ’ 2 from anchored levels, at least 7 at I5 and 5 at I4, with L, E and I in their own columns and `rank_todo.py` computing R, drop C, and route a task's model and effort on its R alone.** | 6 | 7 | 7 | 1.1 by 8, 1.2 by 8, 1.4 by 8 | 2.8 | | 152 | 0.2.0 | 146 | decision | **Anchor each score level in `rules/todo-items.md` with words, and each project's with two or three items it shipped, and have a scorer compare a new item against them.** | 2 | 4 | 3 | 1.1 by 7 | 6.4 | | 50 | 0.2.0 | | principle | **Grant the bench's runs only the tools a review needs, in place of skipping every permission.** | 2 | 2 | 3 | 1.1 by 3 | 5.5 | @@ -77,9 +77,9 @@ ## Details -### 67. Point stability-reviewer at the technical principles in place of its own restatement of them. +### 160. Decide whether the principles audit runs on every chunk or only with the architecture pass, then make larv-review and its decisions say so. -DRY, in `principles/technical-principles.md`: `agents/stability-reviewer.md` restates principles in its own words, and the copy has drifted: it asks for "properly randomised UUIDs" where the principle requires UUID v7. +`skills/larv-review/SKILL.md` ยง3 runs the principles audit only inside the architecture pass, which fires on an architectural decision, and the Audit bullets in ยง3 say the same. `docs/decisions.md`'s entry titled "review: a project decision may opt every chunk out of the architect, the product-owner pass or the comprehension check" says the audit judges every chunk, and so does CHANGELOG 0.1.0: "The principles audit always runs." Running the audit on every chunk adds a principles-auditor for the README's goals and one per principle file that applies, even to a chunk that changes no structure (goal 1.4). Running it only with the architect leaves a principle breach in a plain change unjudged (goal 1.1). The human picks one. Then whichever of `skills/larv-review/SKILL.md` ยง3 and that decision disagrees changes to match. If the audit stops running on every chunk, a bullet under `## Unreleased` corrects CHANGELOG 0.1.0's line. ### 146. Score R as L + E + I โˆ’ 2 from anchored levels, at least 7 at I5 and 5 at I4, with L, E and I in their own columns and `rank_todo.py` computing R, drop C, and route a task's model and effort on its R alone. @@ -324,7 +324,7 @@ Replaces item 62, which release 0.3.0's items split. PR #257's scoring run put L ### 155. Lower the reading cost of the files a chunk reads most before its first commit. -`bin/reading-cost` on 2026-10-16: the last 5 chunks' median is 139738 new input tokens before their first commit, the 5 before them 120770. Read most over the last 5, by opens and searches: `todo.md` 32, `docs/decisions.md` 20, `README.md` 15, `bin/test_rank_todo.py` 10, `bin/loop_claude/test_loop_claude.py` 9, `skills/larv-review/SKILL.md` 9, `CHANGELOG.md` 8, `bin/rank_todo.py` 6, `bin/loop_claude/cycle/prompts.py` 5, `docs/scoring-and-goals-research.md` 5. The chunk that ships this item runs `bin/reading-cost --reset`. +`bin/reading-cost` on 2026-10-16: the last 5 chunks' median is 146584 new input tokens before their first commit, the 5 before them 90662. Read most over the last 5, by opens and searches: `todo.md` 38, `docs/decisions.md` 22, `README.md` 15, `CHANGELOG.md` 11, `bin/test_rank_todo.py` 10, `skills/larv-review/SKILL.md` 8, `bin/loop_claude/test_loop_claude.py` 7, `AGENTS.md` 6, `bin/rank_todo.py` 6, `docs/scoring-and-goals-research.md` 5. The chunk that ships this item runs `bin/reading-cost --reset`. ### 124. Group the shared modules at `bin/`'s root into packages named by purpose, so the root holds only launchers and stand-alone tools.