agentleFS
AVP-DevAVP-Dev/pair-mailbox/skills/pair-work/SKILL.md

pair-work

Skill1 starsChanged 14 days agoMITView on GitHub

Full autonomous collaboration with the peer agent. The two of you plan, implement, review each other, test, fix, and open a pull request without asking the user anything. Use when the user says "работаем вместе над X", "работаем вдвоём", "позови соседа на X", "нужна пара", "work with the peer on X", "let's do this together", or "автономно над X".

  • Reads credentials
  • Commits and pushes

The file

Show its rules and text

We split this skill into the rules it gives an agent

21 rules. About 0 are common, 10 are distinctive, and 11 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈10

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 11

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Read history only when the digest says you need it.

    line 29
  2. Distinctive:

    Read the task and the code first. Claim after: Not the other way around.

    line 35
  3. Very specific:

    Only a human changes the arrangement: pairctl roles --swap.

    line 50
  4. Distinctive:

    If the peer already grabbed it and you think you are the better fit:

    line 52
  5. Distinctive:

    If it is not ready to give it up — work as the critic and wait.

    line 58
  6. Distinctive:

    If the composer is busy — the typed input returns a refusal instead of overwriting what it prints.

    line 115
  7. Very specific:

    If fix had commits, they stay, and that is fine: audit is about what comes next, not about rewriting history.

    line 198
  8. Distinctive:

    Use the CLI's actual subagent feature when it is available and allowed.

    line 207
  9. Distinctive:

    Before dispatch, give the helper the minimum complete packet:

    line 236
  10. Very specific:

    Ask for a concise report with: conclusion.

    line 245
  11. Very specific:

    Only in mode=fix. In audit — none of this: git is not touched at all.

    line 313
  12. Distinctive:

    Commit after every green step, message about what changed, not "fixes".

    line 316
  13. Distinctive:

    Do not tell the user that push and PR are "their business".

    line 320
  14. Very specific:

    Only six things: .env, secrets and tokens, ports and deploy addresses, deploy, DB migrations, deleting data or git history.

    line 328
  15. Very specific:

    If a note is bigger than 5 KB — read only the latest entries.

    line 353
  16. Very specific:

    Ban on manual relay through the human: Never ask the user to pass text or confirmation to the peer's window (*"there is a request hanging …

    line 360
  17. Distinctive:

    Never tell the user "the peer will look now" — you do not know that.

    line 365
  18. Very specific:

    Default autonomy is auto (resolve_autonomy, server.py:317).

    line 389
  19. Very specific:

    read a file by range (path:50-120), never cat it whole.

    line 402
  20. Distinctive:

    when a whole file must travel, say why in the note — the cost is the reader's.

    line 404
  21. Very specific:

    No passing evidence at all — record what the machine actually ran.

    line 436

≈ “Common” is an estimate: at least 1 in 5 of the 408,460 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Autonomous pair work

Session scope: this workflow requires an explicitly enrolled pair. In a standalone CLI, perform the task independently with native subagents; an installed MCP entry or old .pair directory does not assign a critic role. Use pairup when the user explicitly requests a pair. A disconnected enrolled critic retains its write boundary.

Language: this is the English original. The Russian mirror is SKILL.ru.md.

You work together with another agent: a different CLI, a different model, it cannot see your conversation. The only channel is the pair_* tools.

The user gave a task and left. Your job is to carry it to a PR without their involvement.

0. Digest — cheap start, state right after

Always start with pair_digest, then pair_state. The digest (~1000 tokens) answers "where does the round stand" (task, mode, phase, open tasks, obligations, last commit and verdict) and replaces the pair_state + pair_task + pair_transcript bundle (3724 tokens measured). But the digest does not say who writes and what blocks closing — for that, read pair_state right away (authority, roster, unread, done-blockers).

Read history only when the digest says you need it. Answer "how is it going?" with what is actually true right now from pair_state/pair_transcript, not with a promise to check.

1. Split: read first, then claim

Read the task and the code first. Claim after. Not the other way around.

pair_digest                                       # what the task is, who is here, what is open
pair_state                                        # who writes, what blocks closing
# study the code the task will touch
pair_claim(reason="one sentence: why you")

reason is not a formality. It lands in the transcript and in the refusal to the peer, so the peer sees your argument and may disagree with it. "Because I was first" is a bad answer: whoever read the code is fitter to write than whoever was merely faster.

