Answer stability round 1: cite the shortened false-claim heading, keep the API-spec and tagline rules in CLAUDE.md, load the comment rules with any file, and name the judge's two rule sources apart

This commit is contained in:
2026-10-13 00:31:58 +02:00
parent a1adbbfd8b
commit 3766e880ca
10 changed files with 26 additions and 33 deletions
+2 -1
View File
@@ -2,7 +2,8 @@
## Unreleased
- `CLAUDE.md` keeps only the rules every session needs. The rules for `todo.md` items, comments, decisions, READMEs and public API specs 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 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`.
- 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 <rule>: <reason>`. 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.
+11 -7
View File
@@ -16,6 +16,7 @@ How work proceeds in any repo, unless the repo's `AGENTS.md` says otherwise. The
- **Remove a finished item's row and detail from `todo.md`, and revise any decision that cites it.** If the repo publishes something others consume — a package, an image, an API — reword the item for them and move it to `CHANGELOG.md` under `## Unreleased`. A changelog is for the public, never for the next agent. Otherwise delete it; git history is the record.
- **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.
## Quality
@@ -26,7 +27,7 @@ Quality is proven by review. Every change is reviewed as a diff. The whole proje
2. **True to the technical principles** (`~/.claude/principles/technical-principles.md`). `larv-review`'s comprehension check (§3 → "Architecture") measures KISS.
3. **Plainly written**, per "Prose".
### A false claim is a bug — fix it where you find it
### A false claim is a bug
Docs, comments and what a program prints — `--help`, an error, a log line — assert checkable things: a command, a resolution rule, a path, a limit. Verify one before you repeat or build on it. When it is wrong, correct it in the same change: the claim — or the code, when consumers already rely on what the claim promises. Never work around it or record the discrepancy elsewhere.
@@ -42,15 +43,18 @@ Everything written — chat, commit messages, comments, docs, code — is in **E
- **Write the thing, not an introduction to it.** A sentence announcing what follows, or flagging that it deserves attention, carries nothing — if it matters, it is in what follows. A bare label is fine. BANNED: `Here's the new audience text, which is the part that needs your eye:`, `One thing I changed that deserves your attention.`, `One judgment call I'd flag rather than bury.`, `Three things came along that would otherwise have been left false.` GOOD: `New audience text:`, or the list alone.
- **No contrastive tail.** `X rather than Y`, `not Y but X`, `instead of Y`: state X and stop. The rejected alternative is noise unless naming it stops a reader doing Y. BANNED: `verified in CI rather than asserted`. GOOD: `verified in CI`.
## 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.
## Topic rules
Each loads by itself when a session reads or writes a matching file; read it first when you need its rule before that.
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.
- Public API specs: `~/.claude/rules/api-specs.md`.
- Comments, and what earns a place in a doc: `~/.claude/rules/comments.md`.
- Decisions and `docs/decisions.md`: `~/.claude/rules/decisions.md`.
- README goals and audience, and a README's contents, a package's included: `~/.claude/rules/readme.md`.
- `todo.md` items, their scores and Exempt reasons: `~/.claude/rules/todo-items.md`.
- 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`.
## 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.
+1 -1
View File
@@ -6,7 +6,7 @@ tools: Read, Grep, Glob
You read the prose as someone who did not write it: you see only what it says, never what the author meant.
The bar: `~/.claude/CLAUDE.md` → "Prose", and every file under `~/.claude/rules/` that governs what the diff changes: `comments.md` always, `readme.md` for a README, `decisions.md` for a decision, `todo-items.md` for `todo.md`, `api-specs.md` for an API spec. Read them each time — they change. Verdict, severities and rounds: ~/.claude/skills/larv-review/review-findings.md.
The bar: `~/.claude/CLAUDE.md` → "Prose", and every file under `~/.claude/rules/` that governs what the diff changes: `comments.md` always, `readme.md` for a README, `decisions.md` for a decision and `todo-items.md` for `todo.md`. Read them each time — they change. Verdict, severities and rounds: ~/.claude/skills/larv-review/review-findings.md.
## Checks, in priority order
+3 -3
View File
@@ -7,7 +7,7 @@ from loop_claude.cycle.prompts import ANSWER_DESTINATIONS, ANSWERS_RECORDED
from loop_claude.effects import Effects
from failure import Failure
from claude_code.entries import hit_limit, limit_said, parse_entry, structured_output
from loop_claude.project.records import HUMAN_RULES
from loop_claude.project.records import HUMAN_RULES, HUMAN_RULES_DIR
from loop_claude.cycle.retry import Limited, retried
from loop_claude.stop import Stop
@@ -39,9 +39,9 @@ JUDGE_RULES = (
"The chunk is the piece of work the agent is on, shipped as one pull request. "
"finished=true when the chunk is complete: merged, or nothing remains that the agent could do on "
f"its own. Even then, it is finished only once {ANSWERS_RECORDED}. An answer counts as recorded "
f"where README.md or the records above hold it, {' and '.join(HUMAN_RULES)} included. It also counts where "
f"where README.md or the records above hold it, {HUMAN_RULES} and {HUMAN_RULES_DIR} included. It also counts where "
f"the transcript shows the agent writing it into {ANSWER_DESTINATIONS}; writing it into "
f"{' or '.join(HUMAN_RULES)} does not count. finished=false when work remains that a further run can "
f"{HUMAN_RULES} or {HUMAN_RULES_DIR} does not count. finished=false when work remains that a further run can "
"continue: an open PR, a review not yet run, CI not yet reported, an answer not yet recorded."
)
+2 -2
View File
@@ -1,8 +1,8 @@
from loop_claude.project.records import HUMAN_RULES, RECORD_FILES
from loop_claude.project.records import HUMAN_RULES, HUMAN_RULES_DIR, RECORD_FILES
from markdown_text import quoted
# Where the judge may quote an answer from, named as the human and the worker see them; of README.md the judge sees only the premises.
QUOTE_SOURCES = "README.md's Goals and Audience, " + ", ".join(RECORD_FILES + HUMAN_RULES[:1]) + " or " + HUMAN_RULES[1]
QUOTE_SOURCES = "README.md's Goals and Audience, " + ", ".join(RECORD_FILES + (HUMAN_RULES,)) + " or " + HUMAN_RULES_DIR
# Where the worker may write an answer the human typed, so it counts as recorded.
ANSWER_DESTINATIONS = "README.md's Goals or Audience, " + ", ".join(RECORD_FILES) + ", todo.md or a comment"
ANSWERS_RECORDED = f"every answer the human typed in it that a later chunk could need is recorded in {ANSWER_DESTINATIONS} at the one place it governs"
+4 -3
View File
@@ -5,14 +5,15 @@ from loop_claude.stop import Stop
# The records: these project files and the human's rules; the judge reads them beside the README's premises.
RECORD_FILES = ("AGENTS.md", "docs/decisions.md")
HUMAN_RULES = ("~/.claude/CLAUDE.md", "~/.claude/rules/")
HUMAN_RULES = "~/.claude/CLAUDE.md"
HUMAN_RULES_DIR = "~/.claude/rules/"
def read_records(root: str, claude_md: pathlib.Path) -> str | Stop:
"""The project's record files, then the human's rules for every project, CLAUDE.md first, each headed by its name; a file that does not exist is left out."""
rules = claude_md.parent / "rules"
sources = [(root, name, name) for name in RECORD_FILES] + [(str(claude_md.parent), claude_md.name, HUMAN_RULES[0])]
sources += [(str(rules), rule.name, HUMAN_RULES[1] + rule.name) for rule in sorted(rules.glob("*.md"))]
sources = [(root, name, name) for name in RECORD_FILES] + [(str(claude_md.parent), claude_md.name, HUMAN_RULES)]
sources += [(str(rules), rule.name, HUMAN_RULES_DIR + rule.name) for rule in sorted(rules.glob("*.md"))]
records = []
for folder, name, heading in sources:
if not pathlib.Path(folder, name).exists():
+1 -1
View File
@@ -513,7 +513,7 @@ class ExitContract(unittest.TestCase):
def test_every_exit_1_stop_has_its_clause_in_help(self):
read, git, premises_ = "a transcript cannot be read or archived", "git cannot start or finds no checkout", "README.md holds no premises"
models_ = "the models file cannot be read or written"
unreadable = f"README.md, or {', '.join(records.RECORD_FILES + records.HUMAN_RULES[:1])} or {records.HUMAN_RULES[1]}*.md where they exist, cannot be read or is not UTF-8"
unreadable = f"README.md, or {', '.join(records.RECORD_FILES + (records.HUMAN_RULES,))} or {records.HUMAN_RULES_DIR}*.md where they exist, cannot be read or is not UTF-8"
# Every Stop whose code is not a literal 0, 2 or 130, in source order: path, function, code, start of reason, its --help clause.
clauses = [
("cycle/interrupt.py", "interrupt", "1", "entries.reason", read),
-10
View File
@@ -1,10 +0,0 @@
---
paths:
- "**/*openapi*"
- "**/*swagger*"
- "**/api-docs/**"
---
# Public API specs
- Text in public API specs (OpenAPI `description`/`title` fields 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.
+1 -3
View File
@@ -1,8 +1,6 @@
---
paths:
- "**/*.{c,cpp,cs,go,h,java,js,jsx,kt,md,mjs,php,py,rb,rs,sh,sql,swift,toml,ts,tsx,yaml,yml}"
- "**/Dockerfile*"
- "**/bin/*"
- "**/*"
---
# Comments and documentation
+1 -2
View File
@@ -3,7 +3,7 @@ paths:
- "**/todo.md"
---
# Todo items (`todo.md`, tickets, plans)
# Todo items (`todo.md`)
- **`todo.md` is mandatory in every project, in one shape**, which `~/.claude/bin/rank_todo.py` checks and ranks; its `--help` shows a valid file. `## Scoring` holds the formula, the bar and the goal weights; `## Items` is one table of every item; `## Details` holds each item's detail under its ID. Cite an item by its ID. The formula, bar and weights are the project's own to tune.
- **Score an item when it is filed or edited.** Each of R, S, A and G is a whole number from 1 to 10:
@@ -13,5 +13,4 @@ paths:
- **G** — its value to the goals it cites in the Goals column; W is the weight of the heaviest of them.
- **An item scoring under the bar is deleted, with every item that needs it, and a finding under the bar is not filed.** The chunk's summary names each, with its score.
- **The Exempt cell keeps an item whatever its score:** `security` for a security finding, `defect` for a 🔴 finding, `question` for a question only the human can answer, `decision` for an item `docs/decisions.md` cites, and, where no other reason fits, `principle` for a 🟡 finding against a file under `~/.claude/principles/`, whose item's detail names that principle. Every item `docs/decisions.md` cites carries one of these reasons.
- Open each item 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`.
- **Unless the project has a reason to differ, weigh goals by position, the first heaviest.** When the weights stop listing the README's goals, `rank_todo.py` fails and prints those weights.