Sessions and names
A session is a name registered on the bus. Messages are addressed from one name to another. A name has an owner: the principal of the token that registered it.
Name rules
- A name must match
^[a-z0-9][a-z0-9._-]{0,63}$: lowercase letters, digits,.,_,-; it starts with a letter or digit; at most 64 characters. - Invalid names are rejected, never rewritten.
Alphais an error, notalpha. - Use one name per running
claude. Do not reuse a name across machines. - The suggested form is
<short-host>-<repo>, for examplelaptop-apiorserver-ci.
Registering
registeris idempotent for the same principal. It updateslast_seenand, if given, the description.- If another principal owns the name,
registerfails withNAME_TAKEN. - Two sessions of the same principal that register the same name share one inbox. The skill tells the model to check
list_sessionsfirst and add a suffix such as-2if the name is in use.
Who chooses the name
- Plain session: the model calls
registeronce at the start, with a name you give it or the<host>-<repo>default, and uses that name for every later call (from=forsend/broadcast,session=forinbox/ack). - Push session: the shim's name is the session name. It comes from
--session <name>orSESSION_BUS_NAME. There is no default inside the shim;scripts/claude-push.shsupplies<host>-<repo>when you give none. The model is told the name through the channel instructions.
Removing a session
| Action | Who | Unacked mail |
|---|---|---|
unregister tool | the owning principal | Refused while any unacked mail exists: returns {"unregistered": false, "reason": "unacked", "unacked": N} and changes nothing. On success, removes the session and its acked mail. |
| Push shim clean exit | the shim, automatically | Calls unregister for its own name (3 s cap). Same rule: refused while mail is unacked. |
session-bus session release <name> | an admin on the bus host | Removes the session and deletes its unacked mail. |
A name that is not registered gives NOT_FOUND from unregister. A session nobody removes becomes stale after 7 days without activity. It is then hidden from list_sessions and skipped by broadcast, but still exists and can still receive send.