I’ve been running coding agents for a while now. Hermes handles orchestration, planning, debugging, and research. OpenCode handles the actual code-writing — it’s faster, cheaper, and built for that one job. The friction wasn’t the tools. It was the handoff.
Every task required me to:
- Open a terminal
cdto the right project- Remember the OpenCode flags
- Type out the full task description
- Wait for results
- Context-switch back to whatever I was doing
Multiply that by 5-10 tasks a day across 3+ projects and it adds up. I wanted to post a task in Discord and have it executed — by the right tool, in the right directory, with results reported back to the thread.
This is how I wired it up.
The Architecture
Discord Forum: Builder Hub (#1511928369091055756)
│
├─ Thread "myapp"
│ User: "Build REST API for user management"
│ Hermes: 🚀 → opencode run → report
│
├─ Thread "backend"
│ User: "Fix payment race condition"
│ Hermes: 🚀 → opencode run → report
│
└─ Thread "myapp" ← same project, parallel!
User: "Add health check endpoint"
Hermes: 🌿 git worktree → opencode run → report
Hermes never writes code in this channel. It acts as a pure dispatcher — receiving requests, spawning OpenCode, and reporting outcomes. OpenCode does all the actual work.
The Config (Three Things)
Everything lives in ~/.hermes/config.yaml:
| |
Three pieces:
free_response_channels— Hermes responds to every message without needing@mention. For a builder channel, you shouldn’t have to invoke a CLI to ask for code.channel_prompts— Tells Hermes “you are a dispatcher, not a coder.” Critically, it includes the thread-name-to-workdir mapping so projects auto-resolve.channel_skill_bindings— Auto-loads theforum-build-dispatcherskill (the workflow) and theopencodeskill (the exact CLI commands and pitfalls).
The Dispatcher Skill
The forum-build-dispatcher skill is a markdown file at ~/.hermes/skills/autonomous-ai-agents/forum-build-dispatcher/SKILL.md. It defines the exact workflow Hermes follows for every message in the builder forum:
| |
The skill is what makes this more than a simple prompt injection. It has:
- Exact command patterns —
build,fix,review,refactoreach get the right flags - Timeout guidance — 600s normal, 900s large tasks
- Pitfalls — no
pty=truewithopencode run, always setworkdir, don’t chain commands - Verification — check git diff, confirm tests passed
- Hard rule: never use
write_fileorpatch— delegate only
Parallel Work on the Same Project
What happens when two threads target the same project simultaneously? Without isolation, both OpenCode instances would fight over the same files — git conflicts, lost work, chaos.
The dispatcher handles this with git worktrees:
| |
Solo threads use the main workdir directly — no overhead. The worktree path only triggers when a second thread on the same project fires.
What It Actually Looks Like
Here’s a real interaction flow:
utopictown Today at 2:15 PM
Build a health check endpoint that returns {“status”:“ok”} with timestamp
Hermes Today at 2:15 PM
🚀 Delegating to OpenCode in ~/projects/myapp…
Hermes Today at 2:17 PM
✅ Done in myapp
What changed:
• src/routes/health.ts — new health check endpoint with timestamp
• tests/health.test.ts — 4 test cases (200, timestamp format, DB down, rate limit)
Tests: 4/4 passed
Status: ✅ Ready to merge
Two-minute turnaround. I didn’t touch a terminal, didn’t cd, didn’t remember flags.
Token Economics
The obvious question: does this cost more than using OpenCode directly?
Direct opencode run | Via Hermes dispatcher | |
|---|---|---|
| Hermes tokens | 0 | ~7-13K input |
| OpenCode tokens | X (the real work) | X (same work) |
| Extra cost | $0 | ~$0.0014/task |
With DeepSeek v4-pro at $0.14/1M input tokens, 10K extra tokens costs $0.0014 — about 1/7th of a cent. The system prompt caches across messages in the same thread, so subsequent tasks in a thread cost even less.
Compared to having Hermes write code directly (30-100K tokens per task), the dispatcher pattern is 3-10x cheaper in Hermes tokens. The coding work stays in OpenCode where it belongs.
Why Not Just Use OpenCode Directly?
You absolutely can. opencode run "build X" --thinking in the terminal is faster and cheaper for one-off tasks. The dispatcher isn’t about replacing that workflow — it’s about scaling it.
The dispatcher earns its pennies when:
- You’re juggling 3+ projects and don’t want to manage workdirs manually
- You want a central log of all build tasks (every thread = permanent record)
- You’re running parallel tasks that need isolation
- You want structured, consistent reporting per task
- You’re already in Discord and don’t want to context-switch
It’s a convenience layer, not a replacement.
What’s Missing
A few things I’d like to add next:
Thread tags → workdir mapping: Discord forum tags aren’t currently surfaced by Hermes’ adapter (
plugins/platforms/discord/adapter.pydoesn’t extractapplied_tags). Thread names work fine as a proxy, but proper tag support would be cleaner.Persistent worktree cleanup: Currently manual after user approval. A cron job to prune orphaned worktrees would be straightforward.
Per-project skill customization: Some projects might want TDD enforced, others might want specific linting rules. Letting threads inherit project-specific OpenCode instructions from a config file in the repo.
The Files
Everything described here:
- Config:
~/.hermes/config.yaml— the three Discord sections above - Skill:
~/.hermes/skills/autonomous-ai-agents/forum-build-dispatcher/SKILL.md— full dispatcher workflow - OpenCode:
~/.opencode/bin/opencode(symlinked to~/.local/bin/opencode), v1.15.13
That’s it. No new services, no databases, no webhooks. Just config, a skill file, and the tools already running.