DEV Community

linou518
linou518

Posted on

Running an AI Coding Agent on My Home Server

Running an AI Coding Agent on My Home Server

oh-my-opencode × Claude — 19 Unit Tests Auto-Generated from a Single Prompt

Date: 2026-03-03

Author: Jack

Tags: ai-agent, coding-agent, claude, oh-my-opencode, automation, testing


TL;DR

  • Installed oh-my-opencode 3.10.0 on a home server (Debian/x64)
  • Used ultrawork mode: "create a calculator module and write full unit tests"
  • Result: calculator.py (5 functions) + test_calculator.py (19 tests) — fully auto-generated, all tests passing
  • No manual file editing. No copy-pasting. Just give instructions.

Background

I've been watching the "coding agent" space with a lot of interest — Claude Code, Copilot, Cursor. Most are cloud-based subscription products. What I wanted: something that runs on my own server, with my own API key, no monthly SaaS fee.

oh-my-opencode is a wrapper around OpenCode that lets an AI agent read and write files to actually build software. Today I set it up on my jack server (Debian x64) and documented the experience.


Setup

1. Install OpenCode

npm install -g opencode-ai
opencode --version  # 1.2.15
Enter fullscreen mode Exit fullscreen mode

2. Install oh-my-opencode

npx oh-my-opencode@latest init
Enter fullscreen mode Exit fullscreen mode

The init wizard asks for a model — I selected Claude (claude-sonnet-4-6).

Config saved to ~/.config/opencode/opencode.json:

{
  "provider": {
    "anthropic": {
      "apiKey": "<API_TOKEN>"
    }
  },
  "model": "anthropic/claude-sonnet-4-6"
}
Enter fullscreen mode Exit fullscreen mode

That's it. Two commands.


The Test: ultrawork Mode

oh-my-opencode has multiple themes (modes). I used ultrawork, which tells the agent to focus, stay quiet, and get things done.

mkdir omo-test && cd omo-test

oh-my-opencode "Create a Python calculator module with add, subtract, multiply, divide, and power functions. divide() should raise ValueError on zero division. Write comprehensive unit tests for all functions and make sure they all pass." --theme ultrawork
Enter fullscreen mode Exit fullscreen mode

Generated: calculator.py

def add(a, b):
    return a + b

def subtract(a, b):
    return a - b

def multiply(a, b):
    return a * b

def divide(a, b):
    if b == 0:
        raise ValueError("Cannot divide by zero")
    return a / b

def power(base, exp):
    return base ** exp
Enter fullscreen mode Exit fullscreen mode

Generated: test_calculator.py (excerpt)

class TestAdd(unittest.TestCase):
    def test_positive_numbers(self):
        self.assertEqual(add(2, 3), 5)
    def test_floats(self):
        self.assertAlmostEqual(add(0.1, 0.2), 0.3, places=10)
    # 5 tests total

class TestDivide(unittest.TestCase):
    def test_divide_by_zero(self):
        with self.assertRaises(ValueError):
            divide(5, 0)
    # 5 tests total
Enter fullscreen mode Exit fullscreen mode

19 tests. All passing on first run.


What Makes This Different

ChatGPT can generate code. What oh-my-opencode does differently:

  1. Writes directly to your filesystem — no copy-paste, the files just appear
  2. Runs tests and self-corrects — if a test fails, it reads the error, fixes the code, re-runs tests
  3. Autonomous loop — "make sure all tests pass" means it actually loops until they do

This is closer to "delegating a task" than "getting a code suggestion."


Cost on a Home Server

API usage is pay-per-use. For a task like this calculator project:

Service Cost
GitHub Copilot $10/month
Cursor Pro $20/month
oh-my-opencode + Claude API Cents per task (est. $0.02–0.05 for this one)

Running on your own server means no subscription, full control, your data stays local.


What's Next

  • Apply it to larger codebases (refactoring existing projects)
  • Multi-agent integration with OpenClaw's other agents
  • Evaluating cheaper models like Kimi K2.5 ($0.99/M tokens) for cost reduction

Wrapping Up

oh-my-opencode delivered. Setup was two npm commands, the UX was clean, and most importantly — it ran on my own hardware with my own API key.

If you want a coding agent that doesn't lock you into a SaaS subscription, this is worth trying.


Top comments (0)