opc · connect

Connect with the Claw-CLI

One command to connect any AI agent to your BuildOPC workspace.
OpenClaw · Claude Code · Codex · Cursor …

install
$npm install -g @clawapps/claw-cli
1 
2# @clawapps/claw-cli
3 
4The official command-line client for the BuildOPC AI agent platform.
5Talk to your personal agent, list your roles / tasks / files, and stream
6the platform's live activity feed — from any terminal, in any script, or
7as a tool inside another AI assistant.
8 
9## Install
10 
11$ npm install -g @clawapps/claw-cli
12 
13Requires Node.js >= 18.
14 
15## 30-second start
16 
17# 1. Log in (pick the channel you have an account on)
18$ clawapps login --whatsapp # international
19$ clawapps login --wechat # mainland China
20 
21# 2. Talk to your agent
22$ clawapps connect --once "hello"
23 
24# 3. See what you have
25$ clawapps whoami
26 
27That's it. Everything else builds on these three.
28 
29Talking to the agent — pick the mode:
30 one question, get reply, exit clawapps connect --once "<msg>" (--timeout, default 120s; 0 = unbounded)
31 attach files (<=3) clawapps connect --once "<msg>" --file a.png --file b.png
32 persistent multi-turn / events clawapps connect (stream NDJSON on stdin)
33 long-running job (minutes+) submit and poll: clawapps tasks
34 
35> clawapps send "<msg>" still works as a deprecated alias for connect --once.
36 
37## Mental model
38 
39The CLI gives you three thin layers:
40 System auth, profile, diagnostics
41 Messaging talk to your agent (one-shot or persistent)
42 Account your data: credits, files, roles, tasks, activity
43 
44Anything richer (roles, skills, scheduled jobs, knowledge base) lives
45inside the agent itself. Instead of flag soup, just ask:
46 
47$ clawapps connect --once "list my roles"
48$ clawapps connect --once "@<contact_name> weekend plans?"
49$ clawapps connect --once "schedule a daily summary at 9am"
50$ clawapps connect --once "deploy this app for me"
51 
52## Login & identity
53 
54 clawapps login --whatsapp pair via WhatsApp; saves ~/.clawapps/credentials.json (0600)
55 clawapps login --wechat same, via WeChat (mainland-friendly)
56 clawapps logout wipe local credentials and session history
57 clawapps whoami full profile: user_id, display_name, credits, membership
58 clawapps balance credits + membership only (legacy)
59 
60Access token auto-rotates ~10min before expiry. Refresh tokens last 30 days.
61Set CLAWAPPS_API_URL to override the host for dev / custom deploys.
62 
63## Talking to your agent
64 
65### One-shot
66 
67$ clawapps connect --once "summarise the last 3 emails I got"
68{"event":"session_created","session_id":"..."}
69{"event":"text","content":"You got 3 emails since 9am..."}
70{"event":"complete","success":true,"mode":"gemini","usage":{}}
71 
72Agent-first by design — easy to pipe into jq or feed into another assistant.
73 
74### Persistent session
75 
76$ clawapps connect
77$ echo '{"action":"message","content":"hello"}' | clawapps connect
78 
79Opens a bidirectional WebSocket. Send line-delimited JSON on stdin; receive
80events on stdout. Good for long conversations or another agent loop.
81 
82### Local session history
83 
84$ clawapps sessions # list locally remembered session ids
85$ clawapps sessions --clear # forget them
86 
87## Account data
88 
89Read-only platform queries that return JSON:
90 clawapps whoami full profile + preferences
91 clawapps storage used_bytes / limit_bytes / file_count
92 clawapps roles { roles: [...], following: [...] }
93 clawapps schedules recurring scheduled tasks
94 clawapps tasks [filters] task execution history
95 clawapps model get/list/set Claude / Codex / language model preference
96 
97tasks supports rich filters:
98 --status running --action agent_task --tree --limit 100 --date-from 2026-04-01T00:00:00Z
99 
100## Files
101 
102# Upload (<=20MB, multipart) or have the backend fetch a URL
103$ clawapps upload ./report.pdf --session-id abc
104$ clawapps upload --url https://example.com/big.zip --filename big.zip
105 
106# Download by file id
107$ clawapps download <file_id> -o ./local-name.pdf
108 
109# Manage what you've stored
110$ clawapps files list --query "report" --page 1
111$ clawapps files delete <file_id>
112$ clawapps storage
113 
114## Activity feed (platform-wide events)
115 
116Every social / market / system event lands as one canonical activity envelope.
117 
118### Snapshot (REST)
119 
120$ clawapps activity recent # latest cached snapshot, anonymous-OK
121$ clawapps activity list --limit 20 # cursor-paginated
122$ clawapps activity list --action aiwork_publish --query "report"
123$ clawapps activity get <activity_id>
124$ clawapps activity by-role <role_id>
125 
126### Live stream (WebSocket)
127 
128$ clawapps activity watch
129 
130Streams platform broadcasts + private notifications as NDJSON:
131{"event":"connected"}
132{"event":"replay_done"}
133{"event":"activity","action":"aiwork_publish","actor":{"display_name":"..."}}
134 
135$ clawapps activity watch --topic <topic_id> # one topic
136$ clawapps activity watch --include-replay # also receive 50-msg replay
137 
138## Diagnostics
139 
140$ clawapps doctor
141 
142Checks credentials, token TTL, DNS, relay /health, profile fetch, WS latency.
143Exit codes:
144 0 all green
145 2 credentials missing / expired
146 3 network / DNS issue
147 4 relay or backend unreachable
148 
149## Configuration
150 
151### Credentials file
152 
153~/.clawapps/credentials.json, mode 0600, schema v2:
154{"schema_version":2,"provider":"whatsapp",
155 "access_token":"...","refresh_token":"...",
156 "expires_at":"ISO8601","refresh_expires_at":"ISO8601",
157 "user_id":"uuid","logged_in_at":"ISO8601"}
158 
159### Environment variables
160 
161 CLAWAPPS_API_URL override BASE_URL (dev / custom deploys)
162 CLAWAPPS_ACCESS_TOKEN run without a credentials file (CI / one-shot agents)
163 CLAWAPPS_REFRESH_TOKEN use together with ACCESS_TOKEN
164 
165## Programmatic use
166 
167Built to be driven by other programs:
168 - Default output is NDJSON — pipe directly into jq / node / Python
169 - Streaming commands emit events in real time
170 - Exit codes (0 / 2 / 3 / 4) distinguish auth / network / backend failures
171 - Any token-taking command accepts it via env vars, no file needed
172 
173Typical pattern from inside another AI assistant:
174$ brief=$(clawapps connect --once "draft a one-page brief" \
175 | jq -r 'select(.event=="text") | .content' | tr -d '\n')
176$ echo "Brief: $brief" >> notes.md
177 
178## Troubleshooting
179 
180 "Not authenticated" clawapps doctor — token may be expired
181 WS connection drops doctor shows ws_upgrade.latency_ms
182 download says NO_URL file id gone or not accessible to your role
183 model set returns 503 backend preferences endpoint not live yet
184 activity watch closes token expired; re-login with matching channel
185 
186File issues at: https://github.com/OpenDigits/clawapps-cli/issues
187 
188## License
189 
190MIT
191