11# Commander Claude - API Reference
22
3- You are Commander Claude. You can control the Agent Workspace by calling these API endpoints via curl.
3+ You are Commander ( Claude or Codex) . You can control the Claude Orchestrator by calling these HTTP APIs via ` curl ` .
44
5- ** Base URL:** ` http://localhost:4000 `
5+ Runtime connection info (desktop builds pick a free port each launch):
6+ - Host: ` ORCHESTRATOR_HOST ` (default ` 127.0.0.1 ` )
7+ - Port: ` ORCHESTRATOR_PORT ` (default ` 9460 ` for ` npm start ` )
8+ - Auth: if ` AUTH_TOKEN ` is set, every request must include ` -H "X-Auth-Token: $AUTH_TOKEN" ` (or ` ?token=$AUTH_TOKEN ` )
9+
10+ ** Base URL:** ` http://${ORCHESTRATOR_HOST:-127.0.0.1}:${ORCHESTRATOR_PORT:-9460} `
11+
12+ Optional helper (bash):
13+ ``` bash
14+ BASE_URL=" http://${ORCHESTRATOR_HOST:- 127.0.0.1} :${ORCHESTRATOR_PORT:- 9460} "
15+ # If AUTH_TOKEN is set, add: -H "X-Auth-Token: $AUTH_TOKEN"
16+ ```
617
718---
819
@@ -13,75 +24,86 @@ The Command Registry provides semantic, self-documenting commands. **This is the
1324### Discover Available Commands
1425``` bash
1526# See all available commands with descriptions and examples
16- curl -s http://localhost:4000/ api/commander/capabilities | jq
27+ curl -sS " $BASE_URL / api/commander/capabilities" -H " X-Auth-Token: $AUTH_TOKEN " | jq
1728```
1829
1930### Get Live Context (Recommended)
2031``` bash
2132# See current UI/session context (selected queue item, sessions, workspace, etc.)
22- curl -s http://localhost:4000/ api/commander/context | jq
33+ curl -sS " $BASE_URL / api/commander/context" -H " X-Auth-Token: $AUTH_TOKEN " | jq
2334```
2435
2536### Get Runtime Help Prompt (Self-Updating)
2637``` bash
2738# Plain-text prompt generated from the command registry + current context
28- curl -s http://localhost:4000/ api/commander/prompt
39+ curl -sS " $BASE_URL / api/commander/prompt" -H " X-Auth-Token: $AUTH_TOKEN "
2940```
3041
3142### Execute Commands
3243``` bash
3344# General syntax
34- curl -s http://localhost:4000/api/commander/execute \
45+ curl -sS " $BASE_URL /api/commander/execute" \
46+ -H " X-Auth-Token: $AUTH_TOKEN " \
3547 -H " Content-Type: application/json" \
3648 -d ' {"command": "COMMAND_NAME", "params": {...}}'
3749
3850# Focus on a terminal
39- curl -s http://localhost:4000/api/commander/execute \
51+ curl -sS " $BASE_URL /api/commander/execute" \
52+ -H " X-Auth-Token: $AUTH_TOKEN " \
4053 -H " Content-Type: application/json" \
4154 -d ' {"command": "focus-session", "params": {"sessionId": "work1-claude"}}'
4255
4356# Switch workspace
44- curl -s http://localhost:4000/api/commander/execute \
57+ curl -sS " $BASE_URL /api/commander/execute" \
58+ -H " X-Auth-Token: $AUTH_TOKEN " \
4559 -H " Content-Type: application/json" \
4660 -d ' {"command": "switch-workspace", "params": {"name": "Epic Survivors"}}'
4761
4862# Open Commander panel
49- curl -s http://localhost:4000/api/commander/execute \
63+ curl -sS " $BASE_URL /api/commander/execute" \
64+ -H " X-Auth-Token: $AUTH_TOKEN " \
5065 -H " Content-Type: application/json" \
5166 -d ' {"command": "open-commander"}'
5267
5368# Open New Project wizard
54- curl -s http://localhost:4000/api/commander/execute \
69+ curl -sS " $BASE_URL /api/commander/execute" \
70+ -H " X-Auth-Token: $AUTH_TOKEN " \
5571 -H " Content-Type: application/json" \
5672 -d ' {"command": "open-new-project"}'
5773
5874# Start Claude in a session
59- curl -s http://localhost:4000/api/commander/execute \
75+ curl -sS " $BASE_URL /api/commander/execute" \
76+ -H " X-Auth-Token: $AUTH_TOKEN " \
6077 -H " Content-Type: application/json" \
6178 -d ' {"command": "start-claude", "params": {"sessionId": "work1-claude"}}'
6279
6380# Run a shell command
64- curl -s http://localhost:4000/api/commander/execute \
81+ curl -sS " $BASE_URL /api/commander/execute" \
82+ -H " X-Auth-Token: $AUTH_TOKEN " \
6583 -H " Content-Type: application/json" \
6684 -d ' {"command": "run-command", "params": {"sessionId": "work1-server", "command": "npm test"}}'
6785
6886# Broadcast to multiple sessions
69- curl -s http://localhost:4000/api/commander/execute \
87+ curl -sS " $BASE_URL /api/commander/execute" \
88+ -H " X-Auth-Token: $AUTH_TOKEN " \
7089 -H " Content-Type: application/json" \
7190 -d ' {"command": "broadcast", "params": {"sessionIds": ["work1-claude", "work2-claude"], "input": "git pull\n"}}'
7291
7392# Highlight a worktree in sidebar
74- curl -s http://localhost:4000/api/commander/execute \
93+ curl -sS " $BASE_URL /api/commander/execute" \
94+ -H " X-Auth-Token: $AUTH_TOKEN " \
7595 -H " Content-Type: application/json" \
7696 -d ' {"command": "highlight-worktree", "params": {"worktreeId": "work1"}}'
7797
7898# Focus a worktree (show ONLY that worktree's terminals, hide others)
79- curl -s http://localhost:4000/api/commander/execute \
99+ curl -sS " $BASE_URL /api/commander/execute" \
100+ -H " X-Auth-Token: $AUTH_TOKEN " \
80101 -H " Content-Type: application/json" \
81102 -d ' {"command": "focus-worktree", "params": {"worktreeId": "work1"}}'
82103
83104# Show all worktrees again (unfocus)
84- curl -s http://localhost:4000/api/commander/execute \
105+ curl -sS " $BASE_URL /api/commander/execute" \
106+ -H " X-Auth-Token: $AUTH_TOKEN " \
85107 -H " Content-Type: application/json" \
86108 -d ' {"command": "show-all-worktrees"}'
87109```
@@ -100,10 +122,11 @@ curl -s http://localhost:4000/api/commander/execute \
100122
101123``` bash
102124# View all active sessions
103- curl -s http://localhost:4000/ api/commander/sessions | jq
125+ curl -sS " $BASE_URL / api/commander/sessions" -H " X-Auth-Token: $AUTH_TOKEN " | jq
104126
105127# Send input to a specific session
106- curl -s http://localhost:4000/api/commander/send-to-session \
128+ curl -sS " $BASE_URL /api/commander/send-to-session" \
129+ -H " X-Auth-Token: $AUTH_TOKEN " \
107130 -H " Content-Type: application/json" \
108131 -d ' {"sessionId": "zoo-game-work1-claude", "input": "git status\n"}'
109132```
@@ -112,18 +135,20 @@ curl -s http://localhost:4000/api/commander/send-to-session \
112135
113136``` bash
114137# List all workspaces
115- curl -s http://localhost:4000/ api/workspaces | jq
138+ curl -sS " $BASE_URL / api/workspaces" -H " X-Auth-Token: $AUTH_TOKEN " | jq
116139
117140# Scan for available repos
118- curl -s http://localhost:4000/ api/workspaces/scan-repos | jq
141+ curl -sS " $BASE_URL / api/workspaces/scan-repos" -H " X-Auth-Token: $AUTH_TOKEN " | jq
119142
120143# Create a new worktree
121- curl -s http://localhost:4000/api/workspaces/create-worktree \
144+ curl -sS " $BASE_URL /api/workspaces/create-worktree" \
145+ -H " X-Auth-Token: $AUTH_TOKEN " \
122146 -H " Content-Type: application/json" \
123147 -d ' {"repoPath": "~/GitHub/games/monogame/zoo-game", "branchName": "feature/new-work"}'
124148
125149# Remove a worktree
126- curl -s http://localhost:4000/api/workspaces/remove-worktree \
150+ curl -sS " $BASE_URL /api/workspaces/remove-worktree" \
151+ -H " X-Auth-Token: $AUTH_TOKEN " \
127152 -H " Content-Type: application/json" \
128153 -d ' {"worktreePath": "~/GitHub/games/monogame/zoo-game/work5"}'
129154```
@@ -132,10 +157,11 @@ curl -s http://localhost:4000/api/workspaces/remove-worktree \
132157
133158``` bash
134159# Get available project templates
135- curl -s http://localhost:4000/ api/greenfield/templates | jq
160+ curl -sS " $BASE_URL / api/greenfield/templates" -H " X-Auth-Token: $AUTH_TOKEN " | jq
136161
137162# Create new project
138- curl -s http://localhost:4000/api/greenfield/create \
163+ curl -sS " $BASE_URL /api/greenfield/create" \
164+ -H " X-Auth-Token: $AUTH_TOKEN " \
139165 -H " Content-Type: application/json" \
140166 -d ' {"name": "my-project", "path": "~/GitHub", "template": "empty"}'
141167```
@@ -144,43 +170,44 @@ curl -s http://localhost:4000/api/greenfield/create \
144170
145171``` bash
146172# Check git status across worktrees
147- curl -s http://localhost:4000/ api/git/status | jq
173+ curl -sS " $BASE_URL / api/git/status" -H " X-Auth-Token: $AUTH_TOKEN " | jq
148174
149175# Check for updates
150- curl -s http://localhost:4000/ api/git/check-updates | jq
176+ curl -sS " $BASE_URL / api/git/check-updates" -H " X-Auth-Token: $AUTH_TOKEN " | jq
151177
152178# Pull updates
153- curl -s http://localhost:4000/ api/git/pull -X POST
179+ curl -sS " $BASE_URL / api/git/pull" -H " X-Auth-Token: $AUTH_TOKEN " -X POST
154180```
155181
156182## Quick Links & Favorites
157183
158184``` bash
159185# Get quick links and favorites
160- curl -s http://localhost:4000/ api/quick-links | jq
186+ curl -sS " $BASE_URL / api/quick-links" -H " X-Auth-Token: $AUTH_TOKEN " | jq
161187
162188# Get recent sessions
163- curl -s http://localhost:4000/ api/quick-links/recent-sessions | jq
189+ curl -sS " $BASE_URL / api/quick-links/recent-sessions" -H " X-Auth-Token: $AUTH_TOKEN " | jq
164190```
165191
166192## Continuity (Session Memory)
167193
168194``` bash
169195# Get continuity ledger for current workspace
170- curl -s http://localhost:4000/ api/continuity/ledger | jq
196+ curl -sS " $BASE_URL / api/continuity/ledger" -H " X-Auth-Token: $AUTH_TOKEN " | jq
171197
172198# Get workspace continuity info
173- curl -s http://localhost:4000/ api/continuity/workspace | jq
199+ curl -sS " $BASE_URL / api/continuity/workspace" -H " X-Auth-Token: $AUTH_TOKEN " | jq
174200```
175201
176202## User Settings
177203
178204``` bash
179205# Get all user settings
180- curl -s http://localhost:4000/ api/user-settings | jq
206+ curl -sS " $BASE_URL / api/user-settings" -H " X-Auth-Token: $AUTH_TOKEN " | jq
181207
182208# Update global settings
183- curl -s http://localhost:4000/api/user-settings/global \
209+ curl -sS " $BASE_URL /api/user-settings/global" \
210+ -H " X-Auth-Token: $AUTH_TOKEN " \
184211 -X PUT -H " Content-Type: application/json" \
185212 -d ' {"theme": "dark", "notifications": true}'
186213```
@@ -189,7 +216,7 @@ curl -s http://localhost:4000/api/user-settings/global \
189216
190217``` bash
191218# Get all port assignments
192- curl -s http://localhost:4000/ api/ports | jq
219+ curl -sS " $BASE_URL / api/ports" -H " X-Auth-Token: $AUTH_TOKEN " | jq
193220```
194221
195222## Direct File System Access
@@ -211,14 +238,15 @@ git -C ~/GitHub/games/monogame/zoo-game worktree list
211238
212239### Broadcast message to all Claude sessions
213240``` bash
214- for sid in $( curl -s http://localhost:4000/api/commander/sessions | jq -r ' .sessions[] | select(.id | contains("claude")) | .id' ) ; do
215- curl -s http://localhost:4000/api/commander/send-to-session \
241+ for sid in $( curl -sS " $BASE_URL /api/commander/sessions" -H " X-Auth-Token: $AUTH_TOKEN " | jq -r ' .sessions[] | select(.id | contains("claude")) | .id' ) ; do
242+ curl -sS " $BASE_URL /api/commander/send-to-session" \
243+ -H " X-Auth-Token: $AUTH_TOKEN " \
216244 -H " Content-Type: application/json" \
217245 -d " {\" sessionId\" : \" $sid \" , \" input\" : \" # Message from Commander\n\" }"
218246done
219247```
220248
221249### Check what each session is working on
222250``` bash
223- curl -s http://localhost:4000/ api/commander/sessions | jq ' .sessions[] | {id, status, branch}'
251+ curl -sS " $BASE_URL / api/commander/sessions" -H " X-Auth-Token: $AUTH_TOKEN " | jq ' .sessions[] | {id, status, branch}'
224252```
0 commit comments