A standing arrangement beats a race: pair_claim answers by_policy=true when the writer was assigned by a human (pairctl roles), and there is nothing to argue about. Only a human changes the arrangement: pairctl roles --swap.

If the peer already grabbed it and you think you are the better fit:

  1. Name the reason in pair_send — concretely, with file:line.
  2. It may give up the right itself via pair_release(why="..."). That is its decision, not your transfer: you ask, it decides.

If it is not ready to give it up — work as the critic and wait. A critic who is right is more useful than a writer who is wrong.

2. Live channel: wait for messages, don't fall asleep

This is the main thing that makes the pair work. An agent that silently waits is a dead agent.

One read per turn. In your free time call pair_read(wait_seconds=45). It returns when the peer sends a message, or when the time runs out. Came back empty — go back to your task (or sleep): the peer and the supervisor wake you when the mail arrives, so reading again in a loop buys nothing and burns a full context on every poll. A read that would replay a batch you already hold spends its whole wait before answering, so the loop cannot spin.

The batch it returns stays unread until you ACK it: process it, then pass its ack_token on a later pair_read. A retry without the token replays the same letters, and the letters that arrived after it wait behind it — the answer names how many (letters_behind). Reading again will not bring them; acknowledging will (round 101 batch contract — see pair-chat Reading).

Waiting rules:

  • One read per turn. An empty answer is no reason to read again.
  • ACK every batch you get. must_ack in the answer says the batch is still unacknowledged.
  • The wait_seconds default is 0 (DEFAULT_READ_WAIT_SECONDS, read_wait.py:10), the cap is 60s (MAX_READ_WAIT_SECONDS); beyond that the client timeout cuts it.
  • waited_seconds is the time the call really took; wait_budget_seconds is what it was allowed to take. A call that took less than its budget answered early: it replayed a batch you already hold.
  • Time ran out — go back to your task. Do not sit in the wait forever.
  • Both roles may wait. Bounded waiting creates no deadlock: it always expires, and you return to work. (Previously the writer was forced to 0 — that killed the channel: an agent without waiting went idle and missed mail. The winning code is tool_pair_read, server.py:2343.)

When asked "how is it going?" — never answer "checking in a sec". That is the most annoying phrase in the whole system. Open pair_state or pair_transcript and answer with what is actually true right now: phase, what is done, what is pending. If nothing changed — say so.

2a. Two ways to deliver

The body always lands in .pair/mailbox/; only a short pointer goes to the composer. The terminal is a display, not a bus between agents. The full contract is in the pair-chat skill (single source of truth); here only the choice of path:

pair_send — a message into the mailbox. It sits there until the peer itself calls pair_read. Take it for reports, plans, findings: they are not needed immediately. With expects_reply=true it opens an obligation (queue limit — 2 unanswered per role, MAX_OPEN_REVIEWS, mcp/pair_mailbox/review.py:27); a plan before the first commit of a fix round carries plan/план in subject (§9a).

pair_deliver — text into the mailbox + a pointer into the peer's composer in its tmux pane. It wakes up on its own and takes it as its next turn. Take it when you need it to do something now: a question whose answer you need before you go further.

If the composer is busy — the typed input returns a refusal instead of overwriting what it prints. The text is already in the mailbox: go back to waiting. On an unproven (foreign) pane typed input is forbidden — only display-message + mailbox, otherwise it is injection into someone else's composer.

2a-1. When there is no tmux at all

A launch through bin/pair-runner runs the agent as a plain subprocess on a host with no terminal multiplexer. The mailbox is unchanged; the composer is absent. So:

  • pair_send is the channel. It delivers the body into the mailbox; the peer reads it on its own next turn.
  • pair_deliver cannot wake anybody there. It still writes the same mailbox letter and answers in_pane: false with a why naming the missing pane. Read that answer literally: the peer was not woken, only the letter was placed.
  • The wait rule is unchanged: one read per turn, ACK the batch with its ack_token, and wait with a bounded pair_read(wait_seconds=45). Nothing about losing tmux turns the read loop into work.
  • The plan, the review, the verdict and the PR do not change. Only the wake-up path does — and the supervisor's wake file still exists, so a peer's own pair_read sees the letter.

2b. Round mode: digest, then pair_state

pair_state returns mode. It decides what the round does at all, and it is not in the task text — otherwise the agent's instruction ("you are the writer, edit files") may end up contradicting the task, and the one in the system prompt wins.

