From d256c687be5920a4b6d442963a8751549e3abb50 Mon Sep 17 00:00:00 2001 From: Lilleman auf Larv Date: Fri, 25 Sep 2026 00:23:59 +0200 Subject: [PATCH 1/6] Resolve every cited CLAUDE.md heading in a test --- CHANGELOG.md | 2 +- README.md | 2 +- agents/review-protocol.md | 2 +- bin/test_citations.py | 17 +++++++++++++++++ todo.md | 3 +-- 5 files changed, 21 insertions(+), 5 deletions(-) create mode 100644 bin/test_citations.py diff --git a/CHANGELOG.md b/CHANGELOG.md index c355a4a0..76300535 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,7 +10,7 @@ - `loop-claude --help` names the Claude Code version its transcript, session and trust handling were observed on; check it first when an upgrade breaks a cycle. - `loop-claude` runs the model each project's settings pick; `LOOP_CLAUDE_WORKER_MODEL` and `LOOP_CLAUDE_JUDGE_MODEL` override it. This repo runs on Fable 5.1. - Reviewers share one protocol for verdicts, severities, rounds and declines: `agents/review-protocol.md`. -- Skills and agents cite `CLAUDE.md` by heading; the comment and documentation bar lives there alone. +- Skills and agents cite `CLAUDE.md` by heading, and a test resolves each citation; the comment and documentation bar lives there alone. - Update a main checkout with `git pull --ff-only`, never `--autostash`. - One word per concept across `CLAUDE.md`, the agents, the skills and `loop-claude`, each defined once under `CLAUDE.md` → "Vocabulary" and cited from where it is used. - `settings.json`, the agents and the status line name no machine-specific path; the status line shows reset times in the host's time zone. diff --git a/README.md b/README.md index feff3bdb..455c5150 100644 --- a/README.md +++ b/README.md @@ -25,7 +25,7 @@ Rename `## Unreleased` in `CHANGELOG.md` to the version, commit, and tag that co - `loop-claude ` runs a project's next chunk cycle after cycle; `loop-claude --help` states its contract. -Test: `python3 -m unittest bin/test_loop_claude.py` +Test: `python3 -m unittest discover -s bin -p 'test_*.py'` ## Tracking a new file diff --git a/agents/review-protocol.md b/agents/review-protocol.md index 9021b299..644606dc 100644 --- a/agents/review-protocol.md +++ b/agents/review-protocol.md @@ -34,6 +34,6 @@ A reviewer honours an accepted risk in `docs/decisions.md` and a finding decline ## Documenting decisions -Knowledge that outlives one review goes in the repo, never in a memory file: `docs/decisions.md` for every standing decision — accepted risks, declined findings, deliberate deviations, rejected alternatives — and otherwise where `~/.claude/CLAUDE.md` → "Ask, don't guess" and "Comments and documentation" put its kind. +Knowledge that outlives one review goes in the repo, never in a memory file: `docs/decisions.md` for every standing decision — accepted risks, declined findings, deliberate deviations, rejected alternatives — and otherwise where `~/.claude/CLAUDE.md` → "Working loop", "Ask, don't guess", and "Comments and documentation" put its kind. Create the file if it is missing; fix it if it is wrong. Record only decisions the human made and declines made under Declining, plus answers the human gives to ❓ — an unrecorded answer gets asked again next review. Default to recording nothing: never what a change did, never a narration of one symbol, file or test. diff --git a/bin/test_citations.py b/bin/test_citations.py new file mode 100644 index 00000000..fafb6d8b --- /dev/null +++ b/bin/test_citations.py @@ -0,0 +1,17 @@ +import pathlib +import re +import subprocess +import unittest + +ROOT = pathlib.Path(__file__).resolve().parents[1] +CITATION = re.compile(r'CLAUDE\.md`?[ ,→]+"([^"]+)"') +HEADING = re.compile(r"^#+ (.+?)(?: \(.*\))?$", re.MULTILINE) + + +class Citations(unittest.TestCase): + def test_every_cited_heading_is_in_claude_md(self): + headings = set(HEADING.findall((ROOT / "CLAUDE.md").read_text())) + tracked = subprocess.run(["git", "ls-files", "-z"], capture_output=True, check=True, cwd=ROOT, text=True).stdout.split("\0") + cited = [(path, heading) for path in filter(None, tracked) for heading in CITATION.findall((ROOT / path).read_text())] + self.assertTrue(cited) + self.assertEqual([f"{path}: {heading}" for path, heading in cited if heading not in headings], []) diff --git a/todo.md b/todo.md index 1e83dcb2..00cbc047 100644 --- a/todo.md +++ b/todo.md @@ -4,11 +4,10 @@ Ordered by how many seats of the 2026-09-24 scoring panel (`docs/decisions.md`) named the place; each is one chunk. -- Pin every `CLAUDE.md` heading the agents and skills cite with a test that resolves each citation. - Define chunk, plan and release inside `JUDGE_RULES`; the judge reads nothing else. - Name the `set -u` empty-array idiom and the `@sh` eval in `statusline.sh`, one line each. - Make `CLAUDE.md`'s comment rules say an invariant earns a line only where the code cannot show it, state the one-line rule once, and scope the docstring exemption to what a tool consumes; today a reviewer finds two sentences saying keep and one saying delete. -- Open `CLAUDE.md` → "Negation and history" with its scope, comments and docs beside code, and cut its two restatements of the section bar; today a reviewer cites it against a `CHANGELOG.md` line, which the next paragraph governs. +- Open `CLAUDE.md` → "Comments and documentation", "Negation and history", with its scope, comments and docs beside code, and cut its two restatements of the section bar; today a reviewer cites it against a `CHANGELOG.md` line, which the next paragraph governs. - Give the comprehension floor in `larv-review` its own heading and move its six-project calibration sentence to `docs/decisions.md`; today it sits under §2 "Trigger". - Cut what `review-protocol.md` → "Documenting decisions" restates from `CLAUDE.md`: the decision kinds, the create-or-fix line and the record-nothing default. - Make the missing-premises exit name what is missing: `README.md` itself, a `## Goals` or `## Audience` heading, or a body under one; today all three print the same line. -- 2.52.0 From 816bbfc3138a4573d5738023559d6f28930887b2 Mon Sep 17 00:00:00 2001 From: Lilleman auf Larv Date: Fri, 25 Sep 2026 00:27:48 +0200 Subject: [PATCH 2/6] Resolve every name in a citation and pin the arrow spelling --- bin/loop-claude | 2 +- bin/test_citations.py | 14 +++++++++----- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/bin/loop-claude b/bin/loop-claude index 8f611926..6d469e78 100755 --- a/bin/loop-claude +++ b/bin/loop-claude @@ -7,7 +7,7 @@ Run it in a project checkout whose README.md has ## Goals and ## Audience, the p a worker runs the task; a judge then reads the transcript against them. A question only the human can answer, or a release ready to cut, is an interrupt: `claude --resume` on the terminal. An unfinished chunk resumes the same session next cycle; a finished one starts a fresh session. Cycles -continue until that interrupt or Ctrl-C. Words: ~/.claude/CLAUDE.md, "Vocabulary". +continue until that interrupt or Ctrl-C. Words: ~/.claude/CLAUDE.md → "Vocabulary". Exit 1: no task, no premises, claude leaves no transcript, or the worker or the judge fails three times running, a verdict missing a field or quoting nothing in the transcript being a judge failure. diff --git a/bin/test_citations.py b/bin/test_citations.py index fafb6d8b..a053230e 100644 --- a/bin/test_citations.py +++ b/bin/test_citations.py @@ -4,14 +4,18 @@ import subprocess import unittest ROOT = pathlib.Path(__file__).resolve().parents[1] -CITATION = re.compile(r'CLAUDE\.md`?[ ,→]+"([^"]+)"') +CITATION = re.compile(r'`?CLAUDE\.md`? → ("[^"]+"(?:,? (?:and )?"[^"]+")*)') HEADING = re.compile(r"^#+ (.+?)(?: \(.*\))?$", re.MULTILINE) +LEAD = re.compile(r"^(?:- )?\*\*(.+?)(?:\*\*|[:.]| —)", re.MULTILINE) +NAME = re.compile(r'"([^"]+)"') class Citations(unittest.TestCase): - def test_every_cited_heading_is_in_claude_md(self): - headings = set(HEADING.findall((ROOT / "CLAUDE.md").read_text())) + def test_every_citation_names_a_heading_then_headings_or_bold_leads_of_claude_md(self): + text = (ROOT / "CLAUDE.md").read_text() + headings = set(HEADING.findall(text)) + leads = headings | set(LEAD.findall(text)) tracked = subprocess.run(["git", "ls-files", "-z"], capture_output=True, check=True, cwd=ROOT, text=True).stdout.split("\0") - cited = [(path, heading) for path in filter(None, tracked) for heading in CITATION.findall((ROOT / path).read_text())] + cited = [(path, NAME.findall(run)) for path in filter(None, tracked) for run in CITATION.findall((ROOT / path).read_text())] self.assertTrue(cited) - self.assertEqual([f"{path}: {heading}" for path, heading in cited if heading not in headings], []) + self.assertEqual([f"{path}: {names}" for path, names in cited if names[0] not in headings or set(names[1:]) - leads], []) -- 2.52.0 From 2a12d662ce61deaa3f909d5645928b81905bf2bd Mon Sep 17 00:00:00 2001 From: Lilleman auf Larv Date: Fri, 25 Sep 2026 00:31:41 +0200 Subject: [PATCH 3/6] Reject stray citation spellings; end a lead at a sentence dot only --- bin/test_citations.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/bin/test_citations.py b/bin/test_citations.py index a053230e..ae00ea66 100644 --- a/bin/test_citations.py +++ b/bin/test_citations.py @@ -6,8 +6,9 @@ import unittest ROOT = pathlib.Path(__file__).resolve().parents[1] CITATION = re.compile(r'`?CLAUDE\.md`? → ("[^"]+"(?:,? (?:and )?"[^"]+")*)') HEADING = re.compile(r"^#+ (.+?)(?: \(.*\))?$", re.MULTILINE) -LEAD = re.compile(r"^(?:- )?\*\*(.+?)(?:\*\*|[:.]| —)", re.MULTILINE) +LEAD = re.compile(r"^(?:- )?\*\*(.+?)(?:\*\*|[:.](?=\*\*| )| —)", re.MULTILINE) NAME = re.compile(r'"([^"]+)"') +STRAY = re.compile(r'CLAUDE\.md(?!`? → ")[^\n"]{1,5}"') class Citations(unittest.TestCase): @@ -16,6 +17,8 @@ class Citations(unittest.TestCase): headings = set(HEADING.findall(text)) leads = headings | set(LEAD.findall(text)) tracked = subprocess.run(["git", "ls-files", "-z"], capture_output=True, check=True, cwd=ROOT, text=True).stdout.split("\0") - cited = [(path, NAME.findall(run)) for path in filter(None, tracked) for run in CITATION.findall((ROOT / path).read_text())] + texts = [(path, (ROOT / path).read_text()) for path in filter(None, tracked)] + self.assertEqual([f"{path}: {stray}" for path, text in texts for stray in STRAY.findall(text)], [], 'a citation is `CLAUDE.md` then → "Heading"') + cited = [(path, NAME.findall(run)) for path, text in texts for run in CITATION.findall(text)] self.assertTrue(cited) self.assertEqual([f"{path}: {names}" for path, names in cited if names[0] not in headings or set(names[1:]) - leads], []) -- 2.52.0 From e0eb78bfd69be73c77d27967bca45ac132aa9976 Mon Sep 17 00:00:00 2001 From: Lilleman auf Larv Date: Fri, 25 Sep 2026 00:33:43 +0200 Subject: [PATCH 4/6] Make the citation message a resolving example --- bin/test_citations.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/test_citations.py b/bin/test_citations.py index ae00ea66..4da16446 100644 --- a/bin/test_citations.py +++ b/bin/test_citations.py @@ -18,7 +18,7 @@ class Citations(unittest.TestCase): leads = headings | set(LEAD.findall(text)) tracked = subprocess.run(["git", "ls-files", "-z"], capture_output=True, check=True, cwd=ROOT, text=True).stdout.split("\0") texts = [(path, (ROOT / path).read_text()) for path in filter(None, tracked)] - self.assertEqual([f"{path}: {stray}" for path, text in texts for stray in STRAY.findall(text)], [], 'a citation is `CLAUDE.md` then → "Heading"') + self.assertEqual([f"{path}: {stray}" for path, text in texts for stray in STRAY.findall(text)], [], 'spell a citation `CLAUDE.md` → "Vocabulary"') cited = [(path, NAME.findall(run)) for path, text in texts for run in CITATION.findall(text)] self.assertTrue(cited) self.assertEqual([f"{path}: {names}" for path, names in cited if names[0] not in headings or set(names[1:]) - leads], []) -- 2.52.0 From 1c05fbc5da7e135e162585ec78c98d723e08e308 Mon Sep 17 00:00:00 2001 From: Lilleman auf Larv Date: Fri, 25 Sep 2026 00:35:04 +0200 Subject: [PATCH 5/6] Name only the unresolved citation name, with the rule --- bin/test_citations.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/bin/test_citations.py b/bin/test_citations.py index 4da16446..6b3864dd 100644 --- a/bin/test_citations.py +++ b/bin/test_citations.py @@ -21,4 +21,5 @@ class Citations(unittest.TestCase): self.assertEqual([f"{path}: {stray}" for path, text in texts for stray in STRAY.findall(text)], [], 'spell a citation `CLAUDE.md` → "Vocabulary"') cited = [(path, NAME.findall(run)) for path, text in texts for run in CITATION.findall(text)] self.assertTrue(cited) - self.assertEqual([f"{path}: {names}" for path, names in cited if names[0] not in headings or set(names[1:]) - leads], []) + unresolved = [(path, name) for path, names in cited for name in [n for n in names[:1] if n not in headings] + [n for n in names[1:] if n not in leads]] + self.assertEqual([f"{path}: {name}" for path, name in unresolved], [], "the first name is a heading of CLAUDE.md, each later one a heading or a bold lead") -- 2.52.0 From 6be3efece29c6b9171f036bf2e7362aa5556e994 Mon Sep 17 00:00:00 2001 From: Lilleman auf Larv Date: Fri, 25 Sep 2026 00:37:16 +0200 Subject: [PATCH 6/6] Flatten the unresolved comprehension; record that the citation test makes pointer rot visible --- bin/test_citations.py | 2 +- docs/decisions.md | 2 +- todo.md | 1 + 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/bin/test_citations.py b/bin/test_citations.py index 6b3864dd..d830ce74 100644 --- a/bin/test_citations.py +++ b/bin/test_citations.py @@ -21,5 +21,5 @@ class Citations(unittest.TestCase): self.assertEqual([f"{path}: {stray}" for path, text in texts for stray in STRAY.findall(text)], [], 'spell a citation `CLAUDE.md` → "Vocabulary"') cited = [(path, NAME.findall(run)) for path, text in texts for run in CITATION.findall(text)] self.assertTrue(cited) - unresolved = [(path, name) for path, names in cited for name in [n for n in names[:1] if n not in headings] + [n for n in names[1:] if n not in leads]] + unresolved = [(path, name) for path, names in cited for i, name in enumerate(names) if name not in (headings if i == 0 else leads)] self.assertEqual([f"{path}: {name}" for path, name in unresolved], [], "the first name is a heading of CLAUDE.md, each later one a heading or a bold lead") diff --git a/docs/decisions.md b/docs/decisions.md index 257534d7..013e0775 100644 --- a/docs/decisions.md +++ b/docs/decisions.md @@ -22,7 +22,7 @@ ## vocabulary: the concept words are defined under `CLAUDE.md` → "Vocabulary" and cited by a bare link -2026-09-24, larv-review. Serves goal 4. Three seats of the 2026-09-24 panel found the words only in the changelog; a definition at each rule lands one reader and misses the next, so the section is the one landing place and each file using the words links it once, as skills already cite `CLAUDE.md` headings. `loop-claude --help` restates cycle, interrupt and premises, since a terminal reader has no link to follow. Valid until the next scoring run. +2026-09-24, larv-review. Serves goal 4. Three seats of the 2026-09-24 panel found the words only in the changelog; a definition at each rule lands one reader and misses the next, so the section is the one landing place and each file using the words links it once, as skills already cite `CLAUDE.md` headings, and `bin/test_citations.py` fails on a citation no heading or bold lead answers, so the pointer's rot is visible. `loop-claude --help` restates cycle, interrupt and premises, since a terminal reader has no link to follow. Valid until the next scoring run. ## larv-review: a re-entered loop takes a fresh round cap diff --git a/todo.md b/todo.md index 00cbc047..2a513204 100644 --- a/todo.md +++ b/todo.md @@ -13,4 +13,5 @@ Ordered by how many seats of the 2026-09-24 scoring panel (`docs/decisions.md`) - Make the missing-premises exit name what is missing: `README.md` itself, a `## Goals` or `## Audience` heading, or a body under one; today all three print the same line. - Spell the false-claim rule once under `CLAUDE.md` → "Comments and documentation" with its tie-break, the doc corrected unless consumers rely on what it promises, and cite it from "Working with the codebase", "Working loop" and the README paragraph; today four spellings, two of which disagree on which side to fix. - Derive `project()` from the checkout root, today `os.getcwd()`, so `loop-claude` run from a subdirectory joins the root's session. +- Settle whether the "Expect the codebase to get smaller" bullet under `CLAUDE.md` → "One spelling per goal" names an action, and cut it if it is a forecast. - Re-run the four-seat scoring panel and record the score in `docs/decisions.md`; the target is every dimension at 7.0 or above. -- 2.52.0