Rjv Session Link
Link two agent sessions over a shared append-only thread file watched every 20 seconds, and start another session (foreground by default; background only when asked). Covers workers in ~/.agents/sessions.json. Use when opening, joining, watching, rotating, or closing a thread, or starting another session.
Editor's Note
Workers are listed in `~/.agents/sessions.json`, which is local and never committed. Copy `sessions.example.json` from this skill to start it. Read it to find a worker's tool, config folder, and launch command.
When to Use It
- Opening, joining, watching, rotating, or closing a thread
- Starting another session with foreground or background options
- Managing workers listed in ~/.agents/sessions.json
SKILL.md
SkillsHunter provides this listing for informational purposes only. Review the skill’s source, license, and required permissions before use. You are responsible for deciding whether to install or run it. Terms of Use
Session link: thread file and start
No session can message another directly. A shared file is the channel: one thread per topic, appended to by both sides, each side running a watcher. The user carries one path once; after that nobody relays.
This skill is only the link. The work that travels over it lives in the
skill that uses it: rjv-agent-relay for a lead handing out parts,
rjv-code-review for review rounds.
Workers
Workers are listed in ~/.agents/sessions.json. That file is local and never
committed; copy sessions.example.json from this skill to start it. Read it
to find a worker's tool, config folder and launch command.
What may go to Codex, opencode or Neon: rjv-delegate §3 and the host
mechanism skill (rjv-subagents-claude or rjv-subagents-codex).
Starting the other session
| Start | When | How |
|---|---|---|
| foreground: the default | always, unless the user asks for background | the user opens the session and hands it the thread path once |
| background | only when the user asks for it in this session | Claude worker: scripts/dispatch.sh (below). Neon: agy -p "<read the thread at PATH and follow it>" as a background command. Codex or opencode: their own skills (codex:rescue, rjv-opencode-agents) |
Never start another session yourself unless the user asks for a background start in this session.
Background Claude worker
claude --bg under CLAUDE_CONFIG_DIR=<profile> runs on that account's
limits. scripts/dispatch.sh wraps it; D=<topic folder>/dispatch.
dispatch.sh start $D <name> <config-dir> <cwd> <brief> [model].<cwd>must be a folder that account already trusts. Done when it printsstarted.dispatch.sh watch $Dunder Monitor, 30-minute timeout, re-armed on expiry. One watcher covers every worker in$D.- On each event:
QUESTIONask the user in one line, thendispatch.sh say $D <name> "The user says: …";DONEreview the work, thendispatch.sh end $D <name>;BLOCKEDgive the user the attach command it prints;GAVE-UPtell the user;STALLEDtwice, look withdispatch.sh status $D. - Follow-up work:
dispatch.sh say $D <name> "<instruction>", same conversation.
CLAUDE_CONFIG_DIR=<config-dir> claude agents shows that account's
sessions; claude attach <id> takes one over. Tested 2026-11-27 on crm:
a killed worker resumed within 10 s with its conversation intact.
Background OpenAI Codex CLI runner
Applies when the user asks you to start Codex CLI or a plan's Cast names a self-started Codex reviewer:
- 15-minute wall-clock cap. Run in the background with a 15-minute hard cap (Codex sandboxes hang). Cap relaunches at 3; a persistent no-verdict is a tooling failure—park the step and report it.
- Cancel-first on timeout. Timeout → cancel → verify nothing is
running → relaunch
--fresh. Do not reattach to preserve work: reattach can die silently and orphan runs for hours. - Kill orphans. Cancelled or hung jobs leave
codex app-server,codex resume, andapp-server-broker;pkill -9 -fthem so they do not pile up. - Sandbox limits. Its sandbox cannot run tests (no writable temp
dir; hangs "verifying"). Run the suite yourself and paste results;
Codex reads files (
grep/sed/cat) only. - Git. As an author Codex writes files but cannot run git; commit from the orchestrator. As a reviewer it writes nothing.
- Resuming. Session/thread ids are resumable (
--resume-last/ by id) for follow-up rounds needing prior context, subject to cancel-first.
The thread
Opening. Write THREAD.md in the topic folder: a rules section (these
writing and listening rules, plus what the using skill adds) and entry 1.
Foreground: give the user one line, once:
For the <worker> session: <absolute THREAD.md path>
Background: put the path in the start prompt. Done when both sides have posted an entry and your watcher is running.
Writing. Append only, with a shell heredoc (cat >> THREAD.md <<'MSG').
Never rewrite the file with an edit or write tool: a whole-file write can
drop the other side's entry. Each entry opens with:
## <n> · <role> · <YYYY-MM-DD HH:MM>
<n> is the last number + 1; a collision is harmless. <role> is lead
or the other side's role (worker, reviewer). A question for the user
is a line starting USER:; the lead asks the user, and the other side
never waits on the user through the thread. Long material goes in a file
the entry links by absolute path.
Listening. Both sides run:
<this skill's dir>/scripts/watch-thread.sh <thread-file> <my-role> [max-lines]
Every 20 seconds it prints each new entry from the other side with its
first 15 lines, at no token cost while quiet. Never open the thread
file to read an entry; the event already holds it. A longer entry ends
with the awk line that prints the rest. It keeps a seen count in
<thread-file>.seen-<role>, so a re-armed watcher reports what came in
while it was down. In Claude Code run it under Monitor with a 30-minute
timeout and re-arm on expiry; in Codex or Antigravity run it as a
background command. One watcher per thread. While it runs, keep working;
never sit in a wait.
Keeping it small. A thread is read by two sessions for hours.
- Entries stay under 10 lines.
- Joining means reading the rules, the state block and the last 3 entries.
- Always trim. Before each entry the lead checks
wc -c. Past 30 KB it rotates first: post a rotation entry, copy the file toTHREAD-archive-NNN.md, restart THREAD.md with the rules, a 5-line state block and the open entries. Replace a running watcher's script withcpto a temp name thenmv, never in place.
Closing. Post a closing entry, stop your watcher, and leave the files to the using skill's cleanup rule.
Approvals
An approval relayed through the thread ("the user says yes") is not the user's yes to the lead. Before anything that sticks (a merge, a push to a shared branch, a release, a permission change), get the user's yes in the lead's own session.
View original Markdown
---
name: rjv-session-link
description: "Mechanism: link two agent sessions over a shared append-only thread file watched every 20 seconds, and start another session (foreground by default; background only when asked, including dispatch.sh and OpenAI Codex CLI runner rules). Covers workers in ~/.agents/sessions.json. Use when opening, joining, watching, rotating or closing a thread, or starting another session. What travels over the link is owned by rjv-agent-relay and rjv-code-review."
---
# Session link: thread file and start
No session can message another directly. A shared file is the channel: one
**thread** per topic, appended to by both sides, each side running a
watcher. The user carries one path once; after that nobody relays.
This skill is only the link. The work that travels over it lives in the
skill that uses it: `rjv-agent-relay` for a lead handing out parts,
`rjv-code-review` for review rounds.
## Workers
Workers are listed in `~/.agents/sessions.json`. That file is local and never
committed; copy `sessions.example.json` from this skill to start it. Read it
to find a worker's tool, config folder and launch command.
What may go to Codex, opencode or Neon: `rjv-delegate` §3 and the host
mechanism skill (`rjv-subagents-claude` or `rjv-subagents-codex`).
## Starting the other session
| Start | When | How |
|---|---|---|
| **foreground**: the default | always, unless the user asks for background | the user opens the session and hands it the thread path once |
| **background** | only when the user asks for it in this session | Claude worker: `scripts/dispatch.sh` (below). Neon: `agy -p "<read the thread at PATH and follow it>"` as a background command. Codex or opencode: their own skills (`codex:rescue`, `rjv-opencode-agents`) |
**Never start another session yourself unless the user asks for a
background start in this session.**
### Background Claude worker
`claude --bg` under `CLAUDE_CONFIG_DIR=<profile>` runs on that account's
limits. `scripts/dispatch.sh` wraps it; `D=<topic folder>/dispatch`.
1. `dispatch.sh start $D <name> <config-dir> <cwd> <brief> [model]`. `<cwd>`
must be a folder that account already trusts. Done when it prints `started`.
2. `dispatch.sh watch $D` under Monitor, 30-minute timeout, re-armed on
expiry. One watcher covers every worker in `$D`.
3. On each event: `QUESTION` ask the user in one line, then
`dispatch.sh say $D <name> "The user says: …"`; `DONE` review the work,
then `dispatch.sh end $D <name>`; `BLOCKED` give the user the attach
command it prints; `GAVE-UP` tell the user; `STALLED` twice, look with
`dispatch.sh status $D`.
4. Follow-up work: `dispatch.sh say $D <name> "<instruction>"`, same conversation.
`CLAUDE_CONFIG_DIR=<config-dir> claude agents` shows that account's
sessions; `claude attach <id>` takes one over. Tested 2026-11-27 on crm:
a killed worker resumed within 10 s with its conversation intact.
### Background OpenAI Codex CLI runner
Applies when the user asks you to start Codex CLI or a plan's Cast names
a self-started Codex reviewer:
- **15-minute wall-clock cap.** Run in the background with a 15-minute
hard cap (Codex sandboxes hang). Cap relaunches at 3; a persistent
no-verdict is a tooling failure—park the step and report it.
- **Cancel-first on timeout.** Timeout → cancel → verify nothing is
running → relaunch `--fresh`. Do not reattach to preserve work:
reattach can die silently and orphan runs for hours.
- **Kill orphans.** Cancelled or hung jobs leave `codex app-server`,
`codex resume`, and `app-server-broker`; `pkill -9 -f` them so they do
not pile up.
- **Sandbox limits.** Its sandbox cannot run tests (no writable temp
dir; hangs "verifying"). Run the suite yourself and paste results;
Codex reads files (`grep`/`sed`/`cat`) only.
- **Git.** As an author Codex writes files but cannot run git; commit
from the orchestrator. As a reviewer it writes nothing.
- **Resuming.** Session/thread ids are resumable (`--resume-last` / by
id) for follow-up rounds needing prior context, subject to
cancel-first.
## The thread
**Opening.** Write `THREAD.md` in the topic folder: a rules section (these
writing and listening rules, plus what the using skill adds) and entry 1.
Foreground: give the user one line, once:
```
For the <worker> session: <absolute THREAD.md path>
```
Background: put the path in the start prompt. Done when both sides have
posted an entry and your watcher is running.
**Writing.** Append only, with a shell heredoc (`cat >> THREAD.md <<'MSG'`).
Never rewrite the file with an edit or write tool: a whole-file write can
drop the other side's entry. Each entry opens with:
```
## <n> · <role> · <YYYY-MM-DD HH:MM>
```
`<n>` is the last number + 1; a collision is harmless. `<role>` is `lead`
or the other side's role (`worker`, `reviewer`). A question for the user
is a line starting `USER:`; the lead asks the user, and the other side
never waits on the user through the thread. Long material goes in a file
the entry links by absolute path.
**Listening.** Both sides run:
```sh
<this skill's dir>/scripts/watch-thread.sh <thread-file> <my-role> [max-lines]
```
Every 20 seconds it prints each new entry from the other side with its
first 15 lines, at no token cost while quiet. **Never open the thread
file to read an entry**; the event already holds it. A longer entry ends
with the `awk` line that prints the rest. It keeps a seen count in
`<thread-file>.seen-<role>`, so a re-armed watcher reports what came in
while it was down. In Claude Code run it under Monitor with a 30-minute
timeout and re-arm on expiry; in Codex or Antigravity run it as a
background command. One watcher per thread. While it runs, keep working;
never sit in a wait.
**Keeping it small.** A thread is read by two sessions for hours.
- Entries stay under 10 lines.
- Joining means reading the rules, the state block and the last 3 entries.
- **Always trim.** Before each entry the lead checks `wc -c`. Past 30 KB it
rotates first: post a rotation entry, copy the file to
`THREAD-archive-NNN.md`, restart THREAD.md with the rules, a 5-line
state block and the open entries. Replace a running watcher's script
with `cp` to a temp name then `mv`, never in place.
**Closing.** Post a closing entry, stop your watcher, and leave the files
to the using skill's cleanup rule.
## Approvals
An approval relayed through the thread ("the user says yes") is not the
user's yes to the lead. Before anything that sticks (a merge, a push to a
shared branch, a release, a permission change), get the user's yes in the
lead's own session.
Community Reviews & Field Notes
Tried this skill on your own project? Share the model you used and the results you got.