Other stacks
Same recipe, different bootstrap: Node CLI · Python · Web Component · REST API (Node) · Java · Rust
Backend · Estimated time: ~12 min · Karajan iterations: 1–2
This walkthrough takes you from an empty directory to a merged feature on a small Go module using the standard library plus go test. It also covers the Cobra variant if you want a real CLI binary on top.
You should already have done the common setup: npm install -g karajan-code, kj init inside the project, and a green kj doctor. If kj doctor is red, fix that first — kj run will refuse to start otherwise.
You’ll also need Go 1.22+ (go version).
Bootstrap the project.
mkdir hello-go && cd hello-gogo mod init dev.kj/hellogit init -b main && git add -A && git commit -m "chore: scaffold"Create a minimal greeter.go skeleton so Karajan has something to extend:
package hello
// Greet returns the greeting for the given name.// Implementation pending — Karajan fills this in.func Greet(name string) string { return ""}Initialize Karajan in the repo.
kj initkj doctorkj init creates .karajan/ and writes the orchestrator config; kj doctor confirms the agent CLIs, Docker, Ollama, ports, and detects the Go toolchain.
Describe the feature in natural language.
No spec file. No JSON. Just the task as you’d describe it to a colleague:
kj run "Implement Greet(name string) in greeter.go so it returns \'Hello, <name>!'. If name is empty, return 'Hello, stranger!'. \Add a table-driven test in greeter_test.go covering both cases \plus a unicode name." \ --methodology tdd \ --coder claude \ --reviewer codex \ --reviewer-fallback claude \ --max-iterations 5Watch the run on the HU Board.
Open http://localhost:4000 in another tab while the pipeline runs. You’ll see, in real time:
go test output line by line.You can also tail the same trace in the terminal:
kj tailInspect the result.
git statusgit diff --statgo test ./...Expected output of go test ./...:
ok dev.kj/hello 0.002sWith verbose mode you’ll see the table-driven cases:
go test -v ./...# === RUN TestGreet# === RUN TestGreet/named# === RUN TestGreet/empty# === RUN TestGreet/unicode# --- PASS: TestGreet (0.00s)Merge.
Karajan does not push or merge for you by default — that’s your call. When you’re happy with the diff:
git checkout -b feat/greetergit add -A && git commit -m "feat: add Greet(name)"git push -u origin feat/greetergh pr create --fillOr, if you want Karajan to also open the PR for you, add --auto-commit --auto-pr to the kj run invocation.
If you want a real CLI binary instead of a library:
go get github.com/spf13/cobra@latestThen run with an explicit hint:
kj run "Wrap Greet(name) in a 'hello-go greet --name=<name>' command \using Cobra. Add an integration test that runs the binary and \captures stdout." \ --methodology tdd \ --max-iterations 5The coder scaffolds cmd/root.go + cmd/greet.go and writes an exec.Command-based test. Build with go build -o hello-go ./....
The same run launched via the MCP from any MCP-capable client (Cursor, Claude Desktop, Codex):
{ "tool": "kj_run", "params": { "task": "Implement Greet(name string) returning 'Hello, <name>!' (or 'Hello, stranger!' if empty). Table-driven test.", "methodology": "tdd", "coder": "claude", "reviewer": "codex", "reviewerFallback": "claude", "maxIterations": 5 }}Add --mode strict and the deterministic security collectors:
kj run "<task>" \ --mode strict \ --enable-security \ --enable-sonarcloud \ --methodology tddThis wires the OSV-Scanner and Semgrep collectors into the audit (Go ruleset enabled), and gates the merge on the Sonar quality gate as well as the reviewer verdict. Sonar’s Go analyser catches common pitfalls: shadowed errors, leaked goroutines, missing defer close.
Other stacks
Same recipe, different bootstrap: Node CLI · Python · Web Component · REST API (Node) · Java · Rust
Back to the index
How-To index · setup + troubleshooting