Case study · kthulu-go

kthulu-go: let the agent work on structure

An AI-assisted Go framework: the architecture is described as a plan, a modular monolith is generated from it, and the whole CLI is exposed as an MCP server.

Go · Templ + HTMX · Fx · MCP · MCP AppsGitHub ↗Site ↗

The problem

Asking an agent to “add payments” to an empty or messy project produces code that works today and doesn’t fit tomorrow. The agent works on loose text: it doesn’t know where things go, which conventions exist or which modules depend on which. The result depends on the luck of the prompt.

I wanted to give the agent what you give a new person on the team: a plan, a predictable structure and tools that respect that structure.

Decisions

Architecture as code. kthulu plan produces a YAML blueprint of the system (modules, fields, features) and kthulu create turns it into a project. The starting point is a plan you can review, not an empty folder.

A modular monolith by feature. Code is organised in vertical slices by feature, not by technical layer, with Go, Templ and HTMX. Each module is cohesive, and an agent can work inside one without touching the others.

The whole CLI as an MCP server. Any compatible agent (Claude, Cursor and others) can use Kthulu to generate and change software with the same commands a person uses. Kthulu also generates MCP servers: the mcp template creates a dependency-free one with an MCP Apps interface and protocol tests.

Declare instead of repeating. Validation rules are written in the blueprint and generate the Validate() method, its enforcement in the service and 422 responses with per-field errors.

What is built

  • Planning and scaffolding from a blueprint, with templates and composable features (payments, cart, queues, mail, storage).
  • Database-backed job queues with retries, dead letters and recurring tasks, with no extra infrastructure.
  • Migrations that compare entities against the live database and generate additive changes only; destructive ones are reported but never applied.
  • An interactive console, BDD with Gherkin and a terminal agent (kthulu coder).
  • Landing page and docs at kthulu-go.vercel.app.

What I learned

The best prompt for an agent is a good project structure. When the plan, the conventions and the tools are explicit, the agent stops guessing and the generated code looks like what the team would write.

Next casepdfcn-rs: PDFs as components, no browser →