Group loop_claude's modules and move the findings document beside larv-review #117
+2
-1
@@ -19,7 +19,8 @@
|
|||||||
!agents/*.md
|
!agents/*.md
|
||||||
!bin/
|
!bin/
|
||||||
!bin/*
|
!bin/*
|
||||||
!bin/loop_claude/*.py
|
!bin/loop_claude/**/
|
||||||
|
!bin/loop_claude/**/*.py
|
||||||
!docs/
|
!docs/
|
||||||
!docs/*.md
|
!docs/*.md
|
||||||
!principles/
|
!principles/
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
# Claude Code configuration
|
# 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
|
## Goals
|
||||||
|
|
||||||
|
|||||||
@@ -45,7 +45,7 @@ Before anything else, **read the shared principles** at `~/.claude/principles/`.
|
|||||||
|
|
||||||
## Your Output Format
|
## 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>
|
**Surface affected**: <one line>
|
||||||
|
|
||||||
|
|||||||
@@ -128,7 +128,7 @@ Every PR gets at least this sweep.
|
|||||||
|
|
||||||
## Output Format
|
## 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
|
- **Location**: File and line/function
|
||||||
- **Issue**: Clear description of the problem
|
- **Issue**: Clear description of the problem
|
||||||
- **Risk**: What could go wrong in production
|
- **Risk**: What could go wrong in production
|
||||||
|
|||||||
@@ -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.
|
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:
|
Focus on architectural alignment:
|
||||||
- Does it still serve the project's goals and priorities, or has it quietly drifted from them?
|
- Does it still serve the project's goals and priorities, or has it quietly drifted from them?
|
||||||
|
|||||||
@@ -0,0 +1,23 @@
|
|||||||
|
import hashlib
|
||||||
|
import sys
|
||||||
|
|
||||||
|
from loop_claude.file_writes import make_private, replace_file
|
||||||
|
from loop_claude.outcome import Failure
|
||||||
|
|
||||||
|
|
||||||
|
def archive(project, path, note, paths):
|
||||||
|
folder = paths.archive / project
|
||||||
|
try:
|
||||||
|
with open(path, "rb") as handle:
|
||||||
|
raw = handle.read()
|
||||||
|
make_private(folder)
|
||||||
|
except OSError as failure:
|
||||||
|
return Failure(f"could not archive the transcript: {failure.filename}: {failure.strerror}")
|
||||||
|
copy = folder / f"{hashlib.sha256(raw).hexdigest()}.jsonl"
|
||||||
|
# The copy lands last, so a copy on disk always has its verdict beside it.
|
||||||
|
if not copy.exists():
|
||||||
|
for dest, data in ((copy.with_suffix(".verdict.md"), f"{note}\n".encode()), (copy, raw)):
|
||||||
|
if failure := replace_file(dest, data):
|
||||||
|
return Failure(f"could not archive the transcript: {dest}: {failure.reason}")
|
||||||
|
print(f"transcript: {copy}", file=sys.stderr)
|
||||||
|
return None
|
||||||
@@ -5,8 +5,7 @@ import shutil
|
|||||||
import sys
|
import sys
|
||||||
import uuid
|
import uuid
|
||||||
|
|
||||||
from loop_claude.checkout import project_name
|
from loop_claude.claude_code.formats import session_files, transcript_path
|
||||||
from loop_claude.claude_code import session_files, transcript_path
|
|
||||||
|
|
||||||
NAMESPACE = uuid.UUID("64fb586b-d926-4bb3-a44c-c903e86d3eec")
|
NAMESPACE = uuid.UUID("64fb586b-d926-4bb3-a44c-c903e86d3eec")
|
||||||
|
|
||||||
@@ -18,10 +17,10 @@ class Session:
|
|||||||
projects: pathlib.Path
|
projects: pathlib.Path
|
||||||
|
|
||||||
|
|
||||||
def session_for(root, paths):
|
def session_for(project, paths):
|
||||||
"""Exists while its transcript does."""
|
"""Exists while its transcript does."""
|
||||||
# "A " is the human's cue in the session picker that the session is the loop's.
|
# "A " is the human's cue in the session picker that the session is the loop's.
|
||||||
name = f"A {project_name(root, paths.code)} loop-claude"
|
name = f"A {project} loop-claude"
|
||||||
return Session(uuid.uuid5(NAMESPACE, name), name, paths.projects)
|
return Session(uuid.uuid5(NAMESPACE, name), name, paths.projects)
|
||||||
|
|
||||||
|
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
import json
|
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
|
from loop_claude.outcome import Failure
|
||||||
|
|
||||||
|
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
import json
|
import json
|
||||||
import sys
|
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.file_writes import replace_json
|
||||||
from loop_claude.outcome import Failure
|
from loop_claude.outcome import Failure
|
||||||
|
|
||||||
@@ -2,10 +2,10 @@ import subprocess
|
|||||||
import sys
|
import sys
|
||||||
|
|
||||||
from loop_claude import human
|
from loop_claude import human
|
||||||
from loop_claude.checkout import checkouts
|
from loop_claude.claude_code.transcript import human_turns, read
|
||||||
|
from loop_claude.claude_code.trust import trust
|
||||||
from loop_claude.outcome import Failure, Stop
|
from loop_claude.outcome import Failure, Stop
|
||||||
from loop_claude.transcript import human_turns, read
|
from loop_claude.project.checkout import checkouts
|
||||||
from loop_claude.trust import trust
|
|
||||||
|
|
||||||
TO = "answer the question above"
|
TO = "answer the question above"
|
||||||
|
|
||||||
@@ -2,7 +2,7 @@ import itertools
|
|||||||
import json
|
import json
|
||||||
import subprocess
|
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.outcome import Failure
|
||||||
from loop_claude.retry import stop_or_sleep_a_minute
|
from loop_claude.retry import stop_or_sleep_a_minute
|
||||||
|
|
||||||
@@ -1,8 +1,8 @@
|
|||||||
import subprocess
|
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.claude_code.transcript import part_line
|
||||||
from loop_claude.outcome import Failure
|
from loop_claude.outcome import Failure
|
||||||
from loop_claude.transcript import part_line
|
|
||||||
|
|
||||||
|
|
||||||
def run_worker(root, args):
|
def run_worker(root, args):
|
||||||
+12
-33
@@ -1,35 +1,31 @@
|
|||||||
import hashlib
|
from loop_claude.archive import archive
|
||||||
import sys
|
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.checkout import project_name
|
from loop_claude.claude_runs.interrupt import interrupt
|
||||||
from loop_claude.file_writes import make_private, replace_file
|
from loop_claude.claude_runs.judge import judge
|
||||||
from loop_claude.interrupt import interrupt
|
from loop_claude.claude_runs.worker import run_worker, worker_args
|
||||||
from loop_claude.judge import judge
|
|
||||||
from loop_claude.outcome import Continue, Failure, Stop
|
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
|
|
||||||
|
|
||||||
|
|
||||||
def run_cycle(root, task, premises, models, paths):
|
def run_cycle(root, project, task, premises, models, paths):
|
||||||
session = session_for(root, paths)
|
session = session_for(project, paths)
|
||||||
resuming = bool(transcript_file(session))
|
resuming = bool(transcript_file(session))
|
||||||
if failure := run_worker(root, worker_args(task, session, models.worker, resuming)):
|
if failure := run_worker(root, worker_args(task, session, models.worker, resuming)):
|
||||||
return failure
|
return failure
|
||||||
path = transcript_file(session)
|
path = transcript_file(session)
|
||||||
if not path:
|
if not path:
|
||||||
return Stop(1, f"claude left no transcript for session {session.id}")
|
return Stop(1, f"claude left no transcript for session {session.id}")
|
||||||
verdict = judge_through_interrupts(root, task, premises, models, session, path, paths)
|
verdict = judge_through_interrupts(root, project, task, premises, models, session, path, paths)
|
||||||
if isinstance(verdict, Stop):
|
if isinstance(verdict, Stop):
|
||||||
return verdict
|
return verdict
|
||||||
if verdict["finished"]:
|
if verdict["finished"]:
|
||||||
if failure := archive(root, path, f"Task: {task}\n\nVerdict: finished", paths):
|
if failure := archive(project, path, f"Task: {task}\n\nVerdict: finished", paths):
|
||||||
return Stop(1, failure.reason)
|
return Stop(1, failure.reason)
|
||||||
delete_session(session)
|
delete_session(session)
|
||||||
return Continue()
|
return Continue()
|
||||||
|
|
||||||
|
|
||||||
def judge_through_interrupts(root, task, premises, models, session, path, paths):
|
def judge_through_interrupts(root, project, task, premises, models, session, path, paths):
|
||||||
# The interrupt appends to this transcript, so each pass judges and archives it anew.
|
# The interrupt appends to this transcript, so each pass judges and archives it anew.
|
||||||
while True:
|
while True:
|
||||||
entries = read(path)
|
entries = read(path)
|
||||||
@@ -38,25 +34,8 @@ def judge_through_interrupts(root, task, premises, models, session, path, paths)
|
|||||||
verdict = judge(root, task, premises, render(entries), models.judge)
|
verdict = judge(root, task, premises, render(entries), models.judge)
|
||||||
if isinstance(verdict, Stop) or not verdict["interrupt"]:
|
if isinstance(verdict, Stop) or not verdict["interrupt"]:
|
||||||
return verdict
|
return verdict
|
||||||
if failure := archive(root, path, f"Task: {task}\n\nVerdict: interrupt\n\n{verdict['question']}", paths):
|
if failure := archive(project, path, f"Task: {task}\n\nVerdict: interrupt\n\n{verdict['question']}", paths):
|
||||||
return Stop(1, failure.reason)
|
return Stop(1, failure.reason)
|
||||||
if stop := interrupt(root, session.id, models.worker, path, verdict["question"], paths):
|
if stop := interrupt(root, session.id, models.worker, path, verdict["question"], paths):
|
||||||
return stop
|
return stop
|
||||||
|
|
||||||
|
|
||||||
def archive(root, path, note, paths):
|
|
||||||
folder = paths.archive / project_name(root, paths.code)
|
|
||||||
try:
|
|
||||||
with open(path, "rb") as handle:
|
|
||||||
raw = handle.read()
|
|
||||||
make_private(folder)
|
|
||||||
except OSError as failure:
|
|
||||||
return Failure(f"could not archive the transcript: {failure.filename}: {failure.strerror}")
|
|
||||||
copy = folder / f"{hashlib.sha256(raw).hexdigest()}.jsonl"
|
|
||||||
# The copy lands last, so a copy on disk always has its verdict beside it.
|
|
||||||
if not copy.exists():
|
|
||||||
for dest, data in ((copy.with_suffix(".verdict.md"), f"{note}\n".encode()), (copy, raw)):
|
|
||||||
if failure := replace_file(dest, data):
|
|
||||||
return Failure(f"could not archive the transcript: {dest}: {failure.reason}")
|
|
||||||
print(f"transcript: {copy}", file=sys.stderr)
|
|
||||||
return None
|
|
||||||
|
|||||||
@@ -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
|
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.
|
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.
|
loop-claude --help succeeds.
|
||||||
"""
|
"""
|
||||||
import dataclasses
|
import dataclasses
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
from loop_claude.checkout import checkout_root
|
|
||||||
from loop_claude.cycle import run_cycle
|
from loop_claude.cycle import run_cycle
|
||||||
from loop_claude.models import project_models
|
|
||||||
from loop_claude.outcome import Continue, Failure, Stop
|
from loop_claude.outcome import Continue, Failure, Stop
|
||||||
from loop_claude.premises import read_premises
|
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, decode_state, exec_if_edited, fingerprint
|
from loop_claude.reload import RELOAD_FLAG, decode_state, exec_if_edited, fingerprint
|
||||||
from loop_claude.retry import stop_or_sleep_a_minute
|
from loop_claude.retry import stop_or_sleep_a_minute
|
||||||
|
|
||||||
@@ -68,17 +68,18 @@ def run_loop(argv, env, paths, launcher, cwd):
|
|||||||
if isinstance(state, Stop):
|
if isinstance(state, Stop):
|
||||||
return state
|
return state
|
||||||
baseline = fingerprint(launcher)
|
baseline = fingerprint(launcher)
|
||||||
|
project = project_name(state.root, paths.code)
|
||||||
while True:
|
while True:
|
||||||
exec_if_edited(launcher, baseline, state)
|
exec_if_edited(launcher, baseline, state)
|
||||||
state = dataclasses.replace(state, cycle_number=state.cycle_number + 1)
|
state = dataclasses.replace(state, cycle_number=state.cycle_number + 1)
|
||||||
premises = read_premises(state.root)
|
premises = read_premises(state.root)
|
||||||
if isinstance(premises, Stop):
|
if isinstance(premises, Stop):
|
||||||
return premises
|
return premises
|
||||||
models = project_models(state.root, paths, env)
|
models = project_models(project, paths, env)
|
||||||
if isinstance(models, Stop):
|
if isinstance(models, Stop):
|
||||||
return models
|
return models
|
||||||
print(f"\n=== cycle {state.cycle_number} ===", flush=True)
|
print(f"\n=== cycle {state.cycle_number} ===", flush=True)
|
||||||
match run_cycle(state.root, state.task, premises, models, paths):
|
match run_cycle(state.root, project, state.task, premises, models, paths):
|
||||||
case Stop() as stop:
|
case Stop() as stop:
|
||||||
return stop
|
return stop
|
||||||
case Failure(reason):
|
case Failure(reason):
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import dataclasses
|
import dataclasses
|
||||||
import pathlib
|
import pathlib
|
||||||
|
|
||||||
from loop_claude.claude_code import locations
|
from loop_claude.claude_code.formats import locations
|
||||||
|
|
||||||
|
|
||||||
@dataclasses.dataclass(frozen=True)
|
@dataclasses.dataclass(frozen=True)
|
||||||
|
|||||||
@@ -3,8 +3,7 @@ import json
|
|||||||
import sys
|
import sys
|
||||||
|
|
||||||
from loop_claude import human
|
from loop_claude import human
|
||||||
from loop_claude.checkout import project_name
|
from loop_claude.claude_code.formats import catalog
|
||||||
from loop_claude.claude_code import catalog
|
|
||||||
from loop_claude.file_writes import replace_json
|
from loop_claude.file_writes import replace_json
|
||||||
from loop_claude.outcome import Stop
|
from loop_claude.outcome import Stop
|
||||||
|
|
||||||
@@ -15,11 +14,11 @@ class Models:
|
|||||||
worker: str
|
worker: str
|
||||||
|
|
||||||
|
|
||||||
def project_models(root, paths, env):
|
def project_models(project, paths, env):
|
||||||
judge, worker = env.get("LOOP_CLAUDE_JUDGE_MODEL"), env.get("LOOP_CLAUDE_WORKER_MODEL")
|
judge, worker = env.get("LOOP_CLAUDE_JUDGE_MODEL"), env.get("LOOP_CLAUDE_WORKER_MODEL")
|
||||||
if judge and worker:
|
if judge and worker:
|
||||||
return Models(judge, worker)
|
return Models(judge, worker)
|
||||||
chosen = project_model(project_name(root, paths.code), paths)
|
chosen = project_model(project, paths)
|
||||||
if isinstance(chosen, Stop):
|
if isinstance(chosen, Stop):
|
||||||
return chosen
|
return chosen
|
||||||
return Models(judge or chosen, worker or chosen)
|
return Models(judge or chosen, worker or chosen)
|
||||||
@@ -23,12 +23,12 @@ def decode_state(handed, kind):
|
|||||||
|
|
||||||
def fingerprint(launcher):
|
def fingerprint(launcher):
|
||||||
digest = hashlib.sha256()
|
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:
|
try:
|
||||||
content = path.read_bytes()
|
content = path.read_bytes()
|
||||||
except OSError as failure:
|
except OSError as failure:
|
||||||
content = str(failure).encode()
|
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()
|
return digest.hexdigest()
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -7,8 +7,11 @@ import unittest
|
|||||||
|
|
||||||
sys.path.insert(0, str(pathlib.Path(__file__).resolve().parent))
|
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.outcome import Failure, Stop
|
||||||
|
from loop_claude.project import premises
|
||||||
|
|
||||||
CWD = pathlib.Path("/c")
|
CWD = pathlib.Path("/c")
|
||||||
|
|
||||||
@@ -68,9 +71,9 @@ class PartLine(unittest.TestCase):
|
|||||||
|
|
||||||
class Parse(unittest.TestCase):
|
class Parse(unittest.TestCase):
|
||||||
def test_yields_only_json_objects(self):
|
def test_yields_only_json_objects(self):
|
||||||
self.assertEqual(claude_code.parse('{"type": "user"}'), {"type": "user"})
|
self.assertEqual(formats.parse('{"type": "user"}'), {"type": "user"})
|
||||||
self.assertIsNone(claude_code.parse("not json"))
|
self.assertIsNone(formats.parse("not json"))
|
||||||
self.assertIsNone(claude_code.parse("[1, 2]"))
|
self.assertIsNone(formats.parse("[1, 2]"))
|
||||||
|
|
||||||
|
|
||||||
class Grounded(unittest.TestCase):
|
class Grounded(unittest.TestCase):
|
||||||
|
|||||||
@@ -67,11 +67,13 @@ if role == "worker":
|
|||||||
(transcript().parent / sibling).mkdir(parents=True, exist_ok=True)
|
(transcript().parent / sibling).mkdir(parents=True, exist_ok=True)
|
||||||
(transcript().parent / f"{{session()}}.orphaned-1-ab.jsonl").write_text("{{}}\\n")
|
(transcript().parent / f"{{session()}}.orphaned-1-ab.jsonl").write_text("{{}}\\n")
|
||||||
if "append" in step:
|
if "append" in step:
|
||||||
with open(os.environ["FAKE_CLAUDE_EDIT"], "a") as script:
|
edited = pathlib.Path(os.environ["FAKE_CLAUDE_EDIT"], step["append"][0])
|
||||||
script.write(step["append"])
|
edited.parent.mkdir(parents=True, exist_ok=True)
|
||||||
|
with open(edited, "a") as script:
|
||||||
|
script.write(step["append"][1])
|
||||||
if "replace" in step:
|
if "replace" in step:
|
||||||
script = pathlib.Path(os.environ["FAKE_CLAUDE_EDIT"])
|
script = pathlib.Path(os.environ["FAKE_CLAUDE_EDIT"], step["replace"][0])
|
||||||
script.write_text(script.read_text().replace(*step["replace"]))
|
script.write_text(script.read_text().replace(*step["replace"][1:]))
|
||||||
sys.stdout.flush()
|
sys.stdout.flush()
|
||||||
sys.stdout.buffer.write(step.get("stream", "").encode("latin-1"))
|
sys.stdout.buffer.write(step.get("stream", "").encode("latin-1"))
|
||||||
print(json.dumps(said))
|
print(json.dumps(said))
|
||||||
@@ -633,19 +635,19 @@ class Reload(unittest.TestCase):
|
|||||||
copy = checkout.temp / "bin"
|
copy = checkout.temp / "bin"
|
||||||
shutil.copytree(BIN, copy, ignore=shutil.ignore_patterns("__pycache__", "test_*"))
|
shutil.copytree(BIN, copy, ignore=shutil.ignore_patterns("__pycache__", "test_*"))
|
||||||
checkout.script = copy / "loop-claude"
|
checkout.script = copy / "loop-claude"
|
||||||
checkout.env["FAKE_CLAUDE_EDIT"] = str(checkout.script)
|
checkout.env["FAKE_CLAUDE_EDIT"] = str(copy)
|
||||||
run = checkout.run([
|
run = checkout.run([
|
||||||
worker(append="\ndef\n"), judge(),
|
worker(append=["loop-claude", "\ndef\n"]), judge(),
|
||||||
worker(replace=["\ndef\n", "\n# edited\n"]), judge(),
|
worker(replace=["loop-claude", "\ndef\n", "\n# edited\n"]), judge(),
|
||||||
|
worker(append=["loop_claude/nested/edited.py", "# edited\n"]), judge(),
|
||||||
worker(),
|
worker(),
|
||||||
])
|
])
|
||||||
self.assertEqual(run.code, 130)
|
self.assertEqual(run.code, 130)
|
||||||
self.assertEqual(run.roles(), ["worker", "judge"] * 3)
|
self.assertEqual(run.roles(), ["worker", "judge"] * 4)
|
||||||
self.assertIn("keeping the running script", run.stderr)
|
self.assertIn("keeping the running script", run.stderr)
|
||||||
reloads = [argv for argv in run.starts if argv[:1] == ["--reloaded"]]
|
reloads = [json.loads(argv[1]) for argv in run.starts if argv[:1] == ["--reloaded"]]
|
||||||
self.assertEqual(len(reloads), 1)
|
self.assertEqual(reloads, [{"cycle_number": cycle, "failures": 0, "root": str(checkout.root), "task": TASK} for cycle in (2, 3)])
|
||||||
self.assertEqual(json.loads(reloads[0][1]), {"cycle_number": 2, "failures": 0, "root": str(checkout.root), "task": TASK})
|
self.assertIn("=== cycle 4 ===", run.stdout)
|
||||||
self.assertIn("=== cycle 3 ===", run.stdout)
|
|
||||||
|
|
||||||
outside = checkout.temp / "outside"
|
outside = checkout.temp / "outside"
|
||||||
outside.mkdir()
|
outside.mkdir()
|
||||||
|
|||||||
@@ -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.
|
**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. Preconditions
|
||||||
|
|
||||||
|
|||||||
@@ -4,11 +4,10 @@
|
|||||||
|
|
||||||
**⚠️ THE REBUILD NEVER MERGES INTO MAIN WITHOUT THE HUMAN'S EXPLICIT APPROVAL.** Every rebuild chunk is a worktree based on `origin/rebuild` with its PR into `rebuild`, never into main. Other sessions run on `~/.claude` main throughout; only the human merges `rebuild` into main, once they have approved the finished whole.
|
**⚠️ THE REBUILD NEVER MERGES INTO MAIN WITHOUT THE HUMAN'S EXPLICIT APPROVAL.** Every rebuild chunk is a worktree based on `origin/rebuild` with its PR into `rebuild`, never into main. Other sessions run on `~/.claude` main throughout; only the human merges `rebuild` into main, once they have approved the finished whole.
|
||||||
|
|
||||||
The rebuild lifts every dimension: each item below is one chunk on a worktree based on `origin/rebuild`, its PR into `rebuild`, until the last item opens `rebuild`'s PR into main. The sketches, the judges' verdicts and what to take from each: `~/code/claude-handoffs/claude-config_2026-09-28.md`.
|
The rebuild lifts every dimension, one chunk per item, until the last item opens `rebuild`'s PR into main. The sketches, the judges' verdicts and what to take from each: `~/code/claude-handoffs/claude-config_2026-09-28.md`.
|
||||||
|
|
||||||
The places the panel on `rebuild` at 37edc9a named (`docs/decisions.md`), capping dimension first:
|
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.
|
- **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.
|
- **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.
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user