/role
Set this Claude session's agent-bus role so other sessions can address it (e.g. /role frontend, /role backend, /role tester)
$ npx -y skills add mercurialsolo/claudectl --agent claude-codeHow it fires
How this command gets triggered: by you, by Claude, or both.
- Fires itselfClaude auto-loads it when your prompt matches the work.
- You can call itInvoke it directly when you want it.
- Slash command
/role
Context preview
What this command does when you run it.
Set this Claude session's agent-bus role so other sessions can address it (e.g. /role frontend, /role backend, /role tester)
Command definition
role.mdname: role
description: Set this Claude session's agent-bus role so other sessions can address it (e.g. /role frontend, /role backend, /role tester)
args: "<role-name>"
Set this session's agent-bus role so peers can send it directed messages with `claudectl bus send <role> …`. The binding is **PID-keyed** — it follows this exact Claude Code process, so re-runs in the same project don't get confused by other sessions sharing the cwd.
Common role names: `spec`, `frontend`, `backend`, `data-analyst`, `tester`, `infra`, `reviewer`, `planner`. Pick whatever maps to what this session will actually own.
What to do
1. The user supplied a role name as `{{args}}`. If it's empty, run `claudectl bus role suggest --json --top 3` to fetch transcript-derived candidates and propose them; if even that comes back empty, ask the user what to name the role and stop until they reply.
2. Run:
claudectl bus role bind --self {{args}}The `--self` flag tells the CLI to walk the ancestor process chain, find this Claude Code process, and bind the role to that pid + the current working directory. No need to look up the pid yourself.
3. On success the command prints `bound role <name> -> <cwd> (pid=<pid>)`. Echo that confirmation back to the user.
4. If the command errors with "could not find a Claude Code process in the ancestor chain", the plugin was invoked outside the normal `claude` execution context. Tell the user to try again from inside a Claude session, or pass an explicit pid via `claudectl bus role bind <name> <cwd> --pid <pid>`.
5. If the user wants to verify the binding, suggest `claudectl bus role list` or `claudectl bus whoami --json`.
Why pid-binding
Cwd-only bindings get ambiguous when two Claude sessions run in the same folder (e.g. worktrees, or one session in `/repo` and another in `/repo/sub`). The pid binding picks the specific session you ran `/role` from, so directed messages land where you expect.
See issues #307 (pid binding) and #310 (this slash command).
Read more
name: role description: Set this Claude session's agent-bus role so other sessions can address it (e.g. /role frontend, /role backend, /role tester) args: "<role-name>"
Set this session's agent-bus role so peers can send it directed messages with `claudectl bus send <role> …`. The binding is **PID-keyed** — it follows this exact Claude Code process, so re-runs in the same project don't get confused by other sessions sharing the cwd.
Common role names: `spec`, `frontend`, `backend`, `data-analyst`, `tester`, `infra`, `reviewer`, `planner`. Pick whatever maps to what this session will actually own.
What to do
1. The user supplied a role name as `{{args}}`. If it's empty, run `claudectl bus role suggest --json --top 3` to fetch transcript-derived candidates and propose them; if even that comes back empty, ask the user what to name the role and stop until they reply.
2. Run:
claudectl bus role bind --self {{args}}The `--self` flag tells the CLI to walk the ancestor process chain, find this Claude Code process, and bind the role to that pid + the current working directory. No need to look up the pid yourself.
3. On success the command prints `bound role <name> -> <cwd> (pid=<pid>)`. Echo that confirmation back to the user.
4. If the command errors with "could not find a Claude Code process in the ancestor chain", the plugin was invoked outside the normal `claude` execution context. Tell the user to try again from inside a Claude session, or pass an explicit pid via `claudectl bus role bind <name> <cwd> --pid <pid>`.
5. If the user wants to verify the binding, suggest `claudectl bus role list` or `claudectl bus whoami --json`.
Why pid-binding
Cwd-only bindings get ambiguous when two Claude sessions run in the same folder (e.g. worktrees, or one session in `/repo` and another in `/repo/sub`). The pid binding picks the specific session you ran `/role` from, so directed messages land where you expect.
See issues #307 (pid binding) and #310 (this slash command).
Orchestrate a swarm of Claude Code agents with a local brain that learns from you.
Other commands on claudectl.
- /auto-insights
Show or configure auto-generated insights from the claudectl brain — friction patterns, suggested rules, and workflow improvements
Open command - /brain-stats
Show claudectl brain learning metrics — accuracy, correction rate, and effectiveness
Open command - /brain
Toggle the claudectl brain gate on/off/auto for this session
Open command - /inbox
Drain pending agent-bus messages addressed to this session's role
Open command - /sessions
Show status of all active Claude Code sessions (cost, health, context usage)
Open command - /spend
Show Claude Code spend summary — total cost, per-session breakdown, and burn rate
Open command

