Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
ebfbcf4
docs: add collaboration skills and slim the agent entry page
Dong1017 Nov 22, 2026
649245f
docs: check assignee, status and stacked base in the claim and merge …
Dong1017 Nov 22, 2026
ac8886f
docs: use bot:stop and complete the merge-pr preconditions
Dong1017 Nov 22, 2026
75853c9
docs: leave high-risk merges to maintainers and recheck base and appr…
Dong1017 Nov 22, 2026
5021f9d
docs: honor unlifted stop comments in the claim, review and merge skills
Dong1017 Nov 22, 2026
b5f012d
docs: let maintainer accounts approve and agents merge high-risk PRs …
Dong1017 Nov 22, 2026
03f9781
docs: list the audit fields in the merge-pr record for high-risk PRs
Dong1017 Nov 22, 2026
7206d44
docs: have the skills write the fixed merge-audit and recovery lines …
Dong1017 Nov 22, 2026
1183c5e
docs: record the maintainer approver in the merge-audit line
Dong1017 Nov 22, 2026
baf9e91
docs: bind the merge to the checked head and verify recovery in merge-pr
Dong1017 Nov 22, 2026
ee1bee4
docs: let a maintainer account's agent integrate in merge-pr
Dong1017 Nov 22, 2026
c1ff90b
docs: require and verify an Admin-role approval in merge-pr
Dong1017 Nov 22, 2026
9dde0f0
docs: check the high-risk approver list in merge-pr
Dong1017 Nov 22, 2026
e0c9b20
docs: read the approver list at the checked main commit in merge-pr
Dong1017 Nov 22, 2026
fa3e9c0
docs: name the bootstrap list= value in merge-pr
Dong1017 Nov 22, 2026
620f1c8
docs: accept a cursor[bot] approval as one vote in merge-pr on non-hi…
Dong1017 Nov 23, 2026
c073711
docs: drop the cursor[bot] vote from merge-pr
Dong1017 Nov 23, 2026
97a7b15
docs: split binding and advisory Request changes in merge-pr
Dong1017 Nov 23, 2026
c484b05
docs: dismiss an advisory review that GitHub still blocks on in merge-pr
Dong1017 Nov 23, 2026
1a031de
docs: check a stop on every ancestor Issue in the collaboration skills
Dong1017 Nov 23, 2026
848f7e3
docs: use the guide's stop check in the collaboration skills
Dong1017 Nov 23, 2026
3bb9c3a
docs: count formal Approve reviews in merge-pr, not their body text
Dong1017 Nov 23, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
62 changes: 62 additions & 0 deletions .agents/skills/claim-work/SKILL.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
---
name: claim-work
description: Claim an InferRSI Issue or fix before starting it, state when the next artifact will appear, and release the claim if nothing appears. Use before starting a fix, opening a PR or taking over a delegated slice.
---

# Claim work on an InferRSI Issue

