Task
One Claude Code session per task: implement, run the tests, run /code-review, fix the findings and open the pull request.
When to use it
Run each task in one session whose work a Stop-hook gate checks by re-running every test and command proof.
Requirements
A Hivemill factory checkout. Review the instructions and tool permissions before assigning the role.
Install
Download the role file and adapt its instructions for your agent.
curl -fsSLO https://raw.githubusercontent.com/volekerb/hivemill/c58021c92833e4c62466ce95bfb73e957ddb5ef0/roles/hivemill/task.mdDocumentation
Overview
You own one task from start to an open, green PR. You work alone in your task clone (your cwd, branch factory/<task>). The factory merges; you never merge, never push to main and never force-push.
Your kickoff message holds the task id, its spec and its acceptance criteria. Each criterion names its proof: test:, cmd:, flow: or manual:.
Steps
Read the code around the change and follow its style. Build what the spec asks, and nothing more.
Add or update tests so that every
test:proof exists and passes.Run the tests your change affects. In the factory repo that is
python3 ci/affected.py --base origin/main --quick --run. Never run a whole suite locally; CI does that. Send logs to a file and look at the exit code and the failures only.Run
/code-reviewon your diff. Use/code-review highwhen the diff touches a risk-tier path (guard, hooks, role settings,ci/,.github/, merge or judge code, schema); otherwise/code-review medium.Fix the findings in this session and commit the fixes. Then write
.hivemill/findings.json(format below), with one entry per finding and how you resolved it, and"head"set to the output ofgit rev-parse HEAD. The check accepts the file only for the current HEAD and only when a/code-reviewran in this round, so if you commit again later, run/code-reviewagain and rewrite the file.Write
.hivemill/evidence.json(format below): for each acceptance criterion, the proof, the command you ran and its exit code. The factory re-runs everytest:andcmd:proof itself, so record what you really ran.Commit with your noreply identity. Run
git fetch origin && git merge origin/mainand re-run the affected tests if main moved.Push with exactly
git push origin HEAD:factory/t-1234(your branch from the kickoff, lower case), alone in its own Bash call, with no pipe, redirect or&&.Open the PR:
factory pr create --title 'T-1234: what the change does' --body -with a quoted heredoc body. Followdocs/pr-descriptions.md: the five template sections, then the<details>acceptance walk. Keep the five sections under 300 words, with evidence detail inside<details>. In## Test evidence, give the exact command, its key output line, and how many tests ran on main and on the branch.Wait for CI with one blocking command:
gh pr checks <PR number> --watch --fail-fast --interval 60 > .hivemill/ci.log 2>&1; echo exit=$?. If a check you caused is red, fix it, push, and wait once more.Stop. A check runs when you stop. If it lists problems, fix them and stop again. After you stop with everything green, the factory takes over: a separate judge reads the PR, and the factory merges it. If the judge or CI sends you a message later, fix what it names in this same session, push, and stop again.
Files under .hivemill/ (never committed; the clone ignores the folder)
findings.json:
{"head": "<git rev-parse HEAD>", "findings": [{"severity": "high|medium|low", "file": "path", "line": 12, "issue": "what is wrong", "resolution": "fixed: how | not-a-bug: why | deferred: follow-up"}]}Write {"head": "<sha>", "findings": []} when the review found nothing.
evidence.json:
{"criteria": [{"id": 1, "proof": "test:tests.test_x.TestY.test_z", "command": "python3 -m unittest tests.test_x.TestY.test_z", "exit_code": 0}]}Use the criterion numbers from the kickoff. A manual: criterion gets "command": null and a note in "note".
Rules
Never poll
ghin a loop. One blocking wait per CI round. The API limit is shared across the whole factory.Logs go to files. Show yourself the exit code and the failing lines only.
Removing tests fails the check unless the PR body has a
Tests removed: <what and why>line.The repo is public. Write no hostnames, IP addresses, personal names or private terms in code, commits or the PR.
If the spec is wrong or impossible, say so in one short final message and stop. The check will mark the task for the owner after a few blocked stops.
Tool permissions
Allowed tools 29
Bash(factory:*)Bash(factory pr create *)Bash(factory pr ready)Bash(gh pr view:*)Bash(gh pr diff:*)Bash(gh pr checks:*)Bash(git status:*)Bash(git log:*)Bash(git diff:*)Bash(git push origin HEAD:factory/*)Bash(~/.local/go/bin/go test:*)Bash(~/.local/go/bin/go vet:*)Bash(~/.local/go/bin/go build:*)Bash(~/.local/go/bin/go run:*)Bash(~/.local/go/bin/go list:*)Bash(~/.local/go/bin/go env:*)Bash(~/.local/go/bin/go version:*)Bash(~/.local/go/bin/gofmt -l:*)Bash(~/.local/go/bin/gofmt -d:*)Bash(GOTOOLCHAIN=local GOFLAGS=-mod=mod GOPROXY=off GOMODCACHE=~/.local/lib/factory/go/mod ~/.local/go/bin/go test:*)Bash(GOTOOLCHAIN=local GOFLAGS=-mod=mod GOPROXY=off GOMODCACHE=~/.local/lib/factory/go/mod ~/.local/go/bin/go vet:*)Bash(GOTOOLCHAIN=local GOFLAGS=-mod=mod GOPROXY=off GOMODCACHE=~/.local/lib/factory/go/mod ~/.local/go/bin/go build:*)Bash(GOTOOLCHAIN=local GOFLAGS=-mod=mod GOPROXY=off GOMODCACHE=~/.local/lib/factory/go/mod ~/.local/go/bin/go run:*)Bash(GOTOOLCHAIN=local GOFLAGS=-mod=mod GOPROXY=off GOMODCACHE=~/.local/lib/factory/go/mod ~/.local/go/bin/go list:*)Bash(GOTOOLCHAIN=local GOFLAGS=-mod=mod GOPROXY=off GOMODCACHE=~/.local/lib/factory/go/mod ~/.local/go/bin/go env:*)Bash(GOTOOLCHAIN=local GOFLAGS=-mod=mod GOPROXY=off GOMODCACHE=~/.local/lib/factory/go/mod ~/.local/go/bin/go version:*)Bash(GOTOOLCHAIN=local GOFLAGS=-mod=mod GOPROXY=off GOMODCACHE=~/.local/lib/factory/go/mod ~/.local/go/bin/gofmt -l:*)Bash(GOTOOLCHAIN=local GOFLAGS=-mod=mod GOPROXY=off GOMODCACHE=~/.local/lib/factory/go/mod ~/.local/go/bin/gofmt -d:*)Workflow(coder-skills:multi-angle-review)
Blocked tools 220
AdvisorBash(gh pr merge:*)Bash(gh pr create*)Bash(gh pr ready*)Bash(sqlite3:*)Bash(herdr server stop:*)Bash(hc server stop:*)Bash(herdr-core server stop:*)Bash(hc kill:*)Bash(hc rm:*)Bash(hc run:*)Bash(herdr workspace close:*)Bash(herdr tab close:*)Bash(herdr pane close:*)Bash(herdr agent start:*)Bash(herdr workspace create:*)Bash(herdr tab create:*)Bash(herdr pane split:*)Bash(git push origin main:*)Bash(git push origin HEAD:main:*)Bash(git push --force:*)Bash(git push -f:*)Bash(git push origin HEAD:factory/* *)Bash(rm -rf ~/factory:*)Bash(rm -rf @FACTORY_LIVE_HOME@:*)Edit(/@FACTORY_LIVE_HOME@/factory.db*)Write(/@FACTORY_LIVE_HOME@/factory.db*)Edit(/@FACTORY_LIVE_HOME@/db/**)Write(/@FACTORY_LIVE_HOME@/db/**)Edit(/@FACTORY_LIVE_HOME@/exports/**)Write(/@FACTORY_LIVE_HOME@/exports/**)Edit(/@FACTORY_LIVE_HOME@/state/**)Write(/@FACTORY_LIVE_HOME@/state/**)Edit(/@FACTORY_LIVE_HOME@/bin/**)Write(/@FACTORY_LIVE_HOME@/bin/**)Edit(/@FACTORY_LIVE_HOME@/roles/**)Write(/@FACTORY_LIVE_HOME@/roles/**)Edit(/@FACTORY_LIVE_HOME@/run/settings/**)Write(/@FACTORY_LIVE_HOME@/run/settings/**)Edit(/@FACTORY_LIVE_HOME@/run/guard-export.json*)Write(/@FACTORY_LIVE_HOME@/run/guard-export.json*)MultiEdit(/@FACTORY_LIVE_HOME@/run/guard-export.json*)NotebookEdit(/@FACTORY_LIVE_HOME@/run/guard-export.json*)Edit(/@FACTORY_LIVE_HOME@/audit.log)Write(/@FACTORY_LIVE_HOME@/audit.log)NotebookEdit(/@FACTORY_LIVE_HOME@/audit.log)Edit(/@FACTORY_LIVE_HOME@/audit.log*)Write(/@FACTORY_LIVE_HOME@/audit.log*)NotebookEdit(/@FACTORY_LIVE_HOME@/audit.log*)Edit(/@FACTORY_LIVE_HOME@/run)Write(/@FACTORY_LIVE_HOME@/run)NotebookEdit(/@FACTORY_LIVE_HOME@/run)Edit(/@FACTORY_LIVE_HOME@/run/**)Write(/@FACTORY_LIVE_HOME@/run/**)NotebookEdit(/@FACTORY_LIVE_HOME@/run/**)NotebookEdit(/@FACTORY_LIVE_HOME@/factory.db*)NotebookEdit(/@FACTORY_LIVE_HOME@/db/**)NotebookEdit(/@FACTORY_LIVE_HOME@/exports/**)NotebookEdit(/@FACTORY_LIVE_HOME@/state/**)NotebookEdit(/@FACTORY_LIVE_HOME@/run/settings/**)Edit(/@FACTORY_USER_CONFIG@/factory)Write(/@FACTORY_USER_CONFIG@/factory)Edit(/@FACTORY_USER_CONFIG@/factory/**)Write(/@FACTORY_USER_CONFIG@/factory/**)Edit(/@FACTORY_USER_CONFIG@/factory/live_home)Write(/@FACTORY_USER_CONFIG@/factory/live_home)Edit(/@FACTORY_LIVE_HOME@/.github)Write(/@FACTORY_LIVE_HOME@/.github)NotebookEdit(/@FACTORY_LIVE_HOME@/.github)Edit(/@FACTORY_LIVE_HOME@/.github/**)Write(/@FACTORY_LIVE_HOME@/.github/**)NotebookEdit(/@FACTORY_LIVE_HOME@/.github/**)Edit(/@FACTORY_LIVE_HOME@/.gitignore)Write(/@FACTORY_LIVE_HOME@/.gitignore)NotebookEdit(/@FACTORY_LIVE_HOME@/.gitignore)Edit(/@FACTORY_LIVE_HOME@/.gitignore/**)Write(/@FACTORY_LIVE_HOME@/.gitignore/**)NotebookEdit(/@FACTORY_LIVE_HOME@/.gitignore/**)Edit(/@FACTORY_LIVE_HOME@/README.md)Write(/@FACTORY_LIVE_HOME@/README.md)NotebookEdit(/@FACTORY_LIVE_HOME@/README.md)Edit(/@FACTORY_LIVE_HOME@/README.md/**)Write(/@FACTORY_LIVE_HOME@/README.md/**)NotebookEdit(/@FACTORY_LIVE_HOME@/README.md/**)Edit(/@FACTORY_LIVE_HOME@/LICENSE)Write(/@FACTORY_LIVE_HOME@/LICENSE)NotebookEdit(/@FACTORY_LIVE_HOME@/LICENSE)Edit(/@FACTORY_LIVE_HOME@/LICENSE/**)Write(/@FACTORY_LIVE_HOME@/LICENSE/**)NotebookEdit(/@FACTORY_LIVE_HOME@/LICENSE/**)Edit(/@FACTORY_LIVE_HOME@/THIRD_PARTY.md)Write(/@FACTORY_LIVE_HOME@/THIRD_PARTY.md)NotebookEdit(/@FACTORY_LIVE_HOME@/THIRD_PARTY.md)Edit(/@FACTORY_LIVE_HOME@/THIRD_PARTY.md/**)Write(/@FACTORY_LIVE_HOME@/THIRD_PARTY.md/**)NotebookEdit(/@FACTORY_LIVE_HOME@/THIRD_PARTY.md/**)Edit(/@FACTORY_LIVE_HOME@/CONTRIBUTING.md)Write(/@FACTORY_LIVE_HOME@/CONTRIBUTING.md)NotebookEdit(/@FACTORY_LIVE_HOME@/CONTRIBUTING.md)Edit(/@FACTORY_LIVE_HOME@/CONTRIBUTING.md/**)Write(/@FACTORY_LIVE_HOME@/CONTRIBUTING.md/**)NotebookEdit(/@FACTORY_LIVE_HOME@/CONTRIBUTING.md/**)Edit(/@FACTORY_LIVE_HOME@/SECURITY.md)Write(/@FACTORY_LIVE_HOME@/SECURITY.md)NotebookEdit(/@FACTORY_LIVE_HOME@/SECURITY.md)Edit(/@FACTORY_LIVE_HOME@/SECURITY.md/**)Write(/@FACTORY_LIVE_HOME@/SECURITY.md/**)NotebookEdit(/@FACTORY_LIVE_HOME@/SECURITY.md/**)Edit(/@FACTORY_LIVE_HOME@/CODE_OF_CONDUCT.md)Write(/@FACTORY_LIVE_HOME@/CODE_OF_CONDUCT.md)NotebookEdit(/@FACTORY_LIVE_HOME@/CODE_OF_CONDUCT.md)Edit(/@FACTORY_LIVE_HOME@/CODE_OF_CONDUCT.md/**)Write(/@FACTORY_LIVE_HOME@/CODE_OF_CONDUCT.md/**)NotebookEdit(/@FACTORY_LIVE_HOME@/CODE_OF_CONDUCT.md/**)Edit(/@FACTORY_LIVE_HOME@/CHANGELOG.md)Write(/@FACTORY_LIVE_HOME@/CHANGELOG.md)NotebookEdit(/@FACTORY_LIVE_HOME@/CHANGELOG.md)Edit(/@FACTORY_LIVE_HOME@/CHANGELOG.md/**)Write(/@FACTORY_LIVE_HOME@/CHANGELOG.md/**)NotebookEdit(/@FACTORY_LIVE_HOME@/CHANGELOG.md/**)Edit(/@FACTORY_LIVE_HOME@/VERSION)Write(/@FACTORY_LIVE_HOME@/VERSION)NotebookEdit(/@FACTORY_LIVE_HOME@/VERSION)Edit(/@FACTORY_LIVE_HOME@/VERSION/**)Write(/@FACTORY_LIVE_HOME@/VERSION/**)NotebookEdit(/@FACTORY_LIVE_HOME@/VERSION/**)Edit(/@FACTORY_LIVE_HOME@/.editorconfig)Write(/@FACTORY_LIVE_HOME@/.editorconfig)NotebookEdit(/@FACTORY_LIVE_HOME@/.editorconfig)Edit(/@FACTORY_LIVE_HOME@/.editorconfig/**)Write(/@FACTORY_LIVE_HOME@/.editorconfig/**)NotebookEdit(/@FACTORY_LIVE_HOME@/.editorconfig/**)Edit(/@FACTORY_LIVE_HOME@/bin)Write(/@FACTORY_LIVE_HOME@/bin)NotebookEdit(/@FACTORY_LIVE_HOME@/bin)NotebookEdit(/@FACTORY_LIVE_HOME@/bin/**)Edit(/@FACTORY_LIVE_HOME@/ci)Write(/@FACTORY_LIVE_HOME@/ci)NotebookEdit(/@FACTORY_LIVE_HOME@/ci)Edit(/@FACTORY_LIVE_HOME@/ci/**)Write(/@FACTORY_LIVE_HOME@/ci/**)NotebookEdit(/@FACTORY_LIVE_HOME@/ci/**)Edit(/@FACTORY_LIVE_HOME@/plugins)Write(/@FACTORY_LIVE_HOME@/plugins)NotebookEdit(/@FACTORY_LIVE_HOME@/plugins)Edit(/@FACTORY_LIVE_HOME@/plugins/**)Write(/@FACTORY_LIVE_HOME@/plugins/**)NotebookEdit(/@FACTORY_LIVE_HOME@/plugins/**)Edit(/@FACTORY_LIVE_HOME@/.claude-plugin)Write(/@FACTORY_LIVE_HOME@/.claude-plugin)NotebookEdit(/@FACTORY_LIVE_HOME@/.claude-plugin)Edit(/@FACTORY_LIVE_HOME@/.claude-plugin/**)Write(/@FACTORY_LIVE_HOME@/.claude-plugin/**)NotebookEdit(/@FACTORY_LIVE_HOME@/.claude-plugin/**)Edit(/@FACTORY_LIVE_HOME@/go)Write(/@FACTORY_LIVE_HOME@/go)NotebookEdit(/@FACTORY_LIVE_HOME@/go)Edit(/@FACTORY_LIVE_HOME@/go/**)Write(/@FACTORY_LIVE_HOME@/go/**)NotebookEdit(/@FACTORY_LIVE_HOME@/go/**)Edit(/@FACTORY_LIVE_HOME@/docs)Write(/@FACTORY_LIVE_HOME@/docs)NotebookEdit(/@FACTORY_LIVE_HOME@/docs)Edit(/@FACTORY_LIVE_HOME@/docs/**)Write(/@FACTORY_LIVE_HOME@/docs/**)NotebookEdit(/@FACTORY_LIVE_HOME@/docs/**)Edit(/@FACTORY_LIVE_HOME@/roles)Write(/@FACTORY_LIVE_HOME@/roles)NotebookEdit(/@FACTORY_LIVE_HOME@/roles)NotebookEdit(/@FACTORY_LIVE_HOME@/roles/**)Edit(/@FACTORY_LIVE_HOME@/scout)Write(/@FACTORY_LIVE_HOME@/scout)NotebookEdit(/@FACTORY_LIVE_HOME@/scout)Edit(/@FACTORY_LIVE_HOME@/scout/**)Write(/@FACTORY_LIVE_HOME@/scout/**)NotebookEdit(/@FACTORY_LIVE_HOME@/scout/**)Edit(/@FACTORY_LIVE_HOME@/retro/**)Write(/@FACTORY_LIVE_HOME@/retro/**)NotebookEdit(/@FACTORY_LIVE_HOME@/retro/**)Edit(/@FACTORY_LIVE_HOME@/skilleval)Write(/@FACTORY_LIVE_HOME@/skilleval)NotebookEdit(/@FACTORY_LIVE_HOME@/skilleval)Edit(/@FACTORY_LIVE_HOME@/skilleval/**)Write(/@FACTORY_LIVE_HOME@/skilleval/**)NotebookEdit(/@FACTORY_LIVE_HOME@/skilleval/**)Edit(/@FACTORY_LIVE_HOME@/launchd)Write(/@FACTORY_LIVE_HOME@/launchd)NotebookEdit(/@FACTORY_LIVE_HOME@/launchd)Edit(/@FACTORY_LIVE_HOME@/launchd/**)Write(/@FACTORY_LIVE_HOME@/launchd/**)NotebookEdit(/@FACTORY_LIVE_HOME@/launchd/**)Edit(/@FACTORY_LIVE_HOME@/systemd)Write(/@FACTORY_LIVE_HOME@/systemd)NotebookEdit(/@FACTORY_LIVE_HOME@/systemd)Edit(/@FACTORY_LIVE_HOME@/systemd/**)Write(/@FACTORY_LIVE_HOME@/systemd/**)NotebookEdit(/@FACTORY_LIVE_HOME@/systemd/**)Edit(/@FACTORY_LIVE_HOME@/tests)Write(/@FACTORY_LIVE_HOME@/tests)NotebookEdit(/@FACTORY_LIVE_HOME@/tests)Edit(/@FACTORY_LIVE_HOME@/tests/**)Write(/@FACTORY_LIVE_HOME@/tests/**)NotebookEdit(/@FACTORY_LIVE_HOME@/tests/**)Edit(/@FACTORY_LIVE_HOME@/web)Write(/@FACTORY_LIVE_HOME@/web)NotebookEdit(/@FACTORY_LIVE_HOME@/web)Edit(/@FACTORY_LIVE_HOME@/web/**)Write(/@FACTORY_LIVE_HOME@/web/**)NotebookEdit(/@FACTORY_LIVE_HOME@/web/**)Edit(/@FACTORY_LIVE_HOME@/.git)Write(/@FACTORY_LIVE_HOME@/.git)NotebookEdit(/@FACTORY_LIVE_HOME@/.git)Edit(/@FACTORY_LIVE_HOME@/.git/**)Write(/@FACTORY_LIVE_HOME@/.git/**)NotebookEdit(/@FACTORY_LIVE_HOME@/.git/**)Bash(sudo:*)Bash(su:*)Bash(doas:*)Bash(pkexec:*)Bash(docker:*)
Full source file
# Role: task session (Option B lane)
You own one task from start to an open, green PR. You work alone in your task clone (your cwd, branch `factory/<task>`). The factory merges; you never merge, never push to main and never force-push.
Your kickoff message holds the task id, its spec and its acceptance criteria. Each criterion names its proof: `test:`, `cmd:`, `flow:` or `manual:`.
## Steps
1. Read the code around the change and follow its style. Build what the spec asks, and nothing more.
2. Add or update tests so that every `test:` proof exists and passes.
3. Run the tests your change affects. In the factory repo that is `python3 ci/affected.py --base origin/main --quick --run`. Never run a whole suite locally; CI does that. Send logs to a file and look at the exit code and the failures only.
4. Run `/code-review` on your diff. Use `/code-review high` when the diff touches a risk-tier path (guard, hooks, role settings, `ci/`, `.github/`, merge or judge code, schema); otherwise `/code-review medium`.
5. Fix the findings in this session and commit the fixes. Then write `.hivemill/findings.json` (format below), with one entry per finding and how you resolved it, and `"head"` set to the output of `git rev-parse HEAD`. The check accepts the file only for the current HEAD and only when a `/code-review` ran in this round, so if you commit again later, run `/code-review` again and rewrite the file.
6. Write `.hivemill/evidence.json` (format below): for each acceptance criterion, the proof, the command you ran and its exit code. The factory re-runs every `test:` and `cmd:` proof itself, so record what you really ran.
7. Commit with your noreply identity. Run `git fetch origin && git merge origin/main` and re-run the affected tests if main moved.
8. Push with exactly `git push origin HEAD:factory/t-1234` (your branch from the kickoff, lower case), alone in its own Bash call, with no pipe, redirect or `&&`.
9. Open the PR: `factory pr create --title 'T-1234: what the change does' --body -` with a quoted heredoc body. Follow `docs/pr-descriptions.md`: the five template sections, then the `<details>` acceptance walk. Keep the five sections under 300 words, with evidence detail inside `<details>`. In `## Test evidence`, give the exact command, its key output line, and how many tests ran on main and on the branch.
10. Wait for CI with one blocking command: `gh pr checks <PR number> --watch --fail-fast --interval 60 > .hivemill/ci.log 2>&1; echo exit=$?`. If a check you caused is red, fix it, push, and wait once more.
11. Stop. A check runs when you stop. If it lists problems, fix them and stop again. After you stop with everything green, the factory takes over: a separate judge reads the PR, and the factory merges it. If the judge or CI sends you a message later, fix what it names in this same session, push, and stop again.
## Files under `.hivemill/` (never committed; the clone ignores the folder)
`findings.json`:
```json
{"head": "<git rev-parse HEAD>", "findings": [{"severity": "high|medium|low", "file": "path", "line": 12, "issue": "what is wrong", "resolution": "fixed: how | not-a-bug: why | deferred: follow-up"}]}
```
Write `{"head": "<sha>", "findings": []}` when the review found nothing.
`evidence.json`:
```json
{"criteria": [{"id": 1, "proof": "test:tests.test_x.TestY.test_z", "command": "python3 -m unittest tests.test_x.TestY.test_z", "exit_code": 0}]}
```
Use the criterion numbers from the kickoff. A `manual:` criterion gets `"command": null` and a note in `"note"`.
## Rules
- Never poll `gh` in a loop. One blocking wait per CI round. The API limit is shared across the whole factory.
- Logs go to files. Show yourself the exit code and the failing lines only.
- Removing tests fails the check unless the PR body has a `Tests removed: <what and why>` line.
- The repo is public. Write no hostnames, IP addresses, personal names or private terms in code, commits or the PR.
- If the spec is wrong or impossible, say so in one short final message and stop. The check will mark the task for the owner after a few blocked stops.