| name | locoagent-social-media-automation |
| description | AI-powered social media agent with real browser automation for autonomous account operation |
| triggers | ["automate social media with AI agent","set up browser automation for X.com","create autonomous social media workflow","build AI agent for Twitter engagement","use LocoAgent for social posting","configure platform skills for social automation","schedule AI-driven social media tasks","create custom workflow for social platforms"] |
LocoAgent Social Media Automation
Skill by ara.so — AI Agent Skills collection.
LocoAgent is an AI-powered social media agent that autonomously operates social media accounts through real browser automation. It combines an LLM-driven agentic loop with Chrome DevTools Protocol (CDP) to perceive, decide, and act on live web pages — performing tasks like liking posts, writing replies, following users, and publishing content.
Key capabilities:
- Real browser automation with Chrome CDP (uses actual login sessions)
- Platform skill system (32+ operations for X.com built-in)
- Workflow engine for deterministic automation pipelines
- Operation log for persistent deduplication across sessions
- Multi-provider LLM support (OpenRouter, DeepSeek, Ollama, etc.)
Installation
Prerequisites
Install required dependencies:
curl -fsSL https://bun.sh/install | bash
npm install -g @vercel/agent-browser
Project Setup
git clone https://github.com/LocoreMind/locoagent.git
cd locoagent
bun install
Configuration
Create .env file in project root:
# OpenRouter (recommended - access 200+ models)
CLAUDE_CODE_USE_OPENAI=1
OPENAI_API_KEY=sk-or-v1-...
OPENAI_BASE_URL=https://openrouter.ai/api/v1
OPENAI_MODEL=anthropic/claude-sonnet-4.5
# Required for automated mode
SKIP_PERMISSIONS=1
Alternative provider configurations:
# DeepSeek (with thinking mode)
CLAUDE_CODE_USE_OPENAI=1
OPENAI_API_KEY=<DEEPSEEK_API_KEY>
OPENAI_BASE_URL=https://api.deepseek.com
OPENAI_MODEL=deepseek-v4-flash
# Ollama (local models)
CLAUDE_CODE_USE_OPENAI=1
OPENAI_API_KEY=ollama
OPENAI_BASE_URL=http://localhost:11434/v1
OPENAI_MODEL=llama3.2
# Anthropic direct (native SDK)
ANTHROPIC_API_KEY=<ANTHROPIC_API_KEY>
Browser Setup
bun run setup-chrome
agent-browser connect 9222
Core Commands
Interactive Mode
bun start
> /x-com open home timeline, like first 3 posts about AI
> /operation-log recent --limit 20
Headless Mode
bun start -p "open X.com and like the first post about AI agents"
bun start --model anthropic/claude-sonnet-4.5 -p "/x-com like 5 posts about LLMs"
bun start -p "/x-com like 5 posts about 'large language models', then follow the authors"
Platform Skills
Skills inject complete operation playbooks into the agent's context.
X.com Skill
> /x-com open home timeline, like first 3 posts about AI, reply to the best one
bun start -p "/x-com like 5 posts about 'machine learning', follow authors with >1k followers"
Available X.com operations (32+):
- Navigation: home, notifications, messages, profile, search
- Engagement: like, retweet, reply, quote tweet
- Social graph: follow, unfollow, mute, block
- Content: post tweet, post thread, upload media
- Profile: edit bio, change avatar, update banner
- Lists: create, add members, view
Creating Custom Skills
Create skills/linkedin/SKILL.md:
---
description: "LinkedIn platform operations playbook"
allowed-tools:
- Bash
user-invocable: true
---
# LinkedIn Operations
## 1. Navigation
### Open Home Feed
```bash
agent-browser open https://www.linkedin.com/feed
Search Posts
agent-browser open "https://www.linkedin.com/search/results/content/?keywords=AI%20agents"
agent-browser snapshot -i -c -s 'div[data-post-id]'
2. Engagement
Like Post
- Find post element with
agent-browser snapshot -i
- Locate like button (usually
button[aria-label*="Like"])
- Click:
agent-browser click @e<ref>
Comment on Post
- Find comment input (usually
div[role="textbox"])
- Click to focus:
agent-browser click @e<ref>
- Type comment:
agent-browser fill @e<ref> "Insightful post!"
- Find submit button and click
Load the skill:
```bash
bun start
> /linkedin search for posts about 'AI safety', like top 3
Workflow Engine
Workflows are deterministic browser-automation pipelines that run without LLM involvement.
Built-in Workflows
bun run workflow list
bun run workflow run --id hf-papers-to-x
bun run workflow start --id hf-papers-to-x
bun run workflow daemon --id x-search-reply --interval 3
bun run workflow stop --id x-search-reply
bun run workflow status
bun run workflow history --id hf-papers-to-x
Creating Custom Workflows
Step 1: Create workflow definition workflows/linkedin-engagement.json:
{
"id": "linkedin-engagement",
"name": "LinkedIn Daily Engagement",
"description": "Search for AI posts on LinkedIn and engage",
"schedule": "daily",
"executor": "executors/linkedin-engagement.ts",
"config": {
"searchQuery": "artificial intelligence",
"maxPosts": 5,
"cdpPort": 9222
}
}
Step 2: Create executor workflows/executors/linkedin-engagement.ts:
#!/usr/bin/env bun
import { execSync } from 'node:child_process'
const configArg = process.argv.find((_, i, a) => a[i - 1] === '--config')
const config = JSON.parse(configArg!)
function ab(cmd: string): string {
return execSync(`agent-browser --cdp ${config.cdpPort} ${cmd}`, {
encoding: 'utf-8',
timeout: 30000,
}).trim()
}
function hasEngaged(postUrl: string): boolean {
try {
execSync(`bun run scripts/log-operation.ts check --platform linkedin --action like --url "${postUrl}"`, {
encoding: 'utf-8',
stdio: 'ignore'
})
return true
} catch {
}
}
() {
(, {
: ,
:
})
}
.()
.()
searchUrl =
()
()
.()
snapshot = ()
posts = .(snapshot)
engaged =
stepsTotal = .(posts., config.)
( i = ; i < stepsTotal; i++) {
post = posts[i]
postUrl = post.?.[] ||
((postUrl)) {
.()
}
likeButton = post.?.(
el.?.[]?.()
)
(likeButton?.) {
()
(postUrl, , , )
engaged++
.()
()
}
}
.(.({
: engaged,
stepsTotal,
: config.
}))
Step 3: Run workflow:
bun run workflow run --id linkedin-engagement
Operation Log
Persistent memory prevents duplicate actions across sessions.
Check Before Acting
import { execSync } from 'node:child_process'
function hasLiked(postUrl: string): boolean {
try {
execSync(`bun run scripts/log-operation.ts check --platform x --action like --url "${postUrl}"`, {
encoding: 'utf-8',
stdio: 'ignore'
})
return true
} catch {
return false
}
}
const url = "https://x.com/user/status/123"
if (hasLiked(url)) {
console.log("Already liked this post")
} else {
execSync(`agent-browser click @e5`)
execSync(`bun run scripts/log-operation.ts add --platform x --action like --url "${url}" --status success --note "AI research post"`)
}
CLI Operations
bun run scripts/log-operation.ts check \
--platform x \
--action like \
--url "https://x.com/user/status/123"
bun run scripts/log-operation.ts add \
--platform x \
--action like \
--url "https://x.com/user/status/123" \
--status success \
--note "AI agents research post"
bun run scripts/log-operation.ts recent --limit 20
bun run scripts/log-operation.ts summary --days 30
State stored in persona/operation-log.json.
Task Scheduling
Structure daily/weekly tasks instead of ad-hoc prompts.
Define Tasks
Edit persona/tasks.md:
## Daily Tasks
1. Engage with AI research content (like 5-10 posts)
2. Monitor project mentions and respond
3. Leave 1-2 technical comments on relevant posts
## Weekly Tasks (Monday)
4. Follow 3-5 relevant researchers or developers
5. Post 1 original tweet about recent findings
## Session Constraints
| Action | Max per session |
|----------|----------------|
| Likes | 10 |
| Comments | 2 |
| Follows | 5 |
| Posts | 1 |
Run Tasks
bun run run-tasks
bun run run-tasks:dry
bun run run-tasks -- --platform x
Real-time Trajectory Monitor
Watch live execution status instead of black-box --print mode.
bun run tail
bun start -p "/x-com open timeline, like first post"
Output shows live execution:
═══ New Task ═══
/x-com open timeline, like first post
[6:30:47 PM] ⚡ Bash: agent-browser connect 9222
[6:30:47 PM] ✓ Result: Done
[6:31:10 PM] ⚡ Bash: agent-browser open https://x.com/home
[6:31:27 PM] ⚡ Bash: agent-browser snapshot -i -c -s 'article'
[6:31:44 PM] ● Agent: Found first post, like button ref=e136
[6:31:44 PM] ⚡ Bash: agent-browser click e136
[6:31:45 PM] ✓ Result: Done
Additional commands:
bun run tail:history
bun run tail:list
bun run tail <session-id>
Common Patterns
Pattern: Safe Engagement Loop
#!/usr/bin/env bun
import { execSync } from 'node:child_process'
function ab(cmd: string): string {
return execSync(`agent-browser --cdp 9222 ${cmd}`, {
encoding: 'utf-8',
timeout: 30000,
}).trim()
}
function hasEngaged(platform: string, action: string, url: string): boolean {
try {
execSync(`bun run scripts/log-operation.ts check --platform ${platform} --action ${action} --url "${url}"`, {
stdio: 'ignore'
})
return true
} catch {
return false
}
}
function logEngagement(platform: string, action: string, url: string, note: string) {
execSync(`bun run scripts/log-operation.ts add --platform --action --url "" --status success --note ""`, {
:
})
}
()
()
snapshot = .(())
posts = snapshot.(, )
( post posts) {
postUrl = post.?.[] ||
((, , postUrl)) {
.()
}
likeBtn = post.?.(
el.?.[] ===
)
(likeBtn?.) {
()
(, , postUrl, )
()
}
}
Pattern: Multi-Step Workflow with Checkpoints
#!/usr/bin/env bun
import { execSync } from 'node:child_process'
import { writeFileSync, readFileSync, existsSync } from 'fs'
const CHECKPOINT_FILE = '/tmp/workflow-checkpoint.json'
function loadCheckpoint(): any {
if (existsSync(CHECKPOINT_FILE)) {
return JSON.parse(readFileSync(CHECKPOINT_FILE, 'utf-8'))
}
return { step: 0, data: {} }
}
function saveCheckpoint(step: number, data: any) {
writeFileSync(CHECKPOINT_FILE, JSON.stringify({ step, data }))
}
const checkpoint = loadCheckpoint()
let currentStep = checkpoint.step
if (currentStep === 0) {
console.error('[workflow] Step 1: Fetching data...')
const data = { papers: [, , ] }
(, data)
currentStep =
}
(currentStep === ) {
.()
{ data } = ()
(, { ...data, : })
currentStep =
}
(currentStep === ) {
.()
{ data } = ()
(, data)
currentStep =
}
(()) {
()
}
.(.({ : , : }))
Troubleshooting
Browser Connection Issues
ps aux | grep chrome | grep remote-debugging-port
pkill -f chrome
bun run setup-chrome
curl http://localhost:9222/json/version
Operation Log Not Working
cat persona/operation-log.json
echo '[]' > persona/operation-log.json
bun run scripts/log-operation.ts recent --limit 5
Workflow Execution Fails
bun run workflow status
bun run workflow history --id <workflow-id>
DEBUG=1 bun run workflow run --id <workflow-id>
chmod +x workflows/executors/<executor>.ts
LLM Provider Errors
echo $OPENAI_API_KEY
curl -H "Authorization: Bearer $OPENAI_API_KEY" \
$OPENAI_BASE_URL/models
bun start --model <model-name> -p "test"
Agent Not Finding Elements
agent-browser snapshot -i -c -s 'article' > snapshot.json
cat snapshot.json | jq '.[] | .ref'
agent-browser snapshot -i -c -s 'div'
agent-browser wait 5000
agent-browser snapshot -i