Group a cycle's modules under cycle/ and the loop's under loop/ #136

Merged
lilleman merged 4 commits from group-modules into rebuild 2026-09-29 12:07:22 +02:00
17 changed files with 20 additions and 19 deletions
+2 -2
View File
@@ -39,7 +39,7 @@ Apply it as a question to any design that routes A through B, or has A reach int
- **Code & modules.** Dependencies point one way: callers may know the service, the service must never know its callers. Business logic — and its comments — must not name or assume the delivery mechanism (controller, HTTP, request validation, route), because a service may have many consumers (controller, queue worker, CLI, another service). BANNED: `// The controller's validator guarantees these fields`. GOOD: caller-agnostic phrasing ("callers must supply X"), or just let the guard + type signature speak.
- **Data & state.** One owner per piece of state, reached through that owner. Two components writing the same table, file or volume are one component with a seam nobody declared.
- **Tooling & tests.** A test, script or pipeline stage that passes only because another one ran first is entangled: state what it needs and get it, or make it independent.
- **Vendors & records.** A supplier is a component like any other, so the question above is the whole test: prefer the option tying us to none, and where one is genuinely needed — a capability only it has, or a vendor that is the target itself — know what leaving costs (`~/.claude/principles/technical-principles.md`). Documentation the project owns is the case with no excuse. BANNED: the decision log in `.claude/rules/`, where swapping tools takes the project's reasoning with it. GOOD: `docs/decisions.md`, with a path-scoped rule pointing at it.
- **Vendors & records.** A supplier is a component like any other, so the question above is the whole test: prefer the option tying us to none (`~/.claude/principles/technical-principles.md`). Documentation the project owns is the case with no excuse. BANNED: the decision log in `.claude/rules/`, where swapping tools takes the project's reasoning with it. GOOD: `docs/decisions.md`, with a path-scoped rule pointing at it.
- **Proximity is not a reason.** Reusing a listener, config file, table, module or service *because it is already there*, when the new thing has no relationship to it, is how this gets in. If you cannot name the seam, there isn't one.
## One spelling per goal
@@ -160,5 +160,5 @@ Default to NO comment. Delete one that is any of:
- Commit message and PR title: **one line**, prefixed with the ticket ID when the work has one. Example: `ABC-123 - Regression tests for GET /v4/clients`. Never include the repo/project name (like "twu-4") — we're already in that context.
- PR summary: short and concise. No test plan (it lives in the ticket), no link to the ticket (it's in the title).
- Keep the project's main checkout (e.g. `~/code/log`, never a worktree) current: when it is behind `origin` — a merge landed, or a fetch shows it — run `git pull --ff-only` there instead of reporting the lag, never with `--autostash`: a dirty checkout is a finding to report, not to carry along.
- Releases follow semver read strictly (`~/.claude/principles/technical-principles.md`): a minor only adds; a consumer's current code, data and scripts survive it unchanged.
- Releases follow semver read strictly (`~/.claude/principles/technical-principles.md`).
- Never add `Co-Authored-By: Claude ...`, `🤖 Generated with Claude Code`, or any Claude/Anthropic/Agent marker in commits, PR bodies, issue comments, or anywhere else.
+1 -1
View File
@@ -18,7 +18,7 @@ You consider internal logic **only** when it directly affects an external surfac
## Your Review Method
Before anything else, **read the shared principles** at `~/.claude/principles/`. Two of them are your territory: `rest-apis.md` (URL/query conventions, error envelope, pagination, versioning, OpenAPI requirement) and `frontend.md` (intuitive-over-fancy, broad device support, progressive enhancement, semantic HTML, responsive design). `technical-principles.md` applies where it surfaces externally (timestamps communicated as UTC, idempotent writes). Re-read each time — they change.
Before anything else, **read the shared principles** at `~/.claude/principles/`. Two of them are your territory: `rest-apis.md` and `frontend.md`. `technical-principles.md` applies where it surfaces externally (timestamps communicated as UTC, idempotent writes). Re-read each time — they change.
1. **Identify the change surface**: Read the recent changes and pinpoint what external behavior is affected. If the change is purely internal with no external impact, say so plainly and stop — don't manufacture concerns.
+1 -1
View File
@@ -9,7 +9,7 @@ You are an elite stability-focused code reviewer with deep expertise in defensiv
## First Steps
1. **Scope the change.** You review every PR; a fresh invocation has no prior context, so determine the diff yourself. Diff the PR branch against its base (`gh pr diff`, or `git merge-base <base> HEAD` then `git diff`), and review the changed lines **plus enough surrounding code and callers** to judge correctness — read the whole changed file when practical; a diff alone hides whether a caller breaks. Read the PR description and, when the project uses an issue tracker (project-specific — check its docs) and the change references a ticket, that ticket: the diff is judged against its stated intent, and a scope mismatch in either direction is a finding — claimed-but-unimplemented, and implemented-but-unasked (#2).
2. **Read every file in the shared principles** at `~/.claude/principles/` — not just `technical-principles.md`, also `frontend.md`, `logging.md`, and `rest-apis.md`. These are mandatory org guidelines, shared with the systems-architect (same principles, code-level lens here); all code MUST comply. Map the relevant file(s) to the change (frontend PR → `frontend.md`; API PR → `rest-apis.md`; etc.). Re-read each time — they change. Flag violations prominently.
2. **Read every file in the shared principles** at `~/.claude/principles/` — not just `technical-principles.md`, also `frontend.md`, `logging.md`, and `rest-apis.md`. These are mandatory org guidelines; all code MUST comply. Map the relevant file(s) to the change (frontend PR → `frontend.md`; API PR → `rest-apis.md`; etc.). Re-read each time — they change. Flag violations prominently.
3. **Read README.md, AGENTS.md and `docs/decisions.md`** in the current project for project-specific conventions, build instructions, tooling, and the accepted trade-offs a reviewer should honor rather than re-flag. Note the documented test, lint, and static-analysis commands — you will run them.
4. **Verify, don't just read.** Run the test suite and static analysis/linters through the project's documented container tooling (never host runtimes; tear down test containers afterwards). A full-suite run catches broken callers that diff-reading misses. When a suspected bug is cheap to confirm, reproduce it — a scratch script in a temp dir, a targeted test run — before reporting it. Leave the working tree exactly as you found it. Anything you could not run goes in Coverage & Verification, never silently skipped.
5. **Two passes minimum, then hunt absences.**
+2 -3
View File
@@ -56,7 +56,7 @@ You work in distinct stages. Never skip stages. Never collapse them. Goals, audi
### Stage 0: Establish goals, audience, scale & domain language (do this first)
You cannot judge whether an implementation is the best one without a yardstick. The yardstick is five artifacts: **the audience** (who this is for — concrete roles, not "users"), **the problem statement** (what hurts without this), **the goals and their priority order** (including which failure classes are intolerable — the correctness targets the test machinery is priced against), **the scale & horizon** (expected load and data volume in orders of magnitude, team and consumer count, and the intended lifetime — throwaway experiment / MVP / production / long-lived platform — with a promotion event, the one that graduates it and forces re-review), and **the domain glossary** — the ubiquitous language: each core domain concept, one name, one line of meaning. Every name in the design must come from it.
- **Gather** them — read the README, CLAUDE.md, AGENTS.md, the shared principles at `~/.claude/principles/` (org-wide constraints every design must satisfy — the same set the stability-reviewer enforces at code level, applied here through an architectural lens), the relevant ticket, and any design docs. What isn't written down is a question for the user.
- **Gather** them — read the README, CLAUDE.md, AGENTS.md, the shared principles at `~/.claude/principles/` (org-wide constraints every design must satisfy), the relevant ticket, and any design docs. What isn't written down is a question for the user.
- **Test** them: Is the audience concrete? Does the problem statement name the pain, not the solution? Are the goals explicit, measurable, prioritized so you know which wins when two collide, and mutually consistent? Is the horizon stated — spike or platform? Nothing is fit for a purpose whose size and lifespan are unknown. Does the glossary give each concept exactly one name?
- **Fix first if broken.** Unless the purpose and goals are abundantly clear, surfacing the gap IS this run's deliverable: you execute one-shot and cannot pause for answers, so return a short draft of the missing artifacts plus the questions the user must answer, and stop there — design or review continues in a later invocation, once the agreed result is recorded. A missing audience, problem statement, scale & horizon, or glossary is the same fix-first gap. Never design against guessed goals, a guessed audience, or invented vocabulary — surface the ambiguity instead.
@@ -134,7 +134,6 @@ You review the seams that make verification possible and the strategy that uses
- **The external contract is executably pinned.** Contract tests fail when a published shape breaks — the lock on that one-way door. Price them like the versioning machinery (The External Contract): zero consumers outside your control, defer; many, mandatory.
- **Load targets come from Stage 0.** Load and performance tests verify the recorded scale numbers; no recorded scale, nothing to verify — fix Stage 0 first (a rig for unrecorded load is "Hunt the imagined requirement" wearing a QA hat). Data and traffic are production-shaped — a load run against a 1000-row database measures nothing. Runs are scheduled outside the merge gate (see Delivery); determinism here means a repeatable method against fixed thresholds, not identical latencies.
- **Post-deploy production suites are a designed capability.** Tagged, idempotent synthetic traffic against external surfaces only (API, UI), built once and run twice: post-deploy smoke and scheduled monitoring. It asserts liveness of the deployed surface, not logic — logic determinism lives in the pre-merge suites. Self-cleaning means expendable-by-design: a synthetic tenant or TTL-tagged data reaped out-of-band, never teardown-in-the-test, and never a delete endpoint added to the contract only for tests. Side effects are sandboxed by design — a synthetic checkout must never charge a real card — and the synthetic marking propagates through every downstream sink (telemetry, billing, analytics) so real signals stay uncontaminated; a tag that dies at the API edge is a missing seam.
- **Depth scales with the recorded horizon; the seams do not.** E2e breadth, load rigs, and post-deploy suites are ceremony — price them by horizon, blast radius, and the intolerable failures Stage 0 records. An injected clock and a pure core are fundamentals — scale-invariant (Core Philosophy: rigor follows the horizon).
## Delivery (the path to production is architecture)
@@ -149,7 +148,7 @@ How a change ships — merge gate, pipeline, deployment, dependencies — is a d
## Reviewing Existing Work (periodic alignment)
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.
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.
**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).
+2 -1
View File
@@ -6,6 +6,7 @@ import sys
LAUNCHER = pathlib.Path(__file__).resolve()
sys.path.insert(0, str(LAUNCHER.parent))
from loop_claude import main, paths
from loop_claude import paths
from loop_claude.loop import main
sys.exit(main.main(sys.argv[1:], os.environ, paths.paths_from(pathlib.Path.home(), os.environ), LAUNCHER, pathlib.Path.cwd()))
@@ -4,8 +4,8 @@ import subprocess
import typing
from loop_claude.claude_code.formats import structured_output
from loop_claude.cycle.retry import retried
from loop_claude.outcome import Failure
from loop_claude.retry import retried
JUDGE_RULES = (
"Decide whether the human must now be interrupted. interrupt=true when any of these appear:\n"
@@ -1,15 +1,15 @@
import dataclasses
from loop_claude.archive import archive
from loop_claude.claude_code.session import Session, delete_session, transcript_file
from loop_claude.claude_code.transcript import read, render
from loop_claude.claude_runs.interrupt import interrupt
from loop_claude.claude_runs.judge import judge
from loop_claude.claude_runs.worker import run_worker, worker_args
from loop_claude.cycle.archive import archive
from loop_claude.cycle.interrupt import interrupt
from loop_claude.cycle.judge import judge
from loop_claude.cycle.retry import retried
from loop_claude.cycle.worker import run_worker, worker_args
from loop_claude.outcome import Failure, Stop
from loop_claude.paths import Paths
from loop_claude.project.models import Models
from loop_claude.retry import retried
@dataclasses.dataclass(frozen=True)
View File
@@ -37,12 +37,12 @@ import dataclasses
import sys
from loop_claude.claude_code.session import session_for
from loop_claude.cycle import Cycle, run_cycle
from loop_claude.cycle.steps import Cycle, run_cycle
from loop_claude.loop.reload import RELOAD_FLAG, LoopState, decode_state, exec_if_edited, fingerprint
from loop_claude.outcome import Stop
from loop_claude.project.checkout import checkout_root, project_name
from loop_claude.project.models import project_models
from loop_claude.project.premises import read_premises
from loop_claude.reload import RELOAD_FLAG, LoopState, decode_state, exec_if_edited, fingerprint
def main(argv, env, paths, launcher, cwd):
+3 -2
View File
@@ -8,9 +8,10 @@ import unittest
sys.path.insert(0, str(pathlib.Path(__file__).resolve().parent))
from loop_claude import file_writes, main, reload
from loop_claude import file_writes
from loop_claude.claude_code import formats, transcript
from loop_claude.claude_runs import judge
from loop_claude.cycle import judge
from loop_claude.loop import main, reload
from loop_claude.outcome import Failure, Stop
from loop_claude.project import premises
+1 -1
View File
@@ -8,13 +8,13 @@ The rebuild lifts every dimension, one chunk per item, until the last item opens
The places the panel on `rebuild` at 2f9ab2f named (`docs/decisions.md`), capping dimension first:
- **Group `bin/loop_claude/`'s top-level modules, and name `claude_runs` apart from `claude_code`.** Two seats: eleven modules of mixed altitude side by side.
- **Say at `written_by_human` why a `<` prefix marks Claude Code's own entry, and at `trust` why a failure only warns.** Three seats found either only in `CHANGELOG.md`.
- **Say in the README why the tests run on the host and need `uv`.** Two seats: `CLAUDE.md` says never run a runtime on the host, and only `test_python_floor.py` says what `uv` is for.
- **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.
## 0.2.0
- **Sort `bin/`'s imports on their first binding, per `CLAUDE.md` → "Code style", and keep that rule in one place.** Today they sort by path, so a module move reorders unchanged lines; `CLAUDE.md` and `principles/technical-principles.md` each state the sort key, neither says how case sorts, and "host packages" names no Python group.
- **Reword `CLAUDE.md` → "One spelling per goal" so a copy in code is derived from its owner, and drop the README-caveat sentence and the scope list.** A prose pass found "reject at load" fits only copied config, and the scope list reads as excluding internal code.
- **Name CLI flags and exit codes among larv-review's external contracts, or record that they do not fire the architecture pass.** A prose pass found the product-owner row names the CLI and the architecture row does not.
- **Show the judge's reply when `loop-claude` rejects its verdict.** Its stdout is discarded, so a judge that failed three times running leaves nothing to diagnose.