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 tunnel | Changes per session |
|---|---|
| Handle and address | The cable (model and machine) |
| Persona and voice | The lease and its epoch |
| Wired channel accounts | The 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:
{
"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:
| HTTP | reason | Meaning |
|---|---|---|
| 409 | cable_superseded | Another cable holds the lease now |
| 409 | lease_required | This cable holds no lease; call line_attach |
| 409 | lease_released | This 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:
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_handoverwithtextappends an entry to the work log of your cable.line_releasewithhandovergives 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.