docs: add Work Selection Rule for LLM operating rules
Require lease verification (open PRs, branches, worktrees, leases, merged completion) before any issue or PR work. Surface the rule in the portable skill, Gitea runbooks, operator guide, and start-issue template; add doc-contract tests. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
This commit is contained in:
@@ -53,6 +53,42 @@ Additional issue-first rules:
|
||||
owner decision.** Do not create a new repository or a new tracker unless
|
||||
explicitly approved by the owner.
|
||||
|
||||
## Work Selection Rule for LLMs
|
||||
|
||||
Before starting any issue or PR work, acquire or verify a work lease.
|
||||
|
||||
Do not begin coding, reviewing, fixing, branching, committing, pushing,
|
||||
commenting, or creating a PR until you prove the target is not already being
|
||||
worked.
|
||||
|
||||
Required checks:
|
||||
|
||||
1. List open PRs.
|
||||
2. Search for PRs linked to the target issue.
|
||||
3. Search local and remote branches for the issue number.
|
||||
4. Search registered worktrees for the issue branch.
|
||||
5. Check dirty worktrees.
|
||||
6. Check active leases or recent handoffs.
|
||||
7. Check whether the issue was already completed by a merged PR.
|
||||
|
||||
If another active LLM/session owns the lease, stop.
|
||||
|
||||
Allowed responses:
|
||||
|
||||
- continue as the lease owner,
|
||||
- review the existing PR if reviewer capability allows,
|
||||
- produce a handoff,
|
||||
- request takeover after lease expiry,
|
||||
- stop with "work already claimed."
|
||||
|
||||
Never create a parallel branch or PR for the same issue unless the old branch
|
||||
is proven abandoned and the takeover is recorded.
|
||||
|
||||
For Gitea-Tools: `gitea_lock_issue` is the fail-closed lease gate before author
|
||||
mutations; `status:in-progress` and claim comments are supporting lease signals.
|
||||
Use `review_proofs.classify_issue_for_selection` when reporting fresh issue
|
||||
selection (#188).
|
||||
|
||||
## B. Isolated worktree rule
|
||||
|
||||
**Never implement or review in the main checkout.** The main checkout is for
|
||||
@@ -142,6 +178,8 @@ Worktree folder = branch with `/` replaced by `-`
|
||||
|
||||
## E. Start-work workflow
|
||||
|
||||
0. Acquire or verify a work lease (Work Selection Rule) — complete all seven
|
||||
checks before any claim, branch, or PR work.
|
||||
1. Verify the orchestration checkout (right repo, clean tree).
|
||||
2. Fetch/prune: `git fetch <remote> --prune`.
|
||||
3. Confirm local `master` equals remote `master` (`git rev-list --left-right --count <remote>/master...master` → `0 0`).
|
||||
|
||||
Reference in New Issue
Block a user