diff --git a/CHANGELOG.md b/CHANGELOG.md index 7fba327b..e560a603 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,7 +2,7 @@ ## Unreleased -- `workflow-bench/bench.py` gives each run a fixed list of allowed tools. Before, it skipped every permission check. A run may launch agents, run `/security-review`, edit its clone (not the clone's `.git/` or `.claude/`) and its report, and read its clone and the copy of `~/.claude` it benches. For git it gets one command, `workflow-bench/review_git.py`, and no bare `git`. The wrapper runs `log`, `diff`, `show`, `status`, `ls-files`, `add` and `commit -m` on the run's clone, whatever the working directory. It allows only the options it lists for each, and refuses an argument that names a path outside the clone. git runs with no global or system config, hook, pager or editor. A run loads no user settings, so `~/.claude/settings.json`'s hooks and extra directories do not apply to it. Every other call is denied. Expect a benched review that needs another git command, or to run a project's code or tests, to say in its report that it could not. +- `workflow-bench/bench.py` gives each run a fixed list of allowed tools. Before, it skipped every permission check. A run may launch agents, run `/security-review`, edit its clone (not the clone's `.git/` or `.claude/`) and its report, and read its clone and the copy of `~/.claude` it benches. For git it gets one command, `workflow-bench/review_git.py`, and no bare `git`. The wrapper runs `log`, `diff`, `show`, `status`, `ls-files`, `add` and `commit -m` on the run's clone, whatever the working directory. It allows only the options it lists for each, and refuses an argument that names a path outside the clone. git runs with no global or system config, hook, pager or editor. A run loads no settings or MCP servers from `~/.claude` or from the case's clone, so their hooks and extra directories do not apply to it. Every other call is denied. Expect a benched review that needs another git command, or to run a project's code or tests, to say in its report that it could not. - Every goal in `README.md` → Goals is marked `**Maintain:**`, a state to hold, or `**Achieve:**`, a direction to pursue. Each achieve goal has a signal, a counter-signal and a one-line reason under it. A change that breaks a maintain goal is redesigned or dropped, whatever it scores: `rules/todo-items.md` says so, and larv-review's goal alignment step no longer merges such a PR. `rules/goals-and-audience.md` states the form for every project's README. Expect larv-review to stop a PR on a maintain goal where it asked you before. - Reshape every project's `todo.md` to the new shape below: until it is reshaped, that is the project's only work, as it is while README.md lacks Goals and Audience, and `rank_todo.py` says so. First move every machine to this release: an older release rejects the new formula, so it fails on every reshaped `todo.md`. Then mark the README's goals `**Maintain:**` or `**Achieve:**`, score each item's L, E and I, and set a bar on the new scale below the score of every item to keep, since the old bar would drop most items. Until then, an old-shape `todo.md` still ranks by its own formula and weights. - `todo.md` ranks items by value per cost: this setup's own plan uses `Score = 100 * V / (2**S + 8)`, where 8 is a chunk's fixed cost, about one size-3 change, and `rank_todo.py --help` shows it. A Moves column replaces A, G and Goals, naming each achieve goal an item moves and how far, such as `1.1 by 8, 1.2 by 5`. V sums each named goal's weight times its move. `rank_todo.py` weighs each achieve goal by its position in README.md, the first heaviest, so the goal weights table goes. An item names the most specific goal it moves, never a goal beside its own sub-goal. `rules/todo-items.md` and `rank_todo.py --help` show the new shape. diff --git a/workflow-bench/bench.py b/workflow-bench/bench.py index 3f53114d..5b840436 100755 --- a/workflow-bench/bench.py +++ b/workflow-bench/bench.py @@ -50,8 +50,9 @@ def permission_flags(clone, version_dir, report): *(f"{tool}({tree})" for tool in ("Read", "Grep", "Glob") for tree in trees), ] denied = ["Bash(git *)", f"Edit(/{clone}/.git/**)", f"Edit(/{clone}/.claude/**)"] - # No "user" source: ~/.claude/settings.json would add ~/code to the trees and run its hooks. - return ["--setting-sources", "project,local", "--permission-mode", "dontAsk", "--permission-prompts", "none", + # No "user" or "project" source: ~/.claude/settings.json would add ~/code to the trees and run its hooks, + # and a case's committed .claude/settings.json could run its own; --strict-mcp-config ignores a committed .mcp.json. + return ["--setting-sources", "local", "--strict-mcp-config", "--permission-mode", "dontAsk", "--permission-prompts", "none", "--allowedTools", *allowed, "--disallowedTools", *denied] diff --git a/workflow-bench/review_git.py b/workflow-bench/review_git.py index 35f46508..45e87ac6 100644 --- a/workflow-bench/review_git.py +++ b/workflow-bench/review_git.py @@ -7,7 +7,7 @@ working directory, with GIT_DIR and GIT_WORK_TREE pinned to it. The wrapper refuses every subcommand and option ALLOWED does not list, so a cluster of short options or a long option cut to a prefix is refused too. An option that takes a value takes it glued, as -`--format=%h`. A commit needs `-m`, whose value is the one free-text argument. Every other argument +`--grep=fix`. A commit needs `-m`, whose value is the one free-text argument. Every other argument must name no path outside the clone. git runs with no global or system config, hook, pager or editor. The wrapper checks the arguments git receives, after the shell has removed quotes and expanded `$`, so no quoting hides a path from it. It lives outside the clone, so a module planted in the clone @@ -25,10 +25,10 @@ ALLOWED = { "add": {"-A", "--all", "-u", "--update"}, "commit": {"-a", "--all"}, "diff": OUTPUT | {"--cached", "--check", "--staged", "--word-diff"}, - "log": OUTPUT | {"--author=", "--decorate", "--follow", "--format=", "--graph", "--grep=", "--max-count=", - "--oneline", "-p", "--patch", "--pretty=", "--reverse", "--since=", "--until="}, + "log": OUTPUT | {"--author=", "--decorate", "--follow", "--graph", "--grep=", "--max-count=", + "--oneline", "-p", "--patch", "--reverse", "--since=", "--until="}, "ls-files": {"--cached", "--deleted", "--exclude-standard", "--modified", "--others"}, - "show": OUTPUT | {"--format=", "--no-patch", "--oneline", "--pretty=", "-s"}, + "show": OUTPUT | {"--no-patch", "--oneline", "-s"}, "status": {"-b", "--branch", "--porcelain", "-s", "--short"}, } # The commit identity, since no config supplies one. diff --git a/workflow-bench/test_review_git.py b/workflow-bench/test_review_git.py index f3a48959..16216851 100644 --- a/workflow-bench/test_review_git.py +++ b/workflow-bench/test_review_git.py @@ -25,7 +25,7 @@ class Refusal(unittest.TestCase): ["diff", "--ext"], ["ls-files", "-oX/abs/x"], ["diff", "--output=.git/config"], ["diff", "--no-index", "a", "b"], ["commit", "-S", "-m", "x"], ["commit", "--gpg-sign", "-m", "x"], ["commit", "-e", "-m", "x"], ["commit", "--edit", "-m", "x"], ["commit", "-c", "HEAD"], ["add", "-e"], ["add", "-p"], ["add", "-i"], - ["add", "--patch"], ["log", "--help"], + ["add", "--patch"], ["log", "--help"], ["log", "--format=%h %G?"], ["show", "--pretty=%GS"], ): with self.subTest(argv): self.assertIn(argv[1], refusal(argv, escapes) or "") @@ -56,8 +56,8 @@ class Refusal(unittest.TestCase): def test_allows_the_reviews_own_commands(self): for argv in ( - ["log", "--oneline", "abc123..chunk"], ["log", "-5"], ["log", "--max-count=3", "--format=%h %s"], - ["log", "--stat", "HEAD~1..HEAD"], ["log", "--pretty=%H", "--", "src/a.py"], ["diff", "base...chunk", "--stat"], + ["log", "--oneline", "abc123..chunk"], ["log", "-5"], ["log", "--max-count=3", "--oneline"], + ["log", "--stat", "HEAD~1..HEAD"], ["log", "--oneline", "--", "src/a.py"], ["diff", "base...chunk", "--stat"], ["diff", "--cached"], ["diff", "--name-only", "HEAD~1"], ["diff", "--", "src"], ["show", "HEAD"], ["show", "--stat", "abc123"], ["show", "HEAD:README.md"], ["status"], ["status", "--short"], ["ls-files"], ["ls-files", "--others", "--exclude-standard"], ["add", "-A"], ["add", "--", "src/a.py"],