paired-session
Skill3 starsChanged 7 months agoApache-2.0View on GitHub
Drive an implementation through the paired-session coordinator: independent PLAN review, EXEC implementation/review, adversarial gate, then finish, quality polish, docs and security up to operator acceptance. Trigger in exactly three cases: (1) the user explicitly asks for paired-session or names this explicit coordinator entry; (2) the review-loop entry hands off because .review-loop/config.md sets `entry: paired-session`; (3) the review-loop entry hands off because that key is absent (the default entry). Do not trigger on a bare review-loop request in any other case (key invalid, `legacy`, or /review-loop:legacy).
In this repository14 other files it gives its agents.
- CLAUDE.mdCLAUDE.md
- executeSkill
- guideSkill
- paired-sessionSkill
- planSkill
- review-loopSkill
- code-quality-loopSkill
- executeSkill
- guideSkill
- legacySkill
- planSkill
- reorganizeSkill
- review-loopSkill
- review-prSkill
The file
We split this skill into the rules it gives an agent
7 rules. About 0 are common, 1 is distinctive, and 6 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈1
Distinctive · estimate
This author's own choices. Worth a look.
6
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 30
After exit 0, read the complete output file in bounded chunks and follow it.
- Very specific: line 33
After compaction, reload it the same way when no coordinator command is running.
- Very specific: line 42
Run directory: create a UUID.
- Very specific: line 49
Create the run directory (mkdir -p), then write WORKITEM.md there.
- Very specific: line 52
If either step fails or is denied, stop: that is a failed stage A check, reported as stage A failure: <reason>.
- Distinctive: line 64
Never run such a command in a foreground Bash call or extend the foreground timeout.
- Very specific: line 84
Default (efficient): one Bash call with the run block below.
≈ “Common” is an estimate: at least 1 in 5 of the 213,897 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.
Files
Paired-session workflow (Claude Code)
First, before any stage A check or question, read docs/protocol/loading.md
and load the shared entry contract (docs/protocol/paired-session-entry.md) as
its own Bash command, cwd in the user's workspace. The bundle must stay out of
the product worktree (FIELD-18): first print a fresh bundle directory with its
own Bash call,
python3 -c 'import os, tempfile, uuid; print(os.path.join(os.path.realpath(tempfile.gettempdir()), f"review-loop-protocol-{os.getuid()}", uuid.uuid4().hex[:12]))',
then write that printed directory out literally as <bundle-dir>:
python3 ${CLAUDE_PLUGIN_ROOT}/scripts/read_protocol.py --runtime claude --stage entry-paired-session --output <bundle-dir>/protocol-claude-entry-paired-session.mdAfter exit 0, read the complete output file in bounded chunks and follow it; a
missing, unreadable or incompletely read file is a failed stage A check,
reported as stage A failure: cannot load the shared entry contract (<reason>).
After compaction, reload it the same way when no coordinator command is
running; while one is running, read
${CLAUDE_PLUGIN_ROOT}/docs/protocol/paired-session-entry.md directly (the
stage is that whole file), which writes nothing to the workspace. This file
adds only the Claude Code host rules:
- Legacy pointer:
use /review-loop:legacy. Long-command execution failure: unavailable background execution (a failed stage A check; on the explicit entry, HOLD with the reason). - Run directory: create a UUID; the run directory is
${XDG_STATE_HOME:-$HOME/.local/state}/review-loop/runs/<UUID>/, outside the product worktree and outside~/.claude(Claude Code treats paths there as sensitive and denies or prompts for every write). Resolve the run root once with its own Bash call,printf '%s\n' "${XDG_STATE_HOME:-$HOME/.local/state}/review-loop", and use the absolute path it prints (if it is not absolute, use$HOME/.local/state/review-loop: XDG ignores a relativeXDG_STATE_HOME). Create the run directory (mkdir -p), then writeWORKITEM.mdthere. The root is outside the session's working directory, so a restricted permission mode may need the operator to grant it (for example--add-dir <run root>). If either step fails or is denied, stop: that is a failed stage A check, reported asstage A failure: <reason>; never try another location. ResolveWORKSPACEto the intended worktree root andWORKITEM/RUN_DIRto absolute paths. Claude Code substitutes${CLAUDE_PLUGIN_ROOT}in skill content. Define path variables anew in each Bash tool call; shell variables do not persist across separate calls. Pass arguments as an array. Write any launcher log under the run root'slogs/(.../review-loop/logs/), never underruns/. - Long-command form: run every command that can dispatch model turns
(
permission-probe,run,resume,reject --expect) as its own Bash call withrun_in_background: true; wait for the background task completion notification and inspect its final result. Use a shell-output polling tool only if the host exposes one; do not assume a tool namedBashOutputexists. Never run such a command in a foreground Bash call or extend the foreground timeout; long model turns exceed tool limits and can orphan a child CLI. The backstop stops the background command. - Headless sessions: a
claude -psession exits when its turn ends and kills its background tasks, so ending the turn to wait for the notification kills the coordinator mid-turn. Use an interactive session. When you know you run headless (the user or the prompt says so), prefer--detachonrun,resume,reject --expectandpermission-probe: the command returns at once (DETACHED: pid …; log …) and survives the session's exit; readRUN_DIR/state.jsonorstatus --brieffor its progress, the log for its final line (a probe's result isRUN_DIR/permission-probe.json), and end it only withstop(paired_session/docs/detach.md). Without--detach, do not end the turn while a coordinator command runs: poll in bounded foreground calls, reading onlystatusandactive.phasefromRUN_DIR/state.json(orstatus --brief), until the background command itself has exited (the host's task-output tool if it has one; otherwisepgrep -f -- "--run-di[r] <RUN_DIR>"prints nothing; the bracket keeps pgrep from matching its own shell), then inspect its final result as above. Recover a run cut off this way by the shared contract's uncertain-turn rule: check the turn's pid and phase, and ask the user before any--retry-uncertain. - Default (efficient): one Bash call with the
runblock below. Strict: the probe block first, then therunblock as a second Bash call.
Strict only, first Bash call (run_in_background: true):
WORKSPACE='/absolute/path/to/worktree'
WORKITEM='/absolute/run/root/runs/<UUID>/WORKITEM.md'
RUN_DIR='/absolute/run/root/runs/<UUID>'
TEST_COMMAND='the verified project command'
"${CLAUDE_PLUGIN_ROOT}/bin/paired-session" permission-probe \
--workspace "$WORKSPACE" --workitem "$WORKITEM" --run-dir "$RUN_DIR" \
--test-command "$TEST_COMMAND" --lifecycle-mode onrun (run_in_background: true):
WORKSPACE='/absolute/path/to/worktree'
WORKITEM='/absolute/run/root/runs/<UUID>/WORKITEM.md'
RUN_DIR='/absolute/run/root/runs/<UUID>'
TEST_COMMAND='the verified project command'
"${CLAUDE_PLUGIN_ROOT}/bin/paired-session" run \
--workspace "$WORKSPACE" --workitem "$WORKITEM" --run-dir "$RUN_DIR" \
--test-command "$TEST_COMMAND" --lifecycle-mode onA review-only request (--review-only, or the review-loop handoff of code already implemented)
follows the shared contract's review-only entry: add --review-only (and --base "$BASE"
only when the user named a base) to both blocks.
This skill is the explicit paired-session entry and the review-loop handoff target only when the config
key entry is paired-session or absent and the work is fresh or a review-only code target; with legacy
or an invalid value, routing stays legacy.
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
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.

