Skip to content

How the builder works

The builder takes one published version of a spec and delivers a verified change to your repository. Every build follows the same six steps, and the panel shows them live.

  1. 1PlanRead the spec, resolve the stack against your catalog, create the sandbox.
  2. 2GenerateThe engine writes the code inside the sandbox.
  3. 3Wire toolsConnect the approved MCP servers and skills.
  4. 4Prepare testsPlace the visible tests. Held-out tests stay outside.
  5. 5Run evalsRun the gates. Failures go back to the engine a limited number of times.
  6. 6PackagePush a branch and open a pull request.
  • The published spec: purpose, process, rules, limits, tools and the resolved stack.
  • A working copy of the repository it may change, and only that repository.
  • A structural map of the codebase, so it changes code knowing what depends on it.
  • Your architecture standards.
  • The tests it is allowed to see.
  • Credentials of any kind. See Sandbox security.
  • Network access beyond a short list of hosts the build needs.
  • The held-out tests.
  • Any way to change, skip or inspect how its work will be judged.

A build must pass every gate to produce a pull request. They run from cheapest to most expensive, and they run outside the engine’s reach.

Gate What it checks
Build and static checks The code compiles, lints and type-checks on the target stack
Visible tests The agent’s tests that the builder may see. A failure goes back to the engine with its output
Held-out tests The share your risk policy reserves. The engine learns that some failed, never their content
Architecture conformance The change respects your layering, dependencies and conventions
Policy checks Only approved models and MCP servers, within the data classification you allow

The results fill the four dimensions of the build’s evaluation: business, security, robustness and construction. See Build and verify.

Each build has budgets for tokens, time, cost and repair attempts. They come from your cost policy and are enforced by Khala, not by the engine. A build that runs out stops and says why.

The result is a branch and a pull request in your repository. Khala never pushes to your default branch. The pull request carries the spec version, the resolved stack, the result of each gate and a link to the build in the panel.

From there your process takes over: your reviewers, your CODEOWNERS, your required checks.

A failed build keeps everything a successful one keeps. The step that failed, its logs and the gate results stay in the build’s record, and a new build starts clean in a new sandbox.