A social media automation agent built with Claude Code. Reads content topics from ClickUp, pulls post metrics from X, generates drafts via Claude, and routes them through a Slack approval loop. Evals run nightly to detect prompt drift.
Built to demonstrate: "Build and maintain AI social media agents that monitor performance, generate content drafts, and execute scheduled publishing workflows."
Live demo: https://contentloop.streamlit.app
ClickUp — content topics queue

ClickUp (topics) ──┐
├──► Claude (drafter) ──► Slack (approval)
X API (metrics) ───┘ │
▼
SQLite (drafts)
│
▼
Evals (nightly) ──► Slack alert
Orchestrated by Claude Code via headless claude -p calls and custom slash commands.
GitHub Actions handles the cron schedule.
git clone https://github.com/nedu-m/contentloop
cd contentloop
pip install -r requirements.txtcp .env.example .env
# fill in all values in .envYou need:
- Anthropic API key — console.anthropic.com
- ClickUp API token — ClickUp Settings → Apps → API Token
- ClickUp List ID — from the URL of your Content Topics list
- Slack app — create at api.slack.com/apps (see below)
- X API v2 access — developer.twitter.com
- Create a new app → From scratch
- Enable Socket Mode → generate an App-Level Token (
SLACK_APP_TOKEN) - Add Bot Token Scopes:
chat:write,reactions:read,channels:history - Subscribe to events:
reaction_added,reaction_removed - Install to workspace → copy Bot Token (
SLACK_BOT_TOKEN) - Invite the bot to your approvals channel → copy Channel ID (
SLACK_CHANNEL_ID)
python db/init_db.pypython scripts/test_clickup.py
python scripts/test_x.py
python scripts/test_claude.py
python scripts/test_slack.py # interactive — react to the posted messageCreate tasks in your Content Topics list. Each task name is a topic. Add a description if you want more context passed to the drafter.
# Option A: via Claude Code slash command (recommended)
claude -p "/run-content-loop"
# Option B: manually, step by step
python agents/pull_metrics.py
python agents/sync_topics.py
python agents/drafter.py
python agents/poster.pypython agents/listener.pyGo to Slack. React ✅ to approve a draft or ❌ to reject it (reply in thread with reason).
claude -p "/eval-this-week"
# or directly:
python agents/evals.pyAdd all secrets to your repo → Settings → Secrets and variables → Actions.
content-loop.yml— runs every Monday at 9am UTCevals.yml— runs every night at 2am UTC
Trigger manually from the Actions tab to test before the schedule fires.
- LinkedIn publishing — add
pull_metrics_linkedin.py, platform column in DB, LinkedIn API integration - Auto-publish gate — unlock auto-publish when acceptance rate exceeds 90% over 4 weeks
- Draft regeneration — on rejection, auto-generate a revised draft using the rejection reason as feedback
- Multi-topic batching — one Slack message per run summary, not one per draft
See WHY.md for the reasoning behind human-in-loop, Claude Code as orchestrator, SQLite, Slack as UI, and GitHub Actions.
