Skip to content
Automation
Command

/role

Set this Claude session's agent-bus role so other sessions can address it (e.g. /role frontend, /role backend, /role tester)

From plugin
claudectl
2047 skills1 agent7 commands1 MCP
> /plugin marketplace add mercurialsolo/claudectl
> /plugin install claudectl@claudectl

Command definition

role.md
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).

Read more
@mercurialsolo
Ships withclaudectl

Hive compute for coding agent swarms - expand your personal compute by adding on-demand agentic swarms

2042 skills1 agent1 MCP
Get the whole plugin

Stars on GitHub

Momentum

stars in total
204
Star history of mercurialsolo/claudectl on GitHub, a chart by star-history.com

Other commands on claudectl.

auto-insights

auto-insights

Command

Show or configure auto-generated insights from the claudectl brain — friction patterns, suggested rules, and workflow improvements

More commands from other plugins.

plan

plan

Command

Plan n8n Linear ticket implementation

n8n2w209k
@n8n-io@n8n-ioInstall Command
setup

setup

Command

One-time setup after installing ARIS as a Claude Code plugin — registers the Codex reviewer MCP server from the plugin directory…

aris2w18k
@wanshuiyin@wanshuiyinInstall Command
agent
Auto-invoked

agent

Command

name: sc:agent description: SC Agent — session controller that orchestrates investigation, implementation, and review category:…

@galaxy-dawn@galaxy-dawnInstall Command