Group loop_claude's modules into claude_code, claude_runs and project, and move the findings document beside larv-review

This commit is contained in:
2026-09-28 21:28:41 +02:00
parent 6a1a1d9027
commit 998cc3ac85
26 changed files with 39 additions and 35 deletions
+2
View File
@@ -20,6 +20,8 @@
!bin/
!bin/*
!bin/loop_claude/*.py
!bin/loop_claude/*/
!bin/loop_claude/*/*.py
!docs/
!docs/*.md
!principles/
+1 -1
View File
@@ -1,6 +1,6 @@
# Claude Code configuration
My personal `~/.claude`, version controlled: `CLAUDE.md` and `AGENTS.md` for instructions, the words under `CLAUDE.md` → "Vocabulary"; `agents/` and `skills/`; `principles/` for what the reviewer agents hold every project and every review to; `docs/` for decisions; `settings.json` for the harness and `.claude/settings.json` for the harness inside this repo; `statusline.sh`; `CHANGELOG.md` and `todo.md`; and the tools in `bin/`.
My personal `~/.claude`, version controlled: `CLAUDE.md` and `AGENTS.md` for instructions, the words under `CLAUDE.md` → "Vocabulary"; `agents/` and `skills/`; `principles/` for what the reviewer agents hold every project to; `docs/` for decisions; `settings.json` for the harness and `.claude/settings.json` for the harness inside this repo; `statusline.sh`; `CHANGELOG.md` and `todo.md`; and the tools in `bin/`.
## Goals
+1 -1
View File
@@ -45,7 +45,7 @@ Before anything else, **read the shared principles** at `~/.claude/principles/`.
## Your Output Format
Verdict, severities, rounds and declines: ~/.claude/principles/review-findings.md. After the verdict:
Verdict, severities, rounds and declines: ~/.claude/skills/larv-review/review-findings.md. After the verdict:
**Surface affected**: <one line>
+1 -1
View File
@@ -128,7 +128,7 @@ Every PR gets at least this sweep.
## Output Format
Verdict, severities, rounds and declines: ~/.claude/principles/review-findings.md. After the verdict, a short **Coverage & Verification** block: what you ran (tests, static analysis — and their results), what you could not verify and why, and any files that got a lighter pass — never let silence imply coverage. Then the findings, most severe first, each with:
Verdict, severities, rounds and declines: ~/.claude/skills/larv-review/review-findings.md. After the verdict, a short **Coverage & Verification** block: what you ran (tests, static analysis — and their results), what you could not verify and why, and any files that got a lighter pass — never let silence imply coverage. Then the findings, most severe first, each with:
- **Location**: File and line/function
- **Issue**: Clear description of the problem
- **Risk**: What could go wrong in production
+1 -1
View File
@@ -151,7 +151,7 @@ How a change ships — merge gate, pipeline, deployment, dependencies — is a d
You are not a per-PR reviewer. The **stability-reviewer** runs on every change for code-level safety; you run deliberately, every so often, to check the system is still aligned — right goals, right contract, right foundations, sound structure. When you do look at a specific PR, it is because the work touches architectural fundamentals or reopens foundational choices, not for routine line-level review. Stage 0 blocks review as much as design: if the project's purpose and goals are not abundantly clear from its docs, this run's output is the clarifying questions plus a short draft to confirm — not a review; the review happens in a later invocation, once the answers are recorded in the README.
**Verdict and severities: ~/.claude/principles/review-findings.md.** A violation of a non-negotiable fundamental — functional-core/shell entanglement, a unit past a Fits in a head threshold without a stated reason, a method or file carrying more than one responsibility, unreasoned duplication of a core concept, or a broken/leaky external contract — is a 🔴: lead with it, and name the concrete restructuring. The most common instance: a pure transformation (a deterministic input→output computation) entangled inside an imperative-shell or orchestration method, where it could be a named, separately-testable function. The architectural defect being real, not its line count or "how much it works today," sets the severity; rate a non-fundamental finding by its eventual cost — the recorded horizon sets that cost; fundamentals stay 🔴 at every horizon (Core Philosophy: rigor follows the horizon).
**Verdict and severities: ~/.claude/skills/larv-review/review-findings.md.** A violation of a non-negotiable fundamental — functional-core/shell entanglement, a unit past a Fits in a head threshold without a stated reason, a method or file carrying more than one responsibility, unreasoned duplication of a core concept, or a broken/leaky external contract — is a 🔴: lead with it, and name the concrete restructuring. The most common instance: a pure transformation (a deterministic input→output computation) entangled inside an imperative-shell or orchestration method, where it could be a named, separately-testable function. The architectural defect being real, not its line count or "how much it works today," sets the severity; rate a non-fundamental finding by its eventual cost — the recorded horizon sets that cost; fundamentals stay 🔴 at every horizon (Core Philosophy: rigor follows the horizon).
Focus on architectural alignment:
- Does it still serve the project's goals and priorities, or has it quietly drifted from them?
@@ -5,8 +5,8 @@ import shutil
import sys
import uuid
from loop_claude.checkout import project_name
from loop_claude.claude_code import session_files, transcript_path
from loop_claude.project.checkout import project_name
from loop_claude.claude_code.formats import session_files, transcript_path
NAMESPACE = uuid.UUID("64fb586b-d926-4bb3-a44c-c903e86d3eec")
@@ -1,6 +1,6 @@
import json
from loop_claude.claude_code import assistant_parts, human_text, parse, part_text, tool_call
from loop_claude.claude_code.formats import assistant_parts, human_text, parse, part_text, tool_call
from loop_claude.outcome import Failure
@@ -1,7 +1,7 @@
import json
import sys
from loop_claude.claude_code import mark_trusted, trust_records
from loop_claude.claude_code.formats import mark_trusted, trust_records
from loop_claude.file_writes import replace_json
from loop_claude.outcome import Failure
@@ -2,10 +2,10 @@ import subprocess
import sys
from loop_claude import human
from loop_claude.checkout import checkouts
from loop_claude.project.checkout import checkouts
from loop_claude.outcome import Failure, Stop
from loop_claude.transcript import human_turns, read
from loop_claude.trust import trust
from loop_claude.claude_code.transcript import human_turns, read
from loop_claude.claude_code.trust import trust
TO = "answer the question above"
@@ -2,7 +2,7 @@ import itertools
import json
import subprocess
from loop_claude.claude_code import structured_output
from loop_claude.claude_code.formats import structured_output
from loop_claude.outcome import Failure
from loop_claude.retry import stop_or_sleep_a_minute
@@ -1,8 +1,8 @@
import subprocess
from loop_claude.claude_code import assistant_parts, ends_stream, parse
from loop_claude.claude_code.formats import assistant_parts, ends_stream, parse
from loop_claude.outcome import Failure
from loop_claude.transcript import part_line
from loop_claude.claude_code.transcript import part_line
def run_worker(root, args):
+6 -6
View File
@@ -1,14 +1,14 @@
import hashlib
import sys
from loop_claude.checkout import project_name
from loop_claude.project.checkout import project_name
from loop_claude.file_writes import make_private, replace_file
from loop_claude.interrupt import interrupt
from loop_claude.judge import judge
from loop_claude.claude_runs.interrupt import interrupt
from loop_claude.claude_runs.judge import judge
from loop_claude.outcome import Continue, Failure, Stop
from loop_claude.session import delete_session, session_for, transcript_file
from loop_claude.transcript import read, render
from loop_claude.worker import run_worker, worker_args
from loop_claude.claude_code.session import delete_session, session_for, transcript_file
from loop_claude.claude_code.transcript import read, render
from loop_claude.claude_runs.worker import run_worker, worker_args
def run_cycle(root, task, premises, models, paths):
+4 -4
View File
@@ -30,17 +30,17 @@ and read each cycle; a project without an entry, as on its first run, is asked f
LOOP_CLAUDE_JUDGE_MODEL overrides it for the judge, LOOP_CLAUDE_WORKER_MODEL for the worker and the
interrupt; with both set, nothing is asked.
A change to bin/loop-claude or bin/loop_claude/*.py takes effect at the next cycle boundary, once
A change to bin/loop-claude or bin/loop_claude/**/*.py takes effect at the next cycle boundary, once
loop-claude --help succeeds.
"""
import dataclasses
import sys
from loop_claude.checkout import checkout_root
from loop_claude.project.checkout import checkout_root
from loop_claude.cycle import run_cycle
from loop_claude.models import project_models
from loop_claude.project.models import project_models
from loop_claude.outcome import Continue, Failure, Stop
from loop_claude.premises import read_premises
from loop_claude.project.premises import read_premises
from loop_claude.reload import RELOAD_FLAG, decode_state, exec_if_edited, fingerprint
from loop_claude.retry import stop_or_sleep_a_minute
+1 -1
View File
@@ -1,7 +1,7 @@
import dataclasses
import pathlib
from loop_claude.claude_code import locations
from loop_claude.claude_code.formats import locations
@dataclasses.dataclass(frozen=True)
View File
@@ -3,8 +3,8 @@ import json
import sys
from loop_claude import human
from loop_claude.checkout import project_name
from loop_claude.claude_code import catalog
from loop_claude.project.checkout import project_name
from loop_claude.claude_code.formats import catalog
from loop_claude.file_writes import replace_json
from loop_claude.outcome import Stop
+2 -2
View File
@@ -23,12 +23,12 @@ def decode_state(handed, kind):
def fingerprint(launcher):
digest = hashlib.sha256()
for path in [launcher, *sorted((launcher.parent / "loop_claude").glob("*.py"))]:
for path in [launcher, *sorted((launcher.parent / "loop_claude").rglob("*.py"))]:
try:
content = path.read_bytes()
except OSError as failure:
content = str(failure).encode()
digest.update(f"{path.name}\0{len(content)}\0".encode() + content)
digest.update(f"{path.relative_to(launcher.parent)}\0{len(content)}\0".encode() + content)
return digest.hexdigest()
+7 -4
View File
@@ -7,8 +7,11 @@ import unittest
sys.path.insert(0, str(pathlib.Path(__file__).resolve().parent))
from loop_claude import claude_code, file_writes, judge, main, premises, transcript
from loop_claude import file_writes, main
from loop_claude.claude_code import formats, transcript
from loop_claude.claude_runs import judge
from loop_claude.outcome import Failure, Stop
from loop_claude.project import premises
CWD = pathlib.Path("/c")
@@ -68,9 +71,9 @@ class PartLine(unittest.TestCase):
class Parse(unittest.TestCase):
def test_yields_only_json_objects(self):
self.assertEqual(claude_code.parse('{"type": "user"}'), {"type": "user"})
self.assertIsNone(claude_code.parse("not json"))
self.assertIsNone(claude_code.parse("[1, 2]"))
self.assertEqual(formats.parse('{"type": "user"}'), {"type": "user"})
self.assertIsNone(formats.parse("not json"))
self.assertIsNone(formats.parse("[1, 2]"))
class Grounded(unittest.TestCase):
+1 -1
View File
@@ -9,7 +9,7 @@ You orchestrate, fix, and ship; reviewers only report. Run every reviewer synchr
**Forge-neutral.** Five PR operations recur below: read a PR's diff, open a draft PR, read check status, mark ready, merge. Resolve the tooling from the remote per `~/.claude/CLAUDE.md` → "Git, commits, and PRs"; on any other forge, achieve the same intents through its CLI or API — discover how rather than assuming. A forge without a native draft state gets the closest equivalent (a `WIP:`/`Draft:` title prefix); note any approximation in the summary.
Words: `~/.claude/CLAUDE.md` → "Vocabulary". Findings, for every reviewer: ~/.claude/principles/review-findings.md.
Words: `~/.claude/CLAUDE.md` → "Vocabulary". Findings, for every reviewer: ~/.claude/skills/larv-review/review-findings.md.
## 1. Preconditions
-1
View File
@@ -8,7 +8,6 @@ The rebuild lifts every dimension: each item below is one chunk on a worktree ba
The places the panel on `rebuild` at 37edc9a named (`docs/decisions.md`), capping dimension first:
- **Group `bin/loop_claude/`'s 18 flat modules, and move `principles/review-findings.md` beside larv-review.** Two seats; `claude_code.py` is the first group.
- **Show the judge a reply the human sends while claude works.** Claude Code 2.1.284 writes it as an `"attachment"` entry, which `render` drops, so the judge can rule on a question the human already answered during an interrupt.
- **Score `rebuild` with the four-seat panel at 7.0 or above on every dimension and the overall, none below the last run, and open its PR into main for the human.** ⚠️ Leave that PR ready and unmerged: only the human merges it, after approving the whole rebuild. A dimension under the floor gets its places filed above this item.