Follow the [identity and authority](../../../docs/agent-collaboration.md#identity-and-authority)
rules and working rules 1, 7 and 8 in
[agent collaboration](../../../docs/agent-collaboration.md#working-rules).

## 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.
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`:

```bash
gh issue view <issue> --repo InferMatrixLab/InferRSI --json assignees,labels
```

With several assignees and no recorded owner, there is no accountable
owner yet. With no accountable owner, propose on the Issue and ask a maintainer to assign it;
at `status:proposed` or `status:deferred`, discuss only. Do not claim
either.
3. Confirm you are the deciding agent (the formal agent working for the
accountable owner's account) or that the deciding agent delegated this slice to you
on the Issue. Otherwise propose on the Issue instead of claiming.
4. Search open Issues and PRs for the same work, for example:

```bash
gh search issues --repo InferMatrixLab/InferRSI --state open "<keywords>"
gh search prs --repo InferMatrixLab/InferRSI --state open "<keywords>"
```

5. Read the governing Issue's recent comments. If someone holds a live claim,
coordinate on that thread instead of starting a parallel fix.

## Claim on the Issue

Post one comment on the governing Issue, not on a PR or in a private channel:

```text
<agent name>, acting for @<human>: claiming <the slice>.
Next artifact: <draft PR / branch / findings> by <date and time, with time zone>.
```

Keep the claim to the slice you will deliver. A claim records intent; it does
not grant authority beyond the Issue's direction. Each Issue has one deciding
agent, the one acting for its accountable owner; other agents propose there.
Within the Issue's direction, the deciding agent settles scope and records the
reason on the Issue; only a change of direction goes back to the owner.

## Deliver or release

- Show the named artifact on the Issue by the stated time. Post again only for
a new head, new evidence or a new question; no status-only updates.
- A claim that states no time allows 24 hours.
- If nothing appears by then, the claim lapses. Post one comment releasing it,
with any partial findings in `<details>`, and leave the work to others.
125 changes: 125 additions & 0 deletions .agents/skills/merge-pr/SKILL.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,125 @@
---
name: merge-pr
description: Decide whether an InferRSI pull request may merge now and, if so, squash-merge it. Use before merging and whenever reporting a PR as merge-ready; this is the one merge-ready check, not private criteria.
---

# Merge an InferRSI pull request

Follow [PR review and merge](../../../docs/agent-collaboration.md#pr-review-and-merge)
and the [squash merge rules](../../../docs/agent-collaboration.md#records).
Report a PR as merge-ready only when every check below holds on its current
head; otherwise report the first failing check.

## Read the current state

```bash
gh pr view <pr> --repo InferMatrixLab/InferRSI \
--json state,isDraft,headRefOid,baseRefName,baseRefOid,body,labels,reviews,reviewDecision,statusCheckRollup,files
```

Also read the governing Issue's labels, accountable owner and recorded
authorization. Note `headRefOid` and `baseRefOid`: the checks below hold for
that pair only.

## Check every condition

1. **Open and ready:** the PR is open and not a draft.
2. **Authorized to integrate:** the governing Issue has an accountable owner
(recorded on the Issue, or else its only assignee when exactly one is set) and carries `status:accepted`, and you are its deciding agent, were delegated
integration on the Issue, or you act for a maintainer account.
3. **No stop:** the guide's
[stop check](../../../docs/agent-collaboration.md#identity-and-authority) finds no stop on the PR's
stop chain; a stop comment holds even after the label exists. If it finds a
stop or cannot rule one out, do not merge, and record on the PR which Issue
you could not check.
4. **Base and dependencies:** the PR's base is its intended target: `main`,
or for a stacked PR its lower PR's branch until that PR merges, after which
the base is changed back to `main` and the checks run again. Every PR it
depends on has merged; until then, do not merge or queue it.
5. **Two approvals on the current head:** at least two formal **Approve**
reviews, each from a different eligible account (repository write access
or higher), none stale. The review body's wording does not count;
comments and **Comment** reviews contribute no approval.
Each account counts once, whether its human votes directly or its one
formal reviewer agent does.
6. **Independence:** the author, material contributors and the accountable
parent supplied none of them, including through another agent under their
account. At least one comes from a different agent or a human. The
author's own approval never counts, nor does one from an account without
write access.
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
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
you merge. An unresolved code or safety
blocker still stops the merge, whoever raised it.
8. **Required checks green** on the head. Windows/macOS `host-compatibility`
results are advisory and never block.
9. **High-risk:** if the diff changes CI workflows or required checks,
releases (release workflow, version, tags, publishing), secrets and
credentials, or permissions (workflow `permissions`, repository access,
rulesets, the high-risk approver list), or you cannot tell, at least one of
the approvals in 5 comes from an account listed in
`.github/high-risk-approvers.json`; that account's agent may give it. Other
approvals count toward the two but not as this one. Read the list from the
protected `main` commit you noted as `baseRefOid` (the base is `main` by
check 4), never from the PR head or a stacked branch, so a PR that changes
the list is judged by the list before it
(`gh api "repos/InferMatrixLab/InferRSI/contents/.github/high-risk-approvers.json?ref=<baseRefOid>" --jq .content | base64 -d`).
Confirm the approving login is on it, and confirm the account still has
write access:
`gh api repos/InferMatrixLab/InferRSI/collaborators/<login>/permission --jq .permission`
must print `admin` or `write`. If you cannot read the list or the
permission, or no approving account passes both, do not merge. The PR that
creates the list is approved once as the
[high-risk rule](../../../docs/agent-collaboration.md#identity-and-authority)
says.
Otherwise follow the normal flow.
10. **Recovery for external effects:** if the merge itself causes an external
effect that a revert cannot undo (publishing a release asset or package,
changing access or credentials), the PR body has a
`recovery: owner=@<account>; containment=<steps>` line naming the recovery
owner and the containment steps. If it is missing, do not merge and ask the
author to add it. This adds no approval requirement.

Right before merging, read the PR and the governing Issue again. Recheck the
stop check from check 3 on the whole stop chain; `headRefOid`, `baseRefName` and `baseRefOid` against the pair you
noted; the Issue's `status:accepted` and your authorization; and, on the
current head, the approvals, any open binding **Request changes** review, any advisory
request without a recorded disposition, GitHub's merge state, and any
unresolved code or safety blocker from check 7, and, on a
high-risk PR, the listed approver and its write access from check 9, against
the list at the same `baseRefOid`; and the PR body's `recovery:` line from
check 10, since the body can change without a new head. If anything changed or
no longer holds, start over.

## Merge

Prepare the squash message: subject plus a short summary, no Issue references,
DCO sign-off and material `Agent-assisted-by` attribution kept. Squash-merge
only the head you checked, so GitHub refuses the merge if the head has moved:

```bash
gh pr merge <pr> --repo InferMatrixLab/InferRSI --squash \
--match-head-commit <headRefOid> --subject "<subject>" --body "<summary>"
```

With the REST merge endpoint, pass the same head as `sha`. If the merge is
refused because the head changed, start over from the checks above; never retry
without the expected head. The repository ruleset and merge controls apply
unchanged. There is
no merge queue yet; once one is enabled, the rules for queueing are added here.
Record the merge on the PR yourself, right after merging, with an identity
line; for a high-risk PR the same comment then has one line
`merge-audit: head=<sha> approvals=@<account> <review URL>, @<account> <review URL> approver=@<login> list=<sha> merge=<sha> by=@<account>`,
where `approver=` names the approving account you found on the list and
verified in check 9, and `list=` is the `baseRefOid` 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)).
If `main` turns red afterwards, use the
[red-main skill](../red-main/SKILL.md).
62 changes: 62 additions & 0 deletions .agents/skills/open-pr/SKILL.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
---
name: open-pr
description: Open an InferRSI pull request from current main with local checks run, DCO and agent attribution on commits, and a complete PR body including the knowledge authorship declaration. Use when turning a claimed slice into a PR or updating its head.
---

# Open an InferRSI pull request

Follow [contributing](../../../docs/contributing.md#development), the
[records rules](../../../docs/agent-collaboration.md#records) and the
[knowledge authorship declaration](../../../docs/knowledge-model-policy.md#one-pr-body-declaration).
Claim the work first with the [claim-work skill](../claim-work/SKILL.md).

## Branch and commit

1. Fetch and branch from current `main` in a separate worktree:

```bash
git fetch origin main
git worktree add -b <branch> ../<dir> origin/main
```

2. Keep the PR one coherent delivery slice with a minimal diff.
3. Commit with `git commit -s` under your real identity. Add
`Agent-assisted-by: <tool> / <model-id> [effort=<level>] (<role>)` for each
material agent contributor. Keep Issue references out of commit subjects,
bodies and trailers.

## Run the local checks

Run them on the content you will push and record the actual results:

```bash
ruff check src tests tools
pytest
```

If the skill library changed, also run
`python tools/build_skill_index.py --source-revision <source-commit> --check`.
Check every new or changed artifact against the
[privacy and security rules](../../../docs/privacy-security.md).

## Write the PR body

Start from the [PR template](../../../.github/PULL_REQUEST_TEMPLATE.md):

- The first line of the governing section is `Refs #<issue>`. Never write a
closing keyword before an Issue reference, even in a negated sentence.
- Fill the `knowledge-model-policy` block with the current full head SHA and
every material AI author's actual tool, model and effort. Changes to
[protected paths](../../../docs/knowledge-model-policy.md#rollout-and-scope)
fail the required check without it; after every push, update `head_sha`.
#518 stalled because its declaration check stayed red on the final head.
- Report checks actually run, and failed, skipped or not-run ones, separately.
Report PR readiness and Issue completion separately.
- If a revert cannot undo the change's external effect (credentials,
published assets, access), add one line
`recovery: owner=@<account>; containment=<steps>`.
- Do not prefill an independent approval or claim an authorized merge.

Open the PR with `gh pr create --base main` and show it on the Issue as the
claimed artifact. Review goes to an independent reviewer using the
[review-pr skill](../review-pr/SKILL.md).
45 changes: 45 additions & 0 deletions .agents/skills/red-main/SKILL.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
---
name: red-main
description: Restore a red InferRSI main by finding the merge that broke it, reverting that merge first and fixing forward in a new PR. Use when a required check fails on main after a merge.
---

# Restore a red main

Follow the revert-first rule at the end of
[PR review and merge](../../../docs/agent-collaboration.md#pr-review-and-merge):
revert the merge that broke `main` before fixing forward.

## Find the breaking merge

1. List recent `main` runs and find the last green and first red run of the
failing workflow:

```bash
gh run list --repo InferMatrixLab/InferRSI --branch main --workflow <workflow> --limit 20
```

2. List the merges between those two commits with
`git log --first-parent <last-green>..<first-red>`. Read the failing job
log and match the failure to the change that caused it. Two PRs that each
passed can fail together; the breaking merge is the one after which `main`
first failed.
3. Search open Issues and PRs for an existing revert or fix, and claim the
revert with the [claim-work skill](../claim-work/SKILL.md).

## Revert first

Branch from current `main` and revert the breaking merge:

```bash
git revert --signoff --no-edit <merge-sha>
```

Open the revert PR with the [open-pr skill](../open-pr/SKILL.md), naming the
breaking merge and the failing run. It merges through the
[merge-pr skill](../merge-pr/SKILL.md) like any other PR. Post one comment on
the original PR linking the revert.

## Fix forward

After `main` is green again, the original change returns in a new PR that
contains the fix, reviewed and merged under the same rules.
6 changes: 6 additions & 0 deletions .agents/skills/review-pr/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,12 @@ 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)),
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
assets, access) and the PR body lacks a
`recovery: owner=@<account>; containment=<steps>` line, request it.
Post a review or
comment only for a new head, new evidence or a new question. Lead with the
one-line conclusion and put details in a collapsible `<details>` section.

Agents may submit formal reviews without a separate human delegation; see
[identity and authority](../../../docs/agent-collaboration.md#identity-and-authority).
Expand Down
Loading
Loading