From de0dad7d58b2a8ff4aba1752ae05deddc601aff8 Mon Sep 17 00:00:00 2001 From: Lilleman auf Larv Date: Tue, 13 Oct 2026 00:38:48 +0200 Subject: [PATCH] Answer prose round 1: list the judge's rule files in the vocabulary, widen the stability reviewer's prose bar, and reword the router, the maintenance rules and the decision --- CHANGELOG.md | 2 +- CLAUDE.md | 20 ++++++++++---------- agents/stability-reviewer.md | 2 +- bin/loop_claude/loop/main.py | 6 +++--- docs/decisions.md | 4 ++-- rules/decisions.md | 2 +- 6 files changed, 18 insertions(+), 18 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4bd7062d..155d8283 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,7 +2,7 @@ ## Unreleased -- `CLAUDE.md` keeps only the rules every session needs. The rules for `todo.md` items, comments, decisions and READMEs moved to files under `rules/`. Claude Code loads each one when a session reads or writes a matching file. `loop-claude`'s judge reads them beside `CLAUDE.md`, and the prose and stability reviewers read them where they once read `CLAUDE.md`. +- `CLAUDE.md` keeps only the rules no file path can scope. The rules for `todo.md` items, comments, decisions and READMEs moved to files under `rules/`. Claude Code loads each one when a session reads or writes a matching file. `loop-claude`'s judge reads them beside `CLAUDE.md`, and the prose and stability reviewers read them where they once read `CLAUDE.md`. - A README no longer holds cross-cutting decisions; `docs/decisions.md` does. - 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. diff --git a/CLAUDE.md b/CLAUDE.md index 6e583031..36defc89 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -17,7 +17,7 @@ How work proceeds in any repo, unless the repo's `AGENTS.md` says otherwise. The - **Releases are the human's.** The version bump and the publishing credentials are theirs, whatever another rule says. Prepare everything else, so cutting a release is one decision. - **Releases follow semver read strictly** (`~/.claude/principles/technical-principles.md`). - **Open each `todo.md` item or ticket with a bold one-sentence tagline**, so the taglines alone say what a release holds. The tagline states the target state, checkable when done: an imperative verb plus what holds afterwards. A present-tense fact reads as the current state and says nothing about what to do. Add "today X" only where the direction is otherwise ambiguous. GOOD: `**Accept undefined in MetadataValue and drop such keys on output.**` BANNED: `MetadataValue accepts undefined; such keys are dropped on output`. -- **File a security finding the moment it is found.** A security finding — a leaked credential, secret or PII, an auth bypass, an injection — goes under the next release, marked `security`, naming the exposure and the path it reaches. `rank_todo.py` ranks it first in its release. Never among additive or nice-to-have items, never only in a chunk's summary, and never as a question about where it belongs: file it, say you did, and I will unmark it if I disagree. Fixing it inside an unrelated change is a separate call — say whether it is in the blast radius. +- **File a security finding the moment it is found.** A security finding — a leaked credential, secret or PII, an auth bypass, an injection — goes under the next release, marked `security`, naming the exposure and the path it reaches. `~/.claude/bin/rank_todo.py` ranks it first in its release. Never among additive or nice-to-have items, never only in a chunk's summary, and never as a question about where it belongs: file it, say you did, and I will unmark it if I disagree. Fixing it inside an unrelated change is a separate call — say whether it is in the blast radius. ## Quality @@ -45,16 +45,16 @@ Everything written — chat, commit messages, comments, docs, code — is in **E ## Public API specs - Text in public API specs (OpenAPI `description`/`title` fields, in a spec file or in code, and the generated api-docs) is read by external consumers. Never leak internal references: no ticket IDs, internal URLs, repo/system code-names, "see ticket X". Describe behaviour in consumer terms. GOOD: `Deprecated alias for paymentAccountId`. BANNED: `…will be removed (ABC-123)`. -- The opposite of internal code comments, which *may* cite a ticket for a footgun/constraint. +- Internal code comments, by contrast, *may* cite a ticket for a footgun or constraint. ## Topic rules -Each file loads by itself once a session reads or writes a file its line names. On a write it loads only after the write, so read it before you create such a file. +Claude Code loads each rule file below when a session reads or writes a file that matches its line. After a write it loads only once the write is done, so read the rule file before you create a matching file. -- Comments, and what earns a place in a doc: `~/.claude/rules/comments.md`, with any file. -- Decisions: `~/.claude/rules/decisions.md`, with `AGENTS.md` or `docs/decisions.md`. -- README goals and audience, and what a README or a package's README holds: `~/.claude/rules/readme.md`, with `README.md`. -- `todo.md` items, their scores and Exempt reasons: `~/.claude/rules/todo-items.md`, with `todo.md`. +- Comments, and what earns a place in a doc: `~/.claude/rules/comments.md` loads with any file. +- Decisions: `~/.claude/rules/decisions.md` loads with `AGENTS.md` or `docs/decisions.md`. +- README goals and audience, and what a README or a package's README holds: `~/.claude/rules/readme.md` loads with `README.md`. +- `todo.md` items, their scores and Exempt reasons: `~/.claude/rules/todo-items.md` loads with `todo.md`. ## Working with the codebase - Always start a new git worktree when doing something in a codebase, and clean it up when done. Unless told otherwise, branch it off a freshly-updated default branch (`git fetch origin`, then base on `origin/main`), not whatever happens to be checked out. @@ -91,13 +91,13 @@ The rules every project follows, compose-not-entangle first: `~/.claude/principl - When a page renders client-side and comes back empty/blocked, use the Playwright renderer at `~/code/playwright-for-agents/` — `./pw [options]` (see its README). Don't use claude-in-chrome for this. ## Maintaining this file -- When you spot a pattern in how I work that isn't written here or under `~/.claude/rules/` — a preference I've repeated, a correction I've given more than once, a convention you inferred from my code — tell me and ask me to write it up here. Don't add it silently, and don't just keep it in a memory file. -- After every change to this file or a file under `~/.claude/rules/`, re-read them all and restructure it: merge overlapping rules, cut prose that restates a rule, move rules to the section they belong in, drop what's now covered elsewhere. Same information, easier to read and shorter. +- When you spot a pattern in how I work that isn't written here or under `~/.claude/rules/` — a preference I've repeated, a correction I've given more than once, a convention you inferred from my code — tell me and ask me to write it up here or under `~/.claude/rules/`. Don't add it silently, and don't just keep it in a memory file. +- After every change to this file or a file under `~/.claude/rules/`, re-read all of them and restructure them: merge overlapping rules, cut prose that restates a rule, move each rule to the file and section it belongs in, drop what's now covered elsewhere. Same information, easier to read and shorter. ## Vocabulary - **chunk** — the unit of work, shipped as one PR; "Working loop" says what it holds. -- **cycle** — in `loop-claude`, worker runs and the judge's verdict on each, until the chunk closes or is left for the next cycle. In between, the human answers any interrupt, or the worker resumes with an answer the judge quoted from `README.md`, `AGENTS.md`, `docs/decisions.md` or `~/.claude/CLAUDE.md`. +- **cycle** — in `loop-claude`, worker runs and the judge's verdict on each, until the chunk closes or is left for the next cycle. In between, the human answers any interrupt, or the worker resumes with an answer the judge quoted from `README.md`, `AGENTS.md`, `docs/decisions.md`, `~/.claude/CLAUDE.md` or `~/.claude/rules/`. - **gate** — the merge gate: the checks a PR passes before it merges. - **interrupt** — `loop-claude` handing the terminal to the human, `claude --resume`, for a decision that is theirs. - **judge** — the headless claude that reads a worker's transcript each cycle and decides whether to interrupt and whether the chunk is finished. diff --git a/agents/stability-reviewer.md b/agents/stability-reviewer.md index 2b5c8dbf..674dfca8 100644 --- a/agents/stability-reviewer.md +++ b/agents/stability-reviewer.md @@ -110,7 +110,7 @@ Every PR gets at least this sweep. - Is naming precise and unambiguous? - **Does every name in the diff still match its (possibly changed) contents?** When a change meaningfully shifts what a file/folder/package/service/variable does, its name must be updated in the same change — flag a stale name left behind by a content/purpose shift (e.g. a `webhook` test helper reworked into a JWT verifier but still called `webhook`/`WEBHOOK_URL`). The rename belongs in the PR, not "later." - Are magic numbers/strings replaced with named constants? -- **Judge every comment and prose line the diff adds against `~/.claude/rules/comments.md`**; report a density breach with the ratio and the files driving it. +- **Judge every comment and prose line the diff adds against `~/.claude/rules/comments.md`, plus `readme.md` for a README line and `decisions.md` for a decision line**; report a density breach with the ratio and the files driving it. - **Flag a caveat the diff has outlived**, anywhere in the repo: report the sentence's `file:line` and the behaviour that replaced it. - **Flag a pointer standing where a definition belongs** — `~/.claude/rules/comments.md` → "Links and pointers", "A pointer is not a definition". - **Never propose new documentation as a "nice to have".** Suggesting a doc paragraph is proposing bulk someone must maintain. Raise it as a 🟡 only when its absence would actively mislead someone, and say which mistake it prevents; otherwise don't raise it at all. Deleting redundant prose is always the cheaper fix. diff --git a/bin/loop_claude/loop/main.py b/bin/loop_claude/loop/main.py index ccdba7e1..2a8348b0 100644 --- a/bin/loop_claude/loop/main.py +++ b/bin/loop_claude/loop/main.py @@ -4,9 +4,9 @@ usage: loop-claude Run it anywhere inside a project checkout whose README.md has ## Goals and ## Audience, the premises; the task runs at the checkout root. Each cycle a worker runs the task. A judge then reads -the transcript's end, the premises, and the records: the project's AGENTS.md and docs/decisions.md -and the human's ~/.claude/CLAUDE.md and ~/.claude/rules/*.md, where they exist. It rules whether the chunk, the work of one -PR, is finished. A chunk stays unfinished until each answer the human typed in it that a later chunk +the transcript's end, the premises, and the records: the project's AGENTS.md and docs/decisions.md, +and the human's ~/.claude/CLAUDE.md and ~/.claude/rules/*.md, where they exist. It rules whether the +chunk, the work of one PR, is finished. A chunk stays unfinished until each answer the human typed in it that a later chunk could need is recorded: the premises or the records hold it, or the transcript shows the worker writing it into the premises, AGENTS.md, docs/decisions.md, todo.md or a code comment. A choice the worker made that the premises or the records settle is not asked about. When the worker asks a diff --git a/docs/decisions.md b/docs/decisions.md index 1eb22bfa..16c3d722 100644 --- a/docs/decisions.md +++ b/docs/decisions.md @@ -12,10 +12,10 @@ 2026-10-03, lilleman: the judge is to read `~/.claude/CLAUDE.md` whole too. The worker follows that file, so a question it answers should not reach the human (goal 1.2). Reading the whole file is safe, because the judge may quote only words that appear in it. A list of sections would need keeping current. Implemented the same day. -2026-10-13, lilleman, through todo item 95: `CLAUDE.md` keeps only the rules every session needs, and each topic's rules moved to a file under `~/.claude/rules/` that Claude Code loads when a session touches a matching file. The judge reads each of those files whole too, for the reason above, and a worker's write to one counts no more than a write to `CLAUDE.md`. - 2026-10-03, lilleman: the judge rules a chunk finished only once every answer the human typed in it is recorded. A finished chunk's session is deleted, and its answers with it, so an answer recorded nowhere would be asked again in a later chunk (goal 1.2). Implemented the same day by claude, which settled two choices the ruling left open. First, an answer counts as recorded where the files the judge reads hold it, `~/.claude/CLAUDE.md` included, or where the transcript shows the worker writing it into `README.md`'s premises, `AGENTS.md`, `docs/decisions.md`, `todo.md` or a code comment. A worker's write to `~/.claude/CLAUDE.md` does not count: `CLAUDE.md` → "Maintaining this file" leaves new rules in it to the human. The judge cannot read a code comment or `todo.md`. Yet `CLAUDE.md` → "Working loop", "Ask, don't guess" puts a standing choice made in one place in a comment there. And the human's approval of a release's items, which "Working loop" requires, is the set of rows `todo.md` names for that release. The judge also reads the records once a cycle from the main checkout. That checkout may not yet hold an answer the worker wrote and merged. A judge that refused any of these would hold the chunk open every cycle. Second, only an answer a later chunk could need must be recorded, so an approval such as "merge it" holds nothing open. The worker's resume prompt states the rule, so a worker whose chunk is held open knows it. +2026-10-13, implementing todo item 95: `CLAUDE.md` keeps only the rules no file path can scope, and each topic's rules moved to a file under `~/.claude/rules/` that Claude Code loads when a session reads or writes a matching file. The judge reads each of those files whole too, for the reason it reads `CLAUDE.md` whole, and a worker's write to one does not count as recording an answer, as a write to `CLAUDE.md` does not. + ## loop-claude: one session per project, its id derived from the checkout's path relative to `~/code`, or to `/` outside it 2026-09-21, lilleman; revised 2026-09-30 by lilleman. Serves goal 1. One fixed id per project keeps the session picker at one entry per project and makes any transcript under that id loop-claude's own to delete. A checkout outside `~/code` mirroring a path inside it shares that id, and a second loop on it is not refused. Once `todo.md` item 5 lands, the id comes from the full path, so no two checkouts share one, and `loop-claude` refuses to start while another session on that id is active. Moving the checkout orphans its open sessions, archive folder and models entry: sessions stay in the picker until the human deletes them, migration code not being worth a one-human audience. Valid while claude takes `--session-id` and resumes by it. diff --git a/rules/decisions.md b/rules/decisions.md index 14bcb32d..36db592c 100644 --- a/rules/decisions.md +++ b/rules/decisions.md @@ -6,6 +6,6 @@ paths: # Decisions: one home, each linked to a goal or a technical principle -**A choice that shapes what the code does, made in one place, is a comment there, with its reason. Made in more than one place, it is a decision, and the decision log owns it.** A decision's rejected alternative, or what it deliberately does not cover, stays out of every call site. **The decision log has one home: `docs/decisions.md`**. A title states the whole decision in one line: what holds at the commit it ships in, in words a reader finds in the code or the plan. `AGENTS.md` lists every title, so a session works by the decisions without loading their background. A session reads the entry under a title only to question, revise or add a decision. The entry holds the background: its date, who made it, the reasoning, and the premise it rests on ("valid while X") so it can expire honestly when that premise dies. A choice found anywhere else — an `AGENTS.md` body, a comment away from the code it governs, or a README section that is neither a goal nor how one is met — moves: to a comment at its one place, or, once made in more than one place, to the log, leaving its title in `AGENTS.md`'s list. A goal stays a goal in the README; the log records only what the goal leaves open. +**A choice that shapes what the code does, made in one place, is a comment there, with its reason. Made in more than one place, it is a decision, and the decision log owns it.** A decision's rejected alternative, or what it deliberately does not cover, stays out of every call site. **The decision log has one home: `docs/decisions.md`**. A title states the whole decision in one line: what holds at the commit it ships in, in words a reader finds in the code or the plan. `AGENTS.md` lists every title, so a session works by the decisions without loading their background. A session reads the entry under a title only to question, revise or add a decision. The entry holds the background: its date, who made it, the reasoning, and the premise it rests on ("valid while X") so it can expire honestly when that premise dies. A choice found anywhere else — an `AGENTS.md` body, a comment away from the code it governs, or a README section that is neither a goal nor how one is met — moves: to a comment at its one place, or, once made in more than one place, to the log, leaving its title in `AGENTS.md`'s list. **Every decision links to a goal or a technical principle.** An entry names the goal it serves or the technical principle under `~/.claude/principles/` it applies; one that can do neither is a missing goal, and an entry already in the repo with neither behind it is a finding. Propose the goal, never a reason of your own — `~/.claude/CLAUDE.md` → "Working loop", "Ask, don't guess" says how. An entry working against a goal or a technical principle stands only while it names the `todo.md` item that ends it.