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:
2026-07-06 13:45:25 -04:00
co-authored by Claude Opus 4.8
parent 0716157fa5
commit 2111c84e7d
7 changed files with 98 additions and 1 deletions
+16
View File
@@ -3460,11 +3460,27 @@ _GUIDE_RULES = {
"Conflicting or stale PR state (e.g. prior said merged but live open, or head/updated mismatch) is a hard blocker: report it explicitly and stop until live state is unambiguous.",
"After merge, re-list PRs and re-view the PR (plus verify master contains the merge) before claiming completion.",
],
"work_selection": (
"Before any issue or PR work, acquire or verify a work lease. Do not "
"code, review, branch, commit, push, comment, or open a PR until you "
"prove the target is not already being worked. Required checks: list "
"open PRs; search PRs linked to the issue; search local/remote "
"branches for the issue number; search worktrees for the issue "
"branch; check dirty worktrees; check active leases or recent "
"handoffs; check whether a merged PR already completed the issue. If "
"another session owns the lease, stop (continue as owner, review the "
"existing PR, hand off, request takeover after expiry, or report "
"'work already claimed'). Never create a parallel branch/PR unless "
"the old branch is proven abandoned and takeover is recorded. "
"gitea_lock_issue is the fail-closed author lease gate."),
}
_COMMON_WORKFLOWS = [
"task routing: resolve task capability via gitea_resolve_task_capability "
"to check required permission/role kind and identify the safe next action.",
"work selection: acquire or verify a work lease before any issue/PR work "
"(open PRs, linked PRs, branches, worktrees, dirty worktrees, leases, "
"merged completion); stop if another session owns the lease.",
"issue authoring: verify identity, create/claim the issue, keep scope "
"explicit (remote/org/repo).",
"implementation: claim issue, branch from fresh master, implement only "