diff --git a/.agents/skills/README.md b/.agents/skills/README.md new file mode 100644 index 000000000..b68f58447 --- /dev/null +++ b/.agents/skills/README.md @@ -0,0 +1,26 @@ +# InferRSI collaboration skills + +## Choose a skill + +Use one skill for the step you are carrying out. + +- [shape-issue](shape-issue/SKILL.md) — discuss an Issue's direction, record an accepted scope, or split accepted work into native sub-issues. +- [claim-work](claim-work/SKILL.md) — verify acceptance, ownership and existing claims before starting or taking over a slice. +- [open-pr](open-pr/SKILL.md) — open a PR for a claimed slice or update its head. +- [review-pr](review-pr/SKILL.md) — independently review a specific PR revision. +- [merge-pr](merge-pr/SKILL.md) — check merge readiness and integrate when authorized. +- [red-main](red-main/SKILL.md) — recover when a merge breaks `main`. + +To accept a delivered Issue or close it, see the +[closure rules](../../docs/agent-collaboration.md#closure-authorization). +For inference work, use the +[primary inference skills](../../plugins/inferrsi/skills/inferrsi/SKILL.md#load-the-primary-inference-task). + +## Use a skill + +Ask the agent to use the skill by name from the InferRSI checkout. For example, +`Use merge-pr to check whether this PR is ready to merge.` If the agent needs +a file path, ask it to read the linked `SKILL.md` directly. + +Follow that skill and read the relevant sections it links in the +[collaboration guide](../../docs/agent-collaboration.md). diff --git a/.agents/skills/claim-work/SKILL.md b/.agents/skills/claim-work/SKILL.md index 584fa36ac..75aa23648 100644 --- a/.agents/skills/claim-work/SKILL.md +++ b/.agents/skills/claim-work/SKILL.md @@ -12,8 +12,8 @@ rules and working rules 1, 7 and 8 in ## Check before claiming 1. Confirm the governing Issue and its accepted scope before changing code. If - the guide's [stop check](../../../docs/agent-collaboration.md#identity-and-authority) finds a stop on - this work's stop chain, or cannot rule one out, do not claim it. + the [stop check](../../../docs/agent-collaboration.md#human-stop) finds a stop + on the chain or cannot rule one out, do not claim the work. 2. Confirm the Issue has an accountable owner (recorded on the Issue, or else its only assignee when exactly one is set) and carries `status:accepted`: diff --git a/.agents/skills/merge-pr/SKILL.md b/.agents/skills/merge-pr/SKILL.md index 35ed13ac8..7b2be4812 100644 --- a/.agents/skills/merge-pr/SKILL.md +++ b/.agents/skills/merge-pr/SKILL.md @@ -35,7 +35,7 @@ below. cancellation cannot be confirmed, hold the work and report that the PR may still merge automatically. If the PR already merged, report it to the Issue owner for authorized recovery. - Run the guide's [stop check](../../../docs/agent-collaboration.md#identity-and-authority) + Run the guide's [stop check](../../../docs/agent-collaboration.md#human-stop) on the whole stop chain. A stop comment holds even after the label exists. If the check finds a stop or cannot rule one out, do not merge. Record on the PR any Issue you could not check. @@ -65,9 +65,10 @@ below. 7. **No open blocker:** every binding **Request changes** review (from an account with write access or higher) is re-reviewed to **Approve** or dismissed with a recorded reason, by those the - [guide](../../../docs/agent-collaboration.md) allows to dismiss it. An - advisory review, such as one from `cursor[bot]`, does not count as a vote - but has a substantive answer on the PR and a recorded disposition (fixed in + [review rules](../../../docs/agent-collaboration.md#pr-review-and-merge) + allow to dismiss it. An advisory review, such as one from `cursor[bot]`, + has zero votes. Give it a substantive answer on the PR and record each + disposition (fixed in a named commit, or declined with the reason). If GitHub's merge state still shows the PR blocked by it on the current head, someone the guide allows to dismiss reviews dismisses it, and the PR records who did and why, before @@ -143,6 +144,6 @@ line; for a high-risk PR the same comment then has one line where `approver=` names the approving account you found on the list and verified in check 9, and `list=` is the `` you read the list from (`list=bootstrap-570` only for the one-time bootstrap merge in the -[high-risk rule](../../../docs/agent-collaboration.md#identity-and-authority)). +[high-risk rule](../../../docs/agent-collaboration.md#high-risk-changes)). If `main` turns red afterwards, use the [red-main skill](../red-main/SKILL.md). diff --git a/.agents/skills/open-pr/SKILL.md b/.agents/skills/open-pr/SKILL.md index 13ef245b5..3a4676323 100644 --- a/.agents/skills/open-pr/SKILL.md +++ b/.agents/skills/open-pr/SKILL.md @@ -39,6 +39,9 @@ If the skill library changed, also run Check every new or changed artifact against the [privacy and security rules](../../../docs/privacy-security.md). +Run the [stop check](../../../docs/agent-collaboration.md#human-stop) +immediately before each push. + ## Write the PR body Start from the [PR template](../../../.github/PULL_REQUEST_TEMPLATE.md): diff --git a/.agents/skills/review-pr/SKILL.md b/.agents/skills/review-pr/SKILL.md index 77a7df27f..9f45e19af 100644 --- a/.agents/skills/review-pr/SKILL.md +++ b/.agents/skills/review-pr/SKILL.md @@ -75,7 +75,7 @@ formal review still requires **Approve** or **Request changes**, also on a high-risk PR (CI, releases, secrets, permissions); there an **Approve** from an account on the [high-risk approver list](../../../.github/high-risk-approvers.json) as it stands on protected `main` (not the PR head or a stacked branch; see the -[high-risk rule](../../../docs/agent-collaboration.md#identity-and-authority)), +[high-risk rule](../../../docs/agent-collaboration.md#high-risk-changes)), including its agent, counts as the required listed approval. Other approvals count toward the two but not as that one. If a revert cannot undo the change's external effect (credentials, published @@ -89,13 +89,11 @@ Agents may submit formal reviews without a separate human delegation; see [identity and authority](../../../docs/agent-collaboration.md#identity-and-authority). Submit one only from an eligible independent account, and only as that account's formal reviewer agent; other agents under the account report in -comments. Never submit one on your own PR, -and not while the guide's -[stop check](../../../docs/agent-collaboration.md#identity-and-authority) finds a stop on the PR's stop -chain or cannot rule one out; in that case do not submit, and record on the PR -which Issue you could not check. Before -submitting, confirm that the PR is open and the reviewed target, base and head -are still current. +comments. Submit reviews only on PRs you can independently review. Run the +[stop check](../../../docs/agent-collaboration.md#human-stop) immediately +before submitting. Hold if a stop applies or the chain cannot be verified. +Record any unreadable Issue in the chain on the PR. Confirm that the PR is +open and that the reviewed target, base and head are still current. If the revision changed, reassess the affected diff and evidence before submitting. Bind the submission to the reviewed head using GitHub's review `commit_id` or an equivalent revision-bound operation. If that operation is unavailable, leave the diff --git a/.agents/skills/shape-issue/SKILL.md b/.agents/skills/shape-issue/SKILL.md index 88768a3ac..f21cf7f01 100644 --- a/.agents/skills/shape-issue/SKILL.md +++ b/.agents/skills/shape-issue/SKILL.md @@ -11,9 +11,10 @@ and the [working rules](../../../docs/agent-collaboration.md#working-rules). ## Check authority -1. Run the guide's stop check on the Issue, the governing and delegating Issues, - and their real ancestors. On a stop or an unverifiable chain, report the - state to the invoking operator and exit with zero GitHub writes. +1. Run the [stop check](../../../docs/agent-collaboration.md#human-stop) on the + Issue, governing and delegating Issues, and their real ancestors. On a + stop or an unverifiable chain, report the state to the invoking operator + and exit with zero GitHub writes. 2. Identify the accountable owner using the guide. If no owner is recorded or inferable, stay in discussion and ask a maintainer to record one when you have authority to reply. Apply the tracker and RFC boundaries in the guide. diff --git a/AGENTS.md b/AGENTS.md index 688f8efb8..96b29f854 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -6,14 +6,14 @@ Coding agents (Cursor, Codex, Claude, etc.) should treat this file as the **entr **InferRSI** is InferMatrixLab’s canonical home for a **portable RSI / evidence-driven scaffold**. Work is organized as **SIAS**: harness × model × infra planes of the system being optimized, with runnable examples and a first-class `evidence/` tree. InferRSI's own code lives under `src/inferrsi/` (rename on copy) in four cores: Knowledge, Harness, Benchmark and Apps. -This entry contract is portable for derived scaffolds. The repository itself is the maintained workbench: delivering an independent engine uses the [engine delivery template](docs/template/README.md) and does not copy or depend on this runtime. Route your task: modify InferRSI via [contributing](docs/contributing.md) and [agent collaboration](docs/agent-collaboration.md); run experiments via [quickstart](docs/quickstart.md); find any CLI/Python operation via the [operation guide](docs/operations.md). +This entry contract is portable for derived scaffolds. The repository itself is the maintained workbench: delivering an independent engine uses the [engine delivery template](docs/template/README.md) and does not copy or depend on this runtime. Route your task: modify InferRSI via [contributing](docs/contributing.md); run experiments via [quickstart](docs/quickstart.md); find any CLI/Python operation via the [operation guide](docs/operations.md). | Start here | Purpose | | --- | --- | | [README.md](README.md) | Layout, dev smoke, copy checklist | | [docs/operations.md](docs/operations.md) | Every CLI/Python operation: entry, effect class, boundary | | [docs/contributing.md](docs/contributing.md) | Development, acceptance, evidence and CI | -| [docs/agent-collaboration.md](docs/agent-collaboration.md) | Issue-led human–agent collaboration | +| [Collaboration skills](.agents/skills/README.md) | Choose a skill for the current Issue or PR step | | [docs/architecture.md](docs/architecture.md) | Module boundaries and extension contracts | ## Four-lane CI @@ -118,14 +118,11 @@ ruff check src tests ## Collaboration -Rules: [agent collaboration](docs/agent-collaboration.md). Agents may carry work end to end; humans set direction through Issues and stop work with `bot:stop`. One skill per step: - -- Shape an Issue: [shape-issue](.agents/skills/shape-issue/SKILL.md) — record the owner's accepted direction, preserve prior text and split into bounded native sub-issues when needed. -- Claim before starting: [claim-work](.agents/skills/claim-work/SKILL.md) — confirm the Issue has an accountable owner and `status:accepted` and that you are its deciding agent or work under its delegation, search for duplicates, claim on the Issue with the next artifact time, release if nothing appears. -- Open a PR: [open-pr](.agents/skills/open-pr/SKILL.md) — a bounded slice with independent review, branched from current `main`, local checks run, AI declaration filled; report PR readiness and Issue completion separately. -- Review: [review-pr](.agents/skills/review-pr/SKILL.md) — use the review identity format, keep comments short, never approve your own PR; one formal reviewer agent per account. -- Merge: [merge-pr](.agents/skills/merge-pr/SKILL.md) — open and ready, authorized, expected base and dependencies merged, two independent approvals, required checks green, no `bot:stop` or unlifted stop comment, and on a high-risk PR (CI, releases, secrets, permissions) at least one approval from an account on the high-risk approver list in `.github/high-risk-approvers.json` that still has write access, verified at merge time. -- Red `main`: [red-main](.agents/skills/red-main/SKILL.md) — revert the merge that broke it, then fix forward in a new PR. +Humans set direction through Issues and can [stop work](docs/agent-collaboration.md#human-stop) +with `bot:stop` or a stop comment. Agents may carry accepted work end to end. +Claim work before implementation. +Choose one [collaboration skill](.agents/skills/README.md) for the current +step and read the policy sections it calls for. ## Privacy and security diff --git a/docs/agent-collaboration.md b/docs/agent-collaboration.md index a55eaffff..e26259ac6 100644 --- a/docs/agent-collaboration.md +++ b/docs/agent-collaboration.md @@ -1,36 +1,83 @@ # Agent collaboration (issue-led) -Conventions for coordinating humans and agents through Issues and PRs, grounded -in the collaboration RFC ([#21](https://github.com/InferMatrixLab/InferRSI/issues/21)). -GitHub enforces merge requirements through the repository ruleset. -Campaign acceptance, DCO, CI lanes and evidence rules stay in -[contributing](contributing.md); the agent entry contract stays in -[AGENTS](../AGENTS.md). +Start with the [collaboration skill index](../.agents/skills/README.md) for a +specific Issue or PR task. Each skill links to the rules it uses. + +See [contributing](contributing.md) for campaign acceptance, DCO, CI lanes and +evidence rules, and [AGENTS](../AGENTS.md) for repository entry guidance. +The design decisions are recorded in [RFC #21](https://github.com/InferMatrixLab/InferRSI/issues/21) +and [Issue #570](https://github.com/InferMatrixLab/InferRSI/issues/570). The RFC also +records the [reviewed case pointers and their limits](https://github.com/InferMatrixLab/InferRSI/issues/21#reviewed-case-pointers-source-facts-and-limits). ## Identity and authority -- Humans and agents may propose Issues. Proposal origin, assignment and labels do not grant authority. -- A GitHub account may represent a human and their authorized agent team. Assignment identifies accountability, not necessarily the executor. Record the acting person/agent and role when relevant; retain unknown identity rather than guessing. -- Work follows accepted scope and explicit or standing delegation. Record or link that authority. Within the Issue's direction, the accountable agent decides scope, including material scope changes, and exceptions, and records each with its reason on the Issue; a human may override any such decision. Only a change of the Issue's direction goes back to the Issue owner. No agent may waive these controls: independent review with two approvals, at least one approval from the high-risk approver list on high-risk changes, `bot:stop`, and repository permission and ruleset controls. -- The Issue's accountable owner is the one the Issue records explicitly; while this rule rolls out, an Issue without such a record falls back to its assignee only when exactly one assignee is set. With several assignees, or none, and no recorded owner, the Issue has no accountable owner until one is recorded explicitly. Each Issue has one deciding agent: the formal agent working for the accountable owner's account. When one account carries several agents, only that account's one formal agent decides, as with review votes. Other agents propose on the Issue and do not decide. -- An Issue with no accountable owner is not started. Agents may propose on it and ask a maintainer to assign it; they do not claim or implement it until it has one. -- Routine PR review and integration may be delegated without fresh human approval per PR. Existing repository permissions and acceptance policies still apply. -- Completion is accepted by the named person or authorized agent. Acceptance/closure authority must be clear before those actions; it need not block already-authorized implementation. -- Agents carry work end to end: they claim, delegate slices, set accepted scope and acceptance criteria within the Issue's direction, apply repository rules to a case, grant exceptions within the limits above, review and merge PRs, high-risk ones under the rule below. Each such decision is recorded on the Issue or PR with its reason. -- Humans do two things: open Issues that set direction and stop work at any time. A human adds `bot:stop` to an Issue or PR to stop it, or a maintainer account's agent adds it for a human with a comment there linking that human's stop request; agents then make no further changes, reviews or merges there and resume only after the stop is lifted as below. A stop on an Issue also stops the PRs it governs and any work delegated under it, including its sub-issues at any depth and their PRs. An Issue owner's or another human's comment on an Issue or PR asking agents to stop has the same effect, and creating the label does not end it. Only a human lifts a stop (removes the label or lifts the comment): the human who stopped the work (by the label or a comment) or a maintainer acting in person; no agent lifts one, including a maintainer account's agent ([#570](https://github.com/InferMatrixLab/InferRSI/issues/570#issuecomment-7073497490), unchanged by the [later amendment](https://github.com/InferMatrixLab/InferRSI/issues/570#issuecomment-7077630550)). Adding the label for a human or migrating a recorded human stop comment to `bot:stop` keeps the stop in force and is not lifting it, so a maintainer account's agent may do either. Each lift or migration is recorded by a comment on that same Issue or PR (for a migration, with the label added there). If it is unclear whether a stop was posted, lifted or migrated, or by whom, the stop stays in effect. Right before each push, review or merge, an agent runs the stop check: it checks the work's stop chain for the label and for any stop comment not yet lifted this way. The stop chain is the PR, the Issues that govern or delegated the work, and every real ancestor of those Issues (following each Issue's sub-issue parent up to the top). A governing Issue is one the PR body references with `Refs #N` as the source of this work's scope. A legacy closing reference that supplies scope still identifies a governing Issue and is replaced with `Refs #N`. A delegating Issue is one on which the work was delegated to the acting agent; an Issue linked only as background or related reading is not in the chain. If any Issue in the chain cannot be read (for example a permission or API failure), or the agent cannot tell whether a stop is present, it treats the work as stopped, does not act, and records on the PR which Issue it could not check; an Issue outside the chain neither stops the work nor needs to be readable. For example, a PR that refs sub-issue B waits while B's parent A carries `bot:stop`; a PR that refs B and also links an older Issue C as background, which the agent cannot read, is not stopped because of C. A maintainer creates `bot:stop` with the Dong1017 account as soon as this guide merges. -- Keep GitHub auto-merge off for PRs governed by this guide. An armed request can merge after a stop without the integrator's final check. The authorized integrator, or a maintainer if the integrator cannot act, disables any already-armed request and verifies it is gone. On a stop, this applies to every affected PR, including those stopped through a governing or ancestor Issue. Cancelling auto-merge is part of enforcing the stop. Until cancellation is confirmed, hold the work and report that the PR may still merge automatically. If GitHub already merged the PR, report that outcome to the Issue owner for authorized recovery. Enable an asynchronous merge path only after verifying it prevents a PR from merging while stopped. Before enabling a merge queue, record who removes stopped PRs and verify the removal procedure. Recheck for a stop right before enqueueing. -- High-risk changes are CI workflows and required checks, releases (release workflow, version, tags, publishing), secrets and credentials, and permissions (workflow `permissions`, repository access, rulesets, the high-risk approver list). They still need two independent approvals, at least one from an account on the high-risk approver list in [`.github/high-risk-approvers.json`](../.github/high-risk-approvers.json) that still has repository write access at merge time; that account's agent may give it. Other accounts count toward the two approvals but not as this one ([#570](https://github.com/InferMatrixLab/InferRSI/issues/570#issuecomment-7078872219)). Changing that file is itself a high-risk change. Which copy of the list counts: the PR that creates the file is approved once against the five accounts recorded in [#570](https://github.com/InferMatrixLab/InferRSI/issues/570#issuecomment-7078872219), under the existing repository controls. After that, only the copy in the protected `main` commit that the merging agent verifies right before the merge counts, never the copy on the PR head or a stacked branch, so a PR that changes the list is judged by the list in effect before it. If the merging agent cannot read that list or the approver's current write access, it does not merge. This repository is run by bot maintainers: an account and the agent working for it count as that account, and the account holder answers for everything the account does. High-risk changes are tracked after the fact rather than gated on proof of human origin ([#570](https://github.com/InferMatrixLab/InferRSI/issues/570#issuecomment-7077630550)): the approval and the merge each carry an identity line naming the acting agent or human (for the merge, in a PR comment posted with it), so both can be audited later. The merging agent writes that comment itself at merge time: the identity line, then one line `merge-audit: head= approvals=@ , @ approver=@ list= merge= by=@`. `approver=` names the approving account the merging agent found on the high-risk approver list and verified still had write access at merge time, from the collaborator permission GitHub reports for that account; `list=` is the protected `main` commit that list was read from, or `list=bootstrap-570` for the one-time bootstrap merge, whose comment links the [#570 record](https://github.com/InferMatrixLab/InferRSI/issues/570#issuecomment-7078872219); an identity line declares who acted without proving it. When a revert cannot undo a change's external effect (exposed credentials, a published asset, changed access), the author or the author's agent puts one line `recovery: owner=@; containment=` in the PR body before the change takes effect; a reviewer agent that finds it missing requests it, and it adds no approval gate. Misuse is handled after the fact by the account holder and the maintainers: revert, record it on the Issue, and tighten the rule if it recurs. Every step here uses only labels, identity lines and fixed lines like these, so an agent can do it and a bot pipeline can check it; no step waits on a human. -- After the one-time bootstrap, a high-risk merge must keep the checked list effective through integration. Use a merge path that rejects a changed checked base, or serialize high-risk merges with all updates to the list, including manual and automated ones. Under serialization, the integrator holds the exclusive slot from before reading the current protected `main` for the final check until GitHub confirms the merge or rejects it. A head-matched merge alone cannot protect the list. If neither path can be verified, hold the merge. See [merge PR](../.agents/skills/merge-pr/SKILL.md). -- Each account carries at most one agent team, or the agent uses its own account. Each account has one formal reviewer agent; other agents under that account, such as a patrol, report in comments and do not submit **Approve** or **Request changes**. Every agent comment and every formal review (including **Approve** and **Request changes**) carries one line naming the acting agent and the human it acts for, so humans, integrators and other agents can tell who acted. In an agent's **Approve**, put `LGTM` alone first and the identity line next. In other reviews and comments, the identity line comes first. +- **Accountability.** An account may represent a human and one authorized agent + team. An agent may also use its own account. Assignment records accountability. + Record the acting person or agent and role when relevant. Keep unknown + identities explicit. +- **Issue owner.** Use the owner recorded on the Issue. During rollout, if no + owner is recorded, use its sole assignee if there is one. Otherwise, stay in + discussion and ask a maintainer to assign an owner before claiming or + implementing work. Each Issue has one deciding agent, the formal agent acting + for its owner's account. Other agents may propose. +- **Direction and scope.** Humans and agents may propose Issues. Work starts + with accepted direction and explicit or standing delegation. Record or link + that authority. Within that direction, the deciding agent sets criteria, + delegates work, decides scope changes and grants permitted exceptions. + Record decisions with their reasons. Material scope changes and permitted + exceptions belong on the governing Issue. PRs can link to those decisions + and record routine implementation decisions. A human may override an + agent's decision. Only changes of direction go back to the Issue owner. + The two-approval rule, + [high-risk requirements](#high-risk-changes), [human stops](#human-stop), + repository permissions and rulesets bind every exception. +- **Delegated actions.** Routine PR reviews and merges may be delegated without + fresh human approval per PR. The named person or authorized agent accepts + completion. Confirm acceptance and closure authority before those actions. + Authorized implementation can proceed while that authority is established. +- **Review identity.** Each account has one formal reviewer agent. Other agents + under that account report in comments. Put a line naming the acting agent + and the human it acts for first in each agent comment or formal review. + For **Approve**, put `LGTM` alone first and the identity line second. + +## Human stop + +- **Apply.** A human can stop agent changes, reviews and merges at any time + by adding `bot:stop` or posting a stop comment on an Issue or PR. An Issue + stop also covers its governed PRs, delegated work, and its sub-issues at + any depth and their PRs. +- **Record and lift.** A maintainer account's agent may add the label for a + human or migrate a recorded human stop comment. Add it on the same Issue + or PR and comment there linking the human's request. Adding the label + keeps the stop in force. Only the human who stopped the work or a + maintainer acting in person may lift a stop. Record each lift in a comment + on the same Issue or PR when removing the label or lifting the comment. +- **Check.** Before acting, and again right before each push, review or merge, + check the target Issue or PR, governing and delegating Issues, and all + their native GitHub Issue ancestors for `bot:stop` and active stop comments. + A governing Issue supplies scope via `Refs #N` in the PR body. A legacy + closing reference that supplies scope still counts and must be replaced + with `Refs #N`. A delegating Issue records the acting agent's delegation. + Background links fall outside the chain. Hold work if an Issue in the + chain is unreadable or if a stop, lift, migration or the actor is uncertain. + Record any unreadable Issue in the chain on the PR. +- **Prevent automatic merges.** Keep GitHub auto-merge off. The authorized + integrator, or a maintainer if the integrator cannot act, cancels any armed + request and verifies removal. On a stop, do this on every affected PR. + Until confirmed, hold work and report that the PR can still merge + automatically. If it already merged, report it to the Issue owner for + authorized recovery. Verify that an asynchronous merge path blocks stopped + PRs before enabling it. For a merge queue, first record who removes stopped + PRs and verify the removal procedure. Recheck for stops before enqueueing. ## Where agents may act -Run the full [stop check](#identity-and-authority) before acting on an Issue or -PR. An agent acts within its operator's scope and the work's recorded authority. +Run the full [stop check](#human-stop) before acting on an Issue or PR. +An agent acts within its operator's scope and the work's recorded authority. -- **Tracking Issues.** The owner maintains `kind:tracking` Issues. During label - migration, this also covers Issues with explicit roadmap, tracking or status - titles. An RFC with a tracking topic follows the RFC rule. The owner's +- **Tracking Issues.** The owner maintains `kind:tracking` Issues. For legacy + Issues, this also covers explicit roadmap, tracking or status titles. An RFC + with a tracking topic follows the RFC rule. The owner's @-mention authorizes a reply proposing edits in a comment. An agent may make a specific edit delegated by the owner and recorded on the Issue. Closure stays with the owner. @@ -75,19 +122,8 @@ alongside merge authority and required checks. ## Interaction patterns -Illustrative responsibilities, not required services or new authority. - -### Human–Human: shared decisions only - -```mermaid -flowchart LR - A["Goal owner"] --> I["Issue: goal and constraints"] - B["Affected owner, if any"] --> I - I --> D["Record agreement or unresolved dependency"] - D -->|"When agreed by authorized owners"| S["Accepted scope and delegation"] -``` - -Shared-owner coordination is conditional; unresolved dependencies do not authorize blocked work. +When a decision needs multiple owners, record their agreement or the unresolved +dependency on the Issue. Resolve it before starting the work it blocks. ### Human–Agent: delegate work, accept the goal @@ -107,80 +143,89 @@ flowchart TB O -->|"Goal accepted; closure authorized"| C["Close Issue"] ``` -The integrator uses attributable, independent review records. Blocked -integration or incomplete goals remain open, and material scope exceptions -are recorded by the accountable agent for any human to override. - -### PR review and merge - -For a PR targeting `main`, each completed review gives an explicit **PASS** or -**DO NOT PASS** verdict. For PASS, submit **Approve**. GitHub counts the formal -review even when its body is empty. Conversation comments and **Comment** -reviews contribute zero approvals, including comments that say `LGTM` or `PASS`. -For DO NOT PASS, submit **Request changes** with the blockers and the expected -corrections or evidence. - -An eligible approval comes from an independent reviewer using a GitHub account -with repository write access or higher, judged by its permission when it -acts; an agent's **Approve** is a formal approval and counts toward the two. The -account's human or its agent may approve through it. When the author has no -write access, as for an outside contributor, neither the author's own approval -nor one from an account without write access counts. Reviews from -`cursor[bot]` are advisory under these rules and do not count toward the -two; its **Request changes** is still answered before merge. GitHub may -nonetheless report the PR as blocked by that review, so recheck GitHub's -merge state on the current head before merging. If the advisory review still -blocks, it is cleared as described below for a blocking **Request changes** -review, and the PR records who dismissed it and the disposition of each point -(fixed in a named commit, or declined with the reason). High-risk PRs follow the -same rule, and at least one of their two approvals comes from an account on the -[high-risk approver list](../.github/high-risk-approvers.json), as it stands -on the verified protected `main` commit (see the high-risk rule above), that -still has write access at merge time; other accounts count toward the two but not as -that one. The authoring agent never approves its own -PR, and at least one approval comes from a different agent or a human. -The PR author, material contributors, -and the accountable parent for the delivery slice cannot supply an independent -approval, including through another agent acting under their account. Each -eligible account counts once. -An agent may submit a formal review without a separate human delegation; its -identity line names the acting reviewer and the human it acts for. Follow the -[identity format](#identity-and-authority), then give the one-line verdict -(working rule 9). The review state determines whether an approval counts. +Keep blocked integration and incomplete goals open. + +## PR review and merge + +For a PR targeting `main`, a completed review gives **PASS** as **Approve** or +**DO NOT PASS** as **Request changes** with the blockers and expected corrections +or evidence. GitHub counts the formal **Approve** even with an empty review body. +Conversation comments and **Comment** reviews contribute zero approvals. +Formal reviewer agents may review without separate human delegation. Use the +[identity format](#identity-and-authority) and give the one-line verdict. +Each independent GitHub account with write access or higher when it reviews +counts once, whether its human or formal reviewer agent acts. Exclude the +authoring agent, PR author, material contributors, the accountable parent for the +slice, and reviews from their accounts. At least one approval comes from a +different agent or a human. Before merging, verify two distinct eligible +approvals on the current head, resolved blockers and green required checks. The [main ruleset](https://github.com/InferMatrixLab/InferRSI/rules/25528020) -requires at least two approving reviews and dismisses stale approvals when -reviewable changes are pushed. Before merging, the integrator verifies two -current approvals from distinct eligible reviewers as described above, resolution -of all blocking reviews, and passing required checks. - -Windows/macOS `host-compatibility` checks are advisory under the -[CI policy](contributing.md#ci-and-repository-reuse). Reviewers and integrators -must not block approval or merging on their failure, cancellation, queued or -not-run status, or demand a successful rerun or equivalent host-validation artifact -to clear them. Record the actual host result without treating missing evidence -as a pass. - -To clear a blocking **Request changes** review, ask its reviewer to re-review -the current revision and submit **Approve** once the blockers are resolved. -If that reviewer is unavailable, an independent maintainer with authority and -permission to dismiss reviews may dismiss it after verifying that each blocker -is resolved. Record the reason and supporting evidence on the PR. The two -valid approvals are still required after dismissal. +requires two approvals and dismisses stale votes after reviewable changes. +Apply the additional [high-risk requirements](#high-risk-changes) when relevant. + +Resolve a blocking **Request changes** with the reviewer's **Approve** on the +current revision. If the reviewer is unavailable, an independent maintainer +with dismissal authority and permission may dismiss it after verifying each +blocker is resolved. Record the reason and evidence on the PR and verify the +two valid approvals. Treat `cursor[bot]` reviews as advisory with zero votes. +Answer its **Request changes** before merging and recheck GitHub's merge +state on the current head. If the advisory review still blocks, apply the same dismissal rule and +record who dismissed it and each point's disposition, either the fix commit +or the reason for declining it. [GitHub review dismissal](https://docs.github.com/en/pull-requests/how-tos/review-pull-requests/dismissing-a-pull-request-review) -Two PRs that each pass their checks can still break `main` together once both -are merged. Once a GitHub merge queue is enabled, it is the last gate: with the -required checks, it runs them on the merged result without dismissing existing -approvals, so a PR branch need not be up to date with `main` before merging. -Until then, the current ruleset and merge controls apply unchanged. Enabling -the queue is a repository setting for maintainers, and it cannot be enabled -while the required `knowledge-model-policy` check does not run on -`merge_group` events. If `main` still turns red after a merge, an agent first -reverts the merge that broke it, then fixes forward in a new PR; see the -[red main skill](../.agents/skills/red-main/SKILL.md). - -### Agent–Agent: isolated work and conditional handoff +Windows/macOS `host-compatibility` checks are advisory for approval and +merging. Record their actual results under the +[CI policy](contributing.md#ci-and-repository-reuse). + +Two green PRs can break `main` together. A maintainer-enabled merge queue +checks the combined result as the last gate, retaining existing approvals +without requiring a branch update. The queue requires the stop controls above +and `knowledge-model-policy` to run on `merge_group`. Until it is enabled, use +the current ruleset and merge controls. When a merge breaks `main`, revert it +first, then fix forward in a new PR. See [red-main](../.agents/skills/red-main/SKILL.md). + +## High-risk changes + +- **Scope.** CI workflows and required checks, releases (workflow, version, + tags, publishing), secrets and credentials, and permissions (workflow + `permissions`, repository access, rulesets, the approver list). +- **Approvals.** Require two independent approvals. At least one approving + account must appear on [the high-risk approver list](../.github/high-risk-approvers.json) + at the verified protected `main` commit and still have repository write + access at merge time. Its agent may approve, with the account holder + accountable. Check both the list and GitHub's current collaborator + permission for that account just before merging. + A change to the list uses the list already in effect. Hold if either check + cannot be verified. +- **Integration.** Use a merge path that rejects a changed checked base, or + serialize all high-risk merges and list updates, including manual and + automated updates. Hold the exclusive slot from before reading protected + `main` for the final check until GitHub confirms or rejects the merge. + A head-only check leaves the base unprotected. Hold if neither path can be + verified. See [merge-pr](../.agents/skills/merge-pr/SKILL.md). +- **Records.** Both the approval and merge identify who acted. The merging + agent posts the identity line and the following line itself on the PR at + merge time. + + ```text + merge-audit: head= approvals=@ , @ approver=@ list= merge= by=@ + ``` + + `approver=` names the listed approving account whose current write access + was checked. `list=` pins the protected `main` commit supplying the list. + The one-time [bootstrap rule](https://github.com/InferMatrixLab/InferRSI/issues/570#issuecomment-7120472815) + called for `list=bootstrap-570`. The identity line is the acting account's + declaration. +- **Recovery.** Before a change with an external effect a revert cannot undo + (exposed credentials, published assets, changed access), the author or their + agent adds `recovery: owner=@; containment=` to the PR body. + Reviewers request it if missing. The request adds no approval gate. + The account holder and maintainers handle misuse by reverting, recording + it on the Issue and tightening the rule if it recurs. + +## Agent–Agent: isolated work and conditional handoff ```mermaid sequenceDiagram @@ -204,13 +249,36 @@ sequenceDiagram 1. **Scope:** identify requirements, exclusions, owner and relevant dependencies. The accountable agent tracks Issue-level criteria and delegates bounded work; PR readiness and Issue completion are reported separately. Keep each PR a coherent delivery slice; small follow-ups may reuse an Issue. 2. **Isolation:** concurrent writers use separate working directories/indexes and private scratch files. Branch names alone are insufficient. Inspect staged/committed content and coordinate shared IDs, schemas and interfaces. 3. **Evidence:** link checks to actual checked content and relevant environment/test definitions. Distinguish passed, failed, cancelled, skipped, timed-out and not-run. H/B/T—reviewed head, assessed base, tested content—may come from existing records, not mandatory worksheets. -4. **Refresh:** reassess affected evidence after relevant head/base/content/environment/check changes. Refresh checks or explain continued applicability. Neither blanket reuse nor full hardware reruns is the default; changed hashes alone prove neither content change nor equivalence. +4. **Refresh:** after relevant changes to head, base, content, dependencies, environment or check definitions, reassess affected evidence. Refresh the affected checks or cite the earlier evidence that still applies and explain why. Changed hashes alone prove neither content change nor equivalence. 5. **Handoff:** only for an actual transfer or accepted decision change, record the delta, recipient and next action. Keep acceptance status/link, communication status and application status separate. "Applied" needs artifact/evidence; otherwise retain pending or unknown. No full conversation traces or new ledger. 6. **Completion:** merged PR ≠ accepted goal ≠ campaign `PASS` ≠ release. Use `Refs #N` and keep PRs free of GitHub closing keywords and manual Development closing links. The ready lane's `pr-references` job checks the PR body, including standalone closing lines and negated sentences. The integrator checks the live PR and closing links before integration (see [merge PR](../.agents/skills/merge-pr/SKILL.md)). Close the Issue separately under [closure authorization](#closure-authorization), including when a merge supplies its last piece of evidence. Subtasks cannot implicitly close a parent goal. Knowledge proposals to [#17](https://github.com/InferMatrixLab/InferRSI/issues/17) are optional; no automatic promotion. -7. **Parents and dependencies** (repository-wide, [#570 decision](https://github.com/InferMatrixLab/InferRSI/issues/570#issuecomment-7092074182)): an Issue may stand alone with no parent. If it has a parent, it has exactly one, and it is attached as a GitHub sub-issue of that parent. Dependencies point one way and never form a cycle: a child links up to its parent, and only the parent lists its children and holds any acceptance shared by several of them, such as a joint run on the integrated main. Each Issue states its own completion condition: the PR(s) whose merge, or the check whose result, completes it. A completion condition never waits for another Issue to close, so a child does not stay open until a sibling or the parent closes. A real source or code prerequisite (this Issue's change needs another Issue's merged change) may still be recorded as a dependency on the Issue or its PRs; it orders the work and can hold a PR, but it is not a closure condition. Integration or acceptance evidence the Issue's own scope requires, such as a shared integration check, is different: it may be that Issue's completion condition as a named check, stated as the check's result, never as another Issue's closure. Ordering between PRs belongs on those PRs or once in the parent, not in sibling Issues' completion conditions. Existing Issues are brought in line only with their author's agreement. -8. **Claims:** before starting a fix or opening a PR, search open Issues and PRs for the same work and claim it with a comment on the governing Issue; if someone already holds a live claim, coordinate there instead of starting a parallel fix. An agent's claim states when it will next show an artifact (draft PR, branch or findings). A claim that states no time allows 24 hours. If nothing appears by then, the claim lapses: the agent posts one comment releasing it and leaves the work to others. See the [claim work skill](../.agents/skills/claim-work/SKILL.md). +7. **Parents and dependencies.** An Issue may stand alone or have one native + GitHub parent. Keep child links pointing up and let only the parent list + children and record shared acceptance. Keep dependencies acyclic. Each + Issue names its own completion condition as its merged delivery PRs or a + required check, including a shared integration check when applicable. + Other Issues' closures never gate that condition. Record real source or + code prerequisites on the Issue or PR to order work or hold a PR. Record + PR ordering on those PRs or once in the parent. Update existing Issues + with their authors' agreement. +8. **Claims.** Before fixing or opening a PR, search open Issues and PRs for + the same work. Post a claim comment on the governing Issue or coordinate + with its live claimant. State the next artifact and when it will appear + (default 24 hours when no time is given). If the artifact misses the + deadline, the claim lapses. Post one comment releasing it and leave the + work to others. See + [claim-work](../.agents/skills/claim-work/SKILL.md). 9. **Comments:** every agent comment starts with the acting-agent identity line, then a one-line conclusion as the first substantive line; put details in a collapsible `
` section. Post in a thread only for a new head, new evidence or a new question; do not post status-only updates. Do not post, or else minimize, agent comments that only report the agent's own failure or exhausted quota. +### Evidence refresh — hypothetical example + +Suppose a runner PR was reviewed and tested at `H1` against `B1`, then rebased +to `H2` against `B2`. The runner code, test environment and test command are +unchanged. `B2` changes a JSON fixture the runner tests load, so rerun those +tests at `H2` and report their results there. The earlier Ruff result still +applies because its input files, tool version and configuration are unchanged. +Cite the `H1` Ruff result and that reason in the PR. + ## Closure authorization Close an Issue only within the authority above, after its own accepted completion @@ -227,10 +295,10 @@ Only the owner removes it. Identify the recorded decision and label event for the current accountable owner, accepted completion condition and open lifecycle. Reopening or changing the owner or completion condition requires fresh authorization. Immediately -before closing, recheck that authorization, the full stop chain, completion -evidence, required checks and the posted summary. Leave the Issue open if -authority or evidence is stale, unreadable, missing or disputed, or if a stop -applies. +before closing, recheck that authorization, the [full stop chain](#human-stop), +completion evidence, required checks and the posted summary. Leave the Issue +open if authority or evidence is stale, unreadable, missing or disputed, or +if a stop applies. ## Closure summaries @@ -289,20 +357,8 @@ Exact revisions, acceptance scope, preserved limitations and follow-ups.
```` -Examples: [functional change and scoped acceptance (#40)](https://github.com/InferMatrixLab/InferRSI/issues/40#issuecomment-6330534277) and [knowledge delivery with preserved validation limits (#48)](https://github.com/InferMatrixLab/InferRSI/issues/48#issuecomment-6330592855). - -Non-delivery closures (duplicate, cancelled, not planned) keep the same entries but -record disposition and destination instead of a delivered change. Illustrative card: - -```mermaid -flowchart LR - A["Duplicate report"] --> B["Canonical issue #N"] - B --> C["Closed as duplicate"] -``` - -- **Delivered:** none. -- **Verified:** overlap with the canonical issue confirmed by the acceptance owner. -- **Limits:** none applicable. +For a duplicate, cancelled or not-planned closure, keep the same entries and +record the disposition and destination. ## Records @@ -323,7 +379,7 @@ lists every repository label with its group and description, and every name has | Area | one or more `area:*` | the creator | at creation | | Status | `status:proposed` (waiting for a decision) | the acting agent | the status block names a concrete question and its decision owner, and no decision is recorded; the Issue is discussed only and no work starts | | Status | `status:accepted` or `status:deferred`, replacing `status:proposed` | the acting agent | only after the decision owner records that decision in a comment; at `status:accepted` the direction is settled and assigned work may start; at `status:deferred` no work starts | -| Stop switch | `bot:stop` | a human adds it, or a maintainer account's agent for a human; only a human removes it (the human who stopped or a maintainer), never an agent ([stop rule](#identity-and-authority)) | adding stops agent changes, reviews and merges on that Issue or PR, and on an Issue also the PRs it governs, its sub-issues at any depth and their PRs, and delegated work (the [stop check](#identity-and-authority) covers only this chain, not background links); removing lets them resume; it applies at any status and overrides the rows above | +| Stop switch | `bot:stop` | [Human stop](#human-stop) governs adding and lifting | applies at any status and overrides the rows above | | Closure authorization | `bot:auto-close` | the accountable owner or its agent with a linked decision adds it, and only the owner removes it | [standing closure authorization for an accepted Issue](#closure-authorization) | | Protected switch | `skill-eval:execute` | only the owner adds it; the owner or an agent may remove it | adding authorizes paid Skill Eval for one PR; removing revokes it | @@ -376,46 +432,4 @@ not as a verified fact: before relying on one, confirm from the label's own even the named app still applies it. Adding an entry is a scope decision, so it goes through review like any other change to this file. -Apply the [label trim agreed on #570](https://github.com/InferMatrixLab/InferRSI/issues/570#issuecomment-7076085858) -after the manifest change merges. Move `kind:roadmap` and `kind:status` to -`kind:tracking`, and `kind:investigation` to `kind:task`, before retiring the -old labels. The affected Issues keep their recorded scope and acceptance -state. Retire `priority:*` and `help:wanted`. Rename `bot-reviewed` to the -managed `bot:reviewed` label to preserve existing associations. Treat -`bot:reviewed` as informational. Formal review state determines approval. - -## Evidence refresh — hypothetical example - -**Hypothetical illustration only; it records no actual PR, run or result in this -repository.** - -Suppose a PR changing `src/inferrsi/harness/runner.py` was reviewed at head `H1` -against base `B1`, then is rebased onto `B2` (new head `H2`) because `B2` touched -the same file. Rule 4 asks what changed, not for a blanket rerun, and a -file-only comparison is insufficient on its own: - -- Assess affected content, dependencies, environment and check definitions together: the `H1..H2` delta of the affected files, whether `B1..B2` changed anything the checks depend on (imports, fixtures, CI workflow steps, tool versions), and whether the earlier check definitions still test the same contract. -- If that assessment supports reuse, the earlier review and CI **may** remain applicable — say so with an explicit reason, and name in the PR exactly which earlier evidence is reused and why. -- If it does not, refresh the affected checks on `H2` — for example `ruff check src tests` plus the relevant `pytest` selection — and report which content each result ran on. -- Either way, distinguish passed, skipped and not-run checks instead of implying a full rerun. A changed hash alone proves neither content change nor equivalence. - -## Historical evidence and limits - -These conventions are InferRSI proposals informed by the reviewed C1–C7 case pack. -The two pinned snapshots — the -[Magpie repository](https://github.com/yetone/magpie/tree/778000326adaa49cd790846acd2d535572ad5ceb) -and the separate -[release-workflow repository](https://github.com/yetone/magpie-releases/tree/fc85a074b1ba73417d2afda783e1c0a27ed79a1f) -— identify lineage; they are not themselves a link to the case pack. An -accessible case summary with concrete source pointers and stated limits — the -"Reviewed case pointers" section of -[RFC #21](https://github.com/InferMatrixLab/InferRSI/issues/21) — covers C1–C7 -at the level this guide relies on; the full reviewed pack remains with its -owner and is not imported here. C1–C3 inform ownership and review; C4–C5, CI trade-offs; C6, -completion states; C7, learning. - -They are proposals, not demonstrated Magpie enforcement or a causal speedup. -Described practice, inspected implementation, observed records and proposed -adaptations remain distinct evidence classes; see #21 for the per-case limits, -including the unresolved C1 root cause and the unestablished final -tested/merged equivalence. +Treat `bot:reviewed` as informational. Formal review state determines approval.