Other stacks
Same recipe, different bootstrap: Node CLI · Python · Web Component · REST API (Node) · Java · Go
Systems · Estimated time: ~15 min · Karajan iterations: 2–3
This walkthrough takes you from an empty directory to a merged feature on a small Rust CLI crate using cargo + clap for argument parsing. It includes the exact test loop Karajan uses to gate merges (cargo test), so you can re-run it on a real codebase by swapping the bootstrap step for cd <your-repo>.
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 a Rust toolchain via rustup (rustc --version → 1.75+ recommended) and cargo on PATH.
Bootstrap the project.
cargo new hello-rs --bincd hello-rscargo add clap --features derivegit add -A && git commit -m "chore: scaffold"cargo new --bin generates Cargo.toml, src/main.rs with a Hello, world! stub, and initializes a git repo automatically. Confirm cargo test runs (it’ll report 0 tests for now):
cargo testInitialize 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 Rust toolchain (cargo, rustc version).
Describe the feature in natural language.
No spec file. No JSON. Just the task as you’d describe it to a colleague:
kj run "Add a 'greet --name=<name>' subcommand to src/main.rs using \clap with derive. It should print 'Hello, <name>!' to stdout. If \--name is missing, print 'Hello, stranger!'. Add unit tests in a \#[cfg(test)] module covering the greet function for both cases." \ --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:
cargo test output line by line, including rustc warnings.You can also tail the same trace in the terminal:
kj tailInspect the result.
git statusgit diff --statcargo testExpected output of cargo test:
running 2 teststest tests::greet_with_name ... oktest tests::greet_without_name ... ok
test result: ok. 2 passed; 0 failed; 0 ignoredSanity-check live:
cargo run -- greet --name=world# Hello, world!cargo run -- greet# Hello, stranger!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/greetgit add -A && git commit -m "feat: add greet subcommand"git push -u origin feat/greetgh pr create --fillOr, if you want Karajan to also open the PR for you, add --auto-commit --auto-pr to the kj run invocation.
The same run launched via the MCP from any MCP-capable client (Cursor, Claude Desktop, Codex):
{ "tool": "kj_run", "params": { "task": "Add a 'greet --name=<name>' clap subcommand printing 'Hello, <name>!' (or 'Hello, stranger!' if missing). Unit tests in #[cfg(test)].", "methodology": "tdd", "coder": "claude", "reviewer": "codex", "reviewerFallback": "claude", "maxIterations": 5 }}If you’re building a library crate instead of a CLI:
cargo new hello-rs --libcd hello-rsThen run with an explicit hint:
kj run "Implement pub fn greet(name: Option<&str>) -> String in \src/lib.rs returning 'Hello, <name>!' or 'Hello, stranger!'. \Add #[cfg(test)] unit tests." \ --methodology tdd \ --max-iterations 5The coder skips the clap dependency and writes a pure library API. cargo doc --open generates browsable docs from the /// comments.
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 (Rust ruleset enabled), and gates the merge on the Sonar quality gate as well as the reviewer verdict. For Rust specifically, you can also enable cargo clippy -- -D warnings and cargo audit via the audit.tools config — the Karajan reviewer reads their output as additional signal.
Other stacks
Same recipe, different bootstrap: Node CLI · Python · Web Component · REST API (Node) · Java · Go
Back to the index
How-To index · setup + troubleshooting