Getting started
Install munchkins, run a smoke-test agent to prove the pipeline works against a real backend, then scaffold your first custom agent for this repo.
Prerequisites
- Bun ≥ 1.3.0. Munchkins is Bun-only.
npm installandpnpm installare not supported. - A git repository. Every run cuts a fresh worktree from your current branch. If
git rev-parse --show-topleveldoesn't find a repo, the agent refuses to start. - A backend CLI on
PATH, authenticated.claudeis the default. Sign in once withclaudeand accept the auth flow.codexis the alternate backend. Runcodex loginonce if you intend to use--cli=codex.
- Lint / typecheck / scenario / test scripts in the host repo's
package.json(see Install). The deterministic gate calls them by name; any of them can be a no-op, but they must exist. - Claude Code (optional but recommended). The fastest path to your first custom agent is the
/new-munchkinskill, which only runs inside Claude Code. If you don't use Claude Code, you can still build agents by hand — see Build your own. Required only for the skill, not for running agents.
The host repo doesn't have to be the munchkins monorepo — any git repo with the package manager and gate scripts described below will do.
Install
In a fresh repo:
Then add a munchkins script to your package.json so you can invoke it without remembering the entry path:
bun add puts the munchkins binary in node_modules/.bin, so bun run munchkins … resolves directly. bunx @serranolabs.io/munchkins … works as an alternative invocation form.
The deterministic gate the default agents run after each step calls these five commands inside the worktree. Any of them can be a no-op, but they must exist:
Use whichever lint/typecheck/test runners your project already prefers. The agent invokes them as plain shell, not Bun-specific tasks.
Finally, install the bundled Claude Code skills so the /new-munchkin and /launch-munchkin triggers are discoverable from inside Claude Code:
This copies every skill shipped with @serranolabs.io/munchkins into .claude/skills/ in the current working directory. Override the destination with --dest <path> (or -d <path>).
Proof of life: run the bug-fix agent
This is a smoke test. It validates that install worked, the gate scripts are wired correctly, and the backend CLI is authenticated — before you invest in a 15-minute skill interview to build a custom agent.
Create a short markdown spec at scratch/first-bug.md:
Then run:
What you should see, roughly in order:
- Worktree spawn. A fresh checkout under
.worktrees/bug-fix-<ts>-<uuid>/on a new branch namedagent/<slug>-<short-id>. The slug is derived from your spec via Claude. - Agent steps. For
bug-fix: a fix step → a refactor pass on touched files. Each step prints its system + user prompt header (or streams Claude tokens with--thinking/--verbose). - Deterministic gate.
bun run lint:fix,bun run lint,bun run typecheck,bun run scenario,bun test --pass-with-no-tests. If anything fails, thedeterministic-fixersubagent gets up to 3 iterations to recover. - Summary writer. A short Claude call that converts the staged diff into a commit message + a markdown changelog entry. The entry is prepended to
CHANGELOG.mdin the worktree and committed there. - Integration. Default is
merge: rebase the worktree onto your branch, then fast-forward your branch to the rebased tip. Worktree and branch are removed on success. - PASS line. Total duration, token in/out, dollar cost (or
—for Codex), the commit message, and the run's log directory.
Run artifacts land under .munchkins/runs/<slug>-<short-id>/ — see Build your own for the full layout. If a run fails, the worktree and branch are preserved at the printed path; clean up with git worktree remove <path>, which deletes both.
Scaffold your first agent for this repo
The default agents are demos. They don't know your repo's conventions, your file layout, or what "done" looks like for the kind of work you actually do here. The value kicks in when you build agents that match — same gate, same shared presets, same terse voice.
Open Claude Code in this repo's root and trigger the skill:
The trigger phrases "new munchkin", "scaffold a munchkin agent", and "design an agent for this repo" all reach the same skill. It introspects your repo first (agents directory, existing agents, CI gate commands, lint/typecheck configs, package manager) so nothing it generates is hardcoded — then walks you through a short sequential interview: purpose, distinctness from existing agents, archetype, kebab-case name, and the prompt body.
Create-mode produces:
<your-agent>-agent.ts— fully wired againstAgentBuilder, your discovered shared presets, the deterministic gate, and the summary writer.prompts/<your-agent>.md— the system prompt, drafted in the same terse voice as your existing agent prompts.- A side-effect import in your bundle's entry (
packages/<your-bundle>/src/index.ts) plus anAGENTS.mdrow.
The new agent appears in bun run munchkins --help and runs identically to bug-fix, feat-small, or refactor.
Next steps
- Run the agents — flag, env var, and integration details for each default: Bug fix, Small feature, Refactor.
- Go deeper — full
AgentBuilderAPI and the manual path to building your own: Build your own.