relay
Skill1 starsChanged 17 days agoMITView on GitHub
Bidirectional agent handoff and session resumption engine with ambient continuity. Generates lean, bounded context packets before dispatching subagents, resumes previous sessions with boundary-safe directory matching and unanswered questions leading, and maintains an always-current HANDOFF.md live-state file with a state-source ladder (live file, memory recall, project context, git forensics) probed on every workspace entry so any new conversation or agent continues prior work at lowest token cost — even after abrupt endings, with no explicit handoff requested. Dispatches embed the worktree-lease gate for shared checkouts.
We split this skill into the rules it gives an agent
14 rules. 0 are common, 11 are distinctive, and 3 are very specific to this project.
0
Common
Most of the 19 edited versions we read keep these.
11
Distinctive
This author's own choices. Worth a look.
3
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 46
Every invocation resolves to exactly one mode.
- Distinctive: line 61
Before dispatching any subagent for backend, frontend, testing, or refactoring.
- Distinctive: line 62
Before spawning multi-agent teams or worker processes.
- Distinctive: line 63
Before stepping away from a long-running session (>30 minutes).
- Very specific: line 149
If the prior session ended on an unanswered user question (?), highlight it at the very top of your response.
- Distinctive: line 180
Refresh the live file: update HANDOFF.md to point at the dispatched task so an interrupting conversation still lands correctly.
- Distinctive: line 207
If the user's first message is a fresh instruction, treat the resumption block as silent context: proceed with the instruction, informed by …
- Very specific: line 221
No Direct YAML Mutation: Never read, write, or modify internal .memory/ YAML files directly by hand.
- Very specific: line 237
Raw Prefix Collisions: Never match session directories using raw startsWith(path).
- Distinctive: line 238
Hiding Open Questions: Never bury an unanswered user question under a wall of status logs.
- Distinctive: line 239
Compound Objectives: Never combine multiple decoupled tasks into one outbound packet.
- Distinctive: line 242
Ladder Skipping: Do not run deep analysis before the entry probe.
- Distinctive: line 243
Silent Cold Starts: Never invent prior context when the ladder returns nothing — say "cold start" and move.
- Distinctive: line 244
Ticketing Fog: Never write a ticket against a Not-yet-specified map item — fog graduates to tickets, never starts as one.
“Common” is measured: kept by at least 6 in 10 of the 19 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
🤝 relay — Bidirectional Handoff, Resumption & Ambient Continuity Engine
Aliases:
agent-handoff|subagent-handoff|context-packet|resume|where-were-we
handoff provides context continuity across agent lifecycles in three modes:
- Inbound Resumption: Resumes previous agent sessions with boundary-safe directory matching, leading with any unanswered open questions.
- Outbound Dispatch: Generates lean, bounded context packets before dispatching subagents or stepping away.
- Ambient Continuity (v2.1.0): Passively maintains a live state file and probes for it on every workspace entry, so work continues across conversations, agents, and runtimes — even after abrupt endings and even when no one asked for a handoff.
Modes
Every invocation resolves to exactly one mode. Load only the matched reference:
| Mode | Trigger phrases | Behavior | Reference |
ambient-handoff | "relay ambient-handoff", "ambient-handoff" | Ambient Continuity & Live Handoff File Contract | references/ambient-handoff.md |
resumption-protocol | "relay resumption-protocol", "resumption-protocol" | Inbound Session Resumption & Boundary Protection Protocol | references/resumption-protocol.md |
audit | "relay audit", "audit the handoff", "is this handoff trustworthy" | Certify an inbound or outbound handoff against the verification-over-trust checklist (live-state checks, five-section completeness, spot check, staleness sweep) | references/audit.md |
When to Use
Mode A: Inbound Session Resumption
- User asks: "where were we", "resume", "pick up where I left off", "what was I doing", or begins a session with no fresh prompt.
- Restoring state after an interruption or machine restart.
Mode B: Outbound Subagent Dispatch
- Before dispatching any subagent for backend, frontend, testing, or refactoring.
- Before spawning multi-agent teams or worker processes.
- Before stepping away from a long-running session (>30 minutes).
- Whenever a task prompt to another agent exceeds 3 sentences.
Mode C: Ambient Continuity (Default-On)
- Every workspace entry: probe for prior state before doing anything else.
- Every checkpoint: a milestone completes, a decision is made, a correction lands, a task is abandoned mid-flight.
- End of any working turn with work incomplete: session ending normally, crash imminent, or user walking away — no explicit handoff request required.
- A brand-new conversation opens in a working directory where prior work happened: the agent resumes context automatically instead of starting blind.
Quick Reference
Mode Comparison
| Capability | Inbound Resumption (A) | Outbound Dispatch (B) | Ambient Continuity (C) |
| Trigger | "where were we", "resume" | "dispatch worker", "handoff to subagent" | Workspace entry; checkpoints; incomplete end-of-turn |
| Matching Rule | Strict directory-boundary matching (=== or startsWith(cwd + sep)) | Explicit destination file and line range scope | Current working directory, always |
| First Output | Unanswered user question (if any) | Single 1-sentence actionable objective | ≤5-line resumption block, then first productive action |
| Persistence | Session memory / .agents/artifacts/ | .agents/artifacts/handoff-<timestamp>.md | .agents/artifacts/HANDOFF.md (overwritten, never appended) |
| Closing Token | Concrete atomic next-step pointer | Deterministic verification command | Refreshed live file + optional memory write |
Token Budgets (hard limits)
| Phase | Budget | Rule |
| Entry probe | 1 command | test -f .agents/artifacts/HANDOFF.md — zero analysis before this |
| Resumption output | ≤5 lines | State summary + next step only; no narrative, no history retelling |
| Detail loading | On demand | Full packet, references, and memory recall load only when the 5-line block is insufficient or the user asks |
| Live-file write | ≤30 lines | HANDOFF.md is a pointer, not a journal |
The State-Source Ladder (cold-start continuity)
On workspace entry, resolve prior state by climbing the ladder; stop at the first rung that yields state:
- Live Handoff file —
.agents/artifacts/HANDOFF.mdexists → resume from it directly. - Memory recall — query the runtime's session-memory tool (e.g.
memory_sessions/memory_recall), strictly filtered to this directory boundary. - Project context —
.agents/context/current.mdand.agents/context/index.md(maintained byupdateagentsconventions). - Git forensics — reconstruct from the repository itself (recipe in references/resumption-protocol.md); after reconstructing, write HANDOFF.md immediately so the next agent never digs again.
- Cold start — declare honestly:
No prior session history found for this project directory.Never invent history. Offer theupdateagentsaudit.
The Live Handoff File (.agents/artifacts/HANDOFF.md)
One fixed-name file, ≤30 lines, overwritten on every state change — the bridge from any session to any future conversation:
# HANDOFF — <ISO timestamp>
branch: <branch> | phase: <one-line state>
## Next Step
<Single atomic action: file + what to do>
## In-Flight
- <Unfinished item, if any>
## Ruled Out
- <Approach>: <why it failed — one line>
## Decisions
- <Durable choice made, not to be re-litigated>
## Verify
`<exact command>`
## Open Questions
- <Unanswered user question, if any — leads resumption>Omit empty sections. Full schema and write-trigger contract: references/ambient-handoff.md.
Procedures
🔄 Mode A: Inbound Session Resumption Procedure
- Resolve Workspace Directory: Normalize the current working directory. If a directory override argument is provided, resolve to an absolute path.
- Retrieve Prior Session (via the State-Source Ladder above):
Query session history (memory tools,
.agents/artifacts/,.agents/context/current.md), enforcing directory-boundary isolation:// Prohibit raw prefix matching to prevent sibling repo bleed: session.cwd === projectPath || session.cwd.startsWith(projectPath + path.sep) - Surface Unanswered Questions FIRST:
If the prior session ended on an unanswered user question (
?), highlight it at the very top of your response. Do not guess the answer. - Format Resumption Summary (≤5 lines before the first productive action):
Resuming [session_id] "[session_title]". ❓ Open Question from Last Session: [Unanswered question, if present] 📌 State: [key decisions & modified files · active roadblocks] 👉 Immediate Next Step: [Single concrete atomic action]
📦 Mode B: Outbound Subagent Dispatch Procedure
- Triage + approval gate (source:
obra/superpowers,skills/brainstorming/SKILL.md): map the task to one path — spike (throwaway probe), bounded (fixed scope), or architectural (multi-session design) — announce it aloud, then ratchet one way only (spike → bounded → architectural; never downgrade). On every path, get explicit human approval before ANY code is written or dispatched; a dispatch prompt without that approval is a procedure failure. - Extract Operational Facts:
- Objective: Exact 1-sentence goal starting with an imperative verb.
- Decisions Made: Irreversible choices not to be re-litigated.
- Ruled-Out Paths: Approaches tried and eliminated with failure reasons.
- Target Scope: Exact files to touch.
- Hard Constraints: Forbidden files, libraries, or credentials (
MUST NOT). - Deterministic Verification: Exact test or build command.
- Interfaces (source:
obra/superpowers,skills/writing-plans/SKILL.md): every file in Target Scope gets a consumes/produces line — what it reads, what it returns or changes. Unlisted coupling is out of scope. - No placeholders (same source):
TBD, "appropriate handling", and "etc." fail the packet — every section carries exact paths, verbatim code, or a concrete command. - If Blocked: Escalation fallback.
- Assumptions-first + spec template (source:
addyosmani/agent-skillsspec-driven-development): every packet opens with an assumptions block (each assumption evidence-backed or flagged for the human gate), then fills the 6-area spec template — Objective / Commands / Structure / Style / Testing / 3-tier Boundaries. Human gate per phase: SPECIFY → PLAN → TASKS → IMPLEMENT never advances on an unapproved phase.
- Write Handoff Packet to
.agents/artifacts/handoff-<timestamp>.md(structure in README and worked example in examples/sample-handoff.md). - Lease hand-off to workers (shared checkouts): if the packet's Target Scope includes git mutations (branch switches, stashes, commits to shared surfaces), embed the worktree-lease instruction in the dispatch prompt — the worker probes
.agents/artifacts/WORKTREE-LEASE.mdbefore its first git mutation and inherits or acquires per the lease protocol (coupling-routerStep 0). Never dispatch two workers whose scopes overlap on one checkout. - Echo & Dispatch: Embed the packet directly into the subagent invocation prompt.
- Refresh the live file: update HANDOFF.md to point at the dispatched task so an interrupting conversation still lands correctly.
- Close the loop (#51): when the dispatched task returns and you are authorized, perform the delivery action programmatically via the available tools — commit + PR, merge, or issue/checklist update — rather than only describing it. Update the ticket/checklist to the real resulting state so the loop is closed, not narrated. Only describe-and-defer when the action itself requires a human (approval, merge to protected branch, secrets); leave ONE explicit ready-to-run command for that step.
🧭 Route: multi-mode batching & config (#52)
Before dispatching, map the incoming task to the combination of existing modes/references — not a single one — that should act on it in parallel. Decide per sub-task which of relay's own modes (Resume/Dispatch/Ambient) plus which other skills' references each worker runs, and whether the outputs are independent (parallel) or ordered (sequential pipeline). Record the mapping in the packet's Target Scope so workers never re-derive it.
Optional auto-trigger config: where the runtime supports it, document a project-level config (e.g. .agents/relay-config.yaml) that maps trigger keywords → the resolved mode/reference combination, so the same choreography fires without re-deciding each time. Tool-independent — it's a contract, not a tool. Skip the config unless a project runs the same handoff pattern frequently.
🗺️ Decision map: multi-session handoff artifact
For work spanning sessions, attach a wayfinder map to the timestamped packet (source: mattpocock/skills, skills/wayfinder/SKILL.md via abubakar collection) — five lines, refreshed per session: Destination (one-line goal) · Notes (live context) · Decisions (made, not re-litigated) · Not-yet-specified (fog) · Out-of-scope (never touch). Fog-of-war graduation rule: ticket the sharp edges only (research / prototype / task, each marked HITL vs AFK), leave fog as fog — never ticket what is not yet specified. One ticket per session; refer to decisions by name.
🌊 Mode C: Ambient Continuity Procedure
Write side (passive, silent — no prose, no user interruption):
| Trigger | Action |
| Checkpoint completed (milestone, passing gate, landed change) | Overwrite HANDOFF.md with new Next Step |
| User decision or correction received | Record under Decisions; refresh timestamp |
| End of turn with work incomplete | Overwrite HANDOFF.md (Next Step = exactly what you would do next) |
| Ending signal ("close", "wrap up", session end) | Full flush: HANDOFF.md + timestamped packet if the state is rich + memory hook |
| Task blocked or abandoned | Next Step = escalation path; route the failure to dead-letter |
Read side:
- Workspace entry always probes for HANDOFF.md before any other work. If present and fresh (same branch, plausible timestamp), emit the ≤5-line resumption block and continue — even though nobody said "resume".
- If the user's first message is a fresh instruction, treat the resumption block as silent context: proceed with the instruction, informed by state.
- Lease check on entry (shared checkouts): if
.agents/artifacts/WORKTREE-LEASE.mdexists with a fresh heartbeat, another session is live — the ≤5-line resumption block notes this, and the entry session takes a separate worktree or stays read-only until the lease releases (decision rules:coupling-routerStep 0).
Anti-noise guardrails:
- One file, overwritten — never append, never accumulate.
- Refresh only on real state change (checkpoint, decision, reversal); not on every tool call.
- Silent writes: ambient handoff never narrates itself.
🧠 Muse Memory Dual-Scope Architecture Hooks
Handoff integrates with Muse Memory's dual-scope architecture, without ever touching .memory/** raw files directly — that path is owned exclusively by musememory:
- Global User Truth: On session start or workspace entry, query global identity and user preferences from
~/.memory/USER.mdviaget_context(query=...). - Local Project Constraints: Local project constraints and active in-flight boundaries read and write to
./.memory/andCURRENT.md(or.agents/context/current.md). - No Direct YAML Mutation: Never read, write, or modify internal
.memory/**YAML files directly by hand. Always invoke the MCP tools (memory_capture,search,get_context) or sovereign CLI commands (memory capture,memory search). - On outbound handoff or full flush: Push durable decisions only (not the file dump) through
memory_capture(type="decision"|"constraint"). Ephemeral state stays inHANDOFF.md; durable rules and decisions go to memory. - On workspace entry (ladder rung 2): Memory recall is a lookup, filtered strictly to the current directory boundary.
- When no memory tool exists: Durable findings are reported in the output and recorded in
.agents/context/viaupdateagentsconventions — never written to.memory/by hand.
Neighboring Skill Boundaries
context-anchor→ manual mid-session drift stop within one conversation. Ambienthandoff→ session-boundary continuity across conversations; the live file doubles as a rolling anchor.coupling-router→ owns the shared-worktree lease. Handoff routes to it: dispatches embed the lease instruction (Mode B step 3) and workspace entry respects an active lease (Mode C read side). A session that died holding the lease is exactly the case handoff's ladder reconstructs — check itsnotesfor preserved WIP.dead-letter→ failure-path escape hatch. A blocked task lands in both: HANDOFF.md Next Step (continuity) + dead-letter packet (diagnosis).updateagents→ owns durable.agents/context/truth; ambient handoff reads it (ladder rung 3) and routes durable changes to it rather than editing governed context directly.
Pitfalls
- Raw Prefix Collisions: Never match session directories using raw
startsWith(path); sibling directories like/project-stagingwill falsely match/project. - Hiding Open Questions: Never bury an unanswered user question under a wall of status logs.
- Compound Objectives: Never combine multiple decoupled tasks into one outbound packet.
- Omitted Ruled-Out Paths: Subagents re-explore failed attempts unless explicitly forbidden.
- Journal Bloat: HANDOFF.md is a pointer, not a diary. If it exceeds ~30 lines it has become a session log — prune or demote detail to a timestamped packet.
- Ladder Skipping: Do not run deep analysis before the entry probe; the cheapest rung that yields state wins.
- Silent Cold Starts: Never invent prior context when the ladder returns nothing — say "cold start" and move.
- Ticketing Fog: Never write a ticket against a Not-yet-specified map item — fog graduates to tickets, never starts as one.
Verification
- Inbound resumption surfaces any unanswered question before status text.
- Session matching strictly validates directory boundaries.
- Outbound handoff packet is written to
.agents/artifacts/handoff-<timestamp>.md. - Workspace entry performed the HANDOFF.md probe before other work.
- HANDOFF.md is ≤30 lines, overwritten (not appended), and carries an atomic Next Step.
- Resumption output stayed within the ≤5-line budget before the first productive action.
- Memory integration used the runtime's tool API (or reported the durable fact) —
.memory/**never touched by hand. - All 7 outbound packet sections are populated with zero placeholder text.
- Mode B dispatch announced its triage path (spike / bounded / architectural) and carried explicit human approval before any code.
- Outbound packet carries an Interfaces consumes/produces block covering every file in scope.
- Outbound packet opens with an assumptions block and fills the 6-area spec template; no phase advanced without human approval.
- Multi-session work attached a decision map; fog items carry no tickets.
- In shared checkouts, dispatched workers carry the worktree-lease instruction, and entry respected any active lease before mutating.
References
- 🔄 Inbound Resumption & Boundary Protection Protocol
- 🌊 Ambient Continuity & Live Handoff File Contract
- 📄 Sample Handoff Packet
- 📄 Sample Live Handoff File
Other versions24 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 24
- jmfederico/pi-web★ 918same name
- sonichi/sutando★ 396same name
- gavishap/omnia-vault★ 53same name
- jaskirat1616/grok-skills★ 22same name
- bekhruztbx/ai-creative-team★ 18same name
- mhlaghari/stuntman★ 16same name
- gao-xh/multi-agent-protocol★ 4same name
- kurofune/claudit★ 4same name
- RelayMessenger/Relay-SDK★ 4same name
- theyoungastronauts/polaris★ 4same name
14 more not listed
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository49 other files it gives its agents.
- AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- .github/copilot-instructions.mdCopilot instructions
- llms.txtllms.txt
- accountsSkill
- analyticsSkill
- automationSkill
- brandSkill
- client-commsSkill
- contentSkill
- crmSkill
- databaseSkill
- designSkill
- devopsSkill
- growthSkill
- gtmSkill
- incident-responseSkill
- mobileSkill
- opsSkill
- paidadsSkill
- qa-launchSkill
- researchSkill
- retainSkill
- sales-enablementSkill
- seoSkill
- smmSkill
- telegramSkill
- webdevSkill
- context-anchorSkill
- coupling-routerSkill
- evidence-ledgerSkill
- secretarySkill
- gitSkill
- new-projectSkill
- updateagentsSkill
- updatedocsSkill
- animateSkill
- designscopeSkill
- refactorSkill
- auditSkill
- code-reviewSkill
- dead-letterSkill
- gauntlet-loopSkill
- humanizeSkill
- muse-securitySkill
- puaSkill
- clean-system-cacheSkill
- coachSkill
- periodic-retreatSkill
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
Reviews can't be read right now.
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.

