From 415d1dc704286d031aa30fbbb24a88573b9ce395 Mon Sep 17 00:00:00 2001 From: Lilleman auf Larv Date: Sat, 14 Nov 2026 20:47:02 +0100 Subject: [PATCH 01/10] Re-score item 353 at L 3 and S 5, since it reaches six components --- todo.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/todo.md b/todo.md index 709f250c..710bd691 100644 --- a/todo.md +++ b/todo.md @@ -12,7 +12,6 @@ | ID | Release | Blocked by | Exempt | Item | L | E | I | R | S | Moves | Score | |---|---|---|---|---|---|---|---|---|---|---|---| -| 353 | 0.11.0 | | | **Let a project's config take its goals and audience from a Jira epic's description, under the same two headings.** | 2 | 2 | 3 | 5 | 3 | 1.6 by 4 | 1.3 | | 358 | 0.11.0 | | | **Let a project's config allow its runtime and tests on the host, and set the comprehension score under which code health is very important.** | 2 | 2 | 3 | 5 | 3 | 1.6 by 4 | 1.3 | | 362 | 0.11.0 | | | **Send loop-claude's notices through the notifier a project's config names, with Mattermost as the first backend.** | 2 | 1 | 2 | 3 | 3 | 1.6 by 3 | 1.0 | | 363 | 0.11.0 | 362 | | **Add a Slack backend to the notifier, sending each notice as a DM from a bot.** | 2 | 1 | 2 | 3 | 3 | 1.6 by 4 | 1.3 | @@ -23,6 +22,7 @@ | 356 | 0.11.0 | | | **Hand reviewers the review standards from the folder a project's config names, in place of `~/.claude/skills/larv-review/standards/`.** | 2 | 2 | 3 | 5 | 2 | 1.6 by 3 | 1.1 | | 372 | 0.11.0 | | | **Key loop-claude's session, archive, routing state and config-folder commits per chunk, so two chunks of one project run side by side without touching each other's state.** | 3 | 2 | 3 | 6 | 6 | 1.5 by 3 | 0.4 | | 374 | 0.11.0 | 372 | | **Merge open chunks one at a time: rebase, finish the item in todo.md and CHANGELOG.md, rerun the gate and the paired ruling, and keep a chunk waiting for approval in the queue without blocking the next.** | 4 | 2 | 3 | 7 | 6 | 1.5 by 4, 1.6 by 3 | 1.0 | +| 353 | 0.11.0 | | | **Let a project's config take its goals and audience from a Jira epic's description, under the same two headings.** | 3 | 2 | 3 | 6 | 5 | 1.6 by 4 | 0.8 | | 359 | 0.11.0 | | | **Tie a project's releases to what its config names: semver tags, Jira Fix Versions, sprints, or none.** | 3 | 2 | 3 | 6 | 4 | 1.6 by 3 | 0.8 | | 380 | 0.11.0 | | | **Define "plan" in `CLAUDE.md` → "Vocabulary" as the store a project's config names as `plan`, a `todo.md` or a Jira epic, and reword each line of `CLAUDE.md` and `rules/todo-items.md` that says `todo.md` where it is false for a plan in Jira.** | 1 | 2 | 3 | 4 | 2 | 1.6 by 2 | 0.7 | | 375 | 0.11.0 | 372, 373, 374 | | **Run up to the project's configured number of chunks at once, each in its own window of one tmux session named for the project, mark a window whose chunk waits for the human, and refuse to start without tmux at the needed version.** | 4 | 2 | 3 | 7 | 7 | 1.5 by 7 | 0.6 | @@ -84,10 +84,6 @@ ## Details -### 353. Let a project's config take its goals and audience from a Jira epic's description, under the same two headings. - -lilleman's call, 2026-11-12: this client keeps its goals and audience in the plan epic's description. The source is a config setting, never hard-coded; item 346 builds the file source this one adds to. Read through the adf-codec shim. - ### 358. Let a project's config allow its runtime and tests on the host, and set the comprehension score under which code health is very important. lilleman's calls, 2026-11-12. Legacy products may have no container setup, so the config may allow host tooling; `CLAUDE.md`'s container rule and rule-hook then follow it. In 0.10.0 a decision in the project's records can put tooling on the host instead. The comprehension panel will score legacy code low, and today code health under 7.0 is very important. The config sets that floor, 7.0 in the configs of the projects under `~/code`; the signal stays that the score rises. @@ -140,6 +136,10 @@ Where the rebase conflicts, the chunk's worker resolves it, and only the review `bin/chunk_preflight/choices.py:80` `forge_of` is a place the comprehension seats found hard: forge code split across tools. Where this item touches it, build on item 287's forge module if that has shipped. +### 353. Let a project's config take its goals and audience from a Jira epic's description, under the same two headings. + +lilleman's call, 2026-11-12: this client keeps its goals and audience in the plan epic's description. The source is a config setting, never hard-coded; item 346 builds the file source this one adds to. Read through the adf-codec shim. + ### 359. Tie a project's releases to what its config names: semver tags, Jira Fix Versions, sprints, or none. lilleman's call, 2026-11-12: what a release is differs per client. With none, items name no release, and the architecture and principles passes the release review runs need another trigger, which this item settles and records. Readers: `rank_todo.py`'s release order, chunk-preflight's next release, loop-claude's "release ready to cut", larv-review's release review, `CLAUDE.md` → "Working loop". Cutting a release stays the human's. -- 2.52.0 From 8363514fe93d38d998693c68e859926569631fc4 Mon Sep 17 00:00:00 2001 From: Lilleman auf Larv Date: Sat, 14 Nov 2026 21:01:47 +0100 Subject: [PATCH 02/10] Record the reading cost before item 353's first commit --- docs/reading-cost.md | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/docs/reading-cost.md b/docs/reading-cost.md index a92e4975..9bd01b52 100644 --- a/docs/reading-cost.md +++ b/docs/reading-cost.md @@ -2084,3 +2084,20 @@ Read most (opens and searches): - `bin/machine_load/slots.py` 2 - `docs/decisions.md` 2 - `bin/adf_codec/node_shim/Dockerfile` 1 + +## Reading cost, chunk 514c7381359c, finished 2026-11-14T19:43:45Z + +60112 new input tokens before the first commit. + +Read most (opens and searches): + +- `README.md` 6 +- `bin/chunk_preflight/main.py` 2 +- `bin/chunk_preflight/test_chunk_preflight.py` 2 +- `bin/project_config/main.py` 2 +- `bin/chunk_preflight/choices.py` 1 +- `bin/project_config/templates.py` 1 +- `bin/project_config/test_templates.py` 1 +- `ci.sh` 1 +- `docs/decisions.md` 1 +- `todo.md` 1 -- 2.52.0 From 55967b5fa685428b96fa02681d384628eeaa6c44 Mon Sep 17 00:00:00 2001 From: Lilleman auf Larv Date: Sat, 14 Nov 2026 21:01:50 +0100 Subject: [PATCH 03/10] Take a project's goals and audience from a Jira epic's description where its config names one --- CLAUDE.md | 2 +- README.md | 2 + bin/deploy_release/cut.py | 4 +- bin/larv_review/reviewer_header.py | 8 +- bin/larv_review/test_larv_review.py | 6 +- bin/loop_claude/loop/usage.py | 5 +- bin/loop_claude/project/premises.py | 23 +++--- bin/loop_claude/test_black_box.py | 6 +- bin/plan_store/stores.py | 17 +++-- bin/plan_store/test_stores.py | 3 +- bin/project_config/main.py | 9 +-- bin/project_config/settings.py | 24 +++--- bin/project_config/test_project_config.py | 32 ++++++++ bin/record_store/jira_description.py | 53 ++++++++++++++ bin/record_store/stores.py | 13 +++- bin/record_store/test_jira_description.py | 89 +++++++++++++++++++++++ bin/record_store/test_stores.py | 15 +++- bin/release_plan/test_release_standing.py | 2 +- bin/test_rank_todo.py | 4 +- 19 files changed, 267 insertions(+), 50 deletions(-) create mode 100644 bin/record_store/jira_description.py create mode 100644 bin/record_store/test_jira_description.py diff --git a/CLAUDE.md b/CLAUDE.md index baa8f079..cc0fd4a2 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -127,7 +127,7 @@ Claude Code reads this section by its heading when it compacts a conversation. K - **chunk** — the unit of work, shipped as one PR; "Working loop" says what it holds. - **cycle** — in `loop-claude`, worker runs and the judge's verdict on each, until the chunk closes or is left for the next cycle. In between, the human answers any interrupt, or the worker resumes with an answer the judge quoted from the premises or the judge's records. - **gate** — the merge gate: the checks a PR passes before it merges. -- **goals file** — the file holding a project's `## Goals` and `## Audience`: the one its config names as `goals-and-audience`, which `~/.claude/bin/project-config goals-and-audience` prints. It is `README.md`, unless a client's project keeps it in the config's folder. +- **goals file** — the file holding a project's `## Goals` and `## Audience`: the one its config names as `goals-and-audience`, which `~/.claude/bin/project-config goals-and-audience` prints. It is `README.md`, unless a client's project keeps it in the config's folder, or in a Jira epic's description, which the loop only reads. - **interrupt** — `loop-claude` asking the human, on its terminal, for a decision that is theirs. They type a one-line answer there, or `/talk` to open the worker's session there with `claude --resume`. A release ready to cut opens that session at once. A routing call opens claude on that terminal too, in `~/code/claude-config`, the checkout where this setup is developed. - **judge** — the headless claude that reads a worker's transcript each cycle and decides whether to interrupt and whether the chunk is finished. - **judge's records** — the files the judge reads beside the premises: the project's `AGENTS.md` and `docs/decisions.md`, then the human's `~/.claude/CLAUDE.md` and the `.md` files in `~/.claude/rules/` and `~/.claude/skills/larv-review/standards/`. diff --git a/README.md b/README.md index eca08cce..ceb0c6ff 100644 --- a/README.md +++ b/README.md @@ -113,6 +113,8 @@ A client that plans in Jira Cloud names an epic as its project's plan: `plan = " A read fails, naming the issue, where a child is in another Jira project or names no such Fix Version. The config's `env-file` must hold `ATLASSIAN_EMAIL` and `ATLASSIAN_API_TOKEN`, an API token of that Atlassian account, and only its owner may read that file: `chmod 600` it. The loop only reads such a plan so far. `todo-item add`, `edit`, `move` and `finish` fail, so file, edit and finish its issues in Jira. `rank_todo.py` doesn't rank it, since Jira's backlog does. The four things not supported for a plan outside the checkout, above, are not supported for a plan in Jira either. +A client that keeps its goals and audience in an epic's description names that epic as the goals file: `goals-and-audience = "jira:https://acme.atlassian.net/browse/ABC-12"`, which may be the plan's own epic. The description needs `## Goals` and `## Audience` as headings, level-2 headings in Jira's editor, and the same `env-file`. The loop only reads it, so edit the description in Jira. Whoever may edit that description sets the premises every worker and judge follows, so keep its edit rights to the people who own the project's goals. + To name a chunk's branch, worktree, commits and pull request by the issue key, as in `ABC-123` and `ABC-123 - …`, set these three templates, with your Jira project's key in place of `ABC`: `branch = "ABC-{id}"`, `commit-title = "ABC-{id} - {summary}"` and `pull-request-title = "ABC-{id} - {summary}"`. `project-config --help` says how the templates work. ```sh diff --git a/bin/deploy_release/cut.py b/bin/deploy_release/cut.py index 62a088bf..0ee55f03 100644 --- a/bin/deploy_release/cut.py +++ b/bin/deploy_release/cut.py @@ -110,8 +110,8 @@ def same_origin(clone: str, checkout: str) -> Failure | None: def clone_plan(clone: str) -> FilePlan: """The clone's plan, at the path this repo keeps it. ready_release only reads it; FilePlan also takes the files a write would rank it against.""" - decisions, history = (FileStore(pathlib.Path(clone, path), path) for path in ("docs/decisions.md", "docs/comprehension-history.md")) - return FilePlan(pathlib.Path(clone, "todo.md"), "todo.md", pathlib.Path(clone, "README.md"), decisions, history) + goals, decisions, history = (FileStore(pathlib.Path(clone, path), path) for path in ("README.md", "docs/decisions.md", "docs/comprehension-history.md")) + return FilePlan(pathlib.Path(clone, "todo.md"), "todo.md", goals, decisions, history) def ready_release(clone: str, ref: str) -> Release | Failure: diff --git a/bin/larv_review/reviewer_header.py b/bin/larv_review/reviewer_header.py index 0076b3ca..a079a85e 100644 --- a/bin/larv_review/reviewer_header.py +++ b/bin/larv_review/reviewer_header.py @@ -6,8 +6,8 @@ from git_cli.git_repo import branch_titles, git, top from review_rules.round_titles import cap, round_counts from failure import Failure from chunk_preflight.choices import forge_of +from record_store.stores import goals_store, local_file, store from larv_review.history_commands import history_file, places_report -from record_store.stores import local_file, store from project_config.main import located, title_templates from review_rules.review_folder import made_review_folder from deploy_release.forge import open_pull, runner @@ -99,7 +99,11 @@ def reviewer_header(default: str, pass_: str, rerun: bool, home: pathlib.Path) - decisions = local_file(store(config, "decisions"), folder / "decisions.md") if isinstance(decisions, Failure): return decisions - launch = Launch(pass_, round_, rerun, pull_named(worktree, branch), worktree, branch, base, default, folder, folder / f"branch-{head}.diff", principles, config.paths["goals-and-audience"], starts_bare(next((agent for name, agent in REVIEWERS.items() if name == pass_), ""), home), config.paths["working-rules"], decisions, config.language) + # A reviewer reads files, so goals kept in a Jira epic's description are copied into the review folder. + goals = local_file(goals_store(config), folder / "goals.md") + if isinstance(goals, Failure): + return goals + launch = Launch(pass_, round_, rerun, pull_named(worktree, branch), worktree, branch, base, default, folder, folder / f"branch-{head}.diff", principles, goals, starts_bare(next((agent for name, agent in REVIEWERS.items() if name == pass_), ""), home), config.paths["working-rules"], decisions, config.language) if rerun and not launch.asked().exists(): return Failure(f"no report asked for a rerun of {pass_}'s round {round_}: {launch.asked()} is missing; relaunch before you commit the round's answers") written = write_inputs(launch, base, home) diff --git a/bin/larv_review/test_larv_review.py b/bin/larv_review/test_larv_review.py index 2657aad3..91827eb8 100644 --- a/bin/larv_review/test_larv_review.py +++ b/bin/larv_review/test_larv_review.py @@ -22,13 +22,13 @@ from larv_review.ruling import counted, ruling, split, surplus, votes from larv_review.history_commands import decided, rerank from failure import Failure from plan_store.stores import FilePlan +from record_store.stores import FileStore from larv_review.scoring import floor_step, means, under_floor from test_env import isolated_env from release_plan.todo_table import Item, items, NoItemsTable from release_plan.release_standing import LastCut from larv_review.ruling_base import measured_commit from record_store.fakes import MemoryStore -from record_store.fakes import MemoryStore from larv_review.seats import score_line, scores, seats_file, SeatsFile from larv_review.owed import shortfall @@ -154,7 +154,7 @@ class Seats(unittest.TestCase): def test_checkout_plan_fails_on_a_missing_or_tableless_todo(self): with tempfile.TemporaryDirectory() as checkout: path = pathlib.Path(checkout, "todo.md") - plan = FilePlan(path, "todo.md", pathlib.Path(checkout, "README.md"), MemoryStore(), MemoryStore()) + plan = FilePlan(path, "todo.md", FileStore(pathlib.Path(checkout, "README.md"), None), MemoryStore(), MemoryStore()) with self.subTest("missing"): self.assertEqual(checkout_plan(plan).reason, f"the project's plan: {path}: not found; every project keeps a todo.md, and rank_todo.py --help shows one") with self.subTest("no items table"): @@ -932,7 +932,7 @@ class LarvReviewTool(unittest.TestCase): # This checkout has no README.md beside its todo.md. ran = self.record_sevens() self.assertEqual(ran.returncode, 1) - self.assertIn(f"recorded the run, but rank_todo.py cannot rank {self.checkout / 'todo.md'}: {self.checkout / 'README.md'}: not found", ran.stderr) + self.assertIn(f"recorded the run, but rank_todo.py cannot rank {self.checkout / 'todo.md'}: {self.checkout / 'README.md'}: missing or empty", ran.stderr) self.assertIn("not record-scoring again", ran.stderr) self.assertEqual(len(entries((self.checkout / "docs" / "comprehension-history.md").read_text())), 1) diff --git a/bin/loop_claude/loop/usage.py b/bin/loop_claude/loop/usage.py index 477ebb5e..b9b0a3d5 100644 --- a/bin/loop_claude/loop/usage.py +++ b/bin/loop_claude/loop/usage.py @@ -4,8 +4,9 @@ usage: loop-claude Run it anywhere inside a project checkout whose goals file has ## Goals and ## Audience, the premises. The goals file is the one the project's config, ~/.claude-projects//config.toml, sets -as goals-and-audience; `project-config goals-and-audience` prints it. The task runs at the checkout -root. Each cycle a worker runs the task. A chunk's first worker prompt also quotes the premises. +as goals-and-audience: a file, or a Jira epic whose description holds it. `project-config +goals-and-audience` prints where it is. The task runs at the checkout root. +Each cycle a worker runs the task. A chunk's first worker prompt also quotes the premises. They, with code health (~/.claude/CLAUDE.md → "Shared goal") ranked first unless the goals file voids it, choose between ways to deliver the chunk's todo.md items, or else the task, and never widen them. A judge then reads the transcript's end, the premises, and the records: the project's diff --git a/bin/loop_claude/project/premises.py b/bin/loop_claude/project/premises.py index 15f9c3b4..665229a8 100644 --- a/bin/loop_claude/project/premises.py +++ b/bin/loop_claude/project/premises.py @@ -1,23 +1,26 @@ import pathlib from failure import Failure -from project_config.main import goals_file -from loop_claude.project.text_file import read_utf8 +from record_store.stores import goals_store +from project_config.main import located from release_plan.goals_file import section def read_premises(root: str, home: pathlib.Path) -> str | Failure: - """The goals file's path, then its ## Goals and ## Audience; the goals file is the one that the config under home of root's project names. A Failure where no config names root's checkout, the file cannot be read, or the file lacks a section, holds one twice or leaves one empty.""" - path = goals_file(root, home) - if isinstance(path, Failure): - return Failure(f"{path.reason} - no premises.") - text = read_utf8(str(path.parent), path.name, "no premises") + """Where the goals file is kept, then its ## Goals and ## Audience; the goals file is the one that the config under home of root's project names, a file or a Jira epic's description. A Failure where no config names root's checkout, the goals file cannot be read or is empty, or it lacks a section, holds one twice or leaves one empty.""" + config = located(root, home) + if isinstance(config, Failure): + return Failure(f"{config.reason} - no premises.") + goals = goals_store(config) + text = goals.read() if isinstance(text, Failure): - return text + return Failure(f"{text.reason} - no premises.") + if not text: + return Failure(f"{goals.label} is missing or empty - no premises.") bodies: list[str] = [] for name in ("Goals", "Audience"): body = section(text, name) if isinstance(body, Failure): - return Failure(f"{path} {body.reason} - no premises.") + return Failure(f"{goals.label} {body.reason} - no premises.") bodies.append(body) - return f"{path}:\n## Goals\n{bodies[0]}\n\n## Audience\n{bodies[1]}" + return f"{goals.label}:\n## Goals\n{bodies[0]}\n\n## Audience\n{bodies[1]}" diff --git a/bin/loop_claude/test_black_box.py b/bin/loop_claude/test_black_box.py index aea77101..38a375b1 100644 --- a/bin/loop_claude/test_black_box.py +++ b/bin/loop_claude/test_black_box.py @@ -335,8 +335,8 @@ class Premises(unittest.TestCase): self.assertEqual((run.code, run.calls), (1, [])) self.assertRegex(run.raw_stderr, rf"(?m)^{STAMP} .*not a git repository") readmes = { - None: "README.md in {root}: No such file or directory - no premises.", - b"# P\n## Goals\n1. g\xff\n## Audience\nme\n": "README.md in {root} is not UTF-8 on line 3 - no premises.", + None: "{root}/README.md is missing or empty - no premises.", + b"# P\n## Goals\n1. g\xff\n## Audience\nme\n": "cannot read {root}/README.md: not UTF-8 on line 3 - no premises.", b"# P\n## Audience\nme\n": "{root}/README.md has no ## Goals heading - no premises.", b"# P\n## Goals\n1. g\n": "{root}/README.md has no ## Audience heading - no premises.", b"# P\n## Goals\n\n## Audience\nme\n": "{root}/README.md has no text under ## Goals - no premises.", @@ -356,7 +356,7 @@ class Premises(unittest.TestCase): (checkout.root / "README.md").mkdir() run = checkout.run([worker()]) self.assertEqual((run.code, run.calls), (1, [])) - self.assertEqual(run.stderr.strip(), f"README.md in {checkout.root}: Is a directory - no premises.") + self.assertEqual(run.stderr.strip(), f"cannot read {checkout.root}/README.md: Is a directory - no premises.") (checkout.home / ".claude-projects" / "proj" / "config.toml").unlink() run = checkout.run([worker()]) self.assertEqual((run.code, run.calls), (1, [])) diff --git a/bin/plan_store/stores.py b/bin/plan_store/stores.py index 3c0c8d36..60aae6d8 100644 --- a/bin/plan_store/stores.py +++ b/bin/plan_store/stores.py @@ -10,10 +10,10 @@ import typing from release_plan.todo_table import BLOCKED_BY, Item, item_details, items, MOVES, NoItemsTable, renames from failure import Failure from git_cli.git_repo import file_at, git, Git +from record_store.stores import goals_store, store as record_store, RecordStore from plan_store import markdown_edits from project_config.settings import ProjectConfig from release_plan import ranking -from record_store.stores import store as record_store, RecordStore from release_plan.release import Release from text_files.file_writes import replace_file @@ -22,8 +22,9 @@ TAGLINE = "Tagline" FIELDS = ("Release", BLOCKED_BY, "Exempt", TAGLINE, "L", "E", "I", "S", MOVES) -# What a missing todo.md's reader is told. +# What the reader of a missing todo.md, or of a missing or empty goals file, is told. MISSING = "every project keeps a todo.md, and rank_todo.py --help shows one" +GOALS_HINT = "rank_todo.py weighs goals from the goals file the project's config names as goals-and-audience" @dataclasses.dataclass(frozen=True) @@ -69,10 +70,10 @@ class PlanStore(typing.Protocol): @dataclasses.dataclass(frozen=True) class FilePlan: - """A plan kept as a markdown file at path, in the shape `rank_todo.py --help` shows. Every write ranks the file, reading the goals file at goals, the decision log and the comprehension history.""" + """A plan kept as a markdown file at path, in the shape `rank_todo.py --help` shows. Every write ranks the file, reading the goals file from goals, the decision log and the comprehension history.""" path: pathlib.Path tracked: str | None - goals: pathlib.Path + goals: RecordStore decisions: RecordStore history: RecordStore @@ -128,13 +129,15 @@ class FilePlan: return Written(id_, tuple(f"{self.path}: {line}" for line in ranked.notes + ranked.under_bar)) def texts(self) -> tuple[str, str, str, str] | Failure: - """What ranking reads: the file, the goals file, the decision log and the comprehension history. The last two are empty when missing; a missing plan or goals file is a Failure.""" + """What ranking reads: the file, the goals file, the decision log and the comprehension history. The last two are empty when missing; a missing plan, or a goals file that is missing or empty, is a Failure.""" plan = read_text(self.path, MISSING) if isinstance(plan, Failure): return plan - goals = read_text(self.goals, "rank_todo.py weighs goals from the file the project's config names as goals-and-audience") + goals = self.goals.read() if isinstance(goals, Failure): return goals + if not goals: + return Failure(f"{self.goals.label}: missing or empty; {GOALS_HINT}") decisions = self.decisions.read() if isinstance(decisions, Failure): return decisions @@ -155,7 +158,7 @@ def store(config: ProjectConfig) -> PlanStore: def file_plan(config: ProjectConfig, path: pathlib.Path | None = None) -> FilePlan: """The markdown file config names as its plan, for a tool that works on the file itself, as ranking does. path stands in for the configured one where given.""" - return FilePlan(path or config.paths["plan"], config.tracked("plan"), config.paths["goals-and-audience"], record_store(config, "decisions"), record_store(config, "comprehension-history")) + return FilePlan(path or config.paths["plan"], config.tracked("plan"), goals_store(config), record_store(config, "decisions"), record_store(config, "comprehension-history")) def held_at(revision: str, plan: PlanStore, cwd: str, run: Git = git) -> Plan | Failure: diff --git a/bin/plan_store/test_stores.py b/bin/plan_store/test_stores.py index 8397fd1e..06444ef8 100644 --- a/bin/plan_store/test_stores.py +++ b/bin/plan_store/test_stores.py @@ -9,6 +9,7 @@ sys.path.insert(0, str(pathlib.Path(__file__).resolve().parents[1])) from project_config.settings import Epic, ProjectConfig, SETTINGS from failure import Failure +from record_store.stores import FileStore from plan_store.contract import FIRST, PlanStoreContract, SECOND from plan_store.jira_epic import JiraPlan from plan_store.fakes import MemoryPlan @@ -33,7 +34,7 @@ class FilePlanContract(PlanStoreContract, unittest.TestCase): def new_store(self) -> stores.FilePlan: (self.folder / "todo.md").write_text(EMPTY) (self.folder / "README.md").write_text(README) - return stores.FilePlan(self.folder / "todo.md", "todo.md", self.folder / "README.md", MemoryStore(), MemoryStore()) + return stores.FilePlan(self.folder / "todo.md", "todo.md", FileStore(self.folder / "README.md", None), MemoryStore(), MemoryStore()) class FilePlan(FilePlanContract): diff --git a/bin/project_config/main.py b/bin/project_config/main.py index ee85fcbf..657827f9 100644 --- a/bin/project_config/main.py +++ b/bin/project_config/main.py @@ -26,6 +26,10 @@ starts with / or ~/. In a worktree, a "checkout:" path is the worktree's own fil Jira's backlog order, and `project-config plan` prints the setting as the config spells it. Such a config must set `env-file`, and that file must hold ATLASSIAN_EMAIL and ATLASSIAN_API_TOKEN. +`goals-and-audience` may name a Jira Cloud epic the same way. Its description is then the goals +file, with ## Goals and ## Audience as headings, and the same `env-file` rule holds. It is only +read: edit the description in Jira. Reviewers get a copy in the review folder. + `env-file` is an optional setting: the file of KEY=value credentials the project's tools read, a path that starts with / or ~/ and lies outside the checkout and the config's folder, such as "~/.claude-projects/acme-billing.env". Where it is left out, the project has no credentials file, and @@ -129,8 +133,3 @@ def project() -> ProjectConfig | Failure: """The config of the project whose checkout holds the current directory, under the user's home.""" return located(None, pathlib.Path.home()) - -def goals_file(directory: str, home: pathlib.Path) -> pathlib.Path | Failure: - """The file holding the premises, `## Goals` and `## Audience`, of the project whose checkout holds directory, as its config under home names it.""" - config = located(directory, home) - return config if isinstance(config, Failure) else config.paths["goals-and-audience"] diff --git a/bin/project_config/settings.py b/bin/project_config/settings.py index 37797991..6c81a701 100644 --- a/bin/project_config/settings.py +++ b/bin/project_config/settings.py @@ -25,9 +25,12 @@ COMMIT_TITLE = "commit-title" PULL_REQUEST_TITLE = "pull-request-title" BRANCH = "branch" OPTIONAL = (BRANCH, COMMIT_TITLE, ENV_FILE, LANGUAGE, PULL_REQUEST_TITLE, WAIT_FOR_APPROVAL) -# What opens a `plan` setting that names a Jira Cloud epic in place of a path: `jira:`, then the epic's address as the browser shows it. `plan` is the one setting that may name something other than a path. +# What opens a setting that names a Jira Cloud epic in place of a path: `jira:`, then the epic's address as the browser shows it. Only `plan` and `goals-and-audience` may name something other than a path; the same spelling serves both, since the setting says what of the epic is meant. JIRA = "jira:" -EPIC_SPELLING = '"jira:https:///browse/" for a plan kept as a Jira Cloud epic\'s child issues' +EPIC_SPELLINGS = { + "plan": '"jira:https:///browse/" for a plan kept as a Jira Cloud epic\'s child issues', + "goals-and-audience": '"jira:https:///browse/" for goals and audience kept in a Jira Cloud epic\'s description', +} OUTSIDE = "a path that starts with / or ~/ and lies outside the checkout and the config's folder, so that no git remote receives the credentials" @@ -50,7 +53,7 @@ class Epic: @dataclasses.dataclass(frozen=True) class ProjectConfig: - """folder is `~/.claude-projects/`, top is the worktree that asked, and paths holds each of SETTINGS as an absolute path, except `plan` where the plan is kept in Jira.""" + """folder is `~/.claude-projects/`, top is the worktree that asked, and paths holds each of SETTINGS as an absolute path, except `plan` and `goals-and-audience` where they are kept in Jira.""" key: str folder: pathlib.Path top: pathlib.Path @@ -64,6 +67,8 @@ class ProjectConfig: branch: str = templates.BRANCH # The epic whose child issues are the plan, where the config's `plan` names one. epic: Epic | None = None + # The epic whose description holds the goals and audience, where the config's `goals-and-audience` names one. + goals_epic: Epic | None = None @property def plan_file(self) -> pathlib.Path | None: @@ -78,7 +83,8 @@ class ProjectConfig: @property def places(self) -> dict[str, str]: """Where each of SETTINGS is kept, in SETTINGS' order: a path, or the epic as the config spells it.""" - return {name: self.plan_label if name == "plan" else str(self.paths[name]) for name in SETTINGS if name == "plan" or name in self.paths} + epics = {"plan": self.epic, "goals-and-audience": self.goals_epic} + return {name: epic.spelling if (epic := epics.get(name)) else str(self.paths[name]) for name in SETTINGS if epics.get(name) or name in self.paths} @property def texts(self) -> dict[str, str]: @@ -116,7 +122,7 @@ def load(top: pathlib.Path, main: pathlib.Path, home: pathlib.Path) -> ProjectCo return Failure(f"{' and '.join(str(file) for file, _ in named)} each name the checkout {main}; only one config may") file, values = named[0] paths = {name: placed(values[name], top, file.parent, home) for name in SETTINGS if name in values} - epic = epic_of(values.get("plan")) + epics = {name: epic_of(values.get(name)) for name in EPIC_SPELLINGS} env_file = anywhere(values.get(ENV_FILE), home) misplaced = ENV_FILE in values and (env_file is None or lies_in(env_file, top, main, file.parent)) waits = values.get(WAIT_FOR_APPROVAL, False) @@ -124,16 +130,16 @@ def load(top: pathlib.Path, main: pathlib.Path, home: pathlib.Path) -> ProjectCo faults = [ *(f"`{name}` is missing" for name in SETTINGS if name not in values), *(f"`{name}` is not a setting" for name in values if name not in (*SETTINGS, *OPTIONAL)), - *(f"`{name}` is {values[name]!r}, not {SPELLING}" for name, path in paths.items() if path is None and name != "plan"), - *([f"`plan` is {values['plan']!r}, not {SPELLING}, or {EPIC_SPELLING}"] if "plan" in values and paths["plan"] is None and epic is None else []), - *([f"`plan` names a Jira epic, so `{ENV_FILE}` must name the file that holds its credentials"] if epic and ENV_FILE not in values else []), + *(f"`{name}` is {values[name]!r}, not {SPELLING}" for name, path in paths.items() if path is None and name not in EPIC_SPELLINGS), + *(f"`{name}` is {values[name]!r}, not {SPELLING}, or {EPIC_SPELLINGS[name]}" for name in EPIC_SPELLINGS if name in values and paths[name] is None and epics[name] is None), + *(f"`{name}` names a Jira epic, so `{ENV_FILE}` must name the file that holds its credentials" for name, epic in epics.items() if epic and ENV_FILE not in values), *([f"`{ENV_FILE}` is {values[ENV_FILE]!r}, not {OUTSIDE}"] if misplaced else []), *([f"`{WAIT_FOR_APPROVAL}` is {waits!r}, not true or false"] if not isinstance(waits, bool) else []), *(f"`{name}` is {values[name]!r}, {fault}" for name, check in checks.items() if name in values and (fault := check(values[name]))), ] if faults: return Failure(f"{file}: {'; '.join(faults)}. The settings are {', '.join(SETTINGS)}, and optionally {', '.join(OPTIONAL[:-1])} and {OPTIONAL[-1]}.") - return ProjectConfig(file.parent.name, file.parent, top, {name: path for name, path in paths.items() if path}, env_file, waits is True, **{name.replace("-", "_"): str(values[name]) for name in checks if name in values}, epic=epic) + return ProjectConfig(file.parent.name, file.parent, top, {name: path for name, path in paths.items() if path}, env_file, waits is True, **{name.replace("-", "_"): str(values[name]) for name in checks if name in values}, epic=epics["plan"], goals_epic=epics["goals-and-audience"]) def epic_of(value: object) -> Epic | None: diff --git a/bin/project_config/test_project_config.py b/bin/project_config/test_project_config.py index d3631fd7..5c358a3a 100644 --- a/bin/project_config/test_project_config.py +++ b/bin/project_config/test_project_config.py @@ -116,6 +116,38 @@ class LoadTest(ConfigCase): for config in (self.home / ".claude-projects").glob("*/config.toml"): config.unlink() + def test_goals_and_audience_spelt_as_a_jira_epic_is_no_path(self) -> None: + self.write("acme", CLIENT.replace("folder:goals.md", JIRA_PLAN) + 'env-file = "~/acme.env"\n') + found = load(self.checkout, self.checkout, self.home) + assert isinstance(found, ProjectConfig), found + self.assertEqual((found.goals_epic, found.epic), (Epic("https://acme.atlassian.net", "ABC-12"), None)) + self.assertEqual(found.places["goals-and-audience"], JIRA_PLAN) + self.assertEqual(tuple(found.places), SETTINGS) + self.assertNotIn("goals-and-audience", found.paths) + + def test_goals_and_the_plan_may_name_the_same_epic(self) -> None: + self.write("acme", JIRA_CLIENT.replace("folder:goals.md", JIRA_PLAN)) + found = load(self.checkout, self.checkout, self.home) + assert isinstance(found, ProjectConfig), found + self.assertEqual(found.goals_epic, found.epic) + + def test_goals_kept_as_a_file_have_no_epic(self) -> None: + folder = self.write("acme", CLIENT) + found = load(self.checkout, self.checkout, self.home) + assert isinstance(found, ProjectConfig), found + self.assertEqual((found.goals_epic, found.places["goals-and-audience"]), (None, str(folder / "goals.md"))) + + def test_goals_in_jira_need_an_env_file(self) -> None: + self.write("acme", CLIENT.replace("folder:goals.md", JIRA_PLAN)) + self.assertIn("`goals-and-audience` names a Jira epic, so `env-file` must name the file that holds its credentials", self.failure()) + + def test_goals_that_spell_no_path_and_no_epic_name_both_spellings(self) -> None: + self.write("acme", CLIENT.replace("folder:goals.md", "jira:http://acme.atlassian.net/browse/ABC-12") + 'env-file = "~/acme.env"\n') + reason = self.failure() + self.assertIn("`goals-and-audience` is 'jira:http://acme.atlassian.net/browse/ABC-12', not ", reason) + self.assertIn("jira:https:///browse/", reason) + self.assertIn("description", reason) + def test_a_worktree_finds_the_main_checkouts_config_and_reads_its_own_files(self) -> None: self.write("acme", CLIENT) worktree = self.home / "code" / "acme-billing-item-3" diff --git a/bin/record_store/jira_description.py b/bin/record_store/jira_description.py new file mode 100644 index 00000000..7ad27d7c --- /dev/null +++ b/bin/record_store/jira_description.py @@ -0,0 +1,53 @@ +"""A project's goals and audience kept as the description of one Jira Cloud epic, read over Jira's REST API with the plan store's credentials and the adf-codec shim. + +The store only reads: a write is a Failure, so a tool that edits the goals file says to edit the epic in Jira.""" +import dataclasses +import pathlib + +from adf_codec.convert import adfs_to_markdown, Refused +from plan_store.jira_epic import basic_auth, Http, http_json, ToMarkdown +from project_config.settings import Epic +from failure import Failure + +READ_ONLY = "goals and audience kept in Jira are only read: edit the epic's description in Jira" + + +@dataclasses.dataclass(frozen=True) +class EpicDescription: + """The description of epic as markdown, read with the credentials env_file holds.""" + epic: Epic + env_file: pathlib.Path + http: Http = http_json + to_markdown: ToMarkdown = adfs_to_markdown + + @property + def label(self) -> str: + return self.epic.spelling + + @property + def tracked(self) -> str | None: + return None + + def read(self) -> str | Failure: + """The description as markdown; empty where the epic has none.""" + authorization = basic_auth(self.env_file) + if isinstance(authorization, Failure): + return authorization + key = self.epic.key + answer = self.http("GET", f"{self.epic.site}/rest/api/3/issue/{key}?fields=description", authorization, None) + if isinstance(answer, Failure): + return Failure(f"cannot read the epic {key}: {answer.reason}") + fields = answer.get("fields") if isinstance(answer, dict) else None + if not isinstance(fields, dict) or "description" not in fields or not isinstance(fields["description"], dict | None): + return Failure(f"the epic {key} is not in the shape Jira Cloud's REST API version 3 documents: it holds no description field of a document or null") + if fields["description"] is None: + return "" + texts = self.to_markdown([fields["description"]]) + if isinstance(texts, Refused): + return Failure(f"{key}'s description: {texts.failure.reason}") + if isinstance(texts, Failure): + return Failure(f"cannot convert {key}'s description to markdown: {texts.reason}") + return texts[0] + + def write(self, text: str) -> Failure | None: + return Failure(READ_ONLY) diff --git a/bin/record_store/stores.py b/bin/record_store/stores.py index 92445e38..93e15944 100644 --- a/bin/record_store/stores.py +++ b/bin/record_store/stores.py @@ -1,6 +1,6 @@ """The one way a tool reads or writes a project's records: through the store its config names for each. -Each record has its own setting in the config, so a project may keep one record in its wiki and another as a file. The setting's value names the backend. A path names a markdown file, the only backend so far.""" +Each record has its own setting in the config, so a project may keep one record in its wiki and another as a file. The setting's value names the backend. A path names a markdown file, the only backend of a record so far; the goals file may also be a Jira epic's description, which `goals_store` reads.""" import dataclasses import pathlib import typing @@ -68,6 +68,17 @@ def store(config: ProjectConfig, record: str) -> RecordStore: return FileStore(config.paths[record], config.tracked(record)) +def goals_store(config: ProjectConfig) -> RecordStore: + """The store config names for the goals file, which holds ## Goals and ## Audience: a markdown file, or the description of a Jira epic, which only reads.""" + if config.goals_epic is None: + return FileStore(config.paths["goals-and-audience"], config.tracked("goals-and-audience")) + # Imported here, since the Jira store builds on plan_store, which builds on this module. + from record_store.jira_description import EpicDescription + # load refuses a config that names an epic and no env-file. + assert config.env_file is not None + return EpicDescription(config.goals_epic, config.env_file) + + def held_at(revision: str, record: RecordStore, cwd: str, run: Git = git) -> str | Failure: """record's text at revision, read in the checkout at cwd, where its commits hold the record; else as it stands. Empty where there is no such record.""" return record.read() if record.tracked is None else file_at(revision, record.tracked, cwd, run) diff --git a/bin/record_store/test_jira_description.py b/bin/record_store/test_jira_description.py new file mode 100644 index 00000000..07bf1292 --- /dev/null +++ b/bin/record_store/test_jira_description.py @@ -0,0 +1,89 @@ +import base64 +import pathlib +import sys +import tempfile +import unittest + +sys.path.insert(0, str(pathlib.Path(__file__).resolve().parents[1])) + +from project_config.settings import Epic +from record_store.jira_description import EpicDescription +from failure import Failure +from adf_codec.convert import Refused + +EPIC = Epic("https://acme.atlassian.net", "ABC-12") +AUTHORIZATION = "Basic " + base64.b64encode(b"me@example.com:s3cret").decode() +GOALS = {"type": "doc", "version": 1, "content": [{"type": "heading", "attrs": {"level": 2}, "content": [{"type": "text", "text": "Goals"}]}]} + + +class EpicDescriptionTest(unittest.TestCase): + def setUp(self) -> None: + self.env = pathlib.Path(self.enterContext(tempfile.TemporaryDirectory())) / "acme.env" + self.env.write_text("ATLASSIAN_EMAIL=me@example.com\nATLASSIAN_API_TOKEN=s3cret\n") + self.env.chmod(0o600) + self.answer: object = {"key": "ABC-12", "fields": {"description": GOALS}} + self.calls: list[tuple[str, str, str, object]] = [] + self.converted: list[list[dict[str, object]]] = [] + self.markdown: list[str] | Refused | Failure = ["## Goals\n1. **Achieve:** Ship.\n"] + + def http(self, method: str, url: str, authorization: str, body: object) -> object: + self.calls.append((method, url, authorization, body)) + return self.answer + + def to_markdown(self, documents: list[dict[str, object]]) -> list[str] | Refused | Failure: + self.converted.append(documents) + return self.markdown + + def store(self) -> EpicDescription: + return EpicDescription(EPIC, self.env, self.http, self.to_markdown) + + def test_reads_the_epics_description_as_markdown(self) -> None: + self.assertEqual(self.store().read(), "## Goals\n1. **Achieve:** Ship.\n") + self.assertEqual(self.calls, [("GET", "https://acme.atlassian.net/rest/api/3/issue/ABC-12?fields=description", AUTHORIZATION, None)]) + self.assertEqual(self.converted, [[GOALS]]) + + def test_is_named_as_the_config_spells_it_and_held_in_no_commit(self) -> None: + self.assertEqual((self.store().label, self.store().tracked), ("jira:https://acme.atlassian.net/browse/ABC-12", None)) + + def test_an_epic_without_a_description_reads_empty(self) -> None: + self.answer = {"key": "ABC-12", "fields": {"description": None}} + self.assertEqual(self.store().read(), "") + self.assertEqual(self.converted, []) + + def test_an_unreadable_epic_fails_naming_it(self) -> None: + self.answer = Failure("HTTP 404: Issue does not exist") + found = self.store().read() + assert isinstance(found, Failure), found + self.assertIn("ABC-12", found.reason) + self.assertIn("HTTP 404", found.reason) + + def test_an_answer_in_another_shape_fails(self) -> None: + for answer in ({"key": "ABC-12"}, {"fields": {"description": "text"}}, ["ABC-12"]): + with self.subTest(answer): + self.answer = answer + found = self.store().read() + assert isinstance(found, Failure), found + self.assertIn("ABC-12", found.reason) + + def test_a_description_the_shim_refuses_fails(self) -> None: + for markdown in (Refused(0, Failure("an unsupported node")), Failure("docker is not running")): + with self.subTest(markdown): + self.markdown = markdown + found = self.store().read() + assert isinstance(found, Failure), found + self.assertIn("ABC-12", found.reason) + + def test_missing_credentials_fail(self) -> None: + self.env.unlink() + self.assertIsInstance(self.store().read(), Failure) + self.assertEqual(self.calls, []) + + def test_writing_fails_since_the_store_only_reads(self) -> None: + found = self.store().write("## Goals\n") + assert isinstance(found, Failure), found + self.assertIn("Jira", found.reason) + self.assertEqual(self.calls, []) + + +if __name__ == "__main__": + unittest.main() diff --git a/bin/record_store/test_stores.py b/bin/record_store/test_stores.py index fbeeef29..90d861f7 100644 --- a/bin/record_store/test_stores.py +++ b/bin/record_store/test_stores.py @@ -6,9 +6,10 @@ import unittest sys.path.insert(0, str(pathlib.Path(__file__).resolve().parents[1])) +from project_config.settings import Epic, ProjectConfig +from record_store.jira_description import EpicDescription from failure import Failure from record_store.fakes import MemoryStore -from project_config.settings import ProjectConfig from record_store.contract import RecordStoreContract from record_store import stores @@ -171,5 +172,17 @@ class Store(unittest.TestCase): self.assertEqual(str(refused.exception), "plan is not a record; the records are decisions, score-anchors, comprehension-history, reading-cost, changelog") +class GoalsStore(unittest.TestCase): + def test_goals_kept_as_a_file_are_that_file(self): + top = pathlib.Path("/code/acme") + store = stores.goals_store(ProjectConfig("acme", pathlib.Path("/home/me/.claude-projects/acme"), top, {"goals-and-audience": top / "README.md"})) + self.assertEqual((store.label, store.tracked), ("/code/acme/README.md", "README.md")) + + def test_goals_kept_in_jira_are_the_epics_description(self): + epic = Epic("https://acme.atlassian.net", "ABC-12") + store = stores.goals_store(ProjectConfig("acme", pathlib.Path("/home/me/.claude-projects/acme"), pathlib.Path("/code/acme"), {}, pathlib.Path("/home/me/acme.env"), goals_epic=epic)) + self.assertEqual(store, EpicDescription(epic, pathlib.Path("/home/me/acme.env"))) + + if __name__ == "__main__": unittest.main() diff --git a/bin/release_plan/test_release_standing.py b/bin/release_plan/test_release_standing.py index c501ad7e..a0de4d48 100644 --- a/bin/release_plan/test_release_standing.py +++ b/bin/release_plan/test_release_standing.py @@ -26,7 +26,7 @@ ROW = "| {id} | {release} | | | **Do {id}.** | 1 | 1 | 1 | 1 | 1 | 1 by 1 | 10 def plan_at(path: pathlib.Path, tracked: str | None) -> FilePlan: """The markdown plan at path, which these tests only read.""" - return FilePlan(path, tracked, path.parent / "README.md", MemoryStore(), MemoryStore()) + return FilePlan(path, tracked, FileStore(path.parent / "README.md", None), MemoryStore(), MemoryStore()) def plan_in(repo: str) -> FilePlan: diff --git a/bin/test_rank_todo.py b/bin/test_rank_todo.py index 3fc726de..9805eec1 100644 --- a/bin/test_rank_todo.py +++ b/bin/test_rank_todo.py @@ -33,9 +33,9 @@ class Main(unittest.TestCase): self.assertEqual(self.run_main(str(todo)), (0, "")) self.assertEqual(self.run_main("--check", str(todo)), (0, "")) pathlib.Path(temp, "README.md").write_bytes(b"\xff") - self.assertEqual(self.run_main(str(todo)), (1, f"{temp}/README.md: not UTF-8\n")) + self.assertEqual(self.run_main(str(todo)), (1, f"cannot read {temp}/README.md: not UTF-8 on line 1\n")) pathlib.Path(temp, "README.md").unlink() - self.assertEqual(self.run_main(str(todo)), (1, f"{temp}/README.md: not found; rank_todo.py weighs goals from the file the project's config names as goals-and-audience\n")) + self.assertEqual(self.run_main(str(todo)), (1, f"{temp}/README.md: missing or empty; rank_todo.py weighs goals from the goals file the project's config names as goals-and-audience\n")) todo.unlink() self.assertEqual(self.run_main(str(todo)), (1, f"{todo}: not found; every project keeps a todo.md, and rank_todo.py --help shows one\n")) -- 2.52.0 From 0d16290e3876ad93795bee6395a238a3bcb61828 Mon Sep 17 00:00:00 2001 From: Lilleman auf Larv Date: Sat, 14 Nov 2026 21:08:44 +0100 Subject: [PATCH 04/10] Test each message read_premises fails with --- bin/loop_claude/test_loop_claude.py | 33 ++++++++++++++++++++++++++++- 1 file changed, 32 insertions(+), 1 deletion(-) diff --git a/bin/loop_claude/test_loop_claude.py b/bin/loop_claude/test_loop_claude.py index 04a78edb..a5f9db0f 100644 --- a/bin/loop_claude/test_loop_claude.py +++ b/bin/loop_claude/test_loop_claude.py @@ -19,7 +19,7 @@ sys.path.insert(0, str(pathlib.Path(__file__).resolve().parents[1])) from routing_figures import archive, state from routing_figures.calls import Call -from loop_claude.project import checkout, model_choice, records +from loop_claude.project import checkout, model_choice, premises, records from loop_claude.cycle import chunk_items from loop_claude.loop import chunk_start, close from project_config.test_project_config import configured @@ -916,6 +916,37 @@ class RoutingCheck(unittest.TestCase): self.assertTrue(sent.startswith(f"loop-claude in {self.loop(fake).root} asks:\n\nloop-claude's routing figures call for a routing change:\n- {new[0].sentence()}\n"), sent) +class Premises(unittest.TestCase): + def setUp(self) -> None: + self.root = pathlib.Path(self.enterContext(tempfile.TemporaryDirectory())) + self.home = configured(self, self.root).parents[1] + self.readme = self.root / "README.md" + + def read(self) -> str | Failure: + return premises.read_premises(str(self.root), self.home) + + def test_quotes_the_goals_and_audience_under_the_goals_files_name(self) -> None: + self.readme.write_text("# P\n## Goals\n1. g\n## Audience\nme\n") + self.assertEqual(self.read(), f"{self.readme}:\n## Goals\n1. g\n\n## Audience\nme") + + def test_each_failure_says_why_and_that_there_are_no_premises(self) -> None: + for text, said in ((None, f"{self.readme} is missing or empty - no premises."), ("# P\n## Goals\n1. g\n", f"{self.readme} has no ## Audience heading - no premises.")): + with self.subTest(said): + self.readme.unlink(missing_ok=True) + if text is not None: + self.readme.write_text(text) + self.assertEqual(self.read(), Failure(said)) + self.readme.unlink() + self.readme.mkdir() + self.assertEqual(self.read(), Failure(f"cannot read {self.readme}: Is a directory - no premises.")) + + def test_fails_where_no_config_names_the_checkout(self) -> None: + found = premises.read_premises(str(self.root), self.root) + assert isinstance(found, Failure), found + self.assertTrue(found.reason.startswith("no config names the checkout"), found.reason) + self.assertTrue(found.reason.endswith(" - no premises."), found.reason) + + class ModelPrompt(unittest.TestCase): OFFERED = [("claude-opus-5-5", "Opus 5.5"), ("claude-haiku-4-5", "Haiku 4.5")] -- 2.52.0 From e38e45579f0c380f1150de00893e0f1c6e1bdad6 Mon Sep 17 00:00:00 2001 From: Lilleman auf Larv Date: Sat, 14 Nov 2026 21:09:49 +0100 Subject: [PATCH 05/10] =?UTF-8?q?Answer=20security=20round=201:=200=20?= =?UTF-8?q?=F0=9F=94=B4,=200=20=F0=9F=9F=A1=20(0=20misread)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit -- 2.52.0 From 3a2d72a0072ca0163044575880d43d44744841ab Mon Sep 17 00:00:00 2001 From: Lilleman auf Larv Date: Sat, 14 Nov 2026 21:27:23 +0100 Subject: [PATCH 06/10] =?UTF-8?q?Answer=20stability=20round=201:=200=20?= =?UTF-8?q?=F0=9F=94=B4,=204=20=F0=9F=9F=A1=20(0=20misread);=20keep=20goal?= =?UTF-8?q?s=20in=20Jira=20to=20projects=20whose=20plan=20is=20there,=20te?= =?UTF-8?q?st=20the=20reviewer=20header's=20Jira=20read,=20drop=20the=20re?= =?UTF-8?q?peated=20premises=20tests?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- bin/larv_review/test_larv_review.py | 11 ++++++++ bin/loop_claude/test_loop_claude.py | 33 +---------------------- bin/project_config/settings.py | 10 ++++--- bin/project_config/test_project_config.py | 10 ++++--- rules/goals-and-audience.md | 2 +- 5 files changed, 26 insertions(+), 40 deletions(-) diff --git a/bin/larv_review/test_larv_review.py b/bin/larv_review/test_larv_review.py index 91827eb8..cf4e455d 100644 --- a/bin/larv_review/test_larv_review.py +++ b/bin/larv_review/test_larv_review.py @@ -1199,6 +1199,17 @@ class LarvReviewTool(unittest.TestCase): self.config.write_text(PROJECT_CONFIG.replace('"checkout:README.md"', '"folder:goals.md"')) self.assertEqual(self.header_line("Goals and audience:", "principles"), f"Goals and audience: {self.config.parent}/goals.md") + def test_reviewer_header_fails_naming_the_epic_where_it_cannot_read_goals_kept_in_jira(self): + # Port 1 on the loopback refuses the connection, so the read fails without leaving the machine. + epic = "jira:https://127.0.0.1:1/browse/ABC-12" + credentials = self.config.parents[2] / "acme.env" + credentials.write_text("ATLASSIAN_EMAIL=me@example.com\nATLASSIAN_API_TOKEN=s3cret\n") + credentials.chmod(0o600) + self.config.write_text(PROJECT_CONFIG.replace('"checkout:todo.md"', f'"{epic}"').replace('"checkout:README.md"', f'"{epic}"') + 'env-file = "~/acme.env"\n') + ran = self.run_tool("reviewer-header", "prose") + self.assertEqual((ran.returncode, ran.stdout), (1, "")) + self.assertIn("cannot read the epic ABC-12", ran.stderr) + def test_reviewer_header_fails_with_the_configs_message_where_it_sets_no_principles_folder(self): self.config.write_text(PROJECT_CONFIG.replace('principles = "~/principles"\n', "")) ran = self.run_tool("reviewer-header", "prose") diff --git a/bin/loop_claude/test_loop_claude.py b/bin/loop_claude/test_loop_claude.py index a5f9db0f..04a78edb 100644 --- a/bin/loop_claude/test_loop_claude.py +++ b/bin/loop_claude/test_loop_claude.py @@ -19,7 +19,7 @@ sys.path.insert(0, str(pathlib.Path(__file__).resolve().parents[1])) from routing_figures import archive, state from routing_figures.calls import Call -from loop_claude.project import checkout, model_choice, premises, records +from loop_claude.project import checkout, model_choice, records from loop_claude.cycle import chunk_items from loop_claude.loop import chunk_start, close from project_config.test_project_config import configured @@ -916,37 +916,6 @@ class RoutingCheck(unittest.TestCase): self.assertTrue(sent.startswith(f"loop-claude in {self.loop(fake).root} asks:\n\nloop-claude's routing figures call for a routing change:\n- {new[0].sentence()}\n"), sent) -class Premises(unittest.TestCase): - def setUp(self) -> None: - self.root = pathlib.Path(self.enterContext(tempfile.TemporaryDirectory())) - self.home = configured(self, self.root).parents[1] - self.readme = self.root / "README.md" - - def read(self) -> str | Failure: - return premises.read_premises(str(self.root), self.home) - - def test_quotes_the_goals_and_audience_under_the_goals_files_name(self) -> None: - self.readme.write_text("# P\n## Goals\n1. g\n## Audience\nme\n") - self.assertEqual(self.read(), f"{self.readme}:\n## Goals\n1. g\n\n## Audience\nme") - - def test_each_failure_says_why_and_that_there_are_no_premises(self) -> None: - for text, said in ((None, f"{self.readme} is missing or empty - no premises."), ("# P\n## Goals\n1. g\n", f"{self.readme} has no ## Audience heading - no premises.")): - with self.subTest(said): - self.readme.unlink(missing_ok=True) - if text is not None: - self.readme.write_text(text) - self.assertEqual(self.read(), Failure(said)) - self.readme.unlink() - self.readme.mkdir() - self.assertEqual(self.read(), Failure(f"cannot read {self.readme}: Is a directory - no premises.")) - - def test_fails_where_no_config_names_the_checkout(self) -> None: - found = premises.read_premises(str(self.root), self.root) - assert isinstance(found, Failure), found - self.assertTrue(found.reason.startswith("no config names the checkout"), found.reason) - self.assertTrue(found.reason.endswith(" - no premises."), found.reason) - - class ModelPrompt(unittest.TestCase): OFFERED = [("claude-opus-5-5", "Opus 5.5"), ("claude-haiku-4-5", "Haiku 4.5")] diff --git a/bin/project_config/settings.py b/bin/project_config/settings.py index 6c81a701..175f100c 100644 --- a/bin/project_config/settings.py +++ b/bin/project_config/settings.py @@ -25,11 +25,11 @@ COMMIT_TITLE = "commit-title" PULL_REQUEST_TITLE = "pull-request-title" BRANCH = "branch" OPTIONAL = (BRANCH, COMMIT_TITLE, ENV_FILE, LANGUAGE, PULL_REQUEST_TITLE, WAIT_FOR_APPROVAL) -# What opens a setting that names a Jira Cloud epic in place of a path: `jira:`, then the epic's address as the browser shows it. Only `plan` and `goals-and-audience` may name something other than a path; the same spelling serves both, since the setting says what of the epic is meant. +# What opens a setting that names a Jira Cloud epic in place of a path: `jira:`, then the epic's address as the browser shows it. The settings below may name an epic; each reads its own part of it. JIRA = "jira:" EPIC_SPELLINGS = { - "plan": '"jira:https:///browse/" for a plan kept as a Jira Cloud epic\'s child issues', "goals-and-audience": '"jira:https:///browse/" for goals and audience kept in a Jira Cloud epic\'s description', + "plan": '"jira:https:///browse/" for a plan kept as a Jira Cloud epic\'s child issues', } OUTSIDE = "a path that starts with / or ~/ and lies outside the checkout and the config's folder, so that no git remote receives the credentials" @@ -47,7 +47,7 @@ class Epic: @property def spelling(self) -> str: - """The epic as a config's `plan` setting spells it.""" + """The epic as a config spells it.""" return f"{JIRA}{self.site}/browse/{self.key}" @@ -133,6 +133,8 @@ def load(top: pathlib.Path, main: pathlib.Path, home: pathlib.Path) -> ProjectCo *(f"`{name}` is {values[name]!r}, not {SPELLING}" for name, path in paths.items() if path is None and name not in EPIC_SPELLINGS), *(f"`{name}` is {values[name]!r}, not {SPELLING}, or {EPIC_SPELLINGS[name]}" for name in EPIC_SPELLINGS if name in values and paths[name] is None and epics[name] is None), *(f"`{name}` names a Jira epic, so `{ENV_FILE}` must name the file that holds its credentials" for name, epic in epics.items() if epic and ENV_FILE not in values), + # rule-hook ranks a plan kept as a file before tool calls, inside the hook's time limit, which a read from Jira mustn't hold up. + *(["`goals-and-audience` names a Jira epic, so `plan` must name one too"] if epics["goals-and-audience"] and not epics["plan"] else []), *([f"`{ENV_FILE}` is {values[ENV_FILE]!r}, not {OUTSIDE}"] if misplaced else []), *([f"`{WAIT_FOR_APPROVAL}` is {waits!r}, not true or false"] if not isinstance(waits, bool) else []), *(f"`{name}` is {values[name]!r}, {fault}" for name, check in checks.items() if name in values and (fault := check(values[name]))), @@ -143,7 +145,7 @@ def load(top: pathlib.Path, main: pathlib.Path, home: pathlib.Path) -> ProjectCo def epic_of(value: object) -> Epic | None: - """The epic a `plan` setting's value spells; None where it spells none. Only https, so the credentials are never sent in the clear.""" + """The epic a setting's value spells; None where it spells none. Only https, so the credentials are never sent in the clear.""" spelt = isinstance(value, str) and re.fullmatch(rf"{JIRA}(https://[A-Za-z0-9.-]+(?::[0-9]+)?)/browse/([A-Z][A-Z0-9_]*-[0-9]+)", value) return Epic(spelt.group(1), spelt.group(2)) if spelt else None diff --git a/bin/project_config/test_project_config.py b/bin/project_config/test_project_config.py index 5c358a3a..db4796f4 100644 --- a/bin/project_config/test_project_config.py +++ b/bin/project_config/test_project_config.py @@ -117,11 +117,11 @@ class LoadTest(ConfigCase): config.unlink() def test_goals_and_audience_spelt_as_a_jira_epic_is_no_path(self) -> None: - self.write("acme", CLIENT.replace("folder:goals.md", JIRA_PLAN) + 'env-file = "~/acme.env"\n') + self.write("acme", JIRA_CLIENT.replace("folder:goals.md", "jira:https://acme.atlassian.net/browse/ABC-7")) found = load(self.checkout, self.checkout, self.home) assert isinstance(found, ProjectConfig), found - self.assertEqual((found.goals_epic, found.epic), (Epic("https://acme.atlassian.net", "ABC-12"), None)) - self.assertEqual(found.places["goals-and-audience"], JIRA_PLAN) + self.assertEqual(found.goals_epic, Epic("https://acme.atlassian.net", "ABC-7")) + self.assertEqual(found.places["goals-and-audience"], "jira:https://acme.atlassian.net/browse/ABC-7") self.assertEqual(tuple(found.places), SETTINGS) self.assertNotIn("goals-and-audience", found.paths) @@ -131,6 +131,10 @@ class LoadTest(ConfigCase): assert isinstance(found, ProjectConfig), found self.assertEqual(found.goals_epic, found.epic) + def test_goals_in_jira_need_the_plan_in_jira(self) -> None: + self.write("acme", CLIENT.replace("folder:goals.md", JIRA_PLAN) + 'env-file = "~/acme.env"\n') + self.assertIn("`goals-and-audience` names a Jira epic, so `plan` must name one too", self.failure()) + def test_goals_kept_as_a_file_have_no_epic(self) -> None: folder = self.write("acme", CLIENT) found = load(self.checkout, self.checkout, self.home) diff --git a/rules/goals-and-audience.md b/rules/goals-and-audience.md index 9c347648..cf91ff11 100644 --- a/rules/goals-and-audience.md +++ b/rules/goals-and-audience.md @@ -6,7 +6,7 @@ paths: # Goals and Audience -A project's goals and audience live in its goals file (`~/.claude/CLAUDE.md` → "Vocabulary"): `README.md`, or a client project's `goals.md` in its config's folder. +A project's goals and audience live in its goals file (`~/.claude/CLAUDE.md` → "Vocabulary"): `README.md`, or a client project's `goals.md` in its config's folder or its plan epic's description in Jira. - **Goals** state the project's aim and intent, not promises: one numbered line each, like slogans, in priority order; a sub-goal is indented under its goal — "1. Blazing fast performance. 2. Correctness is more important than many features." A goal names no step of the work, such as a check to run first, and rarely an implementation. How a goal is met goes in a method section further down the goals file and names the goal it serves. BANNED as a goal: `Kill weak candidates early, with the cheap checks first.` GOOD: the goal `Keep research on a budget, so it scales in both time and cost.`, with the cheap checks moved to the method section, naming that goal. - **Mark each goal `**Maintain:**` or `**Achieve:**`.** A maintain goal is a state to hold: a change that breaks it is redesigned or dropped, whatever its value to other goals. An achieve goal is a direction to pursue, weighed against the other achieve goals. Under each achieve goal, three indented bullets: `Signal:` what moving towards it looks like, `Counter-signal:` what shows it is bought at a wrong price, and `Why:` one line on how the two connect. A goal with sub-goals states its own signal. A maintain goal has no bullets. BANNED: an unmarked goal; an achieve goal with no signal; `**Achieve:** Delivery speed.` with the signal `faster`. GOOD: `**Achieve:** Delivery speed.` with `Signal: hours from a chunk's start to its merge fall.`, `Counter-signal: 🔴 findings per chunk rise.` and `Why: speed bought by skipping review shows up as defects.` -- 2.52.0 From b514dcfe85b5615214c0d07b51326ac102bb9f5f Mon Sep 17 00:00:00 2001 From: Lilleman auf Larv Date: Sat, 14 Nov 2026 21:27:23 +0100 Subject: [PATCH 07/10] =?UTF-8?q?Answer=20product-owner=20round=201:=200?= =?UTF-8?q?=20=F0=9F=94=B4,=202=20=F0=9F=9F=A1=20(1=20misread);=20open=20t?= =?UTF-8?q?he=20goals=20file=20with=20project-record,=20and=20say=20in=20t?= =?UTF-8?q?he=20help=20where=20it=20prints?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CLAUDE.md | 2 +- bin/project_config/main.py | 7 ++++--- bin/project_record/main.py | 14 +++++++++----- bin/project_record/test_project_record.py | 6 +++++- 4 files changed, 19 insertions(+), 10 deletions(-) diff --git a/CLAUDE.md b/CLAUDE.md index cc0fd4a2..ba09877d 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -127,7 +127,7 @@ Claude Code reads this section by its heading when it compacts a conversation. K - **chunk** — the unit of work, shipped as one PR; "Working loop" says what it holds. - **cycle** — in `loop-claude`, worker runs and the judge's verdict on each, until the chunk closes or is left for the next cycle. In between, the human answers any interrupt, or the worker resumes with an answer the judge quoted from the premises or the judge's records. - **gate** — the merge gate: the checks a PR passes before it merges. -- **goals file** — the file holding a project's `## Goals` and `## Audience`: the one its config names as `goals-and-audience`, which `~/.claude/bin/project-config goals-and-audience` prints. It is `README.md`, unless a client's project keeps it in the config's folder, or in a Jira epic's description, which the loop only reads. +- **goals file** — the file holding a project's `## Goals` and `## Audience`: the one its config names as `goals-and-audience`. Read it in the file `~/.claude/bin/project-record open goals-and-audience` prints. It is `README.md`, unless a client's project keeps it in the config's folder, or in a Jira epic's description, which the loop only reads. - **interrupt** — `loop-claude` asking the human, on its terminal, for a decision that is theirs. They type a one-line answer there, or `/talk` to open the worker's session there with `claude --resume`. A release ready to cut opens that session at once. A routing call opens claude on that terminal too, in `~/code/claude-config`, the checkout where this setup is developed. - **judge** — the headless claude that reads a worker's transcript each cycle and decides whether to interrupt and whether the chunk is finished. - **judge's records** — the files the judge reads beside the premises: the project's `AGENTS.md` and `docs/decisions.md`, then the human's `~/.claude/CLAUDE.md` and the `.md` files in `~/.claude/rules/` and `~/.claude/skills/larv-review/standards/`. diff --git a/bin/project_config/main.py b/bin/project_config/main.py index 657827f9..39f41485 100644 --- a/bin/project_config/main.py +++ b/bin/project_config/main.py @@ -26,9 +26,10 @@ starts with / or ~/. In a worktree, a "checkout:" path is the worktree's own fil Jira's backlog order, and `project-config plan` prints the setting as the config spells it. Such a config must set `env-file`, and that file must hold ATLASSIAN_EMAIL and ATLASSIAN_API_TOKEN. -`goals-and-audience` may name a Jira Cloud epic the same way. Its description is then the goals -file, with ## Goals and ## Audience as headings, and the same `env-file` rule holds. It is only -read: edit the description in Jira. Reviewers get a copy in the review folder. +`goals-and-audience` may name a Jira Cloud epic the same way, where `plan` names one too. The +epic's description is then the goals file, with ## Goals and ## Audience as headings, and +`project-config goals-and-audience` prints the setting as the config spells it. The description is +only read: edit it in Jira. `env-file` is an optional setting: the file of KEY=value credentials the project's tools read, a path that starts with / or ~/ and lies outside the checkout and the config's folder, such as diff --git a/bin/project_record/main.py b/bin/project_record/main.py index 202d0820..3cbfbcd6 100644 --- a/bin/project_record/main.py +++ b/bin/project_record/main.py @@ -4,7 +4,9 @@ usage: project-record open project-record save Run inside a checkout, or a worktree of one. is one of decisions, score-anchors, -comprehension-history, reading-cost and changelog, each kept where the project's config names it. +comprehension-history, reading-cost and changelog, each kept where the project's config names it, +or goals-and-audience, the goals file. Goals kept in a Jira epic's description are only read, so +save refuses them: edit the epic in Jira. open prints the path of a file holding the record's text, and nothing else. Read and edit that file. Where the record is kept as a file, the path is that file. Where it is kept elsewhere, the @@ -22,25 +24,27 @@ import pathlib import sys from failure import Failure -from record_store.stores import FileStore, local_file, RECORDS, RecordStore, store, stored +from record_store.stores import FileStore, goals_store, local_file, RECORDS, RecordStore, store, stored from project_config.main import located # Not git's verbs, such as checkout and commit: those read as acting on the repo. COMMANDS = ("open", "save") # Where the copy of a record kept outside files goes, under the user's home, in a folder per project. COPIES = ".local/state/project-record" +# The goals file opens like a record, though it is a setting of its own. +GOALS = "goals-and-audience" def main(argv: list[str]) -> int: if argv[:1] in (["-h"], ["--help"]): print(__doc__.strip()) return 0 - if len(argv) != 2 or argv[0] not in COMMANDS or argv[1] not in RECORDS: - print(f"usage: project-record {'|'.join(COMMANDS)} , where is one of {', '.join(RECORDS)}", file=sys.stderr) + if len(argv) != 2 or argv[0] not in COMMANDS or argv[1] not in (*RECORDS, GOALS): + print(f"usage: project-record {'|'.join(COMMANDS)} , where is one of {', '.join((*RECORDS, GOALS))}", file=sys.stderr) return 2 home = pathlib.Path.home() config = located(None, home) - done = config if isinstance(config, Failure) else act(argv[0], store(config, argv[1]), home / COPIES / config.key / f"{argv[1]}.md") + done = config if isinstance(config, Failure) else act(argv[0], goals_store(config) if argv[1] == GOALS else store(config, argv[1]), home / COPIES / config.key / f"{argv[1]}.md") if isinstance(done, Failure): print(f"project-record: {done.reason}", file=sys.stderr) return 1 diff --git a/bin/project_record/test_project_record.py b/bin/project_record/test_project_record.py index fa46bea0..66f3c6f4 100644 --- a/bin/project_record/test_project_record.py +++ b/bin/project_record/test_project_record.py @@ -53,11 +53,15 @@ class BlackBox(unittest.TestCase): self.assertEqual((saved.returncode, saved.stdout, saved.stderr), (0, f"{self.top}/docs/decisions.md is the record itself, so nothing is left to store.\n", "")) self.assertFalse((pathlib.Path(os.environ["HOME"]) / ".local").exists(), "a file record gets no copy") + def test_the_goals_file_opens_as_the_config_names_it(self): + opened = self.run_tool("open", "goals-and-audience") + self.assertEqual((opened.returncode, opened.stdout, opened.stderr), (0, f"{self.top}/README.md\n", "")) + def test_exits_2_with_the_usage_on_an_unknown_command_or_record(self): for args in ([], ["open"], ["open", "plan"], ["close", "decisions"], ["open", "decisions", "changelog"]): ran = self.run_tool(*args) self.assertEqual((ran.returncode, ran.stdout), (2, ""), args) - self.assertIn("usage: project-record open|save , where is one of decisions, score-anchors, comprehension-history, reading-cost, changelog", ran.stderr) + self.assertIn("usage: project-record open|save , where is one of decisions, score-anchors, comprehension-history, reading-cost, changelog, goals-and-audience", ran.stderr) def test_exits_1_saying_why_where_no_config_names_the_checkout(self): (pathlib.Path(os.environ["HOME"]) / ".claude-projects" / self.top.name / "config.toml").unlink() -- 2.52.0 From 68808e7eee6759759b9426c2f1c46c2bc4462027 Mon Sep 17 00:00:00 2001 From: Lilleman auf Larv Date: Sat, 14 Nov 2026 21:27:23 +0100 Subject: [PATCH 08/10] =?UTF-8?q?Answer=20prose=20round=201:=200=20?= =?UTF-8?q?=F0=9F=94=B4,=208=20=F0=9F=9F=A1=20(0=20misread);=20reword=20th?= =?UTF-8?q?e=20README=20paragraph,=20help,=20docstrings=20and=20messages?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 2 +- bin/loop_claude/loop/usage.py | 40 ++++++++++++++-------------- bin/loop_claude/project/premises.py | 2 +- bin/plan_store/stores.py | 3 ++- bin/record_store/jira_description.py | 6 ++--- bin/record_store/stores.py | 4 +-- 6 files changed, 29 insertions(+), 28 deletions(-) diff --git a/README.md b/README.md index ceb0c6ff..23bd8687 100644 --- a/README.md +++ b/README.md @@ -113,7 +113,7 @@ A client that plans in Jira Cloud names an epic as its project's plan: `plan = " A read fails, naming the issue, where a child is in another Jira project or names no such Fix Version. The config's `env-file` must hold `ATLASSIAN_EMAIL` and `ATLASSIAN_API_TOKEN`, an API token of that Atlassian account, and only its owner may read that file: `chmod 600` it. The loop only reads such a plan so far. `todo-item add`, `edit`, `move` and `finish` fail, so file, edit and finish its issues in Jira. `rank_todo.py` doesn't rank it, since Jira's backlog does. The four things not supported for a plan outside the checkout, above, are not supported for a plan in Jira either. -A client that keeps its goals and audience in an epic's description names that epic as the goals file: `goals-and-audience = "jira:https://acme.atlassian.net/browse/ABC-12"`, which may be the plan's own epic. The description needs `## Goals` and `## Audience` as headings, level-2 headings in Jira's editor, and the same `env-file`. The loop only reads it, so edit the description in Jira. Whoever may edit that description sets the premises every worker and judge follows, so keep its edit rights to the people who own the project's goals. +A client that keeps its goals and audience in an epic's description names that epic as the goals file: `goals-and-audience = "jira:https://acme.atlassian.net/browse/ABC-12"`, which may be the plan's own epic. Such a config keeps its plan in Jira too, and reads both with the same `env-file`. The description needs `## Goals` and `## Audience` as headings, level-2 headings in Jira's editor. The loop only reads the description, so edit it in Jira; `project-record open goals-and-audience` prints a file holding its text. Whoever may edit that description sets the premises every worker and judge follows, so keep its edit rights to the people who own the project's goals. To name a chunk's branch, worktree, commits and pull request by the issue key, as in `ABC-123` and `ABC-123 - …`, set these three templates, with your Jira project's key in place of `ABC`: `branch = "ABC-{id}"`, `commit-title = "ABC-{id} - {summary}"` and `pull-request-title = "ABC-{id} - {summary}"`. `project-config --help` says how the templates work. diff --git a/bin/loop_claude/loop/usage.py b/bin/loop_claude/loop/usage.py index b9b0a3d5..1ca02464 100644 --- a/bin/loop_claude/loop/usage.py +++ b/bin/loop_claude/loop/usage.py @@ -4,26 +4,26 @@ usage: loop-claude Run it anywhere inside a project checkout whose goals file has ## Goals and ## Audience, the premises. The goals file is the one the project's config, ~/.claude-projects//config.toml, sets -as goals-and-audience: a file, or a Jira epic whose description holds it. `project-config -goals-and-audience` prints where it is. The task runs at the checkout root. -Each cycle a worker runs the task. A chunk's first worker prompt also quotes the premises. -They, with code health (~/.claude/CLAUDE.md → "Shared goal") ranked first unless the goals file -voids it, choose between ways to deliver the chunk's todo.md items, or else the task, and never -widen them. A judge then reads the transcript's end, the premises, and the records: the project's -AGENTS.md and docs/decisions.md, and the human's ~/.claude/CLAUDE.md, ~/.claude/rules/*.md and -~/.claude/skills/larv-review/standards/*.md, where they exist. It rules whether the chunk, the work -of one PR, is finished. A chunk stays unfinished until each answer the human typed in it that a -later chunk could need is recorded: the premises or the records hold it, or the transcript shows the -worker writing it into the premises, AGENTS.md, docs/decisions.md, todo.md or a code comment. A -choice the worker made that the premises or the records settle is not asked about. When the worker -asks a question they answer, the judge quotes the answer, loop-claude prints it, and the worker -resumes with it. A quote they do not hold word for word is dropped, and the question goes to the -human. So does a question asked again after its answer. A question the human answered earlier in the -chunk goes back to the worker with that answer, unless the question quotes the words of the answer -that leave it open. The fourth question they answer in one cycle goes to the human too, with the -quote. An unfinished chunk resumes its session next cycle, and the worker is shown the passage the -judge quoted as the work remaining. The next chunk starts a fresh session. Cycles continue until an -exit below or Ctrl-C. Words: ~/.claude/CLAUDE.md → "Vocabulary". +as goals-and-audience: a file, or a Jira epic's description. `project-config goals-and-audience` +prints where it is. The task runs at the checkout root. Each cycle a worker runs the task. A chunk's +first worker prompt also quotes the premises. They, with code health (~/.claude/CLAUDE.md → +"Shared goal") ranked first unless the goals file voids it, choose between ways to deliver the +chunk's todo.md items, or else the task, and never widen them. A judge then reads the transcript's +end, the premises, and the records: the project's AGENTS.md and docs/decisions.md, and the human's +~/.claude/CLAUDE.md, ~/.claude/rules/*.md and ~/.claude/skills/larv-review/standards/*.md, where +they exist. It rules whether the chunk, the work of one PR, is finished. A chunk stays unfinished +until each answer the human typed in it that a later chunk could need is recorded: the premises or +the records hold it, or the transcript shows the worker writing it into the premises, AGENTS.md, +docs/decisions.md, todo.md or a code comment. A choice the worker made that the premises or the +records settle is not asked about. When the worker asks a question they answer, the judge quotes the +answer, loop-claude prints it, and the worker resumes with it. A quote they do not hold word for +word is dropped, and the question goes to the human. So does a question asked again after its +answer. A question the human answered earlier in the chunk goes back to the worker with that answer, +unless the question quotes the words of the answer that leave it open. The fourth question they +answer in one cycle goes to the human too, with the quote. An unfinished chunk resumes its session +next cycle, and the worker is shown the passage the judge quoted as the work remaining. The next +chunk starts a fresh session. Cycles continue until an exit below or Ctrl-C. Words: +~/.claude/CLAUDE.md → "Vocabulary". A question only the human can answer is an interrupt (bin/loop_claude/cycle/interrupt.py). loop-claude prints the question on its terminal, where the human answers it: diff --git a/bin/loop_claude/project/premises.py b/bin/loop_claude/project/premises.py index 665229a8..41beafad 100644 --- a/bin/loop_claude/project/premises.py +++ b/bin/loop_claude/project/premises.py @@ -7,7 +7,7 @@ from release_plan.goals_file import section def read_premises(root: str, home: pathlib.Path) -> str | Failure: - """Where the goals file is kept, then its ## Goals and ## Audience; the goals file is the one that the config under home of root's project names, a file or a Jira epic's description. A Failure where no config names root's checkout, the goals file cannot be read or is empty, or it lacks a section, holds one twice or leaves one empty.""" + """Where the goals file is kept, then its ## Goals and ## Audience. The goals file is the one that the config of root's checkout, under home, names: a file or a Jira epic's description. A Failure where no config names the checkout, or the goals file cannot be read, is missing or empty, lacks a section, holds one twice or leaves one empty.""" config = located(root, home) if isinstance(config, Failure): return Failure(f"{config.reason} - no premises.") diff --git a/bin/plan_store/stores.py b/bin/plan_store/stores.py index 60aae6d8..a5151fb9 100644 --- a/bin/plan_store/stores.py +++ b/bin/plan_store/stores.py @@ -22,8 +22,9 @@ TAGLINE = "Tagline" FIELDS = ("Release", BLOCKED_BY, "Exempt", TAGLINE, "L", "E", "I", "S", MOVES) -# What the reader of a missing todo.md, or of a missing or empty goals file, is told. +# What the reader of a missing todo.md is told. MISSING = "every project keeps a todo.md, and rank_todo.py --help shows one" +# What the reader of a missing or empty goals file is told. GOALS_HINT = "rank_todo.py weighs goals from the goals file the project's config names as goals-and-audience" diff --git a/bin/record_store/jira_description.py b/bin/record_store/jira_description.py index 7ad27d7c..1e748743 100644 --- a/bin/record_store/jira_description.py +++ b/bin/record_store/jira_description.py @@ -1,6 +1,6 @@ -"""A project's goals and audience kept as the description of one Jira Cloud epic, read over Jira's REST API with the plan store's credentials and the adf-codec shim. +"""A project's goals and audience kept as the description of one Jira Cloud epic, read over Jira's REST API with the credentials of the config's env-file, and converted by the adf-codec shim. -The store only reads: a write is a Failure, so a tool that edits the goals file says to edit the epic in Jira.""" +The store only reads: a write, such as `project-record save goals-and-audience`, fails, saying to edit the epic in Jira.""" import dataclasses import pathlib @@ -39,7 +39,7 @@ class EpicDescription: return Failure(f"cannot read the epic {key}: {answer.reason}") fields = answer.get("fields") if isinstance(answer, dict) else None if not isinstance(fields, dict) or "description" not in fields or not isinstance(fields["description"], dict | None): - return Failure(f"the epic {key} is not in the shape Jira Cloud's REST API version 3 documents: it holds no description field of a document or null") + return Failure(f"the epic {key} is not in the shape Jira Cloud's REST API version 3 documents: its description field is missing, or neither a document nor null") if fields["description"] is None: return "" texts = self.to_markdown([fields["description"]]) diff --git a/bin/record_store/stores.py b/bin/record_store/stores.py index 93e15944..317983a0 100644 --- a/bin/record_store/stores.py +++ b/bin/record_store/stores.py @@ -1,6 +1,6 @@ """The one way a tool reads or writes a project's records: through the store its config names for each. -Each record has its own setting in the config, so a project may keep one record in its wiki and another as a file. The setting's value names the backend. A path names a markdown file, the only backend of a record so far; the goals file may also be a Jira epic's description, which `goals_store` reads.""" +Each record has its own setting in the config, so a project may keep one record in its wiki and another as a file. The setting's value names the backend. A path names a markdown file, the only backend of a record so far; the goals file may also be a Jira epic's description, which `goals_store` picks.""" import dataclasses import pathlib import typing @@ -69,7 +69,7 @@ def store(config: ProjectConfig, record: str) -> RecordStore: def goals_store(config: ProjectConfig) -> RecordStore: - """The store config names for the goals file, which holds ## Goals and ## Audience: a markdown file, or the description of a Jira epic, which only reads.""" + """The store config names for the goals file, which holds ## Goals and ## Audience: a markdown file, or a Jira epic's description, which the store only reads.""" if config.goals_epic is None: return FileStore(config.paths["goals-and-audience"], config.tracked("goals-and-audience")) # Imported here, since the Jira store builds on plan_store, which builds on this module. -- 2.52.0 From 5c05520f1d25507dca605097e3d57e6efd2b6be3 Mon Sep 17 00:00:00 2001 From: Lilleman auf Larv Date: Sat, 14 Nov 2026 21:27:37 +0100 Subject: [PATCH 09/10] Name the goals file among what project-record opens in the README --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 23bd8687..48619258 100644 --- a/README.md +++ b/README.md @@ -164,7 +164,7 @@ Install puts only `loop-claude` on `PATH`; call the others by their path, such a - `metric-bench [history]` benches cheap static metrics of a project's Python against the places its comprehension history names as hardest; `metric-bench --help` states the metrics and the scores. - `mutate-changes [--base ] [--prefix ] [--jobs ]` mutation-tests the lines a branch changes and prints each mutant its tests don't kill; `mutate-changes --help` says which tool it runs for each language. - `project-config []` prints the paths a project's config sets, or the one asked for, and fails naming each setting the config leaves out; Install → "Set up a project" shows a config. -- `project-record open ` prints the path of a file holding one of a project's records, for an agent to read and edit, and `project-record save ` stores the edit; for a record kept as a file, that file is the record. +- `project-record open ` prints the path of a file holding one of a project's records, for an agent to read and edit, and `project-record save ` stores the edit; for a record kept as a file, that file is the record. `goals-and-audience` opens the goals file the same way. - `rank_todo.py [--check] [todo.md]` scores and ranks a project's `todo.md`, by default the one its config names; `rank_todo.py --help` states the format. - `reading-cost [--reset] [record]` appends a figure for each chunk `loop-claude` finished to a project's `docs/reading-cost.md`, and says whether the figures rise; `reading-cost --help` states the measure. - `review-replay ` replays a review pass's archived rounds from the projects run on the model, on the code each reviewed, and prints the lowest rung below the project's that, like each rung above it, qualifies: it finds no less of the 🔴 and 🟡 findings than two replays on the project's rung find, within a margin, and misses no 🔴 that both found. `review-replay --help` states the replay. With `--omit-claude-md` it tests instead whether the pass's reviewer may start without `CLAUDE.md`: it replays each round three times as archived and once without the instruction files, and prints whether the reviewer passes: whether the last replay missed no more findings than the most an unchanged replay missed, with each count and each finding it missed. Each replayed reviewer skips every permission prompt, stability-reviewer has Bash, and an archived prompt may name paths on the host. -- 2.52.0 From fc5e78ba88960d76ca9ca1afc558386acf25097d Mon Sep 17 00:00:00 2001 From: Lilleman auf Larv Date: Sat, 14 Nov 2026 21:30:36 +0100 Subject: [PATCH 10/10] Finish item 353: take a project's goals and audience from a Jira epic's description --- CHANGELOG.md | 1 + todo.md | 5 ----- 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index def31367..36a6f9d2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,7 @@ ## Unreleased +- A project whose plan is a Jira epic can keep its goals and audience in an epic's description too: set `goals-and-audience = "jira:https:///browse/"`. The loop only reads it, and `project-record open goals-and-audience` prints a file holding its text. - A project with a Jira plan can name each chunk's branch, worktree, commits and pull request by the issue key, as in `ABC-123` and `ABC-123 - …`. The README shows the three templates to set. - A read of a plan in a Jira epic converts every issue description in one `adf_codec` container run, however many issues the epic holds. The codec builds its image inside one of the machine's heavy slots that `run-heavy` shares, so sessions reading at once build it once. - A project config may name its plan as `jira:https:///browse/`: the plan is then read from the open child issues of that Jira Cloud epic, in backlog order, with the credentials in the config's `env-file`. Such a plan is only read so far: file, edit and finish its issues in Jira. diff --git a/todo.md b/todo.md index 710bd691..917eecb6 100644 --- a/todo.md +++ b/todo.md @@ -22,7 +22,6 @@ | 356 | 0.11.0 | | | **Hand reviewers the review standards from the folder a project's config names, in place of `~/.claude/skills/larv-review/standards/`.** | 2 | 2 | 3 | 5 | 2 | 1.6 by 3 | 1.1 | | 372 | 0.11.0 | | | **Key loop-claude's session, archive, routing state and config-folder commits per chunk, so two chunks of one project run side by side without touching each other's state.** | 3 | 2 | 3 | 6 | 6 | 1.5 by 3 | 0.4 | | 374 | 0.11.0 | 372 | | **Merge open chunks one at a time: rebase, finish the item in todo.md and CHANGELOG.md, rerun the gate and the paired ruling, and keep a chunk waiting for approval in the queue without blocking the next.** | 4 | 2 | 3 | 7 | 6 | 1.5 by 4, 1.6 by 3 | 1.0 | -| 353 | 0.11.0 | | | **Let a project's config take its goals and audience from a Jira epic's description, under the same two headings.** | 3 | 2 | 3 | 6 | 5 | 1.6 by 4 | 0.8 | | 359 | 0.11.0 | | | **Tie a project's releases to what its config names: semver tags, Jira Fix Versions, sprints, or none.** | 3 | 2 | 3 | 6 | 4 | 1.6 by 3 | 0.8 | | 380 | 0.11.0 | | | **Define "plan" in `CLAUDE.md` → "Vocabulary" as the store a project's config names as `plan`, a `todo.md` or a Jira epic, and reword each line of `CLAUDE.md` and `rules/todo-items.md` that says `todo.md` where it is false for a plan in Jira.** | 1 | 2 | 3 | 4 | 2 | 1.6 by 2 | 0.7 | | 375 | 0.11.0 | 372, 373, 374 | | **Run up to the project's configured number of chunks at once, each in its own window of one tmux session named for the project, mark a window whose chunk waits for the human, and refuse to start without tmux at the needed version.** | 4 | 2 | 3 | 7 | 7 | 1.5 by 7 | 0.6 | @@ -136,10 +135,6 @@ Where the rebase conflicts, the chunk's worker resolves it, and only the review `bin/chunk_preflight/choices.py:80` `forge_of` is a place the comprehension seats found hard: forge code split across tools. Where this item touches it, build on item 287's forge module if that has shipped. -### 353. Let a project's config take its goals and audience from a Jira epic's description, under the same two headings. - -lilleman's call, 2026-11-12: this client keeps its goals and audience in the plan epic's description. The source is a config setting, never hard-coded; item 346 builds the file source this one adds to. Read through the adf-codec shim. - ### 359. Tie a project's releases to what its config names: semver tags, Jira Fix Versions, sprints, or none. lilleman's call, 2026-11-12: what a release is differs per client. With none, items name no release, and the architecture and principles passes the release review runs need another trigger, which this item settles and records. Readers: `rank_todo.py`'s release order, chunk-preflight's next release, loop-claude's "release ready to cut", larv-review's release review, `CLAUDE.md` → "Working loop". Cutting a release stays the human's. -- 2.52.0