Architecture-First AI Development

Stop vibing.
Start building.

AI agents write code fast, but without architectural constraints, they produce unmaintainable spaghetti. vibe-go provides the structure so AI produces production-grade Go from day one.

Purpose-built for AI agents and vibe coding. vibe-go provides the architectural constraints that AI needs but doesn't have — so the code it produces is production-grade, not just "it compiles."
connect-go ent + pgx koanf slog opentelemetry buf

The Vibe Coding Problem is real

"Vibe coding" — letting AI write code by intuition without engineering rigor. It feels productive until it isn't.

Architecture Drift

AI generates code that works in isolation. Each file follows a different pattern. No consistent layering, no dependency direction. Three months in, the codebase is a maze.

Context Window Waste

Without clear interfaces, the agent reads 50 files to understand how to add one field. The context window fills with boilerplate before reaching the actual task.

Implicit Coupling

Agent A writes storage logic that imports service types. Agent B adds a handler that calls the DB directly. Nobody notices until the refactor costs 10x.

Rewrite Loops

Sprint 1: AI generates a working feature. Sprint 2: new feature conflicts with Sprint 1's architecture. Sprint 3: AI suggests rewriting everything. Sound familiar?

AI Code Bad Cases

Patterns we've seen repeated across AI-generated Go projects.

01

God Handler — 300 lines of business logic in an HTTP handler

Validation, DB queries, Redis calls, event publishing — all in one function. The agent "just made it work" without layering.

02

Viper Global Singleton — viper.Get("db.host") everywhere

Scattered config access makes testing impossible. No dependency injection, no explicit contracts between components.

03

fmt.Println Logging — unstructured, unsearchable, unfilterable

AI defaults to fmt.Println or log.Println. No trace_id, no structured fields, no level control. Production debugging becomes guesswork.

04

No Error Codes — every error is fmt.Errorf("something failed")

No structured error codes, no layer attribution. When an API returns 500, you have no idea if it's a DB issue, a business rule violation, or a gateway timeout.

05

Missing Transaction Boundaries — writes that aren't atomic

Agent creates a record, then publishes an event. If the event publish fails, the record exists but nobody knows about it. No Outbox pattern.

06

Copy-Paste Mocks — tests that test nothing

Agent generates mocks that return hardcoded values. Tests pass, but the code doesn't actually work in production. No integration tests at all.

07

Framework Salad — Gin + Echo + net/http in the same project

Agent picks whatever it's seen most in training data. The project ends up with three HTTP frameworks, two ORMs, and four logging libraries.

08

No Health Checks — deploy and pray

No /healthz, no /readyz, no pprof, no metrics endpoint. Kubernetes can't tell if the service is alive. Observability is an afterthought.

vibe-go = Architecture as Code

Not another framework. A scaffold with architectural constraints baked in. AI agents work within the structure — not against it.

L5-Gateway   ══>  Connect handler, middleware, routing
    
L3-Authz     ══>  Permission check, rate limiting
    
L4-Service   ══>  Business orchestration, validation  // interfaces.go
    
L2-Domain    ══>  Pure Go structs, state machine, events  // zero deps
    
L1-Storage   ══>  Ent, PostgreSQL, Redis, Outbox

5-Layer Enforced

Dependency direction locked. check_architecture.sh validates at CI time. Agent can't accidentally violate boundaries.

Interface Inversion

Core defines interfaces, plugins implement them. DI in main.go. Swap Meilisearch for Elasticsearch — zero changes to business logic.

Agent-Ready Tasks

Each task = one module × one layer. Self-contained context, precise interface contracts, executable acceptance criteria.

Structured Errors

L{layer}{seq} error codes. Every error carries its layer. L4_601 = service validation failed. No guessing.

Outbox Built-in

Business writes and event publishing in one transaction. No lost events, no eventual consistency surprises.

Zero Decision Fatigue

Logging: slog. Config: koanf. ORM: ent. HTTP: net/http. Every choice is made. Agent focuses on business, not bike-shedding.

Tech Stack — decided, not debated

CategoryChoiceWhy
APIconnect-gogRPC + HTTP dual-mode, one proto file
ProtobufbufCode gen, lint, breaking change detection
ORMent (pgx)Type-safe, code-gen, graph relations
ConfigkoanfYAML + env, explicit DI, no global singleton
Logginglog/slogStdlib, zero deps, JSON handler
Cachego-redis/v9Cache + event stream + distributed lock
IDoklog/ulidGlobally unique, time-sortable
TracingOpenTelemetryOTLP export, probability sampling
MetricsOtel + Prometheus:9090/metrics, standard format
Migrationgolang-migrateVersioned SQL, CLI + library
Testingtestify + gomock + testcontainersUnit / integration / E2E coverage
Docsbuf + connectrpc/reflectionProto is the contract, no Swagger needed

Built for LRA

vibe-go's task breakdown is designed to work with LRA (Long-Running Agent) — a task management tool purpose-built for AI agent multi-turn development.

Self-Contained Tasks

Each task carries its own context: goal, contracts, dependencies, conventions, acceptance criteria. Agent starts cold and still delivers.

Atomic Claim + Lock

Multiple agents can work in parallel. Each task is claimed atomically — no conflicts, no duplicated work.

Quality Gates

Constitution-based checks ensure every task meets the bar before marking complete. Tests pass, lint clean, architecture valid.

Optional but Recommended

LRA is not required. Use your own workflow if you prefer. But the task breakdown format and agent workflow are designed with LRA in mind.

$ pip install long-run-agent
Documentation  ·  GitHub

Fork. Fill. Ship.

Clone the scaffold, fill in your CLAUDE.md, hand it to an agent. Architecture is pre-decided. The agent just writes business code.

View on GitHub