A Civilization-style strategy game about governing Israel from 15 May 1948. Real ministers, real map, every fact sourced. Unity + deterministic C# sim.
Docs and CI: AI-assisted contributors may do the person-only checks and sign-offs (owner, 4 Nov) (#2481)
Eyal Golan3758b9231b12
diff --git a/.github/skills/statecraft-historical-content/SKILL.md b/.github/skills/statecraft-historical-content/SKILL.mdindex 0694403e7..1f7ad40dc 100644--- a/.github/skills/statecraft-historical-content/SKILL.md+++ b/.github/skills/statecraft-historical-content/SKILL.md@@ -33,6 +33,7 @@ Before drafting, read these first:4. Draft only in the repo’s historical framing and event schema.5. Keep the text grounded, specific, and readable in a game UI.6. Leave `status: draft` on anything an AI drafted. Only a person who has checked every claim against its source sets `fact-checked`.+ An AI-assisted contributor counts as that person, for `fact-checked` and for the `reviewed_by` sign-off, when the pull request's "AI assistance" section discloses the AI help and says which sources were opened and what was checked (the owner, 4 November 2026: "Yes, it counts"; https://github.com/eyalgolan/statecraft-israel/pull/2481#issuecomment-6623108295).7. Validate with `dotnet test sim/Statecraft.sln` when editing repo content.## Historical writing standardsdiff --git a/.github/workflows/ci.yml b/.github/workflows/ci.ymlindex 91f11a2ea..1d63e97ae 100644--- a/.github/workflows/ci.yml+++ b/.github/workflows/ci.yml@@ -109,9 +109,14 @@ jobs:SKIP_LABEL: ${{ contains(github.event.pull_request.labels.*.name, 'no-changelog') }}run: uv run scripts/oss/changelog_check.py --base "$BASE_SHA" --head "$HEAD_SHA" --skip-label "$SKIP_LABEL"# Only a person signs a row off (#375): no commit with an AI co-author trailer may add, change or remove a reviewed_by- # or reviewed_on line in content/. It needs every commit of the PR (fetch-depth 0 above) and fails closed.+ # or reviewed_on line in content/, unless the PR's "AI assistance" section discloses the AI help (owner, 4 November+ # 2026: "Yes, it counts"); even then it may not remove one. CI checks only that the section exists, is not a "no"+ # (no / none / not / n/a / nothing) and names a check; the reviewer reads what was checked and how. It needs every+ # commit of the PR (fetch-depth 0 above) and fails closed. The description is read by the guard from the runner's+ # event file ($GITHUB_EVENT_PATH), never put into this shell line or an env value. The job does not run on a+ # description edit: push again after changing the "AI assistance" section.- name: Only a person signs a row off (reviewed_by and reviewed_on)env:BASE_SHA: ${{ github.event.pull_request.base.sha }}HEAD_SHA: ${{ github.event.pull_request.head.sha }}- run: uv run scripts/oss/reviewed_by_guard.py --base "$BASE_SHA" --head "$HEAD_SHA"+ run: uv run scripts/oss/reviewed_by_guard.py --base "$BASE_SHA" --head "$HEAD_SHA" --pr-event "$GITHUB_EVENT_PATH"diff --git a/CONTRIBUTING.md b/CONTRIBUTING.mdindex 21e19557a..9693dbf03 100644--- a/CONTRIBUTING.md+++ b/CONTRIBUTING.md@@ -18,7 +18,7 @@ If you're unsure where to start, open an issue first and describe what you want- **`help wanted` means nobody holds the issue.** The label comes off while someone has an active claim (activity in the last 7 days, or an open pull request for it) and goes back on when the claim ends. A maintainer comment that says a part is free ("Free now", "Open to anyone") is current, even below an older claim.- **At most 10 claims without a pull request.** You can hold up to 10 claimed issues for which you haven't opened a pull request yet. Issues where you have opened a pull request for the issue don't count toward the 10, and there's no limit on those.- **7 days.** A claim with no activity from its claimant on the issue or its pull request for 7 days is freed with a comment, and the issue is open to anyone again.-- Issues paused until after the MVP, or waiting on an owner ruling, say so in the issue; start only the part a maintainer comment opens (for example the research part). Some research issues ask for "a person's check": a person, not an AI agent, opens each source.+- Issues paused until after the MVP, or waiting on an owner ruling, say so in the issue; start only the part a maintainer comment opens (for example the research part). Some research issues ask for "a person's check": a person opens each source. AI-assisted contributors may do these person-only steps too, such as source checks, device checks and native Hebrew reads (the owner, 4 November 2026: "allow ai assisted contributers"). Disclose the AI assistance in the pull request's "AI assistance" section, say what you checked and how (which source, which device, which strings), and you stay responsible for the check. Such a check also closes an item tagged "a person's check pending". Asked whether an item tagged "a person's check pending" counts as done once an AI-assisted contributor does and reports that check, the owner answered "Done if disclosed (Recommended)" ([4 November 2026](https://github.com/eyalgolan/statecraft-israel/pull/2481#issuecomment-6623108295)); the chosen option read: "Yes, when the PR discloses the AI help and says exactly what was opened and checked; the tag becomes 'checked by <contributor>, AI-assisted'." The same holds for the `reviewed_by` sign-off and the Hebrew `agent-checked` flags ([docs/CONTENT_POLICY.md](docs/CONTENT_POLICY.md), section 2, rules 6 and 7).## Licence of your contribution@@ -109,7 +109,7 @@ AI-assisted work is welcome. Say so in the pull request: which parts, and how yo## What CI runs-Every pull request and every push to `main` runs `Sim (dotnet test)`, `Tools (pytest)`, `Repo policy`, and, on pull requests, `Changelog`. The `Changelog` job also runs `scripts/oss/reviewed_by_guard.py`: a commit with an AI co-author trailer may not add, change or remove a `reviewed_by` or `reviewed_on` line in `content/` (only a person signs a row off, #375). The jobs use no secrets, call no paid API, run no AI agent and push nothing.+Every pull request and every push to `main` runs `Sim (dotnet test)`, `Tools (pytest)`, `Repo policy`, and, on pull requests, `Changelog`. The `Changelog` job also runs `scripts/oss/reviewed_by_guard.py`: a commit with an AI co-author trailer may not remove a `reviewed_by` or `reviewed_on` line in `content/`, and may add or change one only when the pull request's "AI assistance" section discloses the AI help and names the check (a person signs a row off, #375; asked whether an AI-assisted contributor's source check counts as the `reviewed_by` sign-off, the owner answered "Yes, it counts" ([4 November 2026](https://github.com/eyalgolan/statecraft-israel/pull/2481#issuecomment-6623108295))). The guard reads that section from the event that started the run, so push again after you edit it. The jobs use no secrets, call no paid API, run no AI agent and push nothing.**Unity EditMode tests are not in CI.** Running Unity in CI needs the maintainer's Unity account credentials stored as repository secrets. GitHub never gives secrets to pull requests from forks, so the job could not run on the pull requests that most need it, and those credentials would sit on machines that run outside code. So the Unity tests are a local gate: paste their result in your PR, and the maintainer re-runs them before merging any change under `unity/`. A future Unity job must run Unity with `-CI false -GITHUB_ACTIONS false -TF_BUILD false` (runners set `CI=true`, and GitHub Actions and Azure Pipelines also set `GITHUB_ACTIONS=true` or `TF_BUILD=true`; the Unity-MCP plugin treats any of them as CI, then skips its NuGet download and fails to compile), or commit the plugin's DLLs.diff --git a/docs/CONTENT_POLICY.md b/docs/CONTENT_POLICY.mdindex d5decf0b9..9e3003a68 100644--- a/docs/CONTENT_POLICY.md+++ b/docs/CONTENT_POLICY.md@@ -47,15 +47,19 @@ These rules protect the game and the people in it. They are not a viewpoint:(`name_he`, `title_he`, `title_he_f`, `body_he`) that an AI agent checked against its sources, but no person has readyet, carries its own flag beside it, `*_review: agent-checked` (for example `name_he_review`), whatever the row's`status` says about its English facts (owner, 15 October 2026). A native Hebrew speaker reviews these names (#564)- and then removes the line; the loader accepts only `agent-checked` (a blank value is an error), and only next to a+ and then removes the line, or an AI-assisted contributor does, when the pull request discloses the AI help and names+ the strings read and the sources they were read against (asked whether an AI-assisted contributor's Hebrew read can clear an `agent-checked` string or still needs a native Hebrew speaker, the owner answered "AI-assisted can clear it" ([4 November 2026](https://github.com/eyalgolan/statecraft-israel/pull/2481#issuecomment-6623108295))); the loader accepts only `agent-checked` (a blank value is an error), and only next to aname.7. **A sign-off names a person.** A row a person has reviewed carries, beside its `status`, `reviewed_by` (thereviewer's GitHub handle, never an email) and `reviewed_on` (the day), both or neither (owner, 15 October 2026,#375: "Yes, humans only"). Only that person writes the two lines, in their own commit; an AI agent never adds, changesor removes them, and `scripts/oss/reviewed_by_guard.py` fails any pull request where a commit with an AI co-author- trailer does. A signed row is closed to agents too (owner, 15 October 2026, on #629: "Block it in CI"): the guard+ trailer does, unless the pull request's "AI assistance" section discloses the AI help. Then the AI-assisted+ contributor's check counts as the sign-off, under their own handle, and the section should say which sources they+ opened and what they checked (asked whether an AI-assisted contributor's source check counts as the `reviewed_by` sign-off, the owner answered "Yes, it counts" ([4 November 2026](https://github.com/eyalgolan/statecraft-israel/pull/2481#issuecomment-6623108295))). Even then, such a commit never removes a sign-off. CI checks only that the section exists, is not a "no" and names a check; the reviewer reads what was checked and how. A signed row is closed to agents too (owner, 15 October 2026, on #629: "Block it in CI"): the guardfails a pull request where a commit with an AI co-author trailer changes any field of a signed row, the `id`- included, until a person signs the row again or removes its sign-off in a commit of their own. How to sign off:+ included, until a person signs the row again or removes its sign-off in a commit of their own (an AI-assisted+ contributor, disclosed as above, may sign it again but not remove the sign-off). How to sign off:[HISTORIAN_REVIEW.md](HISTORIAN_REVIEW.md#sign-the-row-off). A row with a sign-off leaves the review queue([review-queue.md](review-queue.md)).diff --git a/docs/HISTORIAN_REVIEW.md b/docs/HISTORIAN_REVIEW.mdindex 2189d403a..0447e3b00 100644--- a/docs/HISTORIAN_REVIEW.md+++ b/docs/HISTORIAN_REVIEW.md@@ -75,14 +75,18 @@ reviewed now carries, beside its `status`:Both or neither: the loader (and the map's readers in Unity, and `tools/routes_1948.py`) refuses one without the other, ablank value, or a value of the wrong shape. **Only the reviewer writes these two lines, in a commit of their own.** An AIagent never does, not even to copy a sign-off it was told about: `scripts/oss/reviewed_by_guard.py` fails a pull request-in which a commit with an AI co-author trailer adds, changes or removes either line, and it fails closed. A row with a+in which a commit with an AI co-author trailer adds, changes or removes either line, and it fails closed. The exception+is a pull request whose "AI assistance" section discloses the AI help: then an AI-assisted contributor's check counts+as the sign-off, under their own handle, and the section should say which sources they opened and what they checked+(asked whether an AI-assisted contributor's source check counts as the `reviewed_by` sign-off, the owner answered "Yes, it counts" ([4 November 2026](https://github.com/eyalgolan/statecraft-israel/pull/2481#issuecomment-6623108295))). Even then, such a commit never removes a sign-off. CI checks only that the section exists, is not a "no" and names a check; the reviewer reads what was checked and how. A row with awhole sign-off leaves the review queue (`tools/review_queue.py`, `docs/review-queue.md`).**A signed row is closed to agents** (owner, 15 October 2026, on #629: "Block it in CI"). A sign-off vouches for the textthe reviewer read, so the same guard also fails a pull request in which a commit with an AI co-author trailer changes anyline of a row that carries a whole sign-off, any field, the `id` included, or adds a key inside it. It stays failed untila person, in a later commit of their own in the same pull request, reads the row again and signs it again (a new-`reviewed_by` / `reviewed_on`) or removes its sign-off. Only the row whose own sign-off lines that commit changes is+`reviewed_by` / `reviewed_on`) or removes its sign-off. An AI-assisted contributor, disclosed as above, may sign it+again but not remove the sign-off. Only the row whose own sign-off lines that commit changes isreleased, and a merge commit releases nothing. Any change to the row's `reviewed_by` or `reviewed_on` line counts, evena comment added to it, so change those lines only after reading the row again. A row also covers what it pulls in fromelsewhere through a YAML alias or merge key (`*gov1_k`, `<<: *d`): an agent editing the anchor edits the row. An agent that needs to change a signed row proposes the changediff --git a/docs/SOURCING_FOR_CONTRIBUTORS.md b/docs/SOURCING_FOR_CONTRIBUTORS.mdindex fbc019062..b03aa333a 100644--- a/docs/SOURCING_FOR_CONTRIBUTORS.md+++ b/docs/SOURCING_FOR_CONTRIBUTORS.md@@ -37,3 +37,5 @@ What to do, in this order:## Disclose how you workedIf an AI assistant helped, say so under "AI assistance" in the PR (`CONTRIBUTING.md`) and say which claims you checked yourself against which pages.++A note tagged "a person's check pending" is done when you, AI-assisted or not, do that check and report it: asked whether an item tagged "a person's check pending" counts as done once an AI-assisted contributor does and reports that check, the owner answered "Done if disclosed (Recommended)" ([4 November 2026](https://github.com/eyalgolan/statecraft-israel/pull/2481#issuecomment-6623108295)); the chosen option read: "Yes, when the PR discloses the AI help and says exactly what was opened and checked; the tag becomes 'checked by <contributor>, AI-assisted'." Say in the PR which page you opened for each claim and what you checked there.diff --git a/docs/WRITING_EVENTS.md b/docs/WRITING_EVENTS.mdindex aa456825a..0eaf9345d 100644--- a/docs/WRITING_EVENTS.md+++ b/docs/WRITING_EVENTS.md@@ -351,7 +351,8 @@ If AI helped draft the text, you still check every claim yourself before using `Hebrew display names in the other content files (`name_he`, `title_he`, `title_he_f`, `body_he`) have a separateflag: `*_review: agent-checked` while only an AI agent has checked the name against its sources. A native speaker-removes the line once they have reviewed the name (#564); a blank value is an error, not a review. It does not change+removes the line once they have reviewed the name (#564), or an AI-assisted contributor does when the pull request+discloses the AI help and names the strings read (asked whether an AI-assisted contributor's Hebrew read can clear an `agent-checked` string or still needs a native Hebrew speaker, the owner answered "AI-assisted can clear it" ([4 November 2026](https://github.com/eyalgolan/statecraft-israel/pull/2481#issuecomment-6623108295))); a blank value is an error, not a review. It does not changethe row's `status`.### reviewed_by and reviewed_on@@ -359,8 +360,12 @@ the row's `status`.A person's sign-off beside `status`: `reviewed_by` is the reviewer's GitHub handle (never an email), `reviewed_on` theday, `YYYY-MM-DD`. Both or neither; the loader refuses a blank or malformed value. **Only the reviewer writes them**, in acommit of their own: never add, change or remove them yourself on someone's behalf, and an AI agent never does-(`scripts/oss/reviewed_by_guard.py` fails such a pull request; owner, 15 October 2026, #375). An agent may not edit any-field of a signed row either, until a person signs it again ("Block it in CI", owner, 15 October 2026). See+(`scripts/oss/reviewed_by_guard.py` fails such a pull request; owner, 15 October 2026, #375), unless the pull request's+"AI assistance" section discloses the AI help: then an AI-assisted contributor's check counts as+the sign-off (it may add or change the two lines, never remove them), and the+section should say which sources they opened and what they checked (asked whether an AI-assisted contributor's source check counts as the `reviewed_by` sign-off, the owner answered "Yes, it counts" ([4 November 2026](https://github.com/eyalgolan/statecraft-israel/pull/2481#issuecomment-6623108295))). CI checks only that the section exists, is not a "no" and names a check; the reviewer reads what was checked and how. An agent may not edit any+field of a signed row either, until a person (or a disclosed AI-assisted contributor) signs it again ("Block it in CI",+owner, 15 October 2026). See[HISTORIAN_REVIEW.md](HISTORIAN_REVIEW.md#sign-the-row-off).## What the loader rejectsdiff --git a/docs/WRITING_UI_HE.md b/docs/WRITING_UI_HE.mdindex 7da604374..f54dd9de5 100644--- a/docs/WRITING_UI_HE.md+++ b/docs/WRITING_UI_HE.md@@ -18,6 +18,7 @@ Revision 21 October 2026, localisation follow-up: event/unit field fallbacks and- A writer or translator reads the rules and the checklist.- A native reviewer works through the "For the native reviewer" lists, decides each open point, and signs off by name and date (HE-14).- An AI agent reads the agent brief first. It must never finalise Hebrew and must flag every Hebrew string for native review.+- An AI-assisted contributor may do the native read and clear an `agent-checked` flag, when the pull request's "AI assistance" section discloses the AI help and lists the strings read (the owner, 4 November 2026: "AI-assisted can clear it"; https://github.com/eyalgolan/statecraft-israel/pull/2481#issuecomment-6623108295).- Every quoted string is a real string from `strings.he.yaml` or `strings.en.yaml`, or a real line from the sources named. Rewrites are labelled "candidate".Rule status legend: **observed** (already the practice), **proposed** (new), **maintainer** (needs Eyal's decision), **native** (needs a native Hebrew reviewer), **code** (needs a code change).diff --git a/docs/dev-setup.md b/docs/dev-setup.mdindex 481f1f681..a3fd3f76a 100644--- a/docs/dev-setup.md+++ b/docs/dev-setup.md@@ -39,6 +39,8 @@ Unity, a Unity licence and macOS are only needed for `unity/`. The sim, the cont`scripts/check.sh` runs all the checks in one go, cheapest first, plus a sim build with warnings as errors. It stops at the first failure and shows the end of its output. It takes the base ref as its argument (default `origin/main`); set `CHECK_NO_CHANGELOG=1` if the PR has the `no-changelog` label.+In CI the reviewed_by guard also reads the pull request's "AI assistance" section, and a disclosed AI-assisted sign-off passes (owner, 4 November 2026: "Yes, it counts"). Run locally, it has no description and treats AI assistance as not disclosed. To check with your PR's description: `gh pr view <number> --json body --jq '{pull_request: {body: .body}}' > pr-event.json`, then add `--pr-event pr-event.json`.+To try a rules.yaml change without editing it, use the writer preview: `dotnet run --project sim/Statecraft.Cli -- --preview --set tax_per_capita_per_year=0.00007 --show morale,treasury,fx`. It plays the historical run on the real content and on the same content with the change applied in memory, then prints the changed final-state lines (grouped like a golden failure) and a table of the values you ask for. Other options: `--until YYYY-MM-DD` (default 1950-01-01), `--seed N`, `--every N` (turns between table rows, default 8). It takes single-value top-level keys of `rules.yaml` (an era's own `content/rules/<era>.yaml` value still wins in that era) and writes nothing. A typo fails with the key named, a wrong type with the line.To see the course a saved game took, run `dotnet run --project sim/Statecraft.Cli -- --timeline-course path/to/game.save`. It replays the save as loading it in the game does and prints a tab-separated table with one row per answered event, in the timeline screen's order: `event`, `chosen`, `historical` (the record's option, `-` if none), `diverged` (`true` when the choice left the record; it stays `true` after a rejoin) and `rejoined_by` (the consequence card that brought it back, or `-`). These are the rows the timeline screen shows. Load warnings go to stderr; a file it cannot read or a save the game refuses exits 1 with no table. It writes nothing, and it runs on its own: with `--preview`, `--release-gate`, `--timeline-report`, `--auto`, `--set`, `--show`, `--until`, `--every`, `--seed` or `--turns` it exits 1 rather than ignore the flag.diff --git a/docs/review-queue.md b/docs/review-queue.mdindex ba0f2095d..936637d6b 100644--- a/docs/review-queue.md+++ b/docs/review-queue.md@@ -4,7 +4,9 @@ Generated by `uv run tools/review_queue.py --write` at commit `7fb0b47a`. Do notIt changes no status. Clearing an entry is a content change in its own pull request: a native speaker deletes aname's `*_review: agent-checked` line once they have read it against its source (#564); a person who has checkedevery claim of a listed row signs it off beside its status with `reviewed_by` (their GitHub handle) and-`reviewed_on` (the day), as `docs/HISTORIAN_REVIEW.md` describes; only a person writes those (#375).+`reviewed_on` (the day), as `docs/HISTORIAN_REVIEW.md` describes; only a person writes those (#375). An AI-assisted+contributor may do either when the pull request discloses the AI help (owner, 4 November 2026; CONTENT_POLICY.md,+section 2, rules 6 and 7).**This list is over-inclusive, and it is not a verdict on who checked anything.** The second table lists everyreviewed status whose line was last written by a commit with an AI co-author trailer. Some of those record adiff --git a/docs/translations.md b/docs/translations.mdindex 8c610dc3f..9ebf21d27 100644--- a/docs/translations.md+++ b/docs/translations.md@@ -35,6 +35,8 @@ altalena:`review` is `agent-checked` until a native speaker has read the text, and is left out after that (#564). It is the onlyvalue it may have.+An AI-assisted contributor may also do that read and remove the line, when the pull request discloses the AI help and+names the strings read (the owner, 4 November 2026: "AI-assisted can clear it"; [comment](https://github.com/eyalgolan/statecraft-israel/pull/2481#issuecomment-6623108295)).## Content keysdiff --git a/docs/units.md b/docs/units.mdindex f1dc54008..c05625965 100644--- a/docs/units.md+++ b/docs/units.md@@ -483,6 +483,8 @@ and a unit the sim moves is placed without the control layer.date strings instead), and `number_he` on the row for the subtitle's number line (#1219 item 2), each with its`*_he_sources` (the sources of its proper names) and `*_he_review: agent-checked` until a native speaker has read it(#564). A field without one shows its English, independently of the others; the English card never changes.+ An AI-assisted contributor may also do that read and remove the line, when the pull request discloses the AI help+ (the owner, 4 November 2026: "AI-assisted can clear it"; `docs/CONTENT_POLICY.md`, section 2, rule 6).`UnitData.Parse` refuses a Hebrew text without its English (so a Hebrew commander never adds a line), a present butblank key, sources or a review flag without the text, and text without Hebrew letters; any other Hebrew key failsas every unknown key does. Their sources join the card's source hosts but, like `name_he_sources`,diff --git a/scripts/oss/reviewed_by_guard.py b/scripts/oss/reviewed_by_guard.pyindex 019399b36..421fdc279 100644--- a/scripts/oss/reviewed_by_guard.py+++ b/scripts/oss/reviewed_by_guard.py@@ -2,11 +2,11 @@# requires-python = ">=3.11"# dependencies = ["pyyaml==6.0.3"]# ///-"""Only a person signs a row off, and an agent may not edit a row a person has signed off. For every commit in a pull-request's range this fails when:+"""Only a person signs a row off, or an AI-assisted contributor who discloses the AI help, and an agent may not edit a row+a person has signed off. For every commit in a pull request's range this fails when:1. a commit that an AI agent co-wrote adds, changes or removes a `reviewed_by` or `reviewed_on` line in a content/ YAML- file (owner, 15 October 2026, #375: "Yes, humans only");+ file (owner, 15 October 2026, #375: "Yes, humans only"), unless the pull request discloses the AI help (see below);2. a commit that an AI agent co-wrote changes any line, the id included, of a row that carries a person's whole sign-offin that commit's parent (so on the base, or signed earlier in the same pull request) (owner, 15 October 2026, on #629: "Block it in CI"), unless a later commit of the same pullrequest with no AI trailer changes that row's own reviewed_by / reviewed_on lines (signs it again or removes its@@ -32,11 +32,24 @@ It fails closed: a base or head that does not resolve, a range git cannot list,diff or files cannot be read, a content YAML file that does not parse, and a path git had to quote are failures, neverpasses.-Usage: uv run scripts/oss/reviewed_by_guard.py --base <base-sha> [--head HEAD] [--repo .]"""+Disclosure (owner, 4 November 2026, asked whether an AI-assisted contributor's source check counts as the reviewed_by+sign-off: "Yes, it counts"): with --pr-event, the guard reads the pull request's description from the event file GitHub+writes (GITHUB_EVENT_PATH), never from a shell argument. The pull request discloses the AI help when its "AI assistance"+section (the template's heading, up to the next heading, HTML comments removed) does not start with no / none / not /+n/a / nothing and names a check (one of a short list of verbs: check, verified, compared, opened, read and the like).+CI checks only that much; the reviewer reads what was checked and how. Then an AI-co-authored commit may add or change reviewed_by /+reviewed_on lines, but never remove one: every key it drops must come back in the same commit. (3) applies to it, and the+sign-off lines it adds release a row under (2); its removals never release a row, and an edit to a signed row that the+commit does not sign again still fails. Without --pr-event (local runs, check.sh), with an event that has no pull+request, or with a missing, empty, negative or check-less section, nothing is disclosed: the 15 October rule applies+unchanged. An event file that cannot be read or parsed is a failure.++Usage: uv run scripts/oss/reviewed_by_guard.py --base <base-sha> [--head HEAD] [--repo .] [--pr-event <event.json>]"""from __future__ import annotationsimport argparseimport datetime+import jsonimport reimport subprocessimport sys@@ -55,6 +68,13 @@ DIFF = ["--no-color", "--no-ext-diff", "--no-textconv", "--text", "--src-prefix=NAMES = re.compile(r"reviewed_(?:by|on)")ON_VALUE = re.compile(r"""["']?reviewed_on["']?\s*:\s*["']?([^,}\s#"']*)""")HUNK = re.compile(r"^(@+) (.*?) @+")+HEADING = re.compile(r"^ {0,3}#{1,6}(?:\s+(.*?))?\s*#*\s*$")+NEGATIVE = {"no", "none", "not", "n/a", "na", "nothing"}+FIRST_WORD = re.compile(r"[^\s.,;:!?*_`~>#()\[\]-]+")+CHECK = re.compile(r"\b(?:check|checks|checked|checking|verify|verified|compared|opened|read)\b", re.I)+LIST_MARK = re.compile(r"^\s*(?:(?:\d+[.)]|[-*+])\s+|\[[ xX]\]\s*)")+FENCE = re.compile(r"^ {0,3}(```|~~~)")+KEYS = ("reviewed_by", "reviewed_on")class GuardError(Exception):@@ -99,6 +119,56 @@ def hunks(diff: str) -> list[Hunk]:return out+def ai_assistance(body: str) -> str:+ """The text of the description's first "AI assistance" section, HTML comments removed ("" when there is none). An+ unclosed comment hides the rest of the section; a "#" line inside a ``` or ~~~ code fence is not a heading."""+ lines, found, out, fence = (body or "").splitlines(), False, [], False+ for line in lines:+ if FENCE.match(line):+ fence = not fence # a "#" line inside a code fence is not a heading+ m = None if fence else HEADING.match(line)+ if m:+ if found:+ break+ found = (m.group(1) or "").strip().lower() == "ai assistance"+ continue+ if found:+ out.append(line)+ text = re.sub(r"<!--.*?(?:-->|\Z)", "", "\n".join(out), flags=re.S)+ return text.strip()+++def disclosed(body: str) -> bool:+ """True when the "AI assistance" section exists, is not a "no" and names a check. Its first word, after list markers+ ("1." "1)" "-" "*" "+" "[x]" "[ ]") and markdown punctuation are stripped, is not no / none / not / n/a / nothing, and it+ contains one of check / checks / checked / checking / verify / verified / compared / opened / read as a whole word.+ An empty or template-only section, "None used.", "- [x] None, I checked it" or "Claude Code drafted it." (no check+ named) is not a disclosure. This is all CI can see: what was checked, and how, is for the reviewer to read."""+ text = ai_assistance(body)+ while (stripped := LIST_MARK.sub("", text, count=1)) != text:+ text = stripped+ first = FIRST_WORD.search(text)+ if first is None or first.group(0).lower() in NEGATIVE:+ return False+ return CHECK.search(text) is not None+++def _key_count(lines: list[tuple[str, str]], sign: str, key: str) -> int:+ """How many times the key is named on the diff lines with this sign (comments excluded)."""+ return sum(len(re.findall(rf"[\"']?{key}[\"']?\s*:", t)) for cols, t in lines if sign in cols and _named(t))+++def event_body(path: str) -> str:+ """The pull request description in a GitHub event file; "" for an event with no pull request or no description."""+ try:+ event = json.loads(Path(path).read_text(encoding="utf-8"))+ except (OSError, ValueError) as e:+ raise GuardError(f"cannot read the event file {path}") from e+ pr = event.get("pull_request") if isinstance(event, dict) else None+ body = pr.get("body") if isinstance(pr, dict) else None+ return body if isinstance(body, str) else ""++def _named(text: str) -> bool:return not text.lstrip().startswith("#") and NAMES.search(text) is not None@@ -177,8 +247,9 @@ def changes(repo: Path, sha: str, parents: list[str]) -> list[Change]:return out-def check(repo: Path, base: str, head: str) -> list[str]:- """The problems in base..head, one line each; raises GuardError for anything it cannot determine."""+def check(repo: Path, base: str, head: str, ai_disclosed: bool = False) -> list[str]:+ """The problems in base..head, one line each; raises GuardError for anything it cannot determine. ai_disclosed: the+ pull request discloses the AI help (owner, 4 November 2026, "Yes, it counts")."""repo = Path(repo)try:if _git(["rev-parse", "--is-shallow-repository"], repo).strip() != "false":@@ -204,9 +275,21 @@ def check(repo: Path, base: str, head: str) -> list[str]:for ch in files:named = [(cols, text) for hk in ch.hunks for cols, text in hk.lines if _named(text)]if agent:- if named:+ if named and ai_disclosed:+ # Disclosed (owner, 4 November 2026, "Yes, it counts"): an AI-assisted check may add or change a sign-off,+ # never remove one. Every key a commit drops must come back in the same commit.+ lost = [k for k in KEYS if _key_count(named, "-", k) > _key_count(named, "+", k)]+ if lost:+ problems.append(f"{sha[:10]}: a commit with an AI co-author trailer removes a {' / '.join(lost)} line in "+ f"{ch.path}. Disclosed AI assistance lets a check count as a sign-off (owner, 4 November "+ f"2026, \"Yes, it counts\"); it does not let an AI-co-authored commit remove one. A "+ f"person removes a sign-off in a commit of their own.")+ if named and not ai_disclosed:problems.append(f"{sha[:10]}: a commit with an AI co-author trailer changes a reviewed_by / reviewed_on line "- f"in {ch.path}; only a person signs a row off (#375). Remove those lines from this commit.")+ f"in {ch.path}, and the pull request does not disclose AI assistance. Only a person signs a "+ f"row off (#375), or an AI-assisted contributor who discloses it (owner, 4 November 2026, "+ f"\"Yes, it counts\"): say in the \"AI assistance\" section what was checked and how, then "+ f"push again so CI reads the new description; or remove those lines from this commit.")for p, (parent, old) in enumerate(zip(parents or [EMPTY_TREE], ch.old_paths)):if not old or parent == EMPTY_TREE:continue@@ -218,8 +301,10 @@ def check(repo: Path, base: str, head: str) -> list[str]:if _touches(row, hk.old[p][0], hk.old[p][1], inserted):edited.setdefault((ch.path, row.label), sha)break- continue- # A person's commit: the sign-off's day, and re-signing (or unsigning) a row an agent edited.+ if not ai_disclosed:+ continue+ # A person's commit, or a disclosed AI-assisted one: the sign-off's day, and re-signing (or unsigning) a row an+ # agent edited.for cols, text in named:if "+" in cols:m = ON_VALUE.search(text)@@ -249,7 +334,7 @@ def check(repo: Path, base: str, head: str) -> list[str]:released = {row.label for row in _signed(repo, sha, ch.path, must_exist=False)if any(row.first <= n <= row.last for n in added)}old = ch.old_paths[0] if ch.old_paths else ""- if old and parents:+ if old and parents and not agent: # an AI-co-authored commit's removal never releases a rowreleased |= {row.label for row in _signed(repo, parents[0], old, must_exist=True)if any(row.first <= n <= row.last for n in removed)}for label in released:@@ -266,9 +351,12 @@ def main(argv: list[str] | None = None) -> int:ap.add_argument("--base", required=True)ap.add_argument("--head", default="HEAD")ap.add_argument("--repo", default=".")+ ap.add_argument("--pr-event", help="GitHub event file (GITHUB_EVENT_PATH) to read the PR's AI assistance section from")a = ap.parse_args(argv)try:- problems = check(Path(a.repo), a.base, a.head)+ ai_disclosed = a.pr_event is not None and disclosed(event_body(a.pr_event))+ print(f"reviewed_by guard: AI assistance {'disclosed' if ai_disclosed else 'not disclosed'} in the pull request.")+ problems = check(Path(a.repo), a.base, a.head, ai_disclosed)except GuardError as e:print(f"reviewed_by guard: {e}. Failing closed.")return 1@@ -276,7 +364,7 @@ def main(argv: list[str] | None = None) -> int:print(p)if problems:return 1- print("reviewed_by guard: no AI-co-authored commit touches a sign-off or a signed-off row.")+ print("reviewed_by guard: no AI-co-authored commit signs a row off without disclosure or edits a signed-off row.")return 0diff --git a/scripts/oss/tests/test_github_config.py b/scripts/oss/tests/test_github_config.pyindex 1be0ba4e6..48d2adc08 100644--- a/scripts/oss/tests/test_github_config.py+++ b/scripts/oss/tests/test_github_config.py@@ -238,6 +238,15 @@ def test_the_reviewed_by_guard_runs_on_the_pr_head_with_full_history():assert step["env"]["BASE_SHA"] == "${{ github.event.pull_request.base.sha }}"+def test_the_reviewed_by_guard_reads_the_description_from_the_event_file_only():+ """Owner, 4 November 2026 ("Yes, it counts"): the guard reads the PR's "AI assistance" section from the runner's event+ file. The description is attacker-controlled text, so it never goes into a run line or an env value."""+ job = next(j for j in ci()["jobs"].values() if j["name"] == "Changelog")+ step = next(s for s in job["steps"] if "reviewed_by_guard.py" in s.get("run", ""))+ assert '--pr-event "$GITHUB_EVENT_PATH"' in step["run"]+ assert "github.event.pull_request.body" not in (ROOT / ".github/workflows/ci.yml").read_text(encoding="utf-8")++STEAM = ROOT / ".github/workflows/steam-upload.yml"STEAM_SECRETS = {"STEAM_BUILDER_USERNAME", "STEAM_CONFIG_VDF"}STEAM_LOGIN_STEPS = {"Restore the builder login (owner's secret)", "Upload with steamcmd (owner's builder account)"}diff --git a/scripts/oss/tests/test_reviewed_by_guard.py b/scripts/oss/tests/test_reviewed_by_guard.pyindex af92cf625..01f4112ee 100644--- a/scripts/oss/tests/test_reviewed_by_guard.py+++ b/scripts/oss/tests/test_reviewed_by_guard.py@@ -295,3 +295,175 @@ def test_an_anchor_a_signed_row_uses_is_part_of_it(tmp_path):edit(root2, merge.replace("note: n", "note: m"))commit(root2, "content: change the defaults" + AI)assert len(guard.check(root2, base2, "HEAD")) == 1+++# ---- owner ruling, 4 November 2026 ("Yes, it counts"): an AI-assisted sign-off counts when the PR discloses the AI help --++TEMPLATE = ("## What this changes\n\nSigns off A.\n\n## AI assistance\n\n<!-- One line: the tool, and what it did. Write \"None\" "+ "if no AI tool was used. -->\n{ai}\n\n## Evidence\n\n```\n```\n")+DISCLOSED = TEMPLATE.format(ai="Claude Code opened the source with me; I read page 3 of the Knesset record and checked A's dates.")+++def event(tmp_path, body, name="event.json"):+ import json+ path = tmp_path / name+ path.write_text(json.dumps({"pull_request": {"number": 1, "body": body}}), encoding="utf-8")+ return str(path)+++def test_the_ai_assistance_section_is_read_from_the_template():+ assert guard.disclosed(DISCLOSED)+ assert guard.disclosed(DISCLOSED.replace("\n", "\r\n"))+ for body in (TEMPLATE.format(ai=""), TEMPLATE.format(ai="None"), TEMPLATE.format(ai="None."), TEMPLATE.format(ai="n/a"),+ TEMPLATE.format(ai="<!-- unclosed comment hides the rest: Claude Code did it"), "", None,+ "## What this changes\n\nClaude Code wrote it.\n", # said elsewhere, not in the section+ DISCLOSED.replace("## AI assistance", "## Evidence of AI assistance")):+ assert not guard.disclosed(body), body+++def test_a_disclosed_ai_assisted_sign_off_passes(tmp_path, capsys):+ root, base = repo(tmp_path)+ edit(root, SIGNED)+ commit(root, "content: sign off A" + AI)+ assert guard.check(root, base, "HEAD", ai_disclosed=True) == []+ assert guard.main(["--repo", str(root), "--base", base, "--head", "HEAD", "--pr-event", event(tmp_path, DISCLOSED)]) == 0+ assert "AI assistance disclosed" in capsys.readouterr().out+++def test_an_undisclosed_ai_sign_off_still_fails(tmp_path):+ import json+ root, base = repo(tmp_path)+ edit(root, SIGNED)+ commit(root, "content: sign off A" + AI)+ assert len(guard.check(root, base, "HEAD")) == 1+ no_pr = tmp_path / "push.json"+ no_pr.write_text(json.dumps({"ref": "refs/heads/main"}), encoding="utf-8")+ for i, path in enumerate([None, str(no_pr), event(tmp_path, TEMPLATE.format(ai="None"), "none.json"),+ event(tmp_path, TEMPLATE.format(ai=""), "empty.json"), event(tmp_path, None, "null.json")]):+ args = ["--repo", str(root), "--base", base, "--head", "HEAD"] + (["--pr-event", path] if path else [])+ assert guard.main(args) == 1, i+++def test_an_unreadable_event_file_fails_closed(tmp_path, capsys):+ root, base = repo(tmp_path)+ bad = tmp_path / "bad.json"+ bad.write_text("{not json", encoding="utf-8")+ for path in (str(bad), str(tmp_path / "missing.json")):+ assert guard.main(["--repo", str(root), "--base", base, "--head", "HEAD", "--pr-event", path]) == 1+ assert "cannot read the event file" in capsys.readouterr().out+++def test_human_only_commits_are_judged_the_same_when_disclosed(tmp_path):+ root, base = repo(tmp_path)+ edit(root, SIGNED)+ commit(root, "content: sign off A")+ assert guard.check(root, base, "HEAD") == guard.check(root, base, "HEAD", ai_disclosed=True) == []+ root2, base2 = repo(tmp_path / "late")+ edit(root2, SIGNED.replace("2026-10-15", "2026-10-16"))+ commit(root2, "content: sign off A")+ assert len(guard.check(root2, base2, "HEAD")) == len(guard.check(root2, base2, "HEAD", ai_disclosed=True)) == 1+++def test_a_disclosed_ai_sign_off_dated_after_its_commit_fails(tmp_path):+ root, base = repo(tmp_path)+ edit(root, SIGNED.replace("2026-10-15", "2026-10-16"))+ commit(root, "content: sign off A" + AI)+ problems = guard.check(root, base, "HEAD", ai_disclosed=True)+ assert len(problems) == 1 and "after" in problems[0]+++def test_disclosure_does_not_let_an_ai_commit_edit_a_signed_row_without_signing_it_again(tmp_path):+ """#629 ("Block it in CI") still holds: a disclosed AI-assisted commit that edits a signed row must sign it again."""+ root, base = repo(tmp_path, TWO)+ edit(root, TWO.replace("name: A", "name: A2"))+ commit(root, "content: edit A" + AI)+ problems = guard.check(root, base, "HEAD", ai_disclosed=True)+ assert len(problems) == 1 and "signed off" in problems[0] and "'a'" in problems[0]+ edit(root, TWO.replace("name: A", "name: A2").replace("2026-10-15", "2026-10-16"))+ commit(root, "content: re-read A and sign again" + AI, date="2026-10-16T12:00:00+00:00")+ assert guard.check(root, base, "HEAD", ai_disclosed=True) == []+ assert len(guard.check(root, base, "HEAD")) == 2 # undisclosed: the re-sign is refused and A stays edited+++# ---- review of #2481: a "no AI" statement is not a disclosure, and disclosure never lets an AI commit remove a sign-off --++def test_a_statement_that_no_ai_was_used_is_not_a_disclosure():+ for ai in ("None used.", "No AI was used", "Not used", "**None**, I checked it myself", "N/A: checked by hand",+ "Nothing; I checked each fact", "_No._ Checked by hand."):+ assert not guard.disclosed(TEMPLATE.format(ai=ai)), ai+++def test_naming_a_tool_without_the_check_is_not_a_disclosure():+ for ai in ("Claude Code drafted the test.", "Copilot wrote the YAML.", "Claude Code helped (checklist in the PR)"):+ assert not guard.disclosed(TEMPLATE.format(ai=ai)), ai+++def test_the_template_example_is_a_disclosure():+ assert guard.disclosed(TEMPLATE.format(ai="Claude Code drafted the test; I checked each fact against its source."))+ assert guard.disclosed(TEMPLATE.format(ai="Codex read the scans; I am checking the dates against page 4."))+++def test_a_disclosed_ai_commit_may_not_remove_a_sign_off(tmp_path):+ for i, after in enumerate([ROW, # both keys gone+ ROW + " reviewed_by: eyalgolan\n", # one key gone+ ROW + " # reviewed_by: eyalgolan\n # reviewed_on: 2026-10-15\n"]): # commented out+ root, base = repo(tmp_path / str(i), SIGNED)+ edit(root, after)+ commit(root, "content: drop the sign-off" + AI)+ problems = guard.check(root, base, "HEAD", ai_disclosed=True)+ assert any("removes a" in p for p in problems), (i, problems)+++def test_a_disclosed_ai_removal_does_not_release_an_edited_row(tmp_path):+ """Rule 2: an AI commit edits signed row A, then a disclosed AI commit removes A's sign-off. A stays edited."""+ root, base = repo(tmp_path, TWO)+ edit(root, TWO.replace("name: A", "name: A2"))+ commit(root, "content: edit A" + AI)+ edit(root, TWO.replace("name: A", "name: A2").replace(" reviewed_by: eyalgolan\n reviewed_on: 2026-10-15\n", ""))+ commit(root, "content: unsign A" + AI)+ problems = guard.check(root, base, "HEAD", ai_disclosed=True)+ assert any("removes a" in p for p in problems) and any("signed off" in p and "'a'" in p for p in problems), problems+++def test_a_disclosed_ai_add_or_re_sign_passes_and_an_undisclosed_add_fails(tmp_path):+ root, base = repo(tmp_path)+ edit(root, SIGNED)+ commit(root, "content: sign off A" + AI)+ assert guard.check(root, base, "HEAD", ai_disclosed=True) == []+ assert len(guard.check(root, base, "HEAD")) == 1+ root2, base2 = repo(tmp_path / "re", SIGNED)+ edit(root2, SIGNED.replace("reviewed_by: eyalgolan", "reviewed_by: someone-else").replace("2026-10-15", "2026-10-16"))+ commit(root2, "content: re-sign A" + AI, date="2026-10-16T12:00:00+00:00")+ assert guard.check(root2, base2, "HEAD", ai_disclosed=True) == []+++# ---- second review of #2481: the check verbs, list markers and code fences ----------------------------------------------++def test_a_short_list_of_check_verbs_names_the_check():+ for ai in ("Claude drafted it; I verified every date against the cited source.", "Codex drafted it; I verify each date.",+ "Claude drafted it; I compared each name with the scan.", "Claude found the pages; I opened each one.",+ "Claude found the page; I read it in full."):+ assert guard.disclosed(TEMPLATE.format(ai=ai)), ai+++def test_a_section_with_none_of_the_verbs_does_not_name_the_check():+ for ai in ("Claude drafted it; the dates were already there.", "Copilot suggested the bread-and-butter wording.",+ "Claude Code wrote the YAML and the tests."):+ assert not guard.disclosed(TEMPLATE.format(ai=ai)), ai+++def test_list_markers_are_stripped_before_the_first_word():+ for ai in ("1. None, I checked it", "1) None, I checked it", "- [x] None, I checked it", "* [ ] No AI, checked by hand",+ "+ [X] Not used; I checked it"):+ assert not guard.disclosed(TEMPLATE.format(ai=ai)), ai+ for ai in ("- Claude Code drafted the test; I checked each fact against its source.",+ "1. Claude Code drafted the test; I checked each fact against its source.",+ "- [x] Claude Code drafted the test; I checked each fact against its source."):+ assert guard.disclosed(TEMPLATE.format(ai=ai)), ai+++def test_a_heading_inside_a_code_fence_is_not_a_section():+ fenced = "## What this changes\n\n```\n## AI assistance\nClaude Code; I checked it.\n```\n\n## AI assistance\n\nNone\n"+ assert guard.ai_assistance(fenced) == "None" and not guard.disclosed(fenced)+ inside = TEMPLATE.format(ai="Claude Code drafted it; I checked each date:\n```\n# a shell comment\n```")+ assert "a shell comment" in guard.ai_assistance(inside) and guard.disclosed(inside)diff --git a/tools/review_queue.py b/tools/review_queue.pyindex 0541dc674..152e5af96 100644--- a/tools/review_queue.py+++ b/tools/review_queue.py@@ -317,7 +317,9 @@ def page(entries: list[Entry], human: int, head: str, signed: int = 0) -> str:"It changes no status. Clearing an entry is a content change in its own pull request: a native speaker deletes a","name's `*_review: agent-checked` line once they have read it against its source (#564); a person who has checked","every claim of a listed row signs it off beside its status with `reviewed_by` (their GitHub handle) and",- "`reviewed_on` (the day), as `docs/HISTORIAN_REVIEW.md` describes; only a person writes those (#375).",+ "`reviewed_on` (the day), as `docs/HISTORIAN_REVIEW.md` describes; only a person writes those (#375). An AI-assisted",+ "contributor may do either when the pull request discloses the AI help (owner, 4 November 2026; CONTENT_POLICY.md,",+ "section 2, rules 6 and 7).","","**This list is over-inclusive, and it is not a verdict on who checked anything.** The second table lists every","reviewed status whose line was last written by a commit with an AI co-author trailer. Some of those record a",