AI Orchestrator
by @ciklopentan
DeepSeek AI access via Puppeteer browser automation with CDP interceptor. Persistent daemon (~35ms startup), health checks, graceful shutdown, PM2 management...
clawhub install ai-orchestratorπ About This Skill
name: ai-orchestrator description: > DeepSeek AI access via Puppeteer browser automation with CDP interceptor. Persistent daemon (~35ms startup), health checks, graceful shutdown, PM2 management. Configurable via
.deepseek.json.
Use when: (1) need DeepSeek responses without API key, (2) code analysis, review, or generation,
(3) text analysis, summarization, translation, (4) "consult DeepSeek" or ask-deepseek.sh.
AI Orchestrator v2.0.11
What this is: Browser automation that talks to DeepSeek via Puppeteer. What this is NOT: A general AI router or multi-model orchestrator. It's one browser β one LLM.
Execution
Working directory rule: Unless a command here uses an absolute path, run ai-orchestrator commands from the skill root: ~/.openclaw/workspace/skills/ai-orchestrator.
If you are not already there, run:
cd ~/.openclaw/workspace/skills/ai-orchestrator
Relative paths such as .daemon-ws-endpoint, .profile/, .deepseek.json, and scripts/setup-daemon.sh assume this directory.
Quick Start
# Simple question
ask-deepseek.sh "What is HTTP?"Session (keeps context between questions)
ask-deepseek.sh "Explain OAuth2" --session work
ask-deepseek.sh "What about OpenID Connect?" --session work
ask-deepseek.sh --session work --end-sessionWith daemon (fast startup ~35ms vs ~15s cold)
ask-deepseek.sh "Question" --daemonPipe code or long prompts
cat code.py | ask-deepseek.sh "Find bugs"
ask-deepseek.sh --stdin < code.py
ask-deepseek.sh <<'EOF'
Long multi-line prompt here
EOF
When to use ai-orchestrator
| Task | ai-orchestrator | Direct API | Manual browser | |------|----------------|------------|----------------| | Code analysis / review | β Fast, no API key | Needs API | β Slow | | Text analysis / summary | β (with --daemon) | Needs API | β Tedious | | Brainstorming | β (use Dual Thinking skill) | Needs API | β | | Web scraping | β Wrong tool | β | β | | API testing | β Overkill | β | β | | CAPTCHA solving | β Will fail | β | β (manual) |
Rule: Need LLM reasoning without API key β ai-orchestrator.
Need browser tasks (scrape, click, fill forms) β use agent-browser skill instead.
Default site mode: ai-orchestrator must keep DeepSeek in Expert mode whenever the site exposes the Instant / Expert switch. Treat Expert as the canonical default. Do not fall back to Instant unless a future implementation explicitly adds an override and the user asks for it.
Session continuity: in daemon mode, follow-up requests using --session NAME must restore the exact saved DeepSeek chatUrl for that session unless --new-chat was explicitly requested. Reusing an arbitrary open DeepSeek tab is incorrect because it breaks multi-round review continuity.
All Flags
| Flag | Purpose | |------|---------| |--session NAME | Persistent context across requests (keeps chat history) |
| --daemon | Use running Chrome daemon (~35ms startup) |
| --search | Enable DeepSeek web search capability |
| --think | Enable DeepThink site mode (deeper reasoning) |
| --new-chat | Start new chat within existing session |
| --end-session | Close and clean up session |
| --visible | Open visible browser (for auth/CAPTCHA fixes) |
| --wait | Wait for manual auth completion (with --visible) |
| --close | Force close browser after request |
| --dry-run | Test auth + composer without sending prompt |
| --stdin | Explicitly read prompt body from stdin |
| --debug | Verbose debug output |
| --verbose | More detailed logs |
| -h, --help | Show help |Health check
# 1. Daemon running?
pm2 status | grep -q "deepseek.*online" || echo "Daemon down"2. Dry-run path works?
ask-deepseek.sh --dry-run --daemon || echo "DeepSeek dry-run failed" # Checks auth + composer through the daemon path3. Real response path works?
ask-deepseek.sh "OK" --daemon | grep -q "OK" || echo "DeepSeek not responding"
If any step fails, do not improvise. Use the troubleshooting ladder below.
Failure Recovery (mandatory routing)
First failure rule β do not skip
When any command fails: 1. STOP β do not try a random second fix yet 2. CAPTURE β read the exact error you saw 3. MATCH β find the closest symptom row below 4. RUN β execute that row's exact command 5. VERIFY β retry with the specified verification commandSymptom β exact command
| If you see this symptom | Run this exact command | Then verify with | |---|---|---| |Connection refused, ECONNREFUSED, daemon not online | pm2 restart deepseek-daemon && sleep 8 && ask-deepseek.sh --dry-run --daemon | ask-deepseek.sh "Say OK" --daemon |
| auth expired, CAPTCHA, login page, 401, 403 | cd ~/.openclaw/workspace/skills/ai-orchestrator && pm2 stop deepseek-daemon && rm -f .daemon-ws-endpoint && bash ask-deepseek.sh --visible --wait --dry-run && pm2 start deepseek-daemon | bash ask-deepseek.sh --dry-run --daemon |
| response cuts off / incomplete long answer | ask-deepseek.sh "Part 1" --session temp && ask-deepseek.sh "Continue with next part" --session temp | ask-deepseek.sh --session temp --end-session |
| lock, Singleton, profile already in use | cd ~/.openclaw/workspace/skills/ai-orchestrator && rm -f .profile/Singleton* && pm2 restart deepseek-daemon | bash ask-deepseek.sh --dry-run |
| timeout, selector missing, composer not found | ask-deepseek.sh --dry-run --visible | only after manual inspection consider selector edits |If 3 fixes failed already
Do not keep guessing. Reset to a known-good baseline:cd ~/.openclaw/workspace/skills/ai-orchestrator
pm2 stop deepseek-daemon
pkill -f puppeteer || true
rm -f .daemon-ws-endpoint .profile/Singleton*
bash scripts/setup-daemon.sh
bash ask-deepseek.sh "Say OK" --daemon
If that still fails, escalate to manual auth/inspection with --visible --wait.
Manual Auth with --wait
--wait blocks until you complete auth in the visible browser or interrupt the command yourself.
There is no automatic timeout documented here.
Use Ctrl+C if you need to abort.
Daemon Setup
One-liner:cd ~/.openclaw/workspace/skills/ai-orchestrator && bash scripts/setup-daemon.sh
Or manual:
bash scripts/setup-daemon.sh # Or run step-by-step below
npm install # First time only
pm2 start deepseek-daemon.js --name deepseek-daemon --no-autorestart
pm2 save
pm2 startup # Auto-start on boot
Exit Codes
| Code | Meaning | Action | |------|---------|--------| | 0 | Success β response received | Continue | | 1 | Config/arg error | Check flags, run--help |
| 2 | DeepSeek unreachable or daemon unavailable | Check network, daemon endpoint, pm2 status |
| 3 | Blocked or rate limited | Wait 5s, retry, or use --visible |Note: Partial success (truncated response) still returns 0. Use "Continue" button handling.
Known Limitations (v2.0.11)
DEEPSEEK_SUBMIT_BLOCKED_OVERSIZE_PROMPT if delivery never succeeds..clawhubignore excludes local profile, diagnostics, logs, sessions, and daemon state files.DeepSeek Free Tier Limits
--session for long conversations instead of single huge promptsWorkaround for Long Answers (>13k chars)
ask-deepseek.sh "Write a Python backend guide" --session guide
ask-deepseek.sh "Now cover async and databases" --session guide # Continue
ask-deepseek.sh --session guide --end-session # Done
Logging
After important orchestrator runs, append tomemory/episodic/YYYY-MM-DD.md:
## ai-orchestrator
Task: code review app.js (tool: deepseek, duration: 12s, status: success)
Failure: CAPTCHA on deepseek (fallback: manual via --visible)
Not every request needs logging. Log decisions and failures, not routine questions.What NOT to do
--session chunks insteadConfiguration (.deepseek.json)
{
"idleTimeout": 15000,
"heartbeatInterval": 15000,
"domErrorIdleMs": 25000,
"maxContinueRounds": 30,
"logToFile": true,
"logPath": ".logs/deepseek.log"
}
Minimal Contract for Weak Runtimes
0 = success, 1 = config/runtime error, 2 = DeepSeek unreachable or daemon unavailable, 3 = blocked or rate-limited. Never treat 2 or 3 as success.Instant / Expert, ai-orchestrator must use Expert unless the user explicitly requests otherwise via a future supported override.--session NAME must restore the exact saved chatUrl unless --new-chat was explicitly requested..clawhubignore exists and excludes local runtime state.Minimal Decision Rules for Weak Models
When choosing what to do next, use these defaults:
--daemon--session--new-chat--end-session--visible --wait --dry-run--dry-run--session and split it into chunksagent-browser, not ai-orchestrator mode when that switch exists is used, enable the site DeepThink` toggle before sending the promptTroubleshooting β REFERENCE.md
See REFERENCE.md for:π‘ Examples
# Simple question
ask-deepseek.sh "What is HTTP?"Session (keeps context between questions)
ask-deepseek.sh "Explain OAuth2" --session work
ask-deepseek.sh "What about OpenID Connect?" --session work
ask-deepseek.sh --session work --end-sessionWith daemon (fast startup ~35ms vs ~15s cold)
ask-deepseek.sh "Question" --daemonPipe code or long prompts
cat code.py | ask-deepseek.sh "Find bugs"
ask-deepseek.sh --stdin < code.py
ask-deepseek.sh <<'EOF'
Long multi-line prompt here
EOF