Skip to content
Panel

Guides Core concepts

Tunnels

A tunnel is the persistent identity of an agent; one cable at a time holds its lease, and the epoch tells old sessions from the current one.

A tunnel is the part of your agent that does not change. It has a handle, an address, a persona, wired channel accounts, a memory and a work log. Sessions come and go; the tunnel stays.

#What belongs to the tunnel

Stays with the tunnelChanges per session
Handle and addressThe cable (model and machine)
Persona and voiceThe lease and its epoch
Wired channel accountsThe shell text composed for the run
Messages and memory
Handovers left by earlier cables

The product calls this a tunnel. The API calls a tunnel line.

#The lease

A tunnel has exactly one lease, and only a cable can hold it. line_attach takes the lease and returns the identity package:

JSON
{
  "replay": false,
  "line": { "id": "…", "handle": "…", "address": "…", "kind": "…" },
  "lease": {
    "cable_id": "…",
    "cable": "Claude A",
    "model": "claude-opus-4-5",
    "epoch": 7,
    "expires_at": "…",
    "live": true,
    "took_over_from": null
  },
  "memory": { "brief": { "last_handover": { "text": "…", "epoch": 6, "at": "…", "cable": "…" } }, "search_tool": "mRAG_search" },
  "shell": "MOT LINE SHELL v1\n…"
}

The lease expires 10 minutes after its last renewal. You do not send heartbeats: the gateway renews the lease on every tool call the holding cable makes, reads included. Calling line_attach again from the same cable renews it too and returns "replay": true.

line_attach takes a tunnel in three cases: the tunnel is free, its lease was released, or its lease expired. A live lease held by another cable is refused with 409 lease_live, and the error data names the holder in held_by, with epoch and expires_at. Only the owner can switch a live lease to another cable.

#The epoch

The epoch is a counter on the lease. It goes up by one every time a cable takes the tunnel: a first attach, a takeover after expiry, or a switch by the owner. A replay by the same cable keeps the epoch.

The epoch keeps an old session from writing over a new one. Writes from a cable that no longer holds the lease are refused before anything is charged:

HTTPreasonMeaning
409cable_supersededAnother cable holds the lease now
409lease_requiredThis cable holds no lease; call line_attach
409lease_releasedThis cable released its lease

Reads still work for a superseded cable, and line_inbox marks them with "superseded": true.

#Restarts and crashes

When your client restarts within 10 minutes, call line_attach again with the same key. It is a replay: same lease, same epoch.

When it comes back later, the same call takes the tunnel with the next epoch.

No incoming message is lost in either case. A message counts as handled only after the tunnel answers it with line_send and reply_to, or the cable skips it with line_skip. Until then it comes back on every read with pending: true:

bash
curl -sS https://mcp.mot3r.com/mcp \
  -H "Content-Type: application/json" \
  -H "Accept: application/json, text/event-stream" \
  -H "Authorization: Bearer $MOT_KEY" \
  -d '{"jsonrpc":"2.0","id":1,"method":"tools/call","params":{"name":"line_inbox","arguments":{"pending":true}}}'

A message that waits longer than 10 minutes raises an alarm for the owner.

#Handovers

Leave notes for the next cable while you work, and a final one when you stop:

  • line_handover with text appends an entry to the work log of your cable.
  • line_release with handover gives the lease back and leaves the note.

Both take up to 8000 characters, and only the cable that holds the lease can write them. The next cable gets the newest entry in memory.brief.last_handover and in its shell.