A small OpenClaw-first helper skill + scripts for dependable X/Twitter access using layered transports and capability checks:
- Peeper — no-credit public-account watcher for known handles, included in this kit and also published as a standalone repo.
- OpenClaw xAI
x_search— preferred X search/research transport, using signed-in Grok/xAI OAuth auth profiles when available. - xurl — primary authenticated X account transport for tweet reads, bookmarks, timeline, media, and user actions.
- Direct bearer API — deterministic script/API transport for exact X API calls, metrics, pagination, and compatibility scripts.
- Browser fallback — last resort for UI-only cases or API-tier blocks.
The kit is designed to be shareable: it ships no secrets and should work for any OpenClaw/VPS user who brings their own X Developer app and credentials.
- OpenClaw operators who want X/Twitter read/search/bookmark capability.
- Agent builders who need a repeatable OAuth2/xurl setup path.
- Teams that want to monitor known public X accounts without giving an agent access to the real brand account.
- Technical friends who can bring their own X Developer app, callback URL, and credentials.
This is a technical v0 kit, not a hosted service or one-click consumer installer.
- Watch known public accounts → use Peeper first. It polls public profile
endpoints with
curl, local state, and cache fallback. It does not use X API bearer tokens, X OAuth login, xAI/Grok credits, or a paid RSS bridge. - Search/research X broadly → use OpenClaw/xAI
x_searchthrough the signed-in Grok/xAI OAuth profile when available. - Read exact tweets, timelines, bookmarks, or account-aware surfaces → use
xurlwith the right OAuth context. - Like, repost, reply, bookmark, DM, follow, or post → use
xurlonly after explicit approval or a separate standing policy. - Company/brand account without direct agent access → monitor with Peeper; use a sandbox/service X account only for approved actions.
- No X account, no X API, no Grok/xAI → Peeper can still monitor known public accounts.
- Grok/SuperGrok or xAI auth profile →
x_searchcan handle broad X research/search, but not bookmarks, account timelines, metrics, or actions. - X account plus xurl OAuth/developer app → exact tweet reads, account-aware reads, bookmarks, media, and approved actions become possible, subject to X API tier, scopes, and spend caps.
- Company/brand account that should not be exposed to the agent → do not connect the real account. Use Peeper for monitoring and a sandbox/service X account only for explicitly approved actions.
- Route by capability first: exact tweet read, search, bookmarks, DMs, posting, media, or broad discovery may require different auth contexts.
- Monitor known public accounts with Peeper before spending X API or xAI calls.
- For ordinary "search Twitter/X", research, summaries, and cited discovery, prefer OpenClaw/xAI
x_searchthrough the signed-in xAI/Grok auth profile. Do not spend X API credits or reach for an xAI API-key fallback unless OAuth is unavailable. - Treat
xurlas an external credential adapter. This kit shells out toxurl; it does not parse, mutate, upload, or own~/.xurl. - Keep durable Twitter memory/cache layers explicit. Peeper provides the bundled known-account cache path; larger analysis memory should still live in your own project state.
- Keep public/mutating actions approval-gated even when auth is healthy.
This repo owns the single agent-facing Twitter/X skill plus the portable setup, diagnostics, templates, and test matrix.
In a running OpenClaw workspace, keep responsibilities split:
x-twitter-kitowns agent intent routing, setup, diagnostics, and proof.- The bundled
xurlskill owns rawxurlcommand mechanics only. - Optional host-specific account names, secret refs, and standing policies live
in a local untracked
LOCAL_DEFAULTS.mdbeside the installed skill.
Do not keep a separate host-specific Twitter/search skill active for the same workspace. Do not copy host-specific secrets, profile names, or one-off account assumptions into this public kit.
skills/x-twitter-kit/
├── SKILL.md
├── VISION.md
├── fixtures/
│ └── edgewallet-cache.json
├── scripts/
│ ├── peeper.mjs
│ ├── twitter-doctor.sh
│ └── xurl-oauth2-auth.sh
└── templates/
├── Caddyfile.callback.example
├── LOCAL_DEFAULTS.example.md
├── openclaw-xai-config.patch.json5
└── privacy-policy-x-oauth.md
Additional docs:
- OpenClaw install notes
- Local routing guide
- X OAuth setup notes
- Troubleshooting
- Security policy
- Contributing
-
Run Peeper for no-credit known-account monitoring:
node skills/x-twitter-kit/scripts/peeper.mjs --handle edgewallet --limit 5
Watch mode uses local seen-state and only emits newly observed tweets after the first seed run:
node skills/x-twitter-kit/scripts/peeper.mjs --handle edgewallet --watch --interval 61
-
Install
xurlif you need authenticated account reads or actions:npm install -g @xdevplatform/xurl
-
Create/configure an X Developer app:
- App type: Web App / Automated App / Bot
- Permissions: Read + Write + DM if you need bookmarks, posting, and DMs
- Callback URL: your public callback route, e.g.
https://example.com/callback - Privacy/terms pages: use the templates in
skills/x-twitter-kit/templates/
-
Register app credentials with
xurloutside of agent/chat context. Do not paste credentials into chat or commit them. -
Sign into xAI/Grok in OpenClaw for OAuth-backed
x_search:openclaw models auth login --provider xai --method oauth openclaw models auth list --provider xai
On a headless/VPS setup, use device-code auth when available:
openclaw models auth login --provider xai --device-code
-
Run OAuth2 auth for X account surfaces:
skills/x-twitter-kit/scripts/xurl-oauth2-auth.sh \ --app default \ --redirect-uri https://example.com/callback
-
Run the doctor:
XTK_EXPECTED_X_USERNAME=your_handle \ XTK_BOOKMARK_APP=default \ skills/x-twitter-kit/scripts/twitter-doctor.sh
If your OAuth2 client registration is in a separate xurl app, set
XTK_BOOKMARK_APPto that app name. -
Install the skill into OpenClaw:
cp -R skills/x-twitter-kit ~/.openclaw/workspace/skills/Or configure
skills.load.extraDirsto point at this repo'sskillsdirectory. See OpenClaw install notes. -
Optional: add local host defaults:
cp skills/x-twitter-kit/templates/LOCAL_DEFAULTS.example.md \ ~/.openclaw/workspace/skills/x-twitter-kit/LOCAL_DEFAULTS.mdEdit the local copy with your expected auth profile names, xurl username, secret refs, and standing policies. Do not commit secrets or token values.
- Peeper is for discovering public tweet IDs from known public accounts. It uses unofficial public endpoints, local cache fallback, and no X/xAI auth. Treat it as a practical monitor, not a permanent platform contract.
- Peeper's default public-source path tries FxTwitter first, falls back to syndication, and then falls back to stale local cache before failing.
- Bookmarks require OAuth2 user context. OAuth1 and app-only bearer are not enough.
- Some xurl setups keep OAuth2 client registration and default OAuth1/bearer credentials under different app names. That is okay; use
XTK_BOOKMARK_APP/xurl --app <oauth2-app>for OAuth2-only endpoints. x_searchshould be the default for broad discovery and research, and it should prefer OpenClaw's xAI OAuth auth profile. It is not a replacement for bookmarks, posting, metrics, pagination, or other structured/account actions.- If both xAI OAuth and
XAI_API_KEYare configured, treat the API key as a fallback, not the normal Twitter-search lane. - Public/mutating actions — posting, replies, DMs, likes/reposts, follows, bookmark mutation, deletes — should stay approval-gated.
- Never commit or paste
~/.xurl, OAuth callback codes, client secrets, access/refresh tokens, bearer tokens, or xAI keys.
scripts/ci-check.shci-check.sh includes scripts/test.sh, an offline fake-command capability
matrix for the doctor. It exercises:
- Peeper no-credit monitoring, proving no auth, X API, or xAI path is used.
- xAI/Grok OAuth auth-profile primary routing.
- Expired/stale OAuth profile refresh smoke behavior.
XAI_API_KEYfallback behavior when OAuth is absent.xurlexact read, search, and bookmark checks.- Direct bearer fallback checks without printing bearer values.
- Expected-user mismatch failure behavior.
- Malformed xAI auth JSON.
- Missing and partial OpenClaw config surfaces.
- xurl live read failures.
- Direct bearer HTTP failures.
- API-key fallback secret-leak canaries.
- Guardrails that validation does not call mutating xurl verbs such as post, reply, like, repost, delete, follow, DM, mute, or block.
The online runner is opt-in because it spends live xAI/X calls and can fail when credentials, subscriptions, or X API credits are unavailable:
XTK_RUN_ONLINE_TESTS=1 scripts/test-online.shBy default it runs only non-mutating checks:
- xAI/Grok auth-profile model smoke, then a direct xAI Responses
x_searchrequest using the OpenClaw xAI OAuth profile. xurl readagainstXTK_TEST_TWEET_URL.xurl searchagainstXTK_SEARCH_QUERY.
Additional online checks are explicit:
XTK_RUN_ONLINE_TESTS=1 \
XTK_ONLINE_BOOKMARKS=1 \
XTK_BOOKMARK_APP=default \
scripts/test-online.shXTK_RUN_ONLINE_TESTS=1 \
XTK_ONLINE_BEARER=1 \
XTK_BEARER_OP_REF='op://Vault/Item/Bearer Token' \
scripts/test-online.shThe online runner never calls posting, reply, like, repost, delete, follow, bookmark-mutation, DM, mute, or block commands. Bookmark list checks store temporary JSON only long enough to validate shape and do not print bookmark contents.
For live auth validation, run the doctor with your own credentials/config:
XTK_EXPECTED_X_USERNAME=your_handle \
XTK_BOOKMARK_APP=default \
skills/x-twitter-kit/scripts/twitter-doctor.sh