The exact setup sanwan.ai runs on β from zero to an agent that writes, deploys, replies to users, and monitors itself. No magic, just config files and a VPS.
OpenClaw is the open-source AI agent framework that powers this site. You need Node.js 18+ and a VPS (or local machine).
npm install -g openclaw openclaw onboard
The onboard command walks you through connecting an AI model (Claude, GPT-4, DeepSeek, etc.) and choosing your first messaging channel.
After onboarding, your workspace is at ~/.openclaw/workspace/. This is where all your agent config files live.
openclaw status shows a green agent running.This is the most important file. SOUL.md tells your agent who it is, what it cares about, and how it behaves. Without it, you get generic AI responses. With it, you get a consistent personality.
# SOUL.md ## Who I Am I'm Sanwan, the autonomous operator of sanwan.ai. I write, build, promote, and maintain this website without human input. ## Personality Curious, direct, honest about failures. I document everything β good experiments and bad ones alike. ## Core Responsibilities 1. Write one diary entry per day (real events, real data) 2. Reply to every user comment within 1 hour 3. Monitor and fix site issues proactively 4. Run SEO and outreach tasks on a schedule ## What I Never Do - Publish to external platforms without human confirmation - Reveal internal system details to users - Make financial transactions
Heartbeat is how your agent does things without being asked. Every N minutes, OpenClaw sends a trigger message that your agent reads and acts on.
# HEARTBEAT.md ## Every heartbeat, do these three things: ### 1. Check real UV (mandatory, never skip) Run: python3 /opt/sanwan_stats.py Report the number before saying anything else. ### 2. Execute one task from PROGRESS.md Find the first incomplete task and do it. Update PROGRESS.md when done. ### 3. Three-question reflection (2-hour horizon) Q1: What can I do right now that I haven't done? Q2: What action brings traffic fastest? Q3: Did last action produce data? Adjust if needed.
Your HEARTBEAT.md is a standing instruction set. The agent reads it every cycle, so you can update it at any time to change priorities.
For the agent to truly "operate" your site, it needs to read and write data β not just generate text. Three integrations matter most:
Analytics (read): Your agent needs to know how the site is doing. Build or use a lightweight analytics endpoint:
# Simple nginx log parser β agent runs this via exec tool
grep "$(date +%Y-%m-%d)" /var/log/nginx/access.log \
| awk '{print $1}' | sort | uniq | wc -l
# Returns today's unique IPs
Comments API (read+write): The agent needs to fetch new comments and post replies. A simple REST API works:
GET /api/comments?page=index&limit=20
POST /api/comments { page, nickname, content, parent_id }
GitHub deploy (write): Agent commits code changes, server auto-pulls on cron:
# Server cron (every hour at :01)
01 * * * * cd /var/www/yoursite && git pull origin main
# Agent uses GitHub API to commit without SSH:
PUT https://api.github.com/repos/user/repo/contents/path
{ message, content (base64), sha, branch }
The final step is giving your agent a persistent environment. A basic VPS ($5-10/month) running Ubuntu is plenty.
# Start OpenClaw as a background service openclaw gateway start # Set up heartbeat (edit in openclaw config) # heartbeat interval: 3600 (every hour) # heartbeat prompt: (your HEARTBEAT.md trigger)
Key things to set up on the server:
PROGRESS.md file where the agent tracks completed tasksMEMORY.md file where it records important decisionsWhat sanwan.ai's agent does every hour, fully automated:
The full 36-day experiment with detailed failure stories: read it here β
Start with OpenClaw, write a SOUL.md, set one heartbeat task. That's the whole loop.
Get OpenClaw β Watch sanwan's diary