---
name: rjv-agent-relay
description: "How-to: lead other agent sessions on a long job—split into parts, track them in PLAN.md, write each part's brief, check what comes back, and merge from the lead. Uses rjv-session-link for the thread and start, rjv-delegate for delegation rules, and rjv-code-review for review rounds. Triggers: give another session a task, split across sessions, pass to another session, worker report."
---

# Leading work across agent sessions

Each session runs on its own account or tool with its own usage limit.
The session the user works in leads: it splits the work, writes the
briefs, reviews every result and does all merging, releasing and pushing
to shared branches. A worker does its part, reports, and keeps listening.

Give workers the long, independent parts (sweeps, screen maps, a build
batch in its own worktree). Keep judgment, integration and releases with
the lead.

**The link is `rjv-session-link`**: one thread per worker, the watcher,
and foreground (default) or background start. Read it before opening a
thread. Every hand-out and report below is a thread entry. In a hand-out
entry, name the part, its brief path and how to report; in a report, the
part, the branch head and the result.md path.

Workers are listed in `~/.agents/sessions.json` (local, never committed; see
`rjv-session-link`). Read it for a worker's tool, config folder and launch command.

## Files

One folder per initiative, every path absolute:

```
~/.relay/<project>/<initiative>/
  THREAD.md          the conversation: lead <-> one worker, append-only
  PLAN.md            the ledger: | Part | What | Owner | Status | Folder |
  <part>/brief.md    what the worker must do (brief-2.md for a follow-up round)
  <part>/log.md      the worker's append-only progress log
  <part>/result.md   its report; first line `<Part>: DONE | PARTIAL`
```

A second worker on the same initiative gets its own thread
(`THREAD-<worker>.md`), so each conversation reads in order. A new topic
gets a new initiative folder and its own thread. That is how the lead runs
several sessions at once: one thread each, all watched together.

Update PLAN.md in the same turn a part is handed out, comes back, or is
merged. Never delete these files. Older initiatives may still hold numbered
`to-<worker>/NNN.md` and `to-lead/<worker>-NNN.md` files; read them, but
open a thread instead of writing the next number.

## Writing a brief

The worker knows only the brief and what it reads from disk. Write it the
way `rjv-delegate` §4 says, plus these lines every time:

1. **Read first:** PLAN.md and any shared rules file of the initiative;
   the repo's AGENTS.md if it touches one.
2. **Where it may write:** its part folder and the thread only, unless the
   brief names a branch. Code work goes in ONE worktree and ONE branch per
   worker, never one per part (`git worktree add ../<repo>-<worker>-work
   -b <worker>-work origin/main`). Each part is its own commits with its
   own changeset on that branch, pushed with
   `git push origin HEAD:refs/heads/<worker>-work`. It never commits to
   main or a shared branch; the lead merges the branch whole, posts
   "merged", and the worker fast-forwards to origin/main before the next
   part. The lead deletes merged worktrees and branches.
3. **Read-only repos:** name any repo it must not change.
4. **Standing rules:** never git stash, never `--no-verify`, never
   force-push; its own dev-server port and agent-browser session name,
   killed when done; never ports 3456 or 4173. Say in every brief: load
   `rjv-delegate` (and host mechanism) for model and count.
5. **Done means:** the exact deliverable and its format, and the checks
   that must pass.
6. **Log and result:** append `HH:MM what` to log.md as it goes;
   result.md first line `<Part>: DONE | PARTIAL`, then what it did,
   numbers, open items, branch head if any.
7. **Budget** in minutes, and: "When done, post in the thread that <Part>
   is done, with the branch head and the result.md path."

One part per brief. A worker's part must not touch files the lead, the
lead's agents or another worker are changing at the same time. Hand the
brief out with a thread entry that links it.

PLAN.md here is the relay ledger, not a `rjv-work-plan` `.plans/` file.

Done when the brief carries all seven lines and the hand-out entry is
posted.

## When a result comes back

1. Read result.md and log.md in full. Treat every claim as unchecked.
2. Check what carries the decision yourself: read the diff or the files,
   rerun the checks, open the shots. A worker's own PASS is not the gate
   (`rjv-delegate` §10).
3. Fix small things yourself and say so in the thread. For anything larger
   write `brief-2.md` naming each problem with file:line and what done
   looks like, and post it in the thread.
4. Merge, release and sync from the lead. Mark the part merged in PLAN.md
   and post the outcome in the thread.

Done when PLAN.md shows the part merged or handed back with a brief-2, and
the thread says so.

## What stays with the lead

Plans and the split, reviews, merges to main, releases and publishing,
the lead account's design-system sync, anything needing the user's
decision. A worker does its own account's design-system sync target when
a brief asks for it, since only that account can write that artifact.