fix (default) — everything as described in §3: rounds, code, review, branch, PR.

audit — the project is not intentionally changed. Nobody edits files, creates a branch, commits, or proposes patches: the server refuses patch reservation, and that refusal lands in the audit. Write authority stays, otherwise the phase has nowhere to move, but the subject is different: the writer leads the round, not commits code.

The cycle in audit:

Round 1 — surfaces. Split the code into surfaces and divide them so that each is covered, not "both looked at server.py". What a surface is — you decide together; it is not from the task.

Round 2 — findings. The writer hunts defects and writes each into pair_note(kind="finding-<ID>"): where (file:line + function name), what breaks (two concrete actions and what happens between them), how to verify, severity, and what the check does NOT prove. The last field is required: without it the finding looks stronger than it is.

Round 3 — refutation. This is what makes audit different from fix, and it is its point. Each of you takes the peer's finding and hunts for why it is wrong. Find it — write pair_note with refuted and the reason. Do not find it — confirmed. Only what is confirmed by both goes into the report.

Round 4 — report. The writer assembles pair_note(kind="audit-<date>"): a table of ID / severity / where / status, and a section "what is NOT covered". Silence reads as "all good", and that is a lie if you simply did not look. Confirmed items move to docs/backlog/ under the pair-backlog rules — those are the only files that in audit get created at all.

The same cap — 4 rounds, then handoff with an honest account of what did not converge.

What is forbidden in audit: editing project files, git checkout -b, commits, push, PR, pair_patch_reserve. Checks that do not change state — allowed and expected.

2c. Switching mode mid-work

A human changes the mode, and only a human changes it.

audit → fix after an audit is the usual next step, not a restart:

pairctl mode fix          # same round, same conversation, different work

Findings are not thrown away: confirmed ones sit in docs/backlog/<slug>.md, and the fix round takes them from there as ready input. Tell the peer in its window that the mode changed and which files to take — the agent reads mode itself, but does not know that you did this and why.

fix → audit is a rollback. Same call, and the agent stops editing files. Useful when the fix sprawled and you need to go back to talking about what is happening at all.

Note: switching mode does not touch edits already made and does not roll back the phase. If fix had commits, they stay, and that is fine: audit is about what comes next, not about rewriting history.

2d. Guild delegation: keep the lead context, keep the boundary

The pair has two Tier 1 leads: the writer leads as the Senior Engineering Guild, and the critic as the Tech Lead Council / CTO. Native subagents are optional Tier 2 workers inside one lead's CLI; only the writer and critic appear as roles in state.json. This is a manual workflow, not an engine-created team hierarchy. Use the CLI's actual subagent feature when it is available and allowed; otherwise, work directly. Delegate broad searches and long-log analysis to keep the lead context focused on synthesis and decisions. Delegation should buy focused parallel research or implementation, not add ceremony to a small or tightly coupled change.

The parent lead remains responsible for the work. A subagent never calls pair_*, claims a role, changes authority or phases, closes a shared task, or contacts the other CLI. All cross-CLI coordination stays between the writer and critic.

Critic guild

The critic may delegate read-only code tracing, research, threat review, or audit surfaces. Give each helper one question and a bounded set of paths. The helper reports facts and verified file:line citations to the critic; it does not edit, decide the verdict, or send findings to the writer. The critic checks the important references, then records and communicates its own finding or verdict through the pair protocol.

Writer guild

The writer may delegate a bounded implementation, focused code trace, or verification task. State which files the helper may edit and which commands it may run. Keep parallel edits on disjoint paths; serialize work that touches the same file. Any task worktree must follow the isolation strategy and visa in PROTOCOL.md §21. The writer reviews every returned diff, runs the required checks against the integrated tree, and owns commits and writer evidence. A helper's green report is a lead to verify, not evidence by itself.

Send a context packet

Before dispatch, give the helper the minimum complete packet:

  1. Parent task ID and one-sentence goal.
  2. Current mode and phase, plus the relevant authority boundary.
  3. In-scope files or line ranges and explicitly allowed operations.
  4. Verified context, relevant call paths, and invariants to preserve.
  5. Dependencies and any file boundary needed for safe parallel work.
  6. Acceptance criteria and the exact result you need back.

