docs: add requirements, decisions and agent workflow

Records R1 to R7 from the developer and the decisions D1 to D11 that the
v1 work builds on, plus the issue, branch and review workflow the agents
follow.

Refs #1
This commit is contained in:
Florian Schmidt
2026-10-14 18:34:42 +02:00
parent 6d67f157a5
commit d3091cff16
8 changed files with 459 additions and 0 deletions
+70
View File
@@ -0,0 +1,70 @@
# Agent review
Every PR needs a passing review from a fresh agent session before it merges. The review sets the
`agent-review` commit status on the PR's head commit. A push after the review moves the head, so
the PR needs a new review.
## Starting a review (author)
After the last push, start a reviewer that has none of the work's context: a new agent session, or
a subagent whose whole prompt is `Review PR #<N> of FinalFactory/FinalToken following
docs/agents/review.md`. Use a capable model at high effort. The PR body, the issue and the earlier
reviews on the PR explain the change; the reviewer gets no other briefing.
## Reviewing (reviewer)
1. Record the head commit you review:
`tools/gitea.sh GET /repos/FinalFactory/FinalToken/pulls/<N> | jq -r .head.sha`.
2. Read the PR, its linked issue, the root `AGENTS.md`, the `AGENTS.md` of every touched project,
the [requirements](../requirements.md) and the [recorded decisions](../decisions.md) the change
touches, and the earlier agent reviews on the PR.
3. Read the whole diff: `git fetch origin && git diff origin/master...<sha>`. On a re-review it is
context; step 5 says what can block.
4. Check out the head in a separate worktree and run the checks in
[AGENTS.md](../../AGENTS.md#building-and-testing) that the change affects, always including
`python -B tools/docs/check_docs.py`.
5. If the PR already has a failed agent review, this is a re-review. Check that each blocking
finding of the last failed review is fixed or answered. Then review only the author's commits
since the commit that review covered (named in its first line), leaving out what came in from
`master`: `git log -p --no-merges ^<old sha> ^origin/master <sha>`. Only these two can block.
Anything else you notice is a note, even a bug; the author decides whether to fix it in this
PR. A full pass in every round finds new problems each time, and the loop never ends.
6. Look for:
- **Spec**: it does what the issue asks and stays inside its scope.
- **Decisions**: it matches the recorded decisions, or the PR changes their text and carries
the `type/decision` label.
- **Correctness**: bugs, edge cases, error handling, concurrency, resource cleanup.
- **Rules**: the rules in `AGENTS.md` and in the touched projects' `AGENTS.md`.
- **Tests**: new behaviour has tests.
- **Docs**: docs and `AGENTS.md` files match the new behaviour, commands and decisions.
7. Decide the verdict. `fail` only for a blocking finding: a bug, missing behaviour the issue asks
for, code that breaks a recorded decision or a rule from step 6, missing tests for new
behaviour, or a failing check. A check or tool that misses some cases does not break the rule
it guards: name the gap as a note. Everything else is a note and the review passes.
8. Write the review to a file in this format, then post it with
`tools/agent-review.sh <N> <sha> <pass|fail> <file>`:
```markdown
## Blocking
1. `path:line`: what is wrong, why it matters, and the fix.
## Notes
- `path:line`: the suggestion.
## Checked
What you read and ran, on which commit.
```
The reviewer reports and leaves the code to the author.
## After a failed review (author)
Fix each blocking finding, or answer it in a PR comment when it is wrong. Push, then start a new
fresh review.
After the second failed review, stop. Comment on the issue with the open findings, add the
`status/needs-decision` label and leave it to a developer: merge anyway, allow more rounds, split
the PR or close it.