Commit a chunk's changes to the config's folder in its own repo
CI / tests (pull_request) Failing after 2m33s

This commit is contained in:
2026-11-13 01:58:50 +01:00
parent 1272894aea
commit cfb5e50904
9 changed files with 65 additions and 12 deletions
+1
View File
@@ -2,6 +2,7 @@
## Unreleased
- Each change a chunk makes to a file the project's config keeps in its own folder, such as a plan there, is committed in that folder's git repo under the title of the chunk's commit in the checkout. rule-hook checks the plan's ranking on a commit there, as it does in the checkout, where before it refused such a commit.
- Every tool, prompt, rule and skill reads and writes the plan, `AGENTS.md`, the records and the changelog at the paths the project's config names. A plan outside the checkout is read as it stands; the tools that need a file's commits say what they leave undone for it, and the loop goes on.
- loop-claude, `rank_todo.py`, `todo-item` and rule-hook's `todo.md` checks now fail in a checkout no config names: write a config for each project, with `goals-and-audience = "checkout:README.md"` where its goals stay in its README. They read the goals and audience from the file that setting names, in place of `README.md`. `larv-review reviewer-header` names it on a `Goals and audience:` line, and the reviewers read it from there. A client's project can keep the file, named `goals.md`, in its config's folder, and void code health there as a README can.
- Reviewers read the technical principles from the folder a project's config sets as `principles`, in place of `~/.claude/principles/`. `larv-review reviewer-header` names the folder on a `Technical principles:` line and fails where no config sets it, or the folder is missing or empty. Write a config for each project before its next review; a project that keeps today's principles sets `principles = "~/.claude/principles"`.
+1
View File
@@ -89,6 +89,7 @@ The rules only reviewers apply, for quality, comments, READMEs and prose, live i
## Git, commits, and PRs
- Mark no commit, PR, issue comment or file as the work of Claude, Anthropic or an agent.
- Where the project's config keeps a file in its own folder, `~/.claude-projects/<key>/`, such as the plan or a record, commit each change the chunk makes to that file in the folder's git repo, under the title the chunk's commit in the checkout gives the same change. Commit on that repo's only branch, never on the chunk's branch: one loop runs per project. A dropped item's commit there is titled `Drop item <ID>: <why>` too, and rule-hook checks the plan's ranking there as it does in the checkout.
- 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.
- When the work has a ticket, read it before starting: verify the change matches it and pull useful context from it.
- PR summary: short and concise. No test plan (it lives in the ticket), no link to the ticket (it's in the title).
+1 -1
View File
@@ -77,7 +77,7 @@ To get loop-claude's questions and stops as Mattermost DMs from a bot, write the
### Set up a project
Each project the loop runs in has a folder, `~/.claude-projects/<key>/`, where `<key>` is the project's name, and a config in it, `config.toml`. The folder is a git repo of its own, so the config has a history and a client's files never enter this repo. A project is a whole git checkout, never a subfolder of one.
Each project the loop runs in has a folder, `~/.claude-projects/<key>/`, where `<key>` is the project's name, and a config in it, `config.toml`. The folder is a git repo of its own, so the config has a history and a client's files never enter this repo. Each change a chunk makes to a file there, such as the plan, is committed in that repo under the title of the chunk's commit in the checkout. A project is a whole git checkout, never a subfolder of one.
The config names the project's main checkout and the path of every file the loop keeps for it. No setting has a default: `project-config` fails and names each setting a config leaves out. A path is `checkout:<path>` inside the checkout, `folder:<path>` inside the config's folder, or one that starts with `/` or `~/`. Every tool reads and writes each file at the path its setting gives, and `chunk-preflight` and `todo-item` print those paths for the agents. Keep each file's name, such as `todo.md`: the rules for a file load by its name. A project of your own keeps every file but the principles in its checkout:
+9
View File
@@ -64,6 +64,15 @@ def load(top: pathlib.Path, main: pathlib.Path, home: pathlib.Path) -> ProjectCo
return ProjectConfig(file.parent.name, file.parent, top, {name: path for name, path in paths.items() if path})
def held(folder: pathlib.Path, home: pathlib.Path) -> ProjectConfig | Failure | None:
"""The config folder holds, as its project's main checkout reads it; None where folder is not a config's folder under home."""
file = folder / CONFIG
if folder.resolve().parent != (home / PROJECTS).resolve() or not file.is_file():
return None
config = read(file, home)
return config if isinstance(config, Failure) else load(config[0], config[0], home)
def read(file: pathlib.Path, home: pathlib.Path) -> tuple[pathlib.Path, dict[str, object]] | Failure:
"""The checkout a config names, as an absolute path, and its other values."""
try:
+1 -1
View File
@@ -81,7 +81,7 @@ RULES: dict[RuleName, Rule] = {
),
"todo-rank-check": Rule(
"while todo.md has changes, staged or not, a git commit waits until rank_todo.py --check passes on it: the checkout's own bin/rank_todo.py where the checkout is of this setup's repo, else ~/.claude/bin/rank_todo.py",
"a git commit in a checkout whose todo.md has changes, and every git commit where the project's config puts todo.md outside the checkout, where no commit says whether it changed",
"a git commit in a checkout whose todo.md has changes, and every git commit where the project's config puts todo.md outside the checkout, where no commit says whether it changed; also a git commit in the config's folder, `~/.claude-projects/<key>/`, whose todo.md has changes there",
),
}
# The lookahead ends each reason at the next marker on its line, or at the line's end. The reason is lazy, so it stops at the next marker instead of running on and swallowing the markers after it.
+15
View File
@@ -927,6 +927,21 @@ class TodoRankCheck(unittest.TestCase):
(self.config.parent / "todo.md").write_text("# todo\n")
self.assertEqual(self.details(checkout), [f"own script checked {self.config.parent}/todo.md"])
def test_a_commit_in_the_configs_folder_checks_the_plan_it_keeps_there_once_it_changes(self):
checkout = self.changed_plan(f"{self.folder}/clone", self.STUB)
folder = str(self.config.parent)
git(folder, "init", "-q", "-b", "main")
self.assertEqual(self.details(folder), [], "the plan is the checkout's todo.md, which a commit here doesn't hold")
self.config.write_text(self.config.read_text().replace('"checkout:todo.md"', '"folder:todo.md"'))
(self.config.parent / "todo.md").write_text("# todo\n")
self.assertEqual(self.details(folder), [f"own script checked {folder}/todo.md"], "checked with the checkout's own rank_todo.py, as a commit there would be")
git(folder, "add", "-A")
git(folder, "commit", "-q", "-m", "plan")
self.assertEqual(self.details(folder), [], "committed, so unchanged")
self.config.write_text("checkout = 3\n")
(self.config.parent / "todo.md").write_text("# changed\n")
self.assertEqual(self.details(folder), [], "a config to fix doesn't block the commit that fixes it")
def test_a_plan_in_a_folder_of_the_checkout_is_checked_once_it_changes(self):
checkout = self.changed_plan(f"{self.folder}/clone", self.STUB)
self.config.write_text(self.config.read_text().replace('"checkout:todo.md"', '"checkout:plan/todo.md"'))
+17 -2
View File
@@ -10,7 +10,7 @@ from git_cli.git_repo import git
from rule_hook.git import guarded_git
from project_config.main import located
from release_plan import plan_file
from project_config.settings import ProjectConfig
from project_config.settings import held, ProjectConfig
# The checkout this hook runs from: bin/rule_hook/ sits two folders below it.
@@ -20,10 +20,13 @@ OWN_CHECK_SECONDS = 20
def todo_breaches(directory: str, own: pathlib.Path = OWN) -> list[Breach]:
"""Why the plan of directory's project is not ranked, where the plan has changed; the plan is the todo.md its config names."""
"""Why the plan of directory's project is not ranked, where the plan has changed; the plan is the todo.md its config names. directory may also be a config's folder, which commits its own files."""
top = guarded_git(directory, "rev-parse", "--show-toplevel")
if isinstance(top, Failure):
return []
held_here = held(pathlib.Path(top), pathlib.Path.home())
if held_here is not None:
return folder_breaches(top, held_here, own)
config = located(top, pathlib.Path.home(), functools.partial(git, guarded=True))
if isinstance(config, Failure):
# A checkout whose todo.md changes with no config is one whose config is still to write. An unchanged todo.md may be a third party's, whose clone needs no config.
@@ -36,6 +39,18 @@ def todo_breaches(directory: str, own: pathlib.Path = OWN) -> list[Breach]:
return [Breach("todo-rank-check", line, top) for line in check_failures(top, todo, config, own)]
def folder_breaches(top: str, config: ProjectConfig | Failure, own: pathlib.Path) -> list[Breach]:
"""Why the plan in top, a config's folder and a git repo of its own, is not ranked, where the plan has changed there; checked as a commit in the project's checkout would check it.
A config that cannot be read doesn't block anything here, so that the commit fixing it goes through."""
if isinstance(config, Failure) or not config.paths["plan"].is_relative_to(config.folder):
return []
todo = config.paths["plan"]
if not todo.is_file() or not changed(str(config.folder), todo, todo.relative_to(config.folder).as_posix()):
return []
return [Breach("todo-rank-check", line, top) for line in check_failures(str(config.top), todo, config, own)]
def check_failures(top: str, todo: pathlib.Path, config: ProjectConfig, own: pathlib.Path) -> list[str]:
"""Why rank_todo.py --check fails on todo. A checkout of the repo the hook runs from checks with its own bin/rank_todo.py, so a branch that changes the table's shape is held to its own rules. Any other checkout checks with the hook's ranking: running its script would run its code before every commit."""
script = pathlib.Path(top) / "bin" / "rank_todo.py"
+17
View File
@@ -1873,3 +1873,20 @@ Read most (opens and searches):
- `bin/release_plan/test_ranking.py` 5
- `bin/rule_hook/test_rule_hook.py` 5
- `bin/judge_replay/test_judge_replay.py` 4
## Reading cost, chunk ed034b89322e, finished 2026-11-13T00:56:13Z
102937 new input tokens before the first commit.
Read most (opens and searches):
- `bin/todo_item/test_todo_item.py` 6
- `bin/project_config/test_project_config.py` 3
- `bin/rank_todo.py` 3
- `bin/release_plan/release_standing.py` 3
- `bin/test_env.py` 3
- `bin/test_rank_todo.py` 3
- `bin/todo_item/main.py` 3
- `docs/decisions.md` 3
- `bin/release_plan/plan_file.py` 2
- `bin/release_plan/test_ranking.py` 2
+3 -8
View File
@@ -12,7 +12,6 @@
| ID | Release | Blocked by | Exempt | Item | L | E | I | R | S | Moves | Score |
|---|---|---|---|---|---|---|---|---|---|---|---|
| 345 | 0.10.0 | | | **Commit each change a chunk makes to a plan or record outside the checkout into the project's `~/.claude-projects/<key>/` repo, titled like the chunk's own commits.** | 3 | 2 | 3 | 6 | 4 | 1.6 by 4 | 1.1 |
| 348 | 0.11.0 | | | **Read each project's credentials from the env file its config names, fail naming each missing key, and keep every value out of prompts, transcripts, logs and the archive.** | 2 | 2 | 4 | 6 | 3 | 1.6 by 2, 4 by 5 | 6.9 |
| 354 | 0.11.0 | | | **Read and write the decisions, score anchors, comprehension history, reading cost and changelog each through the backend its project's config names, with markdown files as one backend.** | 3 | 2 | 3 | 6 | 6 | 1.6 by 4, code health by 1 | 1.2 |
| 364 | 0.11.0 | 354 | | **Read a client repo's own `CLAUDE.md` and `AGENTS.md`, propose to its team each change that aligns them with this setup, and record each conflict left as a decision in the project's records.** | 2 | 2 | 2 | 4 | 2 | 1.6 by 4, 1.2 by 2 | 2.2 |
@@ -41,9 +40,9 @@
| 298 | 0.12.0 | | | **Send the judge only the decision entries and the transcript tail a verdict needs, and keep the cut only where `judge-replay` changes no verdict kind.** | 3 | 3 | 3 | 7 | 4 | 1.4 by 2, 1.5 by 1 | 0.9 |
| 331 | 0.12.0 | | | **Reword four decisions to expire when the rungs their replays tested change, not whenever a model joins the ladder.** | 1 | 1 | 1 | 1 | 2 | 1.4 by 2 | 0.8 |
| 327 | 0.12.0 | | | **Have `larv-review` print a round commit's title prefix, counted from the round's report, and have rule-hook refuse a round title whose counts differ from it.** | 3 | 2 | 3 | 6 | 4 | 1.1 by 1, 1.4 by 1 | 0.6 |
| 365 | 0.13.0 | 345, 352 | | **Have `score-outcomes` read the finished and dropped items of a plan outside the checkout, from the project repo's history or from Jira's issue changelogs.** | 3 | 2 | 2 | 5 | 4 | 1.6 by 2, 1.1 by 2 | 1.2 |
| 368 | 0.13.0 | 345, 352 | | **Call a release review due, call a release ready to cut, and tell whether a chunk owes a scoring run, for a plan outside the checkout, from the project repo's history or from Jira.** | 3 | 2 | 2 | 5 | 4 | 1.6 by 2, 1.1 by 2 | 1.2 |
| 366 | 0.13.0 | 345, 352 | | **Count the chunks of a project whose plan sits outside the checkout in the routing figures, from the project repo's history or from Jira.** | 3 | 2 | 2 | 5 | 4 | 1.6 by 2, 1.4 by 2 | 1.1 |
| 365 | 0.13.0 | 352 | | **Have `score-outcomes` read the finished and dropped items of a plan outside the checkout, from the project repo's history or from Jira's issue changelogs.** | 3 | 2 | 2 | 5 | 4 | 1.6 by 2, 1.1 by 2 | 1.2 |
| 368 | 0.13.0 | 352 | | **Call a release review due, call a release ready to cut, and tell whether a chunk owes a scoring run, for a plan outside the checkout, from the project repo's history or from Jira.** | 3 | 2 | 2 | 5 | 4 | 1.6 by 2, 1.1 by 2 | 1.2 |
| 366 | 0.13.0 | 352 | | **Count the chunks of a project whose plan sits outside the checkout in the routing figures, from the project repo's history or from Jira.** | 3 | 2 | 2 | 5 | 4 | 1.6 by 2, 1.4 by 2 | 1.1 |
| 367 | 0.13.0 | 352 | | **Check that every write to a Jira plan leaves it ranked, as rule-hook's `todo-rank-check` checks `todo.md` today.** | 2 | 2 | 3 | 5 | 3 | 1.6 by 2 | 0.7 |
| 303 | 0.14.0 | | defect | **Archive each judge run's prompt and json reply beside the verdict it gave, so judge cost, replays and backups cover the judge as they cover the worker.** | 2 | 2 | 3 | 5 | 3 | 1.4 by 3, 3 by 2 | 4.2 |
| 306 | 0.14.0 | | | **Set a strategy that keeps loop-claude's archive and larv-review's review folders backed up and small over the years, compressing older entries without losing any.** | 3 | 2 | 4 | 7 | 5 | 3 by 5 | 3.9 |
@@ -88,10 +87,6 @@
## Details
### 345. Commit each change a chunk makes to a plan or record outside the checkout into the project's `~/.claude-projects/<key>/` repo, titled like the chunk's own commits.
lilleman's call, 2026-11-12: each `~/.claude-projects/<key>/` is a git repo of its own, so plan and record edits keep a history. Those edits don't ride the chunk's branch: one loop runs per project, and it commits to the project repo's only branch. rule-hook's rank check, and the `Drop item` title rule, apply to these commits as they do in the checkout. Whether these repos are pushed anywhere for backup is a call for later: client data stays on the client's VM (goal 4).
### 348. Read each project's credentials from the env file its config names, fail naming each missing key, and keep every value out of prompts, transcripts, logs and the archive.
lilleman's call, 2026-11-12: credentials (Jira and Confluence API token, GitHub, Mattermost or Slack token) come from a per-project env file such as `~/.claude-projects/<key>.env`, outside the project's repo and named in the config. Which account each service uses is a config setting: a bot account or lilleman's own. A test shows a value never reaches a worker or judge prompt, a log line or the transcript archive, which guards goal 4. Today `~/.claude/.env` serves every project.