Documentation menu
How it works
The workflow: plan, guard, run and verify, settle.
On this page
A unit of work, such as a feature, a fix or a refactor, goes through four steps:
- Plan: the host model describes the tasks and the calls it would make, and Ktesio Build decides the rest.
- Guard: each call is assumed, probed or asked, depending on what it costs to get it wrong.
- Run and verify: each task runs on its tier, is checked, and is committed.
- Settle: assumptions get accepted or rejected, and drift gets fixed.
The kb-build skill walks a host through these steps. Every step is also a command and an MCP tool, so you can drive it yourself.
Plan
ktb plan (MCP plan) takes a slice of work: tasks with their files, a check command and acceptance ids, plus the calls the model would otherwise make without asking. The input shape is in For agents. Rust decides everything else.
A tier for each task, from cheap signals:
- the files and lines touched
- the modules that depend on them
- contracts in scope
- a test-coverage heuristic
- the task kind
- risk tags:
money,auth,migration,public-apiand others raise the floor to balanced
Outcomes override the heuristics, as described in Learning. Only scores near a tier boundary, or vague tasks, go to the kb-triage agent, and its verdict is cached per task kind.
How each task runs on this host: a Claude Code subagent with the tier's model and effort, codex exec --profile kb-<tier> when those profiles exist, or inline.
Parallel groups: the walking skeleton runs first and alone. After it, tasks that share no files and no dependencies run together.
Re-planning: pass the returned slice to plan again, for example after answering questions or passing triage verdicts. Planning the same tasks again without slice re-plans the open slice instead of copying it.
Guard: the cost of being wrong
Each call is scored on three things:
- Reversibility: does it touch a schema, money, auth, a public API or dependencies?
- Direction: does it change scope or user-facing behaviour?
- Fan-out: how many tasks build on it?
The score sets the policy:
| Policy | When |
|---|---|
assume | cheap and confident |
probe | uncertain but cheap: read the code first |
ask | costly and uncertain, user-facing copy, or a tag in [guard] always_ask |
settled | an active decision already answers it, and plan cites that decision |
At most 3 asks reach the person, as one card with lettered options. The rest wait as question records. Each ask returns a subject: record the answer as a decision with that subject, and the next plan counts the call as settled. This is how a second feature reuses the first one's choices without being told.
Assumptions have a leash. Each assumed call is recorded with how many tasks may build on it: 2 for costly calls ([guard] leash), 50 for cheap ones. When the leash is spent, verify pauses only that branch until the assumption is settled.
Verify
ktb verify TASK runs these checks:
- the task's own check;
- the repo's tests, type checks and lint, from
[verify] commandsor detected (Cargo, npm/pnpm/yarn/bun scripts, pytest, ruff, Go, Gradle, Maven); - per-path rules from
[[verify.rules]]: required test levels and coverage floors; controlrecords in scope.
Cargo tests are scoped to the touched crates and their dependents. With require_ac_tests (on by default), every acceptance check must be cited by a test as <intent-id>#ac1. Passing commands are cached by the tree's content hash, so an unchanged tree isn't tested twice.
On a pass with --commit, verify makes one commit per task, with these trailers:
Ktesio-TaskKtesio-SliceKtesio-IntentKtesio-Assumption- the tracker reference from the intent's
ref, when[trackers]is set
It also stores the outcome.
On a fail, it answers retry, then escalate one tier, then stop.
New changes on a task that's already done, such as review fixes, are verified and committed, but not counted as an attempt.
Run headless
ktb run SLICE drives a planned slice with no model chosen by hand. For each task, in group order, it does the following:
- It builds the prompt from the task and its context pack. This happens in Rust and costs no tokens.
- It runs the task on its tier through the host's CLI. That is
claude -p --model M --effort E --output-format stream-json;codex exec --json -c model_reasoning_effort=E(or--profile kb-<tier>);copilot -p --model M --effort E;zcode -p --json; or any command in[run] cmd. - It reads back the real token use and cost.
- It calls
verify.
When an attempt goes wrong:
- A failure retries once on the same tier, with the failure in the prompt. Then it escalates one tier. Then it stops that branch only: its work is stashed and its dependents are skipped.
- A stuck attempt, one that changes no file for
[run] stall_sseconds, is stopped and escalates straight away. Its tokens still count. - A run that finishes but never exits is ended, and its result still counts.
- A task waiting on an assumption whose leash is spent is paused before anything runs.
Settle and check
digestis the one screen to read after a build. It shows the commits built since the last digest, assumptions to settle, drift, open questions, and tokens by tier, with the planning and rolled-back shares.accept ASMturns an assumption into a decision.reject ASMwrites a "Rejected:" decision with the reason, and lists the commits built on the assumption (git log --grep "Ktesio-Assumption: <id>"). With--revert, it reverts their code in one commit and keeps every record.checkfinds drift: invalid files, broken links, two active decisions on onesubject,pathsthat match no file, records whose code changed after they were written, and spent leashes.
Import from BMAD or SpecKit
ktb import turns BMAD documents (v4 docs/, v6 _bmad-output/) and SpecKit documents (.specify/, specs/*/) into records:
| Source documents | Become |
|---|---|
| specs, PRDs, epics, stories | intents with acN: checks |
| architecture, ADRs, plans, research, the constitution | decisions |
| answered clarifications | decisions |
[NEEDS CLARIFICATION] markers | questions |
| API contracts | contracts |
Each record keeps its source, so a re-import skips what it already has and supersedes what changed. --cleanup removes only the framework's scaffolding.