@enderfga/openclaw-claude-code 2.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 +179 -0
- package/dist/bin/cli.d.ts +10 -0
- package/dist/bin/cli.js +301 -0
- package/dist/bin/cli.js.map +1 -0
- package/dist/src/embedded-server.d.ts +19 -0
- package/dist/src/embedded-server.js +190 -0
- package/dist/src/embedded-server.js.map +1 -0
- package/dist/src/hooks/prompt-bypass.d.ts +20 -0
- package/dist/src/hooks/prompt-bypass.js +37 -0
- package/dist/src/hooks/prompt-bypass.js.map +1 -0
- package/dist/src/index.d.ts +47 -0
- package/dist/src/index.js +230 -0
- package/dist/src/index.js.map +1 -0
- package/dist/src/persistent-session.d.ts +100 -0
- package/dist/src/persistent-session.js +563 -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 +394 -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 +261 -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 +79 -0
- package/dist/src/session-manager.js +329 -0
- package/dist/src/session-manager.js.map +1 -0
- package/dist/src/types.d.ts +160 -0
- package/dist/src/types.js +20 -0
- package/dist/src/types.js.map +1 -0
- package/openclaw.plugin.json +76 -0
- package/package.json +46 -0
- package/skills/SKILL.md +594 -0
package/skills/SKILL.md
ADDED
|
@@ -0,0 +1,594 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: claude-code-skill
|
|
3
|
+
description: Control Claude Code via MCP protocol. Trigger with "plan" to write a precise execution plan then feed it to Claude Code. Also supports direct commands, persistent sessions, agent teams, and advanced tool control.
|
|
4
|
+
homepage: https://github.com/enderfga/claude-code-skill
|
|
5
|
+
metadata: {
|
|
6
|
+
"clawdis": {
|
|
7
|
+
"emoji": "🤖",
|
|
8
|
+
"requires": {
|
|
9
|
+
"bins": ["node"],
|
|
10
|
+
"env": []
|
|
11
|
+
},
|
|
12
|
+
"install": [
|
|
13
|
+
{
|
|
14
|
+
"id": "local",
|
|
15
|
+
"kind": "local",
|
|
16
|
+
"path": "~/clawd/claude-code-skill",
|
|
17
|
+
"label": "Use local installation"
|
|
18
|
+
}
|
|
19
|
+
]
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
---
|
|
23
|
+
|
|
24
|
+
# Claude Code Skill
|
|
25
|
+
|
|
26
|
+
Control Claude Code via MCP (Model Context Protocol). This skill unleashes the full power of Claude Code for openclaw agents, including persistent sessions, agent teams, and advanced tool control.
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
---
|
|
30
|
+
|
|
31
|
+
## ⚡ Quick Start
|
|
32
|
+
|
|
33
|
+
```bash
|
|
34
|
+
# Start a persistent Claude session for your project
|
|
35
|
+
claude-code-skill session-start myproject -d ~/project \
|
|
36
|
+
--permission-mode acceptEdits \
|
|
37
|
+
--allowed-tools "Bash,Read,Edit,Write,Glob,Grep"
|
|
38
|
+
|
|
39
|
+
# Send a plan (Claude will execute precisely)
|
|
40
|
+
claude-code-skill session-send myproject --stream '<精确的执行计划>'
|
|
41
|
+
|
|
42
|
+
# Send with high effort (ultrathink) for complex reasoning
|
|
43
|
+
claude-code-skill session-send myproject --stream --ultrathink 'Refactor the auth module'
|
|
44
|
+
|
|
45
|
+
# Enter plan mode — Claude creates a plan first, then executes
|
|
46
|
+
claude-code-skill session-send myproject --stream --plan 'Implement rate limiting'
|
|
47
|
+
|
|
48
|
+
# Check progress
|
|
49
|
+
claude-code-skill session-status myproject
|
|
50
|
+
|
|
51
|
+
# Compact session when context gets large
|
|
52
|
+
claude-code-skill session-compact myproject
|
|
53
|
+
|
|
54
|
+
# Switch model mid-session
|
|
55
|
+
claude-code-skill session-model myproject opus
|
|
56
|
+
|
|
57
|
+
# Start with auto mode — classifier approves safe actions automatically
|
|
58
|
+
claude-code-skill session-start myproject -d ~/project \
|
|
59
|
+
--permission-mode auto --enable-auto-mode \
|
|
60
|
+
--allowed-tools "Bash,Read,Edit,Write,Glob,Grep"
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
## 🎯 When to Use This Skill
|
|
64
|
+
|
|
65
|
+
### Use Persistent Sessions When:
|
|
66
|
+
- ✅ Multi-step tasks requiring multiple tool calls
|
|
67
|
+
- ✅ Iterative development (write code → test → fix → repeat)
|
|
68
|
+
- ✅ Long conversations needing full context
|
|
69
|
+
- ✅ Agent needs to work autonomously
|
|
70
|
+
- ✅ You want streaming real-time feedback
|
|
71
|
+
|
|
72
|
+
### Use Direct MCP Tools When:
|
|
73
|
+
- ✅ Single command execution
|
|
74
|
+
- ✅ Quick file read/write
|
|
75
|
+
- ✅ One-off searches
|
|
76
|
+
- ✅ No context needed between operations
|
|
77
|
+
|
|
78
|
+
## 📚 Command Reference
|
|
79
|
+
|
|
80
|
+
### Basic MCP Operations
|
|
81
|
+
|
|
82
|
+
```bash
|
|
83
|
+
# Connect to Claude Code MCP
|
|
84
|
+
claude-code-skill connect
|
|
85
|
+
claude-code-skill status
|
|
86
|
+
claude-code-skill tools
|
|
87
|
+
|
|
88
|
+
# Direct tool calls (no persistent session)
|
|
89
|
+
claude-code-skill bash "npm test"
|
|
90
|
+
claude-code-skill read /path/to/file.ts
|
|
91
|
+
claude-code-skill glob "**/*.ts" -p ~/project
|
|
92
|
+
claude-code-skill grep "TODO" -p ~/project -c
|
|
93
|
+
claude-code-skill call Write -a '{"file_path":"/tmp/test.txt","content":"Hello"}'
|
|
94
|
+
|
|
95
|
+
# Disconnect
|
|
96
|
+
claude-code-skill disconnect
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
### Persistent Sessions (Agent Loop)
|
|
100
|
+
|
|
101
|
+
#### Starting Sessions
|
|
102
|
+
|
|
103
|
+
```bash
|
|
104
|
+
# Basic start
|
|
105
|
+
claude-code-skill session-start myproject -d ~/project
|
|
106
|
+
|
|
107
|
+
# With custom API endpoint (for Gemini/GPT proxy)
|
|
108
|
+
claude-code-skill session-start gemini-task -d ~/project \
|
|
109
|
+
--base-url http://127.0.0.1:8082 \
|
|
110
|
+
--model gemini-2.0-flash
|
|
111
|
+
|
|
112
|
+
# With permission mode (plan = preview changes before applying)
|
|
113
|
+
claude-code-skill session-start review -d ~/project --permission-mode plan
|
|
114
|
+
|
|
115
|
+
# With tool whitelist (auto-approve these tools)
|
|
116
|
+
claude-code-skill session-start safe -d ~/project \
|
|
117
|
+
--allowed-tools "Bash(git:*),Read,Glob,Grep"
|
|
118
|
+
|
|
119
|
+
# With budget limit
|
|
120
|
+
claude-code-skill session-start limited -d ~/project --max-budget 1.50
|
|
121
|
+
|
|
122
|
+
# Full configuration
|
|
123
|
+
claude-code-skill session-start advanced -d ~/project \
|
|
124
|
+
--permission-mode acceptEdits \
|
|
125
|
+
--allowed-tools "Bash,Read,Edit,Write" \
|
|
126
|
+
--disallowed-tools "Task" \
|
|
127
|
+
--max-budget 5.00 \
|
|
128
|
+
--model claude-opus-4-6 \
|
|
129
|
+
--append-system-prompt "Always write tests" \
|
|
130
|
+
--add-dir "/tmp,/var/log"
|
|
131
|
+
|
|
132
|
+
# Auto mode — safer than bypassPermissions, fewer prompts than acceptEdits
|
|
133
|
+
claude-code-skill session-start autonomous -d ~/project \
|
|
134
|
+
--permission-mode auto --enable-auto-mode \
|
|
135
|
+
--allowed-tools "Bash,Read,Edit,Write,Glob,Grep" \
|
|
136
|
+
--max-budget 3.00
|
|
137
|
+
|
|
138
|
+
# Named session for easy identification
|
|
139
|
+
claude-code-skill session-start review -d ~/project \
|
|
140
|
+
-n "Auth Refactor Review" \
|
|
141
|
+
--permission-mode plan
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
**Permission Modes:**
|
|
145
|
+
| Mode | Description |
|
|
146
|
+
|------|-------------|
|
|
147
|
+
| `acceptEdits` | Auto-accept file edits (default) |
|
|
148
|
+
| `auto` | Classifier-based safety checks, auto-approve safe actions (requires `--enable-auto-mode`) |
|
|
149
|
+
| `plan` | Preview changes before applying |
|
|
150
|
+
| `default` | Ask for each operation |
|
|
151
|
+
| `bypassPermissions` | Skip all prompts (dangerous!) |
|
|
152
|
+
| `delegate` | Delegate decisions to parent |
|
|
153
|
+
| `dontAsk` | Never ask, reject by default |
|
|
154
|
+
|
|
155
|
+
#### Sending Messages
|
|
156
|
+
|
|
157
|
+
```bash
|
|
158
|
+
# Basic send (blocks until complete)
|
|
159
|
+
claude-code-skill session-send myproject "Write unit tests for auth.ts"
|
|
160
|
+
|
|
161
|
+
# Streaming (see progress in real-time)
|
|
162
|
+
claude-code-skill session-send myproject "Refactor this module" --stream
|
|
163
|
+
|
|
164
|
+
# With custom timeout
|
|
165
|
+
claude-code-skill session-send myproject "Run all tests" -t 300000
|
|
166
|
+
|
|
167
|
+
# With effort control
|
|
168
|
+
claude-code-skill session-send myproject "Quick lint fix" --effort low
|
|
169
|
+
claude-code-skill session-send myproject "Design new auth system" --ultrathink
|
|
170
|
+
|
|
171
|
+
# Plan mode — Claude creates a plan, then executes
|
|
172
|
+
claude-code-skill session-send myproject --plan "Add rate limiting to all API endpoints"
|
|
173
|
+
|
|
174
|
+
# Auto-resume stopped sessions
|
|
175
|
+
claude-code-skill session-send myproject "Continue the migration" --auto-resume
|
|
176
|
+
|
|
177
|
+
# NDJSON output for programmatic consumption
|
|
178
|
+
claude-code-skill session-send myproject "Run tests" --stream --ndjson
|
|
179
|
+
```
|
|
180
|
+
|
|
181
|
+
#### Managing Sessions
|
|
182
|
+
|
|
183
|
+
```bash
|
|
184
|
+
# List active sessions
|
|
185
|
+
claude-code-skill session-list
|
|
186
|
+
|
|
187
|
+
# Get detailed status
|
|
188
|
+
claude-code-skill session-status myproject
|
|
189
|
+
|
|
190
|
+
# View conversation history
|
|
191
|
+
claude-code-skill session-history myproject -n 50
|
|
192
|
+
|
|
193
|
+
# Pause and resume
|
|
194
|
+
claude-code-skill session-pause myproject
|
|
195
|
+
claude-code-skill session-resume-paused myproject
|
|
196
|
+
|
|
197
|
+
# Fork a session (create a branch for experiments)
|
|
198
|
+
claude-code-skill session-fork myproject myproject-experiment
|
|
199
|
+
|
|
200
|
+
# Stop
|
|
201
|
+
claude-code-skill session-stop myproject
|
|
202
|
+
|
|
203
|
+
# Restart a failed session
|
|
204
|
+
claude-code-skill session-restart myproject
|
|
205
|
+
```
|
|
206
|
+
|
|
207
|
+
#### Effort & Model Control
|
|
208
|
+
|
|
209
|
+
```bash
|
|
210
|
+
# Set effort level for a session (persists across messages)
|
|
211
|
+
claude-code-skill session-effort myproject low # Fast, minimal thinking
|
|
212
|
+
claude-code-skill session-effort myproject medium # Balanced (default for Opus 4.6)
|
|
213
|
+
claude-code-skill session-effort myproject high # Deep thinking
|
|
214
|
+
claude-code-skill session-effort myproject max # Maximum capability, no token limit (Opus 4.6 only)
|
|
215
|
+
claude-code-skill session-effort myproject auto # Reset to default
|
|
216
|
+
|
|
217
|
+
# Switch model mid-session
|
|
218
|
+
claude-code-skill session-model myproject opus
|
|
219
|
+
claude-code-skill session-model myproject sonnet
|
|
220
|
+
claude-code-skill session-model myproject gemini-pro
|
|
221
|
+
|
|
222
|
+
# Start session with effort preset
|
|
223
|
+
claude-code-skill session-start myproject -d ~/project --effort high
|
|
224
|
+
|
|
225
|
+
# Model aliases (built-in: opus, sonnet, haiku, gemini-flash, gemini-pro)
|
|
226
|
+
# Custom aliases via --model-overrides
|
|
227
|
+
claude-code-skill session-start myproject -d ~/project \
|
|
228
|
+
--model-overrides '{"fast":"gemini-2.0-flash","smart":"claude-opus-4-6"}'
|
|
229
|
+
```
|
|
230
|
+
|
|
231
|
+
#### Cost Tracking
|
|
232
|
+
|
|
233
|
+
```bash
|
|
234
|
+
# Show cost breakdown for a session
|
|
235
|
+
claude-code-skill session-cost myproject
|
|
236
|
+
# → Model: claude-opus-4-6
|
|
237
|
+
# → Tokens in: 12,345 | out: 3,456 | cached: 8,901
|
|
238
|
+
# → Breakdown: Input $0.0103 | Cached $0.0033 | Output $0.0518
|
|
239
|
+
# → 💰 Total: $0.0654
|
|
240
|
+
```
|
|
241
|
+
|
|
242
|
+
#### Branching
|
|
243
|
+
|
|
244
|
+
```bash
|
|
245
|
+
# Branch a session (fork + optional model/effort change)
|
|
246
|
+
claude-code-skill session-branch myproject experiment
|
|
247
|
+
claude-code-skill session-branch myproject fast-branch --model sonnet --effort low
|
|
248
|
+
|
|
249
|
+
# Branch preserves full conversation history from parent
|
|
250
|
+
# Both parent and branch continue independently
|
|
251
|
+
```
|
|
252
|
+
|
|
253
|
+
#### Hooks (Webhook Callbacks)
|
|
254
|
+
|
|
255
|
+
```bash
|
|
256
|
+
# List available hooks
|
|
257
|
+
claude-code-skill session-hooks myproject
|
|
258
|
+
|
|
259
|
+
# Register webhook URLs for events
|
|
260
|
+
claude-code-skill session-hooks myproject \
|
|
261
|
+
--on-tool-error http://localhost:8080/webhook \
|
|
262
|
+
--on-context-high http://localhost:8080/webhook \
|
|
263
|
+
--on-stop http://localhost:8080/webhook
|
|
264
|
+
|
|
265
|
+
# Available hooks:
|
|
266
|
+
# onToolError — a tool call failed
|
|
267
|
+
# onContextHigh — context usage exceeded 70%
|
|
268
|
+
# onStop — session stopped (includes cost summary)
|
|
269
|
+
# onTurnComplete — each turn finished (includes usage)
|
|
270
|
+
# onStopFailure — API error (rate limit, auth failure)
|
|
271
|
+
```
|
|
272
|
+
|
|
273
|
+
#### Config Files
|
|
274
|
+
|
|
275
|
+
```bash
|
|
276
|
+
# Load session config from JSON file
|
|
277
|
+
claude-code-skill session-start myproject --config agent.json
|
|
278
|
+
|
|
279
|
+
# agent.json example:
|
|
280
|
+
# {
|
|
281
|
+
# "cwd": "~/project",
|
|
282
|
+
# "permissionMode": "acceptEdits",
|
|
283
|
+
# "allowedTools": ["Bash", "Read", "Edit", "Write"],
|
|
284
|
+
# "effort": "high",
|
|
285
|
+
# "maxBudget": "5.00",
|
|
286
|
+
# "modelOverrides": { "fast": "gemini-2.0-flash" },
|
|
287
|
+
# "appendSystemPrompt": "Always write tests"
|
|
288
|
+
# }
|
|
289
|
+
```
|
|
290
|
+
|
|
291
|
+
#### Context Management
|
|
292
|
+
|
|
293
|
+
```bash
|
|
294
|
+
# Compact session to reclaim context window
|
|
295
|
+
claude-code-skill session-compact myproject
|
|
296
|
+
|
|
297
|
+
# Compact with custom summary
|
|
298
|
+
claude-code-skill session-compact myproject --summary "Finished auth refactor, now on tests"
|
|
299
|
+
|
|
300
|
+
# Check context usage
|
|
301
|
+
claude-code-skill session-context myproject
|
|
302
|
+
```
|
|
303
|
+
|
|
304
|
+
### Session History & Search
|
|
305
|
+
|
|
306
|
+
```bash
|
|
307
|
+
# Browse all Claude Code sessions
|
|
308
|
+
claude-code-skill sessions -n 20
|
|
309
|
+
|
|
310
|
+
# Search sessions by project
|
|
311
|
+
claude-code-skill session-search --project ~/myapp
|
|
312
|
+
|
|
313
|
+
# Search by time
|
|
314
|
+
claude-code-skill session-search --since "2h"
|
|
315
|
+
claude-code-skill session-search --since "2024-02-01"
|
|
316
|
+
|
|
317
|
+
# Search by query
|
|
318
|
+
claude-code-skill session-search "bug fix"
|
|
319
|
+
|
|
320
|
+
# Resume a historical session
|
|
321
|
+
claude-code-skill resume <session-id> "Continue where we left off" -d ~/project
|
|
322
|
+
```
|
|
323
|
+
|
|
324
|
+
### Batch Operations
|
|
325
|
+
|
|
326
|
+
```bash
|
|
327
|
+
# Read multiple files at once
|
|
328
|
+
claude-code-skill batch-read "src/**/*.ts" "tests/**/*.test.ts" -p ~/project
|
|
329
|
+
```
|
|
330
|
+
|
|
331
|
+
## 🤝 Agent Team Features
|
|
332
|
+
|
|
333
|
+
Deploy multiple Claude agents working together on complex tasks.
|
|
334
|
+
|
|
335
|
+
### Basic Agent Team
|
|
336
|
+
|
|
337
|
+
```bash
|
|
338
|
+
# Define a team of agents
|
|
339
|
+
claude-code-skill session-start team-project -d ~/project \
|
|
340
|
+
--agents '{
|
|
341
|
+
"architect": {
|
|
342
|
+
"description": "Designs system architecture",
|
|
343
|
+
"prompt": "You are a senior software architect. Design scalable, maintainable systems."
|
|
344
|
+
},
|
|
345
|
+
"developer": {
|
|
346
|
+
"description": "Implements features",
|
|
347
|
+
"prompt": "You are a full-stack developer. Write clean, tested code."
|
|
348
|
+
},
|
|
349
|
+
"reviewer": {
|
|
350
|
+
"description": "Reviews code quality",
|
|
351
|
+
"prompt": "You are a code reviewer. Check for bugs, style issues, and improvements."
|
|
352
|
+
}
|
|
353
|
+
}' \
|
|
354
|
+
--agent architect
|
|
355
|
+
|
|
356
|
+
# Switch between agents mid-conversation
|
|
357
|
+
claude-code-skill session-send team-project "Design the authentication system"
|
|
358
|
+
# (architect responds)
|
|
359
|
+
|
|
360
|
+
claude-code-skill session-send team-project "@developer implement the design"
|
|
361
|
+
# (developer agent takes over)
|
|
362
|
+
|
|
363
|
+
claude-code-skill session-send team-project "@reviewer review the implementation"
|
|
364
|
+
# (reviewer agent takes over)
|
|
365
|
+
```
|
|
366
|
+
|
|
367
|
+
### Pre-configured Team Templates
|
|
368
|
+
|
|
369
|
+
```bash
|
|
370
|
+
# Code review team
|
|
371
|
+
claude-code-skill session-start review -d ~/project \
|
|
372
|
+
--agents '{
|
|
373
|
+
"security": {"prompt": "Focus on security vulnerabilities"},
|
|
374
|
+
"performance": {"prompt": "Focus on performance issues"},
|
|
375
|
+
"quality": {"prompt": "Focus on code quality and maintainability"}
|
|
376
|
+
}' \
|
|
377
|
+
--agent security
|
|
378
|
+
|
|
379
|
+
# Full-stack team
|
|
380
|
+
claude-code-skill session-start fullstack -d ~/project \
|
|
381
|
+
--agents '{
|
|
382
|
+
"frontend": {"prompt": "React/TypeScript frontend specialist"},
|
|
383
|
+
"backend": {"prompt": "Node.js/Express backend specialist"},
|
|
384
|
+
"database": {"prompt": "PostgreSQL/Redis database specialist"}
|
|
385
|
+
}' \
|
|
386
|
+
--agent frontend
|
|
387
|
+
```
|
|
388
|
+
|
|
389
|
+
## 🔧 Advanced Features
|
|
390
|
+
|
|
391
|
+
### Tool Control
|
|
392
|
+
|
|
393
|
+
```bash
|
|
394
|
+
# Allow specific tools with patterns
|
|
395
|
+
--allowed-tools "Bash(git:*,npm:*),Read,Edit"
|
|
396
|
+
|
|
397
|
+
# Deny dangerous operations
|
|
398
|
+
--disallowed-tools "Bash(rm:*,sudo:*),Write(/etc/*)"
|
|
399
|
+
|
|
400
|
+
# Limit to specific tool set
|
|
401
|
+
--tools "Read,Glob,Grep"
|
|
402
|
+
|
|
403
|
+
# Disable all tools
|
|
404
|
+
--tools ""
|
|
405
|
+
```
|
|
406
|
+
|
|
407
|
+
### System Prompts
|
|
408
|
+
|
|
409
|
+
```bash
|
|
410
|
+
# Replace system prompt completely
|
|
411
|
+
--system-prompt "You are a Python expert. Always use type hints."
|
|
412
|
+
|
|
413
|
+
# Append to existing prompt
|
|
414
|
+
--append-system-prompt "Always run tests after changes."
|
|
415
|
+
```
|
|
416
|
+
|
|
417
|
+
### Session Management
|
|
418
|
+
|
|
419
|
+
```bash
|
|
420
|
+
# Resume with fork (create a branch)
|
|
421
|
+
--resume <session-id> --fork-session
|
|
422
|
+
|
|
423
|
+
# Use custom UUID for session
|
|
424
|
+
--session-id "550e8400-e29b-41d4-a716-446655440000"
|
|
425
|
+
|
|
426
|
+
# Add additional working directories
|
|
427
|
+
--add-dir "/var/log,/tmp/workspace"
|
|
428
|
+
```
|
|
429
|
+
|
|
430
|
+
### Multi-Model Support (Proxy)
|
|
431
|
+
|
|
432
|
+
Use `--base-url` to route requests through a proxy, enabling other models (Gemini, GPT) to power Claude Code:
|
|
433
|
+
|
|
434
|
+
```bash
|
|
435
|
+
# Use Gemini via claude-code-proxy
|
|
436
|
+
claude-code-skill session-start gemini-task -d ~/project \
|
|
437
|
+
--base-url http://127.0.0.1:8082 \
|
|
438
|
+
--model claude-3-5-sonnet-20241022 # Proxy will map to Gemini
|
|
439
|
+
|
|
440
|
+
# Use GPT via proxy
|
|
441
|
+
claude-code-skill session-start gpt-task -d ~/project \
|
|
442
|
+
--base-url http://127.0.0.1:8082 \
|
|
443
|
+
--model claude-3-haiku-20240307 # Proxy will map to GPT
|
|
444
|
+
```
|
|
445
|
+
|
|
446
|
+
**Note:** Requires `claude-code-proxy` running on port 8082 with proper API keys configured.
|
|
447
|
+
|
|
448
|
+
```bash
|
|
449
|
+
# Start the proxy
|
|
450
|
+
cd ~/clawd/claude-code-proxy && source .venv/bin/activate
|
|
451
|
+
uvicorn server:app --host 127.0.0.1 --port 8082
|
|
452
|
+
```
|
|
453
|
+
|
|
454
|
+
## 🎓 Best Practices
|
|
455
|
+
|
|
456
|
+
### For OpenClaw Agents
|
|
457
|
+
|
|
458
|
+
1. **Always use persistent sessions for multi-step tasks**
|
|
459
|
+
```bash
|
|
460
|
+
# ❌ Bad: Multiple disconnect/reconnect cycles
|
|
461
|
+
claude-code-skill bash "step1"
|
|
462
|
+
claude-code-skill bash "step2"
|
|
463
|
+
|
|
464
|
+
# ✅ Good: Single persistent session
|
|
465
|
+
claude-code-skill session-start task -d ~/project
|
|
466
|
+
claude-code-skill session-send task "Do step1 then step2"
|
|
467
|
+
```
|
|
468
|
+
|
|
469
|
+
2. **Use `--stream` for long-running tasks**
|
|
470
|
+
```bash
|
|
471
|
+
claude-code-skill session-send task "Run full test suite" --stream
|
|
472
|
+
```
|
|
473
|
+
|
|
474
|
+
3. **Set budget limits for safety**
|
|
475
|
+
```bash
|
|
476
|
+
--max-budget 2.00 # Stop after $2 of API usage
|
|
477
|
+
```
|
|
478
|
+
|
|
479
|
+
4. **Use plan mode for critical changes**
|
|
480
|
+
```bash
|
|
481
|
+
--permission-mode plan # Preview before applying
|
|
482
|
+
```
|
|
483
|
+
|
|
484
|
+
5. **Fork before experiments**
|
|
485
|
+
```bash
|
|
486
|
+
claude-code-skill session-fork main experimental
|
|
487
|
+
claude-code-skill session-send experimental "Try risky refactor"
|
|
488
|
+
```
|
|
489
|
+
|
|
490
|
+
### Error Recovery
|
|
491
|
+
|
|
492
|
+
```bash
|
|
493
|
+
# If session fails:
|
|
494
|
+
claude-code-skill session-status myproject # Check what happened
|
|
495
|
+
claude-code-skill session-history myproject -n 20 # See recent events
|
|
496
|
+
claude-code-skill session-restart myproject # Restart from last good state
|
|
497
|
+
|
|
498
|
+
# If you need to start over:
|
|
499
|
+
claude-code-skill session-stop myproject
|
|
500
|
+
claude-code-skill session-start myproject -d ~/project --resume <old-session-id>
|
|
501
|
+
```
|
|
502
|
+
|
|
503
|
+
## 🏗️ Architecture
|
|
504
|
+
|
|
505
|
+
```
|
|
506
|
+
openclaw agent
|
|
507
|
+
↓
|
|
508
|
+
claude-code-skill CLI (this tool)
|
|
509
|
+
↓ HTTP
|
|
510
|
+
backend-api API (:18795)
|
|
511
|
+
↓ MCP
|
|
512
|
+
claude mcp serve (Claude Code)
|
|
513
|
+
↓
|
|
514
|
+
Your files & tools
|
|
515
|
+
```
|
|
516
|
+
|
|
517
|
+
## 🔌 Available Tools (via MCP)
|
|
518
|
+
|
|
519
|
+
All Claude Code tools are accessible:
|
|
520
|
+
|
|
521
|
+
| Tool | Description |
|
|
522
|
+
|------|-------------|
|
|
523
|
+
| Bash | Execute shell commands |
|
|
524
|
+
| Read | Read file contents |
|
|
525
|
+
| Write | Create/overwrite files |
|
|
526
|
+
| Edit | Edit files with string replacement |
|
|
527
|
+
| Glob | Find files by pattern |
|
|
528
|
+
| Grep | Search file contents |
|
|
529
|
+
| Task | Launch sub-agents |
|
|
530
|
+
| WebFetch | Fetch web content |
|
|
531
|
+
| WebSearch | Search the web |
|
|
532
|
+
| Git* | Git operations |
|
|
533
|
+
| AskUserQuestion | Interactive prompts |
|
|
534
|
+
| ... | and 10+ more |
|
|
535
|
+
|
|
536
|
+
## 📊 Examples
|
|
537
|
+
|
|
538
|
+
### Example 1: Code Review
|
|
539
|
+
|
|
540
|
+
```bash
|
|
541
|
+
claude-code-skill session-start review -d ~/myapp \
|
|
542
|
+
--permission-mode plan \
|
|
543
|
+
--agents '{"security":{"prompt":"Focus on security"},"quality":{"prompt":"Focus on quality"}}' \
|
|
544
|
+
--agent security
|
|
545
|
+
|
|
546
|
+
claude-code-skill session-send review \
|
|
547
|
+
"Review all TypeScript files in src/, check for security issues and code quality problems" \
|
|
548
|
+
--stream
|
|
549
|
+
```
|
|
550
|
+
|
|
551
|
+
### Example 2: Automated Testing
|
|
552
|
+
|
|
553
|
+
```bash
|
|
554
|
+
claude-code-skill session-start test -d ~/myapp \
|
|
555
|
+
--allowed-tools "Bash(npm:*,git:*),Read,Write" \
|
|
556
|
+
--max-budget 1.00
|
|
557
|
+
|
|
558
|
+
claude-code-skill session-send test \
|
|
559
|
+
"Find all untested functions, write unit tests, run tests, fix failures"
|
|
560
|
+
```
|
|
561
|
+
|
|
562
|
+
### Example 3: Multi-Agent Debugging
|
|
563
|
+
|
|
564
|
+
```bash
|
|
565
|
+
claude-code-skill session-start debug -d ~/myapp \
|
|
566
|
+
--agents '{
|
|
567
|
+
"detective": {"prompt": "Find the root cause of bugs"},
|
|
568
|
+
"fixer": {"prompt": "Implement fixes"},
|
|
569
|
+
"tester": {"prompt": "Verify fixes work"}
|
|
570
|
+
}' \
|
|
571
|
+
--agent detective
|
|
572
|
+
|
|
573
|
+
claude-code-skill session-send debug "We have a memory leak in the API server" --stream
|
|
574
|
+
# Detective investigates, then hands off to fixer, then to tester
|
|
575
|
+
```
|
|
576
|
+
|
|
577
|
+
## 🔗 Integration with OpenClaw
|
|
578
|
+
|
|
579
|
+
When openclaw needs to perform complex coding tasks:
|
|
580
|
+
|
|
581
|
+
```bash
|
|
582
|
+
# From within openclaw agent context:
|
|
583
|
+
openclaw skills run claude-code-skill -- session-start task -d ~/project
|
|
584
|
+
openclaw skills run claude-code-skill -- session-send task "Implement feature X" --stream
|
|
585
|
+
openclaw skills run claude-code-skill -- session-status task
|
|
586
|
+
```
|
|
587
|
+
|
|
588
|
+
Or use the skill programmatically via backend-api HTTP API (see TOOLS.md section 3).
|
|
589
|
+
|
|
590
|
+
## 📖 See Also
|
|
591
|
+
|
|
592
|
+
- **TOOLS.md section 3** - Full HTTP API documentation
|
|
593
|
+
- **backend-api endpoints** - Backend integration details
|
|
594
|
+
- **Claude Code docs** - Official Claude Code documentation (query via `qmd` tool)
|