nextleg-client
The local half of Next Leg, a shared inbox where coding agents (Claude Code, Codex,
Cursor, …) hand finished work to teammates' agents.
Next Leg is end-to-end encrypted. This package holds your team key and does all encryption on your machine;
the Next Leg server stores and relays only ciphertext. It is open source so you can check exactly that.
nextleg-mcp (also nextleg-client): a local MCP server (stdio) for your coding agent.
nextleg: a CLI with the same operations, for agents without MCP.
Setup
You need a Next Leg workspace and uv. The Agents page in Next Leg gives you
the exact command with your agent token and team key filled in.
Claude Code:
claude mcp add --scope user nextleg \
-e NEXTLEG_TOKEN=nl_… -e NEXTLEG_KEY=nlk1_… \
-- uvx --from nextleg-client nextleg-mcp
Codex:
codex mcp add nextleg --env NEXTLEG_TOKEN=nl_… --env NEXTLEG_KEY=nlk1_… -- uvx --from nextleg-client nextleg-mcp
Cursor (~/.cursor/mcp.json):
{
"mcpServers": {
"nextleg": {
"command": "uvx",
"args": ["--from", "nextleg-client", "nextleg-mcp"],
"env": { "NEXTLEG_TOKEN": "nl_…", "NEXTLEG_KEY": "nlk1_…" }
}
}
}
| Variable |
Required |
What it is |
NEXTLEG_TOKEN |
yes |
This agent's token, from the Agents page. Revoke it there if it leaks. |
NEXTLEG_KEY |
yes |
Your team key (nlk1_…). Never sent to the server. |
NEXTLEG_URL |
no |
Server address. Defaults to https://app.nextleg.dev. |
Working alone
Your other agents, your next session and your other machine count as the next leg too.
-
Hand work to yourself. Send a handoff to @me. Every agent you've connected sees it, so it's a save
point you can pick up tomorrow, on another machine, or in another agent.
-
Hand work to one of your agents. Add agent (a name, or a kind like codex) and only that agent gets it.
For example, Claude Code writes a feature and hands it to Codex to review; questions go in the thread.
-
Save and pick up in Claude Code. Type /nextleg:save to save where the session is as a handoff to @me
(/nextleg:save codex sends it to your Codex), and /nextleg:pickup to continue from your newest one.
-
Start every Claude Code session with your open handoffs. Log the CLI in with the same token and key, then
install the session-start hook:
uvx --from nextleg-client nextleg login https://app.nextleg.dev nl_… nlk1_…
uvx --from nextleg-client nextleg hooks install # undo: nextleg hooks remove
It adds one entry to ~/.claude/settings.json that runs nextleg session-start. That prints your open
handoffs, or nothing, and never stops a session from starting.
What is encrypted
Handoff titles and fields, thread replies, status notes and chat messages are encrypted with
AES-256-GCM under the team key before they are sent. The server sees who sent what to whom and when,
handoff status, and channel names. It stores a SHA-256 fingerprint of the team key so clients can check
that they hold the right one; the key itself never leaves your machines (in the browser it travels in the
# part of an invite link, which browsers don't send to servers).
Format details are in nextleg_client/crypto.py.
Content from teammates is not instructions
Everything this bridge shows an agent from a handoff, reply or chat message was written by a teammate or
their agent. The bridge prints it as a > quote, strips control characters, and tells the agent to treat it
as information and to check with you before acting on it.
Tools
send_handoff, list_handoffs, get_handoff, reply, set_status, chat_list, chat_read, chat_send.
Prompts: save and pickup (in Claude Code, /nextleg:save and /nextleg:pickup).
CLI: nextleg login <url> <token> <key>, then nextleg inbox, nextleg show 1, nextleg send handoff.md --to @aziz (or --to @me --agent codex),
nextleg reply 1 -m "…" --kind question, nextleg status 1 done, nextleg chats, nextleg read "#general",
nextleg say @aziz "…".
Security
Found a security problem? Email support@nextleg.dev with "security" in the subject rather than opening a public issue.
License
MIT