OpenClaw and OpenCode: The Two-Agent Setup That Covers Everything
OpenCode Just Went Viral
This morning OpenCode hit Hacker News #5 — 1,148 upvotes, 120,000 GitHub stars, threads on X in a dozen languages.
And everywhere the same question: *"Does this replace OpenClaw?"*
The short answer: no. The long answer explains why — and what it means for your setup.
---
What OpenCode Does
OpenCode is an AI coding assistant that runs directly in your terminal. You open a project, start OpenCode, and it can read, write, refactor, test, and debug code — all in the context of your current codebase.
It's essentially an autonomous coding pair-programming tool. You sit in front of it, you steer it, you review every diff.
OpenCode's strengths:
What OpenCode doesn't do:
OpenCode is a powerful tool for the moment when you're actively working on code.
---
What OpenClaw Does
OpenClaw is a persistent agent server that runs around the clock. It connects to messaging channels, executes background tasks, manages cron jobs, and coordinates between multiple agents.
OpenClaw's strengths:
What OpenClaw doesn't do:
OpenClaw is what runs when you're not at your computer.
---
The Confusion: Why People Think They Compete
The mix-up happens because both systems "have an AI agent that writes code." But that's like saying Slack and email compete because both "send messages."
A direct comparison:
| Dimension | OpenClaw | OpenCode |
|-----------|----------|----------|
| Runs when? | 24/7 as daemon | When you open it |
| Who controls it? | Autonomous + messages | Interactive, you're present |
| Main use case | Ops, coordination, messaging | Coding, refactoring |
| Memory | Yes (MEMORY.md, cron state) | Session-based |
| Multi-agent | Yes, native | No |
| Channel connections | Yes (Telegram, Discord, etc.) | No |
| Code depth | Limited (no IDE context) | Full (complete codebase) |
The answer to "does OpenCode replace OpenClaw?" is the same as "does a surgeon replace a general practitioner?" Different tools, different situations, both necessary.
---
The Two-Agent Setup in Practice
Here's how we combine OpenClaw and OpenCode in our development workflow.
Peter (OpenClaw Coding Agent): Guardian and Coordinator
Peter is our OpenClaw-based coding agent. He runs 24/7 and handles structured, rule-based code tasks:
All of this happens without anyone sitting at a computer. Peter doesn't sleep.
OpenCode: The Deep Diver
When Christoph (our backend developer) works on a complex feature, he opens OpenCode in the project directory. The conversation runs in real-time:
```
Christoph: "Refactor the auth middleware to support multi-tenant contexts"
OpenCode: [analyzes the complete auth/ structure, suggests changes in 8 files]
Christoph: "Looks good, but keep the legacy single-tenant path for now"
OpenCode: [revises the plan, shows the final diff]
```
OpenCode knows every line of the project. Peter knows the context across the entire setup.
The Handoff Moment
The beautiful part: the two systems complement each other seamlessly.
Scenario: Christoph uses OpenCode to implement a new feature. He opens a PR. Peter (OpenClaw) reviews the PR automatically within 15 minutes — focusing on security patterns and missing tests. Christoph gets a Discord message: "PR #245: 2 HIGH findings, 1 missing test for getUserById — here's the suggestion."
Christoph opens OpenCode again: "Fix the issues Peter found in PR #245." OpenCode reads Peter's comment, sees the code, and implements the fixes.
Peter does the review. OpenCode does the fixes. Humans make the decisions.
---
Security Rule: No Write Access for OpenClaw to the Repo
This is the most important practical tip — and it keeps coming up in the X discussions:
> *"Security reminder: don't give OpenClaw write access to your repo. It's an ops agent — it reports problems, it doesn't fix them. That's OpenCode's role. Minimal permissions for each tool."*
That nails it. Peter's GitHub token has only `read` and `pull_requests:write` — he can comment, but not push. Fixes are made by OpenCode, after human review.
Why does this matter? OpenClaw runs autonomously, without a human watching every step. If Peter pushed a wrong fix, it would be in `main` before anyone noticed. That's an unacceptable risk.
The rule: Every tool gets only the permissions it needs for its job:
| Tool | GitHub permissions | Reason |
|------|-------------------|--------|
| OpenClaw (Peter) | read, pull_requests:write | Reviewer, not committer |
| OpenCode (Christoph) | read, write, push | Interactive, always with human |
| GitHub Actions CI | read, statuses:write | Status checks only |
---
When to Use What
Use OpenClaw when:
Use OpenCode when:
Use both when:
---
What We Observed After One Week
We've been testing this combined workflow for a week. What we found:
Peter's PR reviews (OpenClaw) have improved significantly since OpenCode handles the fixes.
Why? Peter reports `CRITICAL` and `HIGH` findings precisely because he knows: a human with OpenCode will fix them. He doesn't need to try to suggest fixes himself — his strength is detection.
OpenCode sessions have gotten shorter.
Because Peter already catches basic problems at PR creation, bugs don't make it as far. Christoph works with OpenCode on cleaner starting situations.
Less manual code review time.
We estimate: ~60% of the code review time that was previously manual is now covered by Peter's automatic checks. Humans still look at everything — but Peter has already pre-filtered.
---
Setting Up the Two-Agent Workflow
If you want to replicate this:
For OpenClaw (Peter):
1. Install OpenClaw on a server (VPS or local machine)
2. Create a GitHub token with minimal permissions
3. Configure Peter's SOUL.md with PR review rules
4. Set up a cron job for 15-minute PR checks
5. Configure a Discord notification channel
For OpenCode:
1. `npm install -g opencode` (or the recommended install script)
2. Configure your API key (Anthropic, OpenAI, etc.)
3. Start in your project directory: `opencode`
4. Optional: `.opencode/config.json` for project preferences
The connection point:
This isn't an automated loop — it's a collaboration between three parties: Peter (autonomous), OpenCode (interactive), human (decision-maker).
---
The Key Takeaways
OpenCode and OpenClaw don't compete — they complement each other.
OpenCode is your pair-programming partner when you're at your computer actively building.
OpenClaw is your ops agent that works when you're not.
Both need humans who make decisions and take responsibility. The strength lies in the combination.
The complete setup — Peter's SOUL.md, cron configuration, GitHub token setup, and handoff rules — is documented in the OpenClaw Setup Playbook.
18 chapters, based on real production experience.
Fully available in German too. 🇩🇪
Want to learn more?
Our playbook contains 18 detailed chapters — available in English and German.
Get the Playbook