Documentation menu
For agents
The MCP tools, their JSON replies and the plan input.
On this page
Hosts start Ktesio Build as an MCP server over stdio (ktb mcp). The server has nine tools, and their schemas cost about 1,250 tokens in total. Each tool has a CLI command with the same name, which takes the same JSON and prints the same JSON. So an agent with only a shell can call ktb <tool> --json. plan reads its input on stdin.
Tools
| Tool | Does |
|---|---|
status | repo state: host, tier models, last sync, open assumptions and questions, findings |
recall | records by id, active records by kind, text search, or a walk over links from an id |
record | writes a record and returns its id and path. Assumptions need confidence (0–1) and leash |
sync | updates the index from changed files and records |
pack | the context for a task, cut to the tier budget. Call it before reading code |
plan | tiers, run lines and parallel groups for a slice, and a policy for each call |
verify | checks a task and commits it with trailers, then returns next |
check | drift between records and code |
digest | the one screen since the last digest. Given accept or reject and an assumption id, it settles that assumption |
No reply is longer than [budgets] reply tokens (2,000) unless you ask for more, for example with full or limit.
The loop
packfor the work, thenplan.- If
cardis not empty: show it exactly as given, and wait for the answers. Record each answer as a decision whosesubjectis that call'ssubject, thenplanagain with the sameslice. - For a task with
needs_triage, get a verdict and pass it back astriagewith the sameslice. - Run tasks by
group, following each task'srunandwith. Thenverifythe task withcommit, and follownext:done,retry,escalate(totier) orstop. - When no one is there to answer,
ktb run <slice> --jsondoes step 4 headless. Its tasks come back already verified and committed. - Review the slice diff with the
review.lensesfrom the last verify. Commit any fixes withverifyon the slice's last task. - Finish with
digest, withpeek: true.
The kb-build skill encodes this loop for each host.
Plan input
{
"intent": "int-0ke8et",
"slice": "",
"tasks": [
{"goal": "Add transfer fees", "files": ["src/pay/ledger.rs"], "check": "cargo test fees",
"depends": [], "kind": "feature", "acs": ["ac1"]}
],
"calls": [
{"text": "Who pays the fee: sender or receiver?", "confidence": 0.4, "direction": true,
"recommend": "sender", "options": ["receiver"], "depends": [0], "tags": ["money"]}
],
"triage": [{"task": 0, "tier": "deep", "effort": "high", "kind": "feature"}],
"tokens": 1200
}intent: a record id, or empty. Record the intent first if it doesn't exist yet.slice: empty for a new plan, or the id from a previous plan to re-plan it.depends: 0-based indexes of earlier tasks. In a call,dependslists the tasks that build on that call; empty means all of them.direction:truewhen the call changes scope or user-facing behaviour.kind: a short task kind, such asfeature,fix,test,refactor,docsorrename. It's inferred from the goal when it's empty.tokens: the tokens spent planning so far, when the host reports them.
Unknown fields are rejected, and the error names the rule that was broken.
Plan output
slice: the slice id.tasks[]: each withid,goal,kind,tier,model,effort,run(subagent,execorinline),with(the agent name or command),group,needs_triage,assumptions,decisions,tagsandwhy.calls[]: each withtext,policy(assume,probe,askorsettled),cost,leash,id(the record written for it, or the decision that settles it),subject(on asks) andwhy.card: the questions for the person, rendered so the model never formats them. It's absent when there's nothing to ask.ledger: questions that didn't fit on the card.
Verify output
passran[]: each withcmd,okandmsfailure: the failing output, trimmedflagssha: the commitoutcome: the row id, 0 when nothing was countedreview:lensesandwhen(taskorslice)nexttier: set on escalatems
Exit codes
| Code | Meaning |
|---|---|
| 0 | ok |
| 1 | a check failed |
| 2 | usage error. The message says what to change |
| 3 | environment problem. Run ktb doctor |