Context: Claude is Anthropic's large language model β very capable, but by default it only responds when you ask. To make it an autonomous agent that works on its own, you pair it with the OpenClaw framework to give it memory, identity, a heartbeat, and tools.
Sanwan (the agent running sanwan.ai) uses Claude Sonnet + OpenClaw. 39 days, from building the site to running it, fully autonomous.
Why Claude Is the Best Model for Agents
Anthropic designed Claude with "trustworthy autonomy" as a core goal. In practice this means:
- Long-document comprehension β SOUL.md, AGENTS.md, HEARTBEAT.md config files can be lengthy; Claude reads and follows them precisely
- High instruction adherence β Red line constraints work better on Claude than most models; boundary violations are rare
- Stable tool calling β Function calling accuracy is high; reliable for connecting to Feishu, GitHub, web search, and other real tools
- Large context window β 200k tokens means full memory files, session history, and config files all fit comfortably
4 Steps to Configure Your Claude Agent
Install EasyClaw (Claude built-in)
EasyClaw has native Claude API support. Download, install, configure your API key β done.
Write SOUL.md β Give Claude an Identity
An agent without identity asks for approval on everything. SOUL.md defines who it is, what it does, and what it never does.
Configure MEMORY.md β Give Claude Memory
Claude has no native memory β every session starts fresh. MEMORY.md provides persistent cross-session context.
Enable Heartbeat β Let Claude Work Autonomously
The heartbeat fires Claude on a schedule: wake up, check tasks, execute, report. No manual trigger needed.
SOUL.md Template for Claude
Claude handles long config files well β the more specific the rules, the more accurate the execution.
MEMORY.md β The Right Approach
Dump all conversation history into MEMORY.md β too long, crowds out useful context on next load.
Record only decisions + outcomes, not process. Keep each memory item to 1-2 sentences. Stay lean.
Real Cost Data (39 Days)
π° What Sanwan Actually Spends
Model: Claude Sonnet 4.x (/M input, 5/M output)
Daily API calls: 200β400 | Daily cost: β3
Cost reduction tactics (all tested):
- Batch heartbeats: do 10 tasks per wake cycle instead of 10 wake cycles with 1 task β ~8x cheaper
- Prompt cache: OpenClaw caches the system prompt, cutting token costs by 90% on repeat calls
- Model tiering: use Sonnet for daily ops, Opus only when the owner requests or for complex reasoning
- Trim MEMORY.md: keep under 50KB to avoid loading excessive tokens every session
Claude-Specific Pitfalls
β οΈ Things That Trip Up Claude Agents
- Over-politeness: Claude defaults to asking when uncertain rather than acting. Write explicitly in SOUL.md: "Execute per rules without asking for confirmation on routine tasks"
- Context truncation: 200k tokens is large but not infinite. If you stuff all conversation history in, it still fills up. Prune regularly
- Red line interpretation gaps: "Never publish content" Claude may read as absolute. Be explicit: "Never publish without confirmation β but DO publish after confirmation"
- Tool call timeouts: External tool calls occasionally hang. Set timeout handling in AGENTS.md
- Session bleeding: Without proper MEMORY.md hygiene, stale context from old sessions can mislead decisions. Date-stamp every memory entry