melkin — ~/lab/relevo.mdx

~/lab/relevo

relevo

Two Claude Code sessions that pass the work to each other

· claude-code · typescript · repo

@melanmostaTikTok

claude plugin marketplace add melandres8/claude-mods
relevo/hooks/register.tsx
const PROMPTS: Record<RelevoRole, string> = {
  planner: [
    '# relevo: planner',
    'Divides el objetivo en pasos pequeños y verificables. NO editas código.',
    'Cuando el plan o el siguiente paso esté listo, termina tu respuesta con un bloque <handoff>…</handoff> para el constructor.',
    'Cuando el objetivo esté cumplido, emite <done>resumen</done>.',
    'Los mensajes que empiezan con "[relevo ronda N · de builder]" son el informe del constructor: revísalo y decide el siguiente paso.',
  ].join('\n'),
  builder: [
    '# relevo: builder',
    'Ejecutas exactamente el paso recibido.',
    'Al terminar, cierra con un <handoff> que traiga qué hiciste, qué archivos tocaste, el resultado de los tests y tus dudas.',
    'Los mensajes que empiezan con "[relevo ronda N · de planner]" son el paso que te manda el planificador.',
  ].join('\n'),
}

Why I built it

I often run two Claude Code sessions side by side: one plans, the other builds. I was the messenger between them. I copied each plan into the builder, then copied each report back into the planner.

relevo removes that step. The planner writes the next step inside a <handoff> block. When its turn ends, relevo sends the block to the builder session.

How the loop works

Each role gets a short prompt, the one in the snippet. The planner splits the goal into small, verifiable steps and does not edit code.

The builder runs exactly the step that it receives. It closes with a <handoff> report: what it did, the files it touched, the test results, and its doubts.

relevo adds a header to each delivery, which the model reads as [relevo ronda 3 · de planner]. Only the planner raises the round. The builder answers with the round that it received.

A band over the prompt shows the state in one line: the role, the peer, the rounds as ▰▰▰▱▱▱▱▱▱▱ 3/10, and whose turn it is.

One session sends a link request, and the other session takes no role on its own. It shows the id of the first session and the command that accepts the request, such as /relevo builder <id-of-A>. The Aceptar button in its panel does the same.

The session that asks for the link creates a random nonce. The acceptance returns it, and every round header carries it. A round counts only when it has the link’s nonce and comes from the other role.

relevo counts only the messages that the relevo of the other session wrote. It drops a look-alike text, such as one that a model sends with SendMessage, and shows a toast. The model never sees that text, and it never sees the nonce either.

How it stops

  • The planner writes <done>…</done> when the goal is met.
  • The rounds reach maxRounds, 10 by default, in either session. relevo pauses and holds the pending <handoff>. /relevo resume sends it and grants another maxRounds rounds.
  • The link is not accepted yet. relevo sends nothing: it holds the <handoff> and pauses until /relevo resume.
  • A send fails or the peer rejects it. relevo shows the reason in a toast and pauses.

relevo also guards against echo loops. It sends only from the end of a model turn, never when a message arrives. It does not resend a <handoff> equal to the last one it received or sent.

Set it up

Pick one way to load the plugin. If you combine the marketplace install with --plugin-dir, the hooks load twice and each handoff goes out twice.

claude plugin marketplace add melandres8/claude-mods
claude plugin install relevo@claude-mods

Both sessions need relevo 0.2.0, because the link protocol changed in that version. The code is in melandres8/claude-mods, under the MIT license.

Open two sessions in the same project and type /relevo in the first one. The panel asks for the role and the other session, and Conectar sends the link request. After the second session accepts, the panel asks for the goal.

Without the panel:

/relevo planner <peer>     # in session A: asks for the link
/relevo builder <id-of-A>  # in session B: accepts it
/relevo goal Add pagination to the /users endpoint with tests

hire.me

Building something like this? I do it for clients. I reply within 48 h.