@enderfga/claw-orchestrator 3.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +218 -0
- package/assets/banner.jpg +0 -0
- package/configs/council-reviewer-prompt.md +82 -0
- package/configs/council-system-prompt.md +141 -0
- package/dist/bin/cli.d.ts +13 -0
- package/dist/bin/cli.js +460 -0
- package/dist/bin/cli.js.map +1 -0
- package/dist/src/base-oneshot-session.d.ts +87 -0
- package/dist/src/base-oneshot-session.js +228 -0
- package/dist/src/base-oneshot-session.js.map +1 -0
- package/dist/src/circuit-breaker.d.ts +21 -0
- package/dist/src/circuit-breaker.js +49 -0
- package/dist/src/circuit-breaker.js.map +1 -0
- package/dist/src/consensus.d.ts +20 -0
- package/dist/src/consensus.js +52 -0
- package/dist/src/consensus.js.map +1 -0
- package/dist/src/constants.d.ts +129 -0
- package/dist/src/constants.js +138 -0
- package/dist/src/constants.js.map +1 -0
- package/dist/src/council.d.ts +67 -0
- package/dist/src/council.js +914 -0
- package/dist/src/council.js.map +1 -0
- package/dist/src/embedded-server.d.ts +25 -0
- package/dist/src/embedded-server.js +360 -0
- package/dist/src/embedded-server.js.map +1 -0
- package/dist/src/inbox-manager.d.ts +38 -0
- package/dist/src/inbox-manager.js +111 -0
- package/dist/src/inbox-manager.js.map +1 -0
- package/dist/src/index.d.ts +63 -0
- package/dist/src/index.js +973 -0
- package/dist/src/index.js.map +1 -0
- package/dist/src/logger.d.ts +16 -0
- package/dist/src/logger.js +44 -0
- package/dist/src/logger.js.map +1 -0
- package/dist/src/models.d.ts +69 -0
- package/dist/src/models.js +299 -0
- package/dist/src/models.js.map +1 -0
- package/dist/src/openai-compat.d.ts +224 -0
- package/dist/src/openai-compat.js +756 -0
- package/dist/src/openai-compat.js.map +1 -0
- package/dist/src/persistent-codex-app-session.d.ts +108 -0
- package/dist/src/persistent-codex-app-session.js +465 -0
- package/dist/src/persistent-codex-app-session.js.map +1 -0
- package/dist/src/persistent-codex-session.d.ts +37 -0
- package/dist/src/persistent-codex-session.js +208 -0
- package/dist/src/persistent-codex-session.js.map +1 -0
- package/dist/src/persistent-cursor-session.d.ts +21 -0
- package/dist/src/persistent-cursor-session.js +241 -0
- package/dist/src/persistent-cursor-session.js.map +1 -0
- package/dist/src/persistent-custom-session.d.ts +78 -0
- package/dist/src/persistent-custom-session.js +938 -0
- package/dist/src/persistent-custom-session.js.map +1 -0
- package/dist/src/persistent-gemini-session.d.ts +21 -0
- package/dist/src/persistent-gemini-session.js +216 -0
- package/dist/src/persistent-gemini-session.js.map +1 -0
- package/dist/src/persistent-session.d.ts +80 -0
- package/dist/src/persistent-session.js +745 -0
- package/dist/src/persistent-session.js.map +1 -0
- package/dist/src/proxy/anthropic-adapter.d.ts +136 -0
- package/dist/src/proxy/anthropic-adapter.js +392 -0
- package/dist/src/proxy/anthropic-adapter.js.map +1 -0
- package/dist/src/proxy/handler.d.ts +39 -0
- package/dist/src/proxy/handler.js +365 -0
- package/dist/src/proxy/handler.js.map +1 -0
- package/dist/src/proxy/schema-cleaner.d.ts +11 -0
- package/dist/src/proxy/schema-cleaner.js +34 -0
- package/dist/src/proxy/schema-cleaner.js.map +1 -0
- package/dist/src/proxy/thought-cache.d.ts +19 -0
- package/dist/src/proxy/thought-cache.js +53 -0
- package/dist/src/proxy/thought-cache.js.map +1 -0
- package/dist/src/session-manager.d.ts +317 -0
- package/dist/src/session-manager.js +1528 -0
- package/dist/src/session-manager.js.map +1 -0
- package/dist/src/types.d.ts +513 -0
- package/dist/src/types.js +8 -0
- package/dist/src/types.js.map +1 -0
- package/dist/src/validation.d.ts +31 -0
- package/dist/src/validation.js +104 -0
- package/dist/src/validation.js.map +1 -0
- package/openclaw.plugin.json +122 -0
- package/package.json +84 -0
- package/skills/SKILL.md +184 -0
- package/skills/references/claude-cli-tracking.md +25 -0
- package/skills/references/cli.md +187 -0
- package/skills/references/council.md +210 -0
- package/skills/references/getting-started.md +133 -0
- package/skills/references/inbox.md +81 -0
- package/skills/references/multi-engine.md +382 -0
- package/skills/references/openai-compat.md +203 -0
- package/skills/references/sessions.md +191 -0
- package/skills/references/tools.md +418 -0
- package/skills/references/ultra.md +126 -0
|
@@ -0,0 +1,191 @@
|
|
|
1
|
+
# Sessions
|
|
2
|
+
|
|
3
|
+
Sessions are the core abstraction — persistent, multi-turn coding conversations backed by a CLI subprocess.
|
|
4
|
+
|
|
5
|
+
## Lifecycle
|
|
6
|
+
|
|
7
|
+
```
|
|
8
|
+
start() → send() → send() → ... → stop()
|
|
9
|
+
↑ |
|
|
10
|
+
└── resume (7-day TTL) ────┘
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
### Starting a Session
|
|
14
|
+
|
|
15
|
+
```typescript
|
|
16
|
+
const info = await manager.startSession({
|
|
17
|
+
name: 'my-task',
|
|
18
|
+
cwd: '/path/to/project',
|
|
19
|
+
model: 'opus', // alias or full name
|
|
20
|
+
permissionMode: 'acceptEdits',
|
|
21
|
+
effort: 'high',
|
|
22
|
+
allowedTools: ['Bash', 'Read', 'Edit', 'Write'],
|
|
23
|
+
maxTurns: 50,
|
|
24
|
+
maxBudgetUsd: 5.0,
|
|
25
|
+
});
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
Key options:
|
|
29
|
+
|
|
30
|
+
| Option | Description |
|
|
31
|
+
|--------|-------------|
|
|
32
|
+
| `engine` | `'claude'` (default), `'codex'`, or `'gemini'` — see [Multi-Engine](./multi-engine.md) |
|
|
33
|
+
| `model` | Model alias (`opus`, `sonnet`, `haiku`, `gemini-pro`) or full name |
|
|
34
|
+
| `permissionMode` | `acceptEdits`, `bypassPermissions`, `plan`, `auto`, `default` |
|
|
35
|
+
| `effort` | `low`, `medium`, `high`, `max`, `auto` |
|
|
36
|
+
| `bare` | Skip hooks, LSP, auto-memory, CLAUDE.md |
|
|
37
|
+
| `worktree` | Run in isolated git worktree |
|
|
38
|
+
| `appendSystemPrompt` | Append custom instructions to the system prompt |
|
|
39
|
+
|
|
40
|
+
### Sending Messages
|
|
41
|
+
|
|
42
|
+
```typescript
|
|
43
|
+
const result = await manager.sendMessage('my-task', 'Fix the auth bug', {
|
|
44
|
+
effort: 'high', // override effort for this message
|
|
45
|
+
plan: true, // enter plan mode
|
|
46
|
+
timeout: 600_000, // 10 min timeout
|
|
47
|
+
onChunk: (text) => process.stdout.write(text), // streaming
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
console.log(result.output);
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
### Session Persistence
|
|
54
|
+
|
|
55
|
+
Sessions automatically persist to `~/.openclaw/claude-sessions.json`:
|
|
56
|
+
|
|
57
|
+
- **Memory TTL**: configurable (default 120 min) — idle sessions unloaded
|
|
58
|
+
- **Disk TTL**: 7 days — sessions can be resumed after gateway restart
|
|
59
|
+
- **Auto-resume**: `startSession` with the same name auto-resumes if a persisted session exists
|
|
60
|
+
|
|
61
|
+
### Session Resume & Fork
|
|
62
|
+
|
|
63
|
+
```typescript
|
|
64
|
+
// Resume a specific Claude Code session
|
|
65
|
+
await manager.startSession({
|
|
66
|
+
name: 'continued',
|
|
67
|
+
resumeSessionId: 'abc123-session-id',
|
|
68
|
+
});
|
|
69
|
+
|
|
70
|
+
// Fork for experiments (preserves history, new branch)
|
|
71
|
+
await manager.startSession({
|
|
72
|
+
name: 'experiment',
|
|
73
|
+
resumeSessionId: 'abc123',
|
|
74
|
+
forkSession: true,
|
|
75
|
+
});
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
## Runtime Operations
|
|
79
|
+
|
|
80
|
+
### Model Switching
|
|
81
|
+
|
|
82
|
+
Switch models mid-conversation. The session restarts with `--resume` to preserve history:
|
|
83
|
+
|
|
84
|
+
```typescript
|
|
85
|
+
await manager.switchModel('my-task', 'haiku'); // fast model for simple tasks
|
|
86
|
+
await manager.switchModel('my-task', 'opus'); // back to powerful model
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
### Tool Management
|
|
90
|
+
|
|
91
|
+
Add/remove tool permissions at runtime:
|
|
92
|
+
|
|
93
|
+
```typescript
|
|
94
|
+
await manager.updateTools('my-task', {
|
|
95
|
+
allowedTools: ['Bash', 'Read'],
|
|
96
|
+
merge: true, // add to existing list
|
|
97
|
+
});
|
|
98
|
+
|
|
99
|
+
await manager.updateTools('my-task', {
|
|
100
|
+
removeTools: ['Bash'], // revoke Bash access
|
|
101
|
+
});
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
### Context Management
|
|
105
|
+
|
|
106
|
+
```typescript
|
|
107
|
+
// Compact to reclaim context window
|
|
108
|
+
await manager.compactSession('my-task', 'We fixed the auth bug, now working on tests');
|
|
109
|
+
|
|
110
|
+
// Check context usage
|
|
111
|
+
const status = manager.getStatus('my-task');
|
|
112
|
+
console.log(`Context: ${status.stats.contextPercent}%`);
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
### Cost Tracking
|
|
116
|
+
|
|
117
|
+
```typescript
|
|
118
|
+
const cost = manager.getCost('my-task');
|
|
119
|
+
console.log(`Model: ${cost.model}`);
|
|
120
|
+
console.log(`Input: $${cost.breakdown.inputCost.toFixed(4)}`);
|
|
121
|
+
console.log(`Output: $${cost.breakdown.outputCost.toFixed(4)}`);
|
|
122
|
+
console.log(`Total: $${cost.totalUsd.toFixed(4)}`);
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
## Multi-Model Proxy
|
|
126
|
+
|
|
127
|
+
Built-in format translation lets Claude Code CLI talk to non-Anthropic models:
|
|
128
|
+
|
|
129
|
+
- **Anthropic ↔ OpenAI** bidirectional message/tool conversion
|
|
130
|
+
- **Streaming SSE** format conversion
|
|
131
|
+
- **Gemini** schema cleaning (removes unsupported JSON Schema keys)
|
|
132
|
+
- **Gemini** thought signature caching (round-trip thinking)
|
|
133
|
+
- Auto-detect provider from model name patterns
|
|
134
|
+
|
|
135
|
+
See `src/proxy/` for implementation details.
|
|
136
|
+
|
|
137
|
+
## Circuit Breaker
|
|
138
|
+
|
|
139
|
+
SessionManager tracks consecutive failures per engine type. After 3 consecutive start failures for an engine, a circuit breaker opens with exponential backoff (1s × 2^(n-1), capped at 5 minutes). During backoff, new session creation for that engine is rejected with a descriptive error.
|
|
140
|
+
|
|
141
|
+
- Resets on successful session start
|
|
142
|
+
- State visible in `health()` response under `circuitBreakers`
|
|
143
|
+
- Constants: `CIRCUIT_BREAKER_THRESHOLD` (3), `CIRCUIT_BREAKER_BACKOFF_BASE_MS` (1s), `CIRCUIT_BREAKER_MAX_BACKOFF_MS` (5 min)
|
|
144
|
+
|
|
145
|
+
## Orphaned Process Cleanup
|
|
146
|
+
|
|
147
|
+
If the plugin crashes without calling `stop()`, child CLI processes (claude, codex, gemini, agent) may become orphans. SessionManager tracks PIDs in `~/.openclaw/session-pids.json` and cleans up stale processes on startup:
|
|
148
|
+
|
|
149
|
+
1. Reads PID file from previous run
|
|
150
|
+
2. For each PID, checks if process is alive (`kill -0`)
|
|
151
|
+
3. Verifies the process command line matches a known CLI binary (prevents killing recycled PIDs)
|
|
152
|
+
4. Sends SIGTERM, then SIGKILL after 3 seconds
|
|
153
|
+
5. Clears the PID file
|
|
154
|
+
|
|
155
|
+
## Stats & Monitoring
|
|
156
|
+
|
|
157
|
+
Session stats are returned by `getStats()` and surfaced through `claude_session_status`.
|
|
158
|
+
|
|
159
|
+
Fields added in plugin v2.13.0 (Claude CLI 2.1.111):
|
|
160
|
+
|
|
161
|
+
| Field | Type | Description |
|
|
162
|
+
|-------|------|-------------|
|
|
163
|
+
| `retries` | number | Total API retries that occurred during the session |
|
|
164
|
+
| `lastRetryError` | string \| undefined | Error message from the most recent retry (if any) |
|
|
165
|
+
|
|
166
|
+
Fields added in plugin v2.14.0 (Claude CLI 2.1.121):
|
|
167
|
+
|
|
168
|
+
| Field | Type | Description |
|
|
169
|
+
|-------|------|-------------|
|
|
170
|
+
| `pluginErrors` | `Array<{plugin, reason}>` \| undefined | Plugins that failed to load due to unmet dependencies, captured from the `system/init` event. `undefined` when no plugin errors occurred. |
|
|
171
|
+
|
|
172
|
+
### `system/api_retry` events
|
|
173
|
+
|
|
174
|
+
When Claude Code CLI performs an API retry (transient errors, overload, etc.) it emits a `system` event with subtype `api_retry`. The plugin parses these events and increments `retries` / updates `lastRetryError` in the session stats. These events are also visible in the session event history returned by `claude_session_grep`.
|
|
175
|
+
|
|
176
|
+
```typescript
|
|
177
|
+
const status = manager.getStatus('my-task');
|
|
178
|
+
console.log(`Retries so far: ${status.stats.retries}`);
|
|
179
|
+
if (status.stats.lastRetryError) {
|
|
180
|
+
console.log(`Last retry reason: ${status.stats.lastRetryError}`);
|
|
181
|
+
}
|
|
182
|
+
```
|
|
183
|
+
|
|
184
|
+
## ISession.pid
|
|
185
|
+
|
|
186
|
+
All session engine classes expose an optional `pid` readonly property, providing the OS process ID of the underlying CLI subprocess. Returns `undefined` when no process is running.
|
|
187
|
+
|
|
188
|
+
```typescript
|
|
189
|
+
const session = manager.getSession('my-session');
|
|
190
|
+
console.log(session.pid); // e.g., 12345 or undefined
|
|
191
|
+
```
|
|
@@ -0,0 +1,418 @@
|
|
|
1
|
+
# Tools Reference
|
|
2
|
+
|
|
3
|
+
All tools are registered as Claw Orchestrator plugin tools. In standalone mode, they're accessible via the embedded HTTP server.
|
|
4
|
+
|
|
5
|
+
> **v3.0 rename:** Tools previously prefixed with `claude_` are now engine-neutral. The old names (`session_start`, `session_send`, `session_stop`, `session_list`, `sessions_overview`, `session_status`, `session_grep`, `session_compact`, `agents_list`, `team_list`, `team_send`, `session_update_tools`, `session_switch_model`, `project_purge`, `session_send_to`, `session_inbox`, `session_deliver_inbox`) remain registered as deprecated aliases through the v3.0.x line and will be removed in v3.1. New code should use the canonical names below. The `codex_*`, `council_*`, `ultraplan_*`, `ultrareview_*` tool names are unchanged.
|
|
6
|
+
|
|
7
|
+
## Session Lifecycle (5)
|
|
8
|
+
|
|
9
|
+
### `session_start`
|
|
10
|
+
|
|
11
|
+
Start a persistent coding session with full CLI flag support.
|
|
12
|
+
|
|
13
|
+
| Parameter | Type | Description |
|
|
14
|
+
|-----------|------|-------------|
|
|
15
|
+
| `name` | string | Session name (auto-generated if omitted) |
|
|
16
|
+
| `cwd` | string | Working directory |
|
|
17
|
+
| `engine` | `'claude'` \| `'codex'` \| `'gemini'` \| `'cursor'` \| `'custom'` | Engine to use (default: `claude`). Use `custom` with `customEngine` for any CLI. |
|
|
18
|
+
| `model` | string | Model alias or full name |
|
|
19
|
+
| `permissionMode` | string | `acceptEdits`, `bypassPermissions`, `plan`, `auto`, `default` |
|
|
20
|
+
| `effort` | string | `low`, `medium`, `high`, `max`, `auto` |
|
|
21
|
+
| `allowedTools` | string[] | Tools to auto-approve |
|
|
22
|
+
| `disallowedTools` | string[] | Tools to deny |
|
|
23
|
+
| `maxTurns` | number | Max agent loop turns |
|
|
24
|
+
| `maxBudgetUsd` | number | Max API spend (USD) |
|
|
25
|
+
| `systemPrompt` | string | Replace system prompt |
|
|
26
|
+
| `appendSystemPrompt` | string | Append to system prompt |
|
|
27
|
+
| `agents` | object | Custom sub-agents JSON |
|
|
28
|
+
| `agent` | string | Default agent to use |
|
|
29
|
+
| `bare` | boolean | Skip hooks, LSP, auto-memory, CLAUDE.md |
|
|
30
|
+
| `worktree` | string \| boolean | Run in git worktree |
|
|
31
|
+
| `fallbackModel` | string | Fallback when primary overloaded |
|
|
32
|
+
| `resumeSessionId` | string | Resume existing session by ID |
|
|
33
|
+
| `jsonSchema` | string | JSON Schema for structured output |
|
|
34
|
+
| `mcpConfig` | string \| string[] | MCP server config file(s) |
|
|
35
|
+
| `settings` | string | Settings.json path or inline JSON |
|
|
36
|
+
| `noSessionPersistence` | boolean | Do not save session to disk |
|
|
37
|
+
| `betas` | string \| string[] | Custom beta headers |
|
|
38
|
+
| `enableAgentTeams` | boolean | Enable experimental agent teams |
|
|
39
|
+
| `enableAutoMode` | boolean | Enable auto permission mode |
|
|
40
|
+
| `customEngine` | object | Custom engine config (required when `engine='custom'`). See [Multi-Engine: Custom Engine](./multi-engine.md#custom-engine-enginecustom). |
|
|
41
|
+
| `includeHookEvents` | boolean | Stream hook lifecycle events (PreToolUse/PostToolUse) as `system` events |
|
|
42
|
+
| `permissionPromptTool` | string | MCP tool name to delegate permission prompts to (non-interactive use) |
|
|
43
|
+
| `excludeDynamicSystemPromptSections` | boolean | Move cwd/env/git context from system prompt to user message for better prompt cache hits; auto-enabled with `bare: true` |
|
|
44
|
+
| `enablePromptCaching1H` | boolean | Enable 1-hour prompt cache TTL (vs default 5-min); auto-enabled with `bare: true` |
|
|
45
|
+
| `debug` | string | Debug categories to enable (comma-separated, e.g. `"api,mcp"`) |
|
|
46
|
+
| `debugFile` | string | File path to write debug output to |
|
|
47
|
+
| `fromPr` | string \| number | Resume a session linked to a GitHub PR number or URL |
|
|
48
|
+
| `channels` | string \| string[] | MCP channel subscription spec (research preview) |
|
|
49
|
+
| `dangerouslyLoadDevelopmentChannels` | string \| string[] | Development MCP channel subscriptions (research preview) |
|
|
50
|
+
| `forkSubagent` | boolean | Fork subagent for non-interactive sessions (sets `CLAUDE_CODE_FORK_SUBAGENT=1`) |
|
|
51
|
+
| `enableToolSearch` | boolean | Enable Vertex AI tool search (sets `ENABLE_TOOL_SEARCH=1`) |
|
|
52
|
+
| `otelLogUserPrompts` | boolean | OpenTelemetry: log user prompts (sets `OTEL_LOG_USER_PROMPTS=1`) |
|
|
53
|
+
| `otelLogRawApiBodies` | boolean | OpenTelemetry: log raw API request/response bodies (sets `OTEL_LOG_RAW_API_BODIES=1`); debug only |
|
|
54
|
+
| `bedrockServiceTier` | `'default'` \| `'flex'` \| `'priority'` | AWS Bedrock service tier (sets `ANTHROPIC_BEDROCK_SERVICE_TIER`); only effective when routing through Bedrock |
|
|
55
|
+
| `effort` | `'low'` \| `'medium'` \| `'high'` \| `'xhigh'` \| `'max'` \| `'auto'` | Reasoning effort level. `xhigh` is Opus 4.7-only (between `high` and `max`); triggers `ultrathink` prefix on user messages, same as `high` and `max`. |
|
|
56
|
+
|
|
57
|
+
### `session_send`
|
|
58
|
+
|
|
59
|
+
Send a message and get the response.
|
|
60
|
+
|
|
61
|
+
| Parameter | Type | Required | Description |
|
|
62
|
+
|-----------|------|----------|-------------|
|
|
63
|
+
| `name` | string | yes | Session name |
|
|
64
|
+
| `message` | string | yes | Message to send |
|
|
65
|
+
| `effort` | string | | Override effort for this message |
|
|
66
|
+
| `plan` | boolean | | Enable plan mode |
|
|
67
|
+
| `timeout` | number | | Timeout in ms (default 300000) |
|
|
68
|
+
| `stream` | boolean | | Collect streaming chunks in result |
|
|
69
|
+
|
|
70
|
+
### `session_stop`
|
|
71
|
+
|
|
72
|
+
Graceful shutdown (SIGTERM, then SIGKILL after 3s).
|
|
73
|
+
|
|
74
|
+
| Parameter | Type | Required |
|
|
75
|
+
|-----------|------|----------|
|
|
76
|
+
| `name` | string | yes |
|
|
77
|
+
|
|
78
|
+
### `session_list`
|
|
79
|
+
|
|
80
|
+
List all active and persisted sessions. No parameters.
|
|
81
|
+
|
|
82
|
+
### `sessions_overview`
|
|
83
|
+
|
|
84
|
+
Dashboard view: all sessions with ready/busy/paused state, cost, context %, last activity. No parameters.
|
|
85
|
+
|
|
86
|
+
---
|
|
87
|
+
|
|
88
|
+
## Session Operations (5)
|
|
89
|
+
|
|
90
|
+
### `session_status`
|
|
91
|
+
|
|
92
|
+
Detailed status: tokens, cost, context %, tool calls, uptime.
|
|
93
|
+
|
|
94
|
+
| Parameter | Type | Required |
|
|
95
|
+
|-----------|------|----------|
|
|
96
|
+
| `name` | string | yes |
|
|
97
|
+
|
|
98
|
+
**Returned stats fields** (selected):
|
|
99
|
+
|
|
100
|
+
| Field | Type | Description |
|
|
101
|
+
|-------|------|-------------|
|
|
102
|
+
| `retries` | number | Number of API retries that occurred during this session |
|
|
103
|
+
| `lastRetryError` | string \| undefined | Error message from the most recent retry (if any) |
|
|
104
|
+
|
|
105
|
+
### `session_grep`
|
|
106
|
+
|
|
107
|
+
Regex search over session event history.
|
|
108
|
+
|
|
109
|
+
| Parameter | Type | Required | Description |
|
|
110
|
+
|-----------|------|----------|-------------|
|
|
111
|
+
| `name` | string | yes | Session name |
|
|
112
|
+
| `pattern` | string | yes | Regex pattern |
|
|
113
|
+
| `limit` | number | | Max results (default 50) |
|
|
114
|
+
|
|
115
|
+
### `session_compact`
|
|
116
|
+
|
|
117
|
+
Reclaim context window via `/compact`.
|
|
118
|
+
|
|
119
|
+
| Parameter | Type | Required |
|
|
120
|
+
|-----------|------|----------|
|
|
121
|
+
| `name` | string | yes |
|
|
122
|
+
| `summary` | string | |
|
|
123
|
+
|
|
124
|
+
### `session_update_tools`
|
|
125
|
+
|
|
126
|
+
Update tool permissions at runtime. Restarts session with `--resume`.
|
|
127
|
+
|
|
128
|
+
| Parameter | Type | Description |
|
|
129
|
+
|-----------|------|-------------|
|
|
130
|
+
| `name` | string | Session name |
|
|
131
|
+
| `allowedTools` | string[] | New allowed tools (replaces or merges) |
|
|
132
|
+
| `disallowedTools` | string[] | New disallowed tools |
|
|
133
|
+
| `removeTools` | string[] | Tools to remove from lists |
|
|
134
|
+
| `merge` | boolean | Merge with existing (default: replace) |
|
|
135
|
+
|
|
136
|
+
### `session_switch_model`
|
|
137
|
+
|
|
138
|
+
Hot-swap model mid-conversation. Restarts with `--resume`.
|
|
139
|
+
|
|
140
|
+
| Parameter | Type | Required |
|
|
141
|
+
|-----------|------|----------|
|
|
142
|
+
| `name` | string | yes |
|
|
143
|
+
| `model` | string | yes |
|
|
144
|
+
|
|
145
|
+
---
|
|
146
|
+
|
|
147
|
+
## Project State (1)
|
|
148
|
+
|
|
149
|
+
### `project_purge`
|
|
150
|
+
|
|
151
|
+
Wraps `claude project purge` (CLI 2.1.126+). Deletes Claude Code state for a project — transcripts, tasks, file history, config entry. **Defaults to dry-run for safety**; pass `dry_run=false` to actually delete. The CLI's confirmation prompt is bypassed by default (`--yes`) since the wrapper has no TTY; safety is enforced upstream via the dry-run default.
|
|
152
|
+
|
|
153
|
+
| Parameter | Type | Required | Description |
|
|
154
|
+
|-----------|------|----------|-------------|
|
|
155
|
+
| `path` | string | | Project path to purge. Resolved to absolute. Ignored when `all=true`. |
|
|
156
|
+
| `all` | boolean | | Purge state for every project. Mutually exclusive with `path`. |
|
|
157
|
+
| `dry_run` | boolean | | List what would be deleted without deleting. **Defaults to `true`.** |
|
|
158
|
+
|
|
159
|
+
Returns `{ ok, stdout, stderr, dryRun }`.
|
|
160
|
+
|
|
161
|
+
---
|
|
162
|
+
|
|
163
|
+
## Codex (7)
|
|
164
|
+
|
|
165
|
+
Tools targeting OpenAI's `codex` CLI. The `codex_resume` and `codex_review` tools are one-shot wrappers and work without a managed session. The `codex_goal_*` tools require a session started with `engine: "codex-app"` (see [multi-engine.md](./multi-engine.md)) — the legacy `engine: "codex"` (which uses `codex exec`) has no slash-command surface.
|
|
166
|
+
|
|
167
|
+
### `codex_resume`
|
|
168
|
+
|
|
169
|
+
Resume a previously recorded Codex thread by UUID/name, or pick the most recent with `last=true`. Spawns `codex exec resume` with `--json` and parses the JSONL output into structured fields. Independent of session manager state.
|
|
170
|
+
|
|
171
|
+
| Parameter | Type | Required | Description |
|
|
172
|
+
|-----------|------|----------|-------------|
|
|
173
|
+
| `session_id` | string | | Codex thread UUID/name. Mutually exclusive with `last`. |
|
|
174
|
+
| `last` | boolean | | Resume the most recent recorded session. |
|
|
175
|
+
| `message` | string | yes | Prompt to send after resuming. |
|
|
176
|
+
| `cwd` | string | | Working directory. |
|
|
177
|
+
| `model` | string | | Override model. |
|
|
178
|
+
| `timeout` | number | | Timeout in ms (default 300000). |
|
|
179
|
+
|
|
180
|
+
> Note: `codex exec resume` does not accept `--sandbox` or `-C` (sandbox policy and cwd are inherited from the original session). The `cwd` parameter only sets the spawn's working directory so `--last`'s session-picker scopes correctly.
|
|
181
|
+
|
|
182
|
+
Returns `{ ok, text, threadId?, usage?, events }`.
|
|
183
|
+
|
|
184
|
+
### `codex_review`
|
|
185
|
+
|
|
186
|
+
Run a non-interactive Codex code review (`codex review`). Pick exactly one diff scope.
|
|
187
|
+
|
|
188
|
+
| Parameter | Type | Description |
|
|
189
|
+
|-----------|------|-------------|
|
|
190
|
+
| `prompt` | string | Custom review instructions. |
|
|
191
|
+
| `cwd` | string | Repository to review. |
|
|
192
|
+
| `uncommitted` | boolean | Review staged + unstaged + untracked. |
|
|
193
|
+
| `base` | string | Review changes against this base branch. |
|
|
194
|
+
| `commit` | string | Review changes introduced by this commit SHA. |
|
|
195
|
+
| `title` | string | Optional commit title shown in review summary. |
|
|
196
|
+
| `model` | string | Override model. |
|
|
197
|
+
| `timeout` | number | Timeout in ms (default 600000). |
|
|
198
|
+
|
|
199
|
+
Returns `{ ok, stdout, stderr }`.
|
|
200
|
+
|
|
201
|
+
### `codex_goal_set`
|
|
202
|
+
|
|
203
|
+
Set a long-horizon objective. Sends `/goal <objective>` via the app-server. **Requires `engine: "codex-app"`.**
|
|
204
|
+
|
|
205
|
+
| Parameter | Type | Required |
|
|
206
|
+
|-----------|------|----------|
|
|
207
|
+
| `name` | string | yes |
|
|
208
|
+
| `objective` | string | yes |
|
|
209
|
+
| `timeout` | number | |
|
|
210
|
+
|
|
211
|
+
Returns `{ ok, text, goal }` where `goal` is `{ objective, status: "active"|"paused"|"budgetLimited"|"complete", tokensUsed, timeUsedSeconds, tokenBudget?, ... }` or `null`.
|
|
212
|
+
|
|
213
|
+
### `codex_goal_get`
|
|
214
|
+
|
|
215
|
+
Read the cached goal state. Pure read — does not send a turn.
|
|
216
|
+
|
|
217
|
+
| Parameter | Type | Required |
|
|
218
|
+
|-----------|------|----------|
|
|
219
|
+
| `name` | string | yes |
|
|
220
|
+
|
|
221
|
+
Returns `{ ok, goal }` (`null` if no goal active).
|
|
222
|
+
|
|
223
|
+
### `codex_goal_pause` / `codex_goal_resume` / `codex_goal_clear`
|
|
224
|
+
|
|
225
|
+
Send `/goal pause`, `/goal resume`, or `/goal clear` respectively. Requires `engine: "codex-app"`.
|
|
226
|
+
|
|
227
|
+
| Parameter | Type | Required |
|
|
228
|
+
|-----------|------|----------|
|
|
229
|
+
| `name` | string | yes |
|
|
230
|
+
| `timeout` | number | |
|
|
231
|
+
|
|
232
|
+
Returns `{ ok, text, goal }`.
|
|
233
|
+
|
|
234
|
+
> **Stability note:** Codex's `goals` feature is flagged "under development" in 0.128.0 and has known bugs (issue #20591). The slash-command parsing on the server side may also evolve. The wrapper is intentionally a thin sugar layer so upstream changes only affect the slash-text we send, not the protocol structure.
|
|
235
|
+
|
|
236
|
+
---
|
|
237
|
+
|
|
238
|
+
## Agent Teams (3)
|
|
239
|
+
|
|
240
|
+
### `agents_list`
|
|
241
|
+
|
|
242
|
+
List agent definitions from `.claude/agents/` (project + global).
|
|
243
|
+
|
|
244
|
+
| Parameter | Type |
|
|
245
|
+
|-----------|------|
|
|
246
|
+
| `cwd` | string |
|
|
247
|
+
|
|
248
|
+
### `team_list`
|
|
249
|
+
|
|
250
|
+
List teammates in an agent team session.
|
|
251
|
+
|
|
252
|
+
| Parameter | Type | Required |
|
|
253
|
+
|-----------|------|----------|
|
|
254
|
+
| `name` | string | yes |
|
|
255
|
+
|
|
256
|
+
### `team_send`
|
|
257
|
+
|
|
258
|
+
Send message to a specific teammate.
|
|
259
|
+
|
|
260
|
+
| Parameter | Type | Required |
|
|
261
|
+
|-----------|------|----------|
|
|
262
|
+
| `name` | string | yes |
|
|
263
|
+
| `teammate` | string | yes |
|
|
264
|
+
| `message` | string | yes |
|
|
265
|
+
|
|
266
|
+
---
|
|
267
|
+
|
|
268
|
+
## Council (7)
|
|
269
|
+
|
|
270
|
+
### `council_start`
|
|
271
|
+
|
|
272
|
+
Start a multi-agent council. Runs in background, returns session ID immediately.
|
|
273
|
+
|
|
274
|
+
| Parameter | Type | Required | Description |
|
|
275
|
+
|-----------|------|----------|-------------|
|
|
276
|
+
| `task` | string | yes | Task description |
|
|
277
|
+
| `projectDir` | string | yes | Working directory |
|
|
278
|
+
| `agents` | AgentPersona[] | | Agent list (defaults to 3-agent team) |
|
|
279
|
+
| `maxRounds` | number | | Max rounds (default 15) |
|
|
280
|
+
| `agentTimeoutMs` | number | | Per-agent timeout (default 1800000) |
|
|
281
|
+
| `maxTurnsPerAgent` | number | | Max tool turns per agent (default 30) |
|
|
282
|
+
| `maxBudgetUsd` | number | | Max API spend per agent |
|
|
283
|
+
| `defaultPermissionMode` | string | | Default permission mode for agents (`acceptEdits`, `bypassPermissions`, etc.). Overridden by agent-level `permissionMode`. Default: `bypassPermissions` |
|
|
284
|
+
|
|
285
|
+
### `council_status`
|
|
286
|
+
|
|
287
|
+
Get status of a running or recently completed council.
|
|
288
|
+
|
|
289
|
+
| Parameter | Type | Required |
|
|
290
|
+
|-----------|------|----------|
|
|
291
|
+
| `id` | string | yes |
|
|
292
|
+
|
|
293
|
+
### `council_abort`
|
|
294
|
+
|
|
295
|
+
Abort a running council, stopping all agent sessions.
|
|
296
|
+
|
|
297
|
+
| Parameter | Type | Required |
|
|
298
|
+
|-----------|------|----------|
|
|
299
|
+
| `id` | string | yes |
|
|
300
|
+
|
|
301
|
+
### `council_inject`
|
|
302
|
+
|
|
303
|
+
Inject a user message into the next round of a running council.
|
|
304
|
+
|
|
305
|
+
| Parameter | Type | Required |
|
|
306
|
+
|-----------|------|----------|
|
|
307
|
+
| `id` | string | yes |
|
|
308
|
+
| `message` | string | yes |
|
|
309
|
+
|
|
310
|
+
### `council_review`
|
|
311
|
+
|
|
312
|
+
Review a completed council session. Returns a structured report of all changed files, branches, worktrees, plan.md status, review files, and agent summaries. Does not modify any state.
|
|
313
|
+
|
|
314
|
+
| Parameter | Type | Required |
|
|
315
|
+
|-----------|------|----------|
|
|
316
|
+
| `id` | string | yes |
|
|
317
|
+
|
|
318
|
+
**Returns**: `CouncilReviewResult` with `changedFiles`, `branches`, `worktrees`, `reviews`, `planContent`, and `agentSummaries`.
|
|
319
|
+
|
|
320
|
+
### `council_accept`
|
|
321
|
+
|
|
322
|
+
Accept and finalize council work. Cleans up all council scaffolding: removes worktrees, deletes `council/*` branches, removes `plan.md` and `reviews/` directory.
|
|
323
|
+
|
|
324
|
+
| Parameter | Type | Required |
|
|
325
|
+
|-----------|------|----------|
|
|
326
|
+
| `id` | string | yes |
|
|
327
|
+
|
|
328
|
+
**Returns**: `CouncilAcceptResult` with `branchesDeleted`, `worktreesRemoved`, `planDeleted`, `reviewsDeleted`.
|
|
329
|
+
|
|
330
|
+
### `council_reject`
|
|
331
|
+
|
|
332
|
+
Reject council work and provide feedback. Rewrites `plan.md` with rejection feedback and commits it. Does NOT delete any worktrees or branches — the council can be restarted to retry.
|
|
333
|
+
|
|
334
|
+
| Parameter | Type | Required | Description |
|
|
335
|
+
|-----------|------|----------|-------------|
|
|
336
|
+
| `id` | string | yes | Council session ID |
|
|
337
|
+
| `feedback` | string | yes | Detailed feedback on what needs to be fixed |
|
|
338
|
+
|
|
339
|
+
**Returns**: `CouncilRejectResult` with `planRewritten` and `feedback`.
|
|
340
|
+
|
|
341
|
+
---
|
|
342
|
+
|
|
343
|
+
## Inbox (3)
|
|
344
|
+
|
|
345
|
+
### `session_send_to`
|
|
346
|
+
|
|
347
|
+
Send a cross-session message. Delivered immediately if target is idle, queued if busy.
|
|
348
|
+
|
|
349
|
+
| Parameter | Type | Required | Description |
|
|
350
|
+
|-----------|------|----------|-------------|
|
|
351
|
+
| `from` | string | yes | Sender session name |
|
|
352
|
+
| `to` | string | yes | Target session name, or `"*"` for broadcast |
|
|
353
|
+
| `message` | string | yes | Message text |
|
|
354
|
+
| `summary` | string | | Short preview (5-10 words) |
|
|
355
|
+
|
|
356
|
+
### `session_inbox`
|
|
357
|
+
|
|
358
|
+
Read inbox messages for a session.
|
|
359
|
+
|
|
360
|
+
| Parameter | Type | Required | Description |
|
|
361
|
+
|-----------|------|----------|-------------|
|
|
362
|
+
| `name` | string | yes | Session name |
|
|
363
|
+
| `unreadOnly` | boolean | | Only unread (default true) |
|
|
364
|
+
|
|
365
|
+
### `session_deliver_inbox`
|
|
366
|
+
|
|
367
|
+
Deliver all queued inbox messages to an idle session.
|
|
368
|
+
|
|
369
|
+
| Parameter | Type | Required |
|
|
370
|
+
|-----------|------|----------|
|
|
371
|
+
| `name` | string | yes |
|
|
372
|
+
|
|
373
|
+
---
|
|
374
|
+
|
|
375
|
+
## Ultraplan (2)
|
|
376
|
+
|
|
377
|
+
### `ultraplan_start`
|
|
378
|
+
|
|
379
|
+
Start a dedicated Opus planning session (up to 30 min). Runs in background.
|
|
380
|
+
|
|
381
|
+
| Parameter | Type | Required | Description |
|
|
382
|
+
|-----------|------|----------|-------------|
|
|
383
|
+
| `task` | string | yes | What to plan |
|
|
384
|
+
| `cwd` | string | | Project directory |
|
|
385
|
+
| `model` | string | | Model (default: opus) |
|
|
386
|
+
| `timeout` | number | | Timeout ms (default 1800000) |
|
|
387
|
+
|
|
388
|
+
### `ultraplan_status`
|
|
389
|
+
|
|
390
|
+
Get status and plan text when completed.
|
|
391
|
+
|
|
392
|
+
| Parameter | Type | Required |
|
|
393
|
+
|-----------|------|----------|
|
|
394
|
+
| `id` | string | yes |
|
|
395
|
+
|
|
396
|
+
---
|
|
397
|
+
|
|
398
|
+
## Ultrareview (2)
|
|
399
|
+
|
|
400
|
+
### `ultrareview_start`
|
|
401
|
+
|
|
402
|
+
Launch a fleet of bug-hunting agents (1-20) reviewing code from different angles.
|
|
403
|
+
|
|
404
|
+
| Parameter | Type | Required | Description |
|
|
405
|
+
|-----------|------|----------|-------------|
|
|
406
|
+
| `cwd` | string | yes | Project directory |
|
|
407
|
+
| `agentCount` | number | | Agents (1-20, default 5) |
|
|
408
|
+
| `maxDurationMinutes` | number | | Duration (5-25 min, default 10) |
|
|
409
|
+
| `model` | string | | Model for reviewers |
|
|
410
|
+
| `focus` | string | | Review focus area |
|
|
411
|
+
|
|
412
|
+
### `ultrareview_status`
|
|
413
|
+
|
|
414
|
+
Get status and findings when completed.
|
|
415
|
+
|
|
416
|
+
| Parameter | Type | Required |
|
|
417
|
+
|-----------|------|----------|
|
|
418
|
+
| `id` | string | yes |
|