X (Twitter) integration for NanoClaw. Post tweets, like, reply, retweet, and quote. Use for setup, testing, or troubleshooting X functionality. Triggers on "setup x", "x integration", "twitter", "post tweet", "tweet".
Browser automation for X interactions via WhatsApp.
Compatibility: NanoClaw v1.0.0. Directory structure may change in future versions.
| Action | Tool | Description |
|---|---|---|
| Post | x_post | Publish new tweets |
| Like | x_like | Like any tweet |
| Reply | x_reply | Reply to tweets |
| Retweet | x_retweet | Retweet without comment |
| Quote | x_quote | Quote tweet with comment |
Before using this skill, ensure:
npm ls playwright dotenv-cli || npm install playwright dotenv-cli
.env (if Chrome is not at default location):
# Find your Chrome path
mdfind "kMDItemCFBundleIdentifier == 'com.google.Chrome'" 2>/dev/null | head -1
# Add to .env
CHROME_PATH=/path/to/Google Chrome.app/Contents/MacOS/Google Chrome
# 1. Setup authentication (interactive)
npx dotenv -e .env -- npx tsx .claude/skills/x-integration/scripts/setup.ts
# Verify: data/x-auth.json should exist after successful login
# 2. Rebuild container to include skill
./container/build.sh
# Verify: Output shows "COPY .claude/skills/x-integration/agent.ts"
# 3. Rebuild host and restart service
npm run build
launchctl kickstart -k gui/$(id -u)/com.nanoclaw # macOS
# Linux: systemctl --user restart nanoclaw
# Verify: launchctl list | grep nanoclaw (macOS) or systemctl --user status nanoclaw (Linux)
| Variable | Default | Description |
|---|---|---|
CHROME_PATH | /Applications/Google Chrome.app/Contents/MacOS/Google Chrome | Chrome executable path |
NANOCLAW_ROOT | process.cwd() | Project root directory |
LOG_LEVEL | info | Logging level (debug, info, warn, error) |
Set in .env file (loaded via dotenv-cli at runtime):
# .env
CHROME_PATH=/Applications/Google Chrome.app/Contents/MacOS/Google Chrome
Edit lib/config.ts to modify defaults:
export const config = {
// Browser viewport
viewport: { width: 1280, height: 800 },
// Timeouts (milliseconds)
timeouts: {
navigation: 30000, // Page navigation
elementWait: 5000, // Wait for element
afterClick: 1000, // Delay after click
afterFill: 1000, // Delay after form fill
afterSubmit: 3000, // Delay after submit
pageLoad: 3000, // Initial page load
},
// Tweet limits
limits: {
tweetMaxLength: 280,
},
};
Paths relative to project root:
| Path | Purpose | Git |
|---|---|---|
data/x-browser-profile/ | Chrome profile with X session | Ignored |
data/x-auth.json | Auth state marker | Ignored |
logs/nanoclaw.log | Service logs (contains X operation logs) | Ignored |
┌─────────────────────────────────────────────────────────────┐
│ Container (Linux VM) │
│ └── agent.ts → MCP tool definitions (x_post, etc.) │
│ └── Writes IPC request to /workspace/ipc/tasks/ │
└──────────────────────┬──────────────────────────────────────┘
│ IPC (file system)
▼
┌─────────────────────────────────────────────────────────────┐
│ Host (macOS) │
│ └── src/ipc.ts → processTaskIpc() │
│ └── host.ts → handleXIpc() │
│ └── spawn subprocess → scripts/*.ts │
│ └── Playwright → Chrome → X Website │
└─────────────────────────────────────────────────────────────┘
.claude/skills/x-integration/
├── SKILL.md # This documentation
├── host.ts # Host-side IPC handler
├── agent.ts # Container-side MCP tool definitions
├── lib/
│ ├── config.ts # Centralized configuration
│ └── browser.ts # Playwright utilities
└── scripts/
├── setup.ts # Interactive login
├── post.ts # Post tweet
├── like.ts # Like tweet
├── reply.ts # Reply to tweet
├── retweet.ts # Retweet
└── quote.ts # Quote tweet
To integrate this skill into NanoClaw, make the following modifications:
1. Host side: src/ipc.ts
Add import after other local imports:
import { handleXIpc } from '../.claude/skills/x-integration/host.js';
Modify processTaskIpc function's switch statement default case:
// Find: