Expand description
The subagent a tool call runs for, so its ballot binds its own session
rather than its parent’s. Claude Code hands a hook the subagent’s
agent_id and the call’s tool_use_id, but gives the command it runs
no variable that names the agent. The hook leaves the call under the
runtime directory, and the ljos the command runs, or the MCP server
the call reaches, takes it back once. A shell call stays behind as
taken until it expires, so the same line run again inside the call
binds the session its first run bound and is refused as cast.
A shell call is kept with the hook’s ancestors, and only a process that
runs under the nearest of them still alive takes it: the harness that
ran the hook runs the command too. The files are not signed. Anything
running as the same user can still write one naming a live ancestor of
a later ljos; the check stops a record left by hand, or by a process
in another tree, from naming a session.
Structs§
- Taken
- The call a hook saw run this process’s
ljosline, as this process took it.
Functions§
- claim_
command - The agent of the
ljosline this process runs, when a hook saw it undersession. The newest call whose line is this argv is taken, so no other process takes it too and a parent’s call is never answered by an older one its subagent left. An empty agent is the parent’s. - claim_
mcp_ call - The session and subagent of a Claude Code MCP call, by the tool use id
its
_metacarries, when its hook saw a subagent make it. Taken once. - claim_
recent_ mcp_ session - The session of a recent MCP hook call when
_metacarried no id ortoolUseId, taken once when only one conversation’s hook call is waiting in the last [MCP_CALL_TTL_MS]. - claim_
unsessioned_ command - The session and agent of the
ljosline this process runs, when this process names no session of its own: a seat whose runner stamps no id in the shell. The hook saw the line under its session, so every session’s calls are read, and the newest whose line is this argv is taken once. An empty agent is the parent’s. - is_
seat_ mcp_ tool - Whether
toolis one of the seat’s MCP tools,mcp__SERVER__ljos_NAME, andSERVERis a key whose command is the seat’s own MCP server. The name shape alone is not enough. An unknown or unreadable config is not a match. - mcp_
prefixed_ tool mcp__SERVER__NAME, split on the last__soSERVERmay contain__.Nonewhen the name is not that shape.- note_
hook_ call - Leave what a hook payload says about its tool call. On
PreToolUse, eachljosline of a shell call is kept for the process that runs it, and a subagent’smcp__SERVER__ljos_NAMEcall is kept for the server whether or notSERVERis a configured key. OnPostToolUsewhat the call did not take is dropped. The payload’s agent is this hook process’s own. Returns whether the call is aPreToolUseon a confirmed seat server: the server judges that call, so the hook has nothing more to say. - payload_
names_ mcp_ tool - An MCP tool call. Shell-only checks, such as a missing working directory, do not apply to it.
- peek_
recent_ mcp_ session claim_recent_mcp_sessionwithout taking the record, for a caller that only wants to know whether the record names it.- runs_
as_ ljos - Whether this process is the
ljoscommand line, rather than the MCP server or a test. - taken_
harness - The harness of the call this process took, once it has looked for one.