Ask for a concise report with: conclusion; changed or inspected paths with verified file:line references; commands and actual results if run; what was not checked; and open questions or risks. Avoid forwarding whole logs or unrelated files. Treat the report as unverified until the parent checks the cited code and any claimed result.

Track the work at the lead level

The parent keeps the shared record coherent. Use pair_task for independently deliverable work that must remain open across the round; do not create a shared task for every private implementation step. Keep short-lived assignments and their status in the lead's plan or handoff note. Record decisions and confirmed findings with pair_note. Only the writer records evidence, after verifying it against the integrated tree. Close a shared task only after its acceptance criteria are met; if work is abandoned, drop it with a reason. Never report a helper as done solely because it returned a completion message.

3. Cycle (fix)

Repeat until green. Cap of 4 rounds, then pair_note(kind="handoff") with an honest account of what did not converge.

Round 1 — plan. The writer studies the code, writes pair_note(kind="plan"), sends the plan to the critic via pair_send with expects_reply and plan in subject — and waits for an objection or agreement. No answer — no code (§9a). The critic hunts holes: wrong assumptions, no error handling, unclear where it breaks. Bad plan — writes why, the writer rewrites.

Round 2 — code. The writer follows the plan and runs tests. No green tests — no round.

Round 3 — review. The critic reads the whole git diff. Findings go into pair_note(kind="finding") with file:line. Real ones — the writer fixes, the critic re-checks exactly those. False ones — the critic records why in verdict.

The critic does not invent problems for volume. If the code is good — it says so plainly.

A verdict the merge gate can read. The gate reads the LAST ## -section of the verdict note that carries a MACHINE-READABLE marker (PROTOCOL §10g): either verdict-approve <sha> or a line that is exactly **APPROVED**. The prose "APPROVED" or a heading like ## Verdict: APPROVED is not a marker: the gate then falls back to an OLDER marked section and compares that stale head with the live one, and the merge is refused for a reason that has nothing to do with the work. When the critic approves, the note ends with:

## verdict-approve <the head sha being reviewed>

**APPROVED**

<the head sha> is what pins the verdict to a revision, so a verdict for an older commit does not approve a newer one.

Round 4 — repeat. What was found is fixed, tests are green, the critic confirmed. The writer records pair_evidence(kind="test", ...) with what the machine actually printed (count and exit code), and only then pair_advance("verify"), then pair_advance("done") — but only after reading all the mail: the server will not let you close the round over unread mail. The full done gate list is in §9 below.

4. Bar for a finding

Four questions, otherwise it is not a finding: what breaks, why it is vulnerable, at what cost, what to fix. A file:line reference is required. One strong conclusion beats five weak ones.

Not a finding: what a linter or tests will catch; style and naming; "add tests".

5. Git

Only in mode=fix. In audit — none of this: git is not touched at all.

  • Own branch: git checkout -b <short-task-name> at the start.
  • Commit after every green step, message about what changed, not "fixes".
  • Green tests required before commit.
  • At the end: git push and a GitHub PR. This is part of the work, not a separate action.
  • Never push to main. Branch and PR only.
  • Do not tell the user that push and PR are "their business". That is your job.
  • In autonomy=auto, finish the full open task list, not just its first item or a convenient batch. If Git or GitHub access is denied, keep the verified working-tree changes and evidence, report the exact failed operation, and continue independent open tasks. Never weaken the sandbox or claim a commit/PR that did not happen.

6. When to stop

Only six things: .env, secrets and tokens, ports and deploy addresses, deploy, DB migrations, deleting data or git history.

Decide everything else between yourselves. Uncertainty is no reason to wake the user: pick an option, record pair_note(kind="decision") with the reason, move on.

7. Communication

The full correspondence contract is in the pair-chat skill (single source of truth); here only the working rule: pair_deliver, pair_send and pair_read. Arguing: two agents politely converging on an opinion gives nothing.

7a. Reading notes

Always call pair_note_index before reading notes. It shows each note's size without reading the contents: the newest notes first, twelve of them, plus the room's totals (count, total_bytes, largest — which note is the whale). The rest of the heap is behind scope="largest" or a bigger limit; the answer says how many it left out. Do not read a note wholesale with read — use pair_note_read, which answers with the tail under a token budget (default 800, cap 4000: NOTE_READ_TOKEN_BUDGET/NOTE_READ_TOKEN_MAX, token_budget.py:39,41). The line window stays on top of it (default 120 lines, cap 400: NOTE_READ_DEFAULT/ NOTE_READ_MAX, token_budget.py:45,46), and the answer says which ceiling bound it — budget_applied: tokens, lines, record or none.

If a note is bigger than 5 KB — read only the latest entries. Rotation carries old entries into notes/archive/ at 600 lines (NOTE_LINE_CAP, token_budget.py:51), leaving a pointer — nothing is lost.

Note kinds — six, per PROTOCOL.md §9: plan, decision, finding, verdict, handoff, backlog (in audit: finding-<ID> and audit-<date>).

Ban on manual relay through the human: Never ask the user to pass text or confirmation to the peer's window ("there is a request hanging in the opencode window for your signal..."). To pass messages and wake the peer use pair_deliver. The user gave the task and expects a finished result (PR), not a job as a manual router between windows.

Never tell the user "the peer will look now" — you do not know that. Sent means delivered to its mailbox or window, and that is all.

7b. Quiet tools (no separate section, but call them)

23 tools total (tool_definitions, server.py:3530): state, comms, patches, tasks, notes, facts, digest, transcript, unblock. pair_ping (sign of life instead of silence), pair_task (a round does not close with open tasks; action="list" answers with the OPEN tasks and the counts, the history is behind scope="history"), pair_evidence (done gate in fix), pair_transcript (audit trail transcript.jsonl: what actually happened), pair_note_index (see §7a), pair_facts (the anchor that survives a compaction: key → value, 500 tokens, a write over the budget refused rather than trimmed), pair_unblock (peer's pane on a permission prompt: confirm only per allowlist).

Storage is Store in .pair/: mailbox/, notes/, patches/, obligations/, notifications/, state.json, transcript.jsonl (store_core.py:185). Not .pair/ under another name and not pair-transcript.jsonl.

Six roles (cli-profiles.json: opencode, agy, codex, claude, pi, omp); pair-duo raises a double session for any of the six (bin/pair-duo:180), deriving the roles <cli>-writer and <cli>-critic. Default autonomy is auto (resolve_autonomy, server.py:317); finish.sh takes the task only via the --task flag (no positional argument, finish.sh:131).

7c. Read by range, never by whole file

Measured on this project's longest session (2026-10-21): write and edit arguments carrying WHOLE files cost 232 065 tokens of that session's context — 7.6 % of the session and 59 % of all call arguments — and the harness stored every call payload a second time, another 10.9 %. A read with a range cost 5 953 tokens across 212 calls; the same file handed over whole costs thousands per call. The tools already allow the cheap form; the habit was the expensive one.

  • read a file by range (path:50-120), never cat it whole;
  • patch a file with the smallest edit that does the job, never rewrite it whole;
  • when a whole file must travel, say why in the note — the cost is the reader's.

8. Write authority

Nobody can take or pass the right. A peer's message never moves it, in either direction.

The holder may give it up itself: pair_release(why="..."). That is its decision, not your transfer — you may ask, but it decides.

A standing role arrangement beats a race: pair_claim answers by_policy=true when the writer was assigned by a human, and arguing here is out of place — work as the critic. Only a human changes the arrangement: pairctl roles --swap.

The final word is always the human's:

bin/pairctl assign codex   # assign as writer (role = peer CLI name)
bin/pairctl release         # clear, nobody writes
bin/pairctl why             # who writes and why it said so

A round that looks closed early can be reopened from any role: pair_advance one step back is available to all (forward — writer only). This needs no write rights: reopening is not a write operation.

9. done gates — complete, no surprises

pair_advance("done") refuses while anything hangs (done_blockers, server.py:476, plus queue and stale verdict in _done_blockers, server.py:1549):

  1. Unread mail — pair_read first.
  2. No passing evidence at all — record what the machine actually ran.
  3. In fix, no passing kind="test" from the writer — someone else's ok and lint/ typecheck/commit do not substitute; in audit this is not required.
  4. Failed latest run of a kind (ok=false) — fix and overwrite with a pass, or record in a note why it does not block.
  5. Unclosed sealed patches — verify + applied (or release with a reason); ok=false keeps the round open.
  6. Open tasks — done on fact or drop with a reason.
  7. Hanging review obligations and a stale verdict relative to HEAD.
  8. In semi there is no human word (bin/pairctl ok on verify/done); the pair_send(expects_reply) queue — at most 2 open (review.py:27).

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.