Configuration

policy.yaml

Every field in policy.yaml: caps, budget, concurrency, archiving, defaults and maxima, and the policy fields a layer may set.

policy.yaml applies to every work item and lives at $KRAFT_HOME/config/policy.yaml.

kraft admin reload rereads this file with the same validation as startup. If the file doesn't validate, Kraft keeps the running policy and reload exits 1 naming why. New loop caps apply to loops that start after the reload.

For how caps, maxima and layers combine, see Caps and budgets.

config/policy.yaml
loops: {}
default: { attempts: 3, wall_clock_s: 3600 }

findings:
  loop_severities: [critical, important]

max_concurrent: 3

budget:
  work_item_usd: 10
  daily_usd: 50

rate_limit_retries: 5
forge_cli_timeout_s: 120

archive:
  after_days: 30

The shipped file also holds defaults: and maxima: as comments; see defaults and maxima.

Top-level keys

FieldTypeDefaultMeaning
loops.<name>{attempts, wall_clock_s}unsetSets attempts and wall_clock_s for one named loop. See Loop keys.
default{attempts, wall_clock_s}—Required: without it policy.yaml doesn't load, and Kraft refuses new work. The attempts and wall_clock_s ceiling for every fix loop not named in loops; a max_attempts on the loop itself wins. The seeded file sets {attempts: 3, wall_clock_s: 3600}.
max_slicesinteger6The most slices a plan's ## Slices section may name. A plan with more isn't sliced, and its plan gate says why. Added in 2.6
max_concurrent_slicesintegerunsetHow many children of one sliced item may run at once. Unset: only max_concurrent limits them. Added in 2.6
max_concurrentinteger3The concurrency limit: how many work items may be active at once across all repos, however they were started. A start past the limit is queued, not refused.
auto_escalate_stuckbooleantrueWhether a stuck stop auto-dispatches an escalation turn on a node that declares no escalation of its own.
auto_escalate_stuck_capinteger3How many times one stuck run is auto-escalated before it is left for you.
auto_escalate_delay_sinteger0Seconds to wait after the triggering event before an auto-escalation fires, so a person about to look isn't preempted.
auto_review_attemptsinteger1How many automated-review attempts one pending gate may spend before it is left for you.
forge_cli_timeout_snumber120Seconds one forge CLI call (gh, glab, git) may run before Kraft kills it and reports a forge error. Read at startup and on reload.
agent_idle_minutesinteger30Minutes an agent session may write nothing to its log before Kraft kills it and stops the item for you. 0 turns it off. Added in 2.3
forge_poll_sinteger300Seconds between the MR-closed poller's ticks, which ask the forge about every item parked at a merge-request node. Minimum 30.
attribution.mrbooleantrueWhether every merge request description ends with a footer that links to Kraft and names the work item. With false, Kraft leaves it off from the next description it writes; it rewrites the description at every sync. Added in 2.5
findings.loop_severitieslist of critical, important or minor[critical, important]Which review-finding severities burn a fix cycle; lower ones are recorded and shown at the human-review gate.
budget.work_item_usdnumberunsetDollar cap per work item across all its loops. Unset: no cap. The seeded file sets 10.
budget.daily_usdnumberunsetThe daily dollar cap: what every work item on this instance may spend together since local midnight. Unset: no cap. The seeded file sets 50.
rate_limit_retriesinteger5How many times Kraft relaunches a work item after a rejected API rate limit before stopping and waiting for you.
archive.after_daysintegerunsetCompleted and abandoned items older than this many days auto-archive, checked hourly and on a publish or reload. The board's Done header shows the number. Unset or 0: no auto-archive and no note. The seeded file sets 30.
storage.worktrees.limitsizeunsetThe most disk worktrees may use. Unset: nothing is measured or held. Over it, a start that needs a new worktree waits. See Storage keys.
storage.worktrees.quotasize80% of limitOver it, Kraft warns and nothing else. Needs a limit.
storage.worktrees.auto_cleanup.min_ageageunsetUnset: no automatic clean-up. An empty auto_cleanup block is 24h. When starts are held, Kraft archives finished items that ended at least this long ago, oldest first, until what archiving can free is under quota. Needs a limit.
storage.outputs.max_sizesize64MThe most Kraft keeps of one task's step outputs; a larger capture fails the task. At most 256M. See Step output keys. Added in 2.6
triggerslist of {cron, repo, chain, title, description}unsetRetired: schedules: in intake.yaml replaces it (see Inbound triggers). A file that still has it is read, so schedules keep firing, and kraft admin doctor names the move.
wait_timeout_minutesintegerunsetRetired: use total_time_cap_minutes, or maxima.tasks.total_time_cap_minutes. Read with a log warning. In defaults it doesn't load. A chain or override save that sets it is refused, with the name to use.
defaultsmappingunsetStarting points that any scope may move within maxima. See defaults and maxima.
maximamappingunsetUnset: no bound. The ceiling on policy overrides. See defaults and maxima.

A budget cap refuses to start the next agent task and can't interrupt one that is running. See Caps and budgets.

Storage keys

Added in 2.1

storage.worktrees bounds the disk the worktrees use:

config/policy.yaml
storage:
  worktrees:
    limit: 10G
    quota: 8G
    auto_cleanup:     # optional; the block being there turns it on
      min_age: 24h
  • A size is a whole number and a unit, K, M, G or T, in either case, and binary: 1G is 1024³ bytes. A bare number such as 10 is refused, because it would be a 10-byte limit.
  • Without limit nothing is measured, warned about or held. quota without a limit, or at or above it, is invalid.
  • Kraft counts what a worker can write, under run/: worktrees/, sandbox-git/, each item's sandbox home (items/<id>/sandbox-home/, or an older item's sandbox-home/<id>/), each item's docs/ and its sessions' out/ folders, and each item's step outputs (outputs/). Archiving removes the worktree, the sandbox home and the step outputs; abandoning removes the rest. Session logs, earlier versions of a document, attachment copies, the databases and Docker's images and volumes aren't counted.
  • The figure is measured at startup and every 10 minutes, and matches du. An archive or abandon takes that item's size off it at once, and a start that creates a worktree adds an estimate (the mean size of the items measured) at once, until the next measurement replaces it.
  • At or under quota, nothing happens. Over quota, /api/health and kraft admin doctor warn.
  • Over limit, a start that would create a new worktree is queued until usage is back under the limit, and its item gets a work_item_storage_held event. A resume or retry of an item that already has a worktree isn't held.
  • The limit holds starts only for what archiving can free: everything counted but the items' docs/ and out/ folders. Those count toward quota and show on the Storage page, but archiving keeps them, so on their own they never hold a start. Step outputs are freed by archiving, so they count toward the limit.
  • Unless auto_cleanup is set, Kraft never archives or deletes anything for the limit, step outputs included. With it, they go only with an item it archives, and an in-place item has no worktree to archive that way, so a manual archive is what frees its step outputs. archive.after_days works as before. See Limit the disk worktrees use.
  • auto_cleanup turns on automatic clean-up. auto_cleanup: {} is min_age: 24h, and auto_cleanup: with nothing after it is off. It needs a limit.
  • min_age is a whole number and h or d, in either case: 12h, 24h, 2d. Days are the largest unit, so 1w is refused, and so is a bare 24. 0h means no floor.
  • When starts are held, Kraft archives completed and abandoned items that have a worktree and ended at least min_age ago, oldest first, until what archiving can free is at or under quota. One archive runs at a time, and one item's failure is logged and skipped.
  • Archiving removes the worktree and any uncommitted changes in it. A branch with unpushed commits is kept, and the item stays restorable under Archived. Its work_item_archived event carries by: auto and reason: storage.
  • When that can't free enough, because every finished item is newer than min_age or the rest is live work, starts stay held and kraft admin doctor says how many finished items were too recent.
  • A running item can pass the limit between two measurements. The limit stops the next start, not work in flight.
  • An in-place item has no worktree. It is never measured, never held and never picked by auto_cleanup.

kraft admin reload applies a change.

Step output keys

Added in 2.6

storage.outputs.max_size bounds what Kraft keeps of one task's step outputs:

config/policy.yaml
storage:
  outputs:
    max_size: 64M
  • It is a size, written as for storage.worktrees, and is at most 256M, the most one remote machine returns. A larger value is refused when the file loads.
  • The total apparent size of the files in the task's output folder is checked when the task ends. Over the limit, the task fails and nothing is kept.
  • The limit bounds what is kept, not peak use. While a task runs it can write as much as its disk holds, as it can into its worktree, docs/ or out/.
  • Kraft reads the limit when it launches the task and records it with the session, so a task that ends after a restart is held to the number it started under.
  • A change reaches tasks launched after kraft admin reload.

Loop keys

loops maps a loop key to its own attempts and wall_clock_s. A key that names no live loop is silently unused, so spell it exactly:

KeyNames
<node id>.fix_loopThe fix loop of that exec node; see Fix loop.
<node id>.on_base_changedThe restarts of that node when a rebase moves the base.
<node id>.on_merge_rejectedThe rewinds of that node when a merge train or merge queue drops the merge request. Unset, it is 3 attempts over 7 days, not default. See on_merge_rejected. Added in 2.3
<gate id>_reject_loopThe rejections of that gate.
config/policy.yaml
loops:
  verification.fix_loop: { attempts: 5, wall_clock_s: 7200 }

The default caps

These are the caps the shipped chains and library set. The loop default and the two dollar caps are in Top-level keys; the per-level defaults and maxima ship unset and are below.

BoundShipped valueWhere it is set
Fix-loop attempts2 for verification, 3 for merge_request_feedbackmax_attempts on the loop, in the chain
implementer task running time120 minutestime_cap_minutes on the task, in library.yaml
Wait for CI90 minutestotal_time_cap_minutes on the wait task, in library.yaml
Wait for the automated review30 minutesthe same key
Wait for an external approval10080 minutes (7 days)the same key
Wait for the post-merge pipeline90 minutesthe same key

Whichever bound runs out first stops the item, and the stop names its scope.

The shipped implementer cap

The implementer task, which both shipped chains run, sets time_cap_minutes: 120. Successful runs finish well inside it, so it binds only a run that has gone wrong, for example a worker stuck on a test run it backgrounded. A turn that ends with a background job still running fails the task: see Result file.

A long plan can need more. Raise the item's own cap, or set a larger one on the task in library.yaml. The task's 120 is above the commented tasks default of 90, which a scope may do. A maxima.tasks.time_cap_minutes (or a broader level's) below 120 makes Kraft refuse both shipped chains at intake, so lower the task's cap to fit.

defaults and maxima

Kraft ships these commented out, because an uncommented value is a real ceiling. This example is illustrative. Uncomment and edit it to use it:

config/policy.yaml
# defaults:
#   timeout_minutes: 60
#   max_attempts: 3
#   allowed_harnesses: [codex, claude]
#   escalation_harness: claude
#   work_item: { time_cap_minutes: 480, total_time_cap_minutes: 2880, budget_usd: 20 }
#   nodes:     { time_cap_minutes: 180 }
#   steps:     { time_cap_minutes: 120 }
#   tasks:     { time_cap_minutes: 90 }
# maxima:
#   timeout_minutes: 180
#   allowed_harnesses: [codex, claude]
#   work_item: { time_cap_minutes: 1440, token_budget: 2000000, budget_usd: 25 }
#   tasks:     { time_cap_minutes: 240, total_time_cap_minutes: 10080 }

defaults takes timeout_minutes, max_attempts, allowed_harnesses, escalation_harness, escalation_grants and the per-level caps. maxima takes allowed_tools, allowed_harnesses, timeout_minutes, max_attempts and the per-level caps.

Two rules hold for both sections:

  • A narrower level's cap may not exceed a broader one's (tasks <= steps <= nodes <= work_item), and a defaults entry may not exceed its level's maximum. Kraft refuses either when it reads the file, naming both.
  • A cap written flat (defaults: time_cap_minutes: 30) is refused, with a message naming the level form to use.
FieldTypeDefaultMeaning
timeout_minutes, max_attempts, allowed_harnessesinteger, integer, list of harness profile IDsunsetOperational starting points that any layer may move in either direction, bounded only by maxima.
escalation_harnessstringclaudeThe harness profile in harnesses.yaml that an escalation turn runs on, or item. In defaults only: a maxima that names it doesn't load, and Kraft refuses new work.
escalation_grantslist[git-commit, git-rebase, git-push]The grants every escalation turn holds; [] is none. In defaults only, like escalation_harness.
work_item, nodes, steps, tasksmapping: time_cap_minutes, total_time_cap_minutes, token_budget, budget_usdunsetNo bound when unset. Per-level values for time_cap_minutes, total_time_cap_minutes, token_budget and budget_usd; a gate is a node.
maxima.allowed_toolslist of tool namesunsetNo bound when unset. A safety field that starts at its maximum and can only be narrowed.
Don't set maxima.allowed_tools unless every harness you use can run under it. A safety field set only in maxima binds every task. See Tool lists for the harnesses that refuse a list.

Policy fields

These keys go in a policy: block on a repo (repos.yaml), a chain, a node, a step, a task or a work item's override. Kraft applies the layers from the broadest to the narrowest. The "Rule down the layers" column says how a layer may change what it inherits: the safety fields only narrow, and the operational ones move either way within maxima. Kraft refuses a layer that breaks its row's rule, and names the scope.

FieldTypeRule down the layersMeaning
allowed_toolslistOnly narrows.Tool names the agent may use; the permission gate answers from it. Unset allows every tool, and [] allows none. See Tool lists.
deny_toolslistOnly accumulates.Tool names the permission gate denies, on top of allowed_tools.
grantslistOnly accumulates; an item override can drop one, never add one.Named git operations a task is guaranteed: git-commit, git-rebase, git-push. See Grants.
sandboxmappingSet once, never changed or removed, its resources included.Runs every process of the whole work item in docker run, within its resource limits. Two scopes with different sandboxes are refused. See Sandboxed workers.
token_budgetintegerWithin its level's maxima; a child's never above its parent's.Tokens (input plus output) the scope's launches may spend before the next launch is refused.
budget_usdnumberAs token_budget.The same cap in dollars, under budget.work_item_usd and budget.daily_usd.
allowed_harnesseslistWithin maxima.Harness profiles an agent task may select; Kraft refuses others at intake and again at launch.
escalation_harnessstringAny value, execution node or broader.The harness profile an escalation turn runs on; a name harnesses.yaml doesn't define is refused.
max_attempts, timeout_minutesintegerWithin maxima; execution node or broader.Bound the node's fix loop; a step, task or gate refuses them.
time_cap_minutesintegerAs token_budget.Running time of the scope; a launch past it is refused and a running process is killed at it.
total_time_cap_minutesintegerAs time_cap_minutes.Wall-clock time of the scope, including waits and gates, less only a manual pause. For a wait it is the wait's timeout.

A launch into a sandbox with neither network: nor unrestricted_network: true is refused. Which tool policies a sandbox refuses depends on its network:; see Tool policy.

How the layers combine

A work item freezes its policy when you file it. Kraft layers it from the broadest source to the narrowest:

  1. defaults and maxima in policy.yaml.
  2. The repository's policy: in repos.yaml.
  3. The chain's policy:.
  4. Each node's, step's and task's own policy:.
  5. Your item's own override, from kraft item create --policy or kraft item set-policy.

At intake Kraft refuses a layer that relaxes what it inherits, and names the scope, so a bad policy fails when you file the item and not hours into a run. The chain narrowing the same field first never causes a refusal.

Your override is the one layer that can change after filing. On a running or waiting item a change takes effect from the next node entered and the next check of a wait.

A recovery plan inherits the task, step or node that declares it. A fix loop, its judge, a node's escalation task and its conflict handler inherit their node. A gate's auto_review inherits its gate.

What a cap stop says

A time cap stops the item with the reason "<scope> hit its time cap of N minutes". It reads "total time cap" for total_time_cap_minutes, and the scope reads "the work item" for the item itself. A gate's own timeout stops the item the same way, naming the gate, and the gate stays open for you to approve or reject. For the fix per reason, see Caps, budgets and waits.

Tool lists

allowed_tools and deny_tools hold tool names, never permission rules. Use a bare tool (Bash, Read) or one exact MCP tool (mcp__kraft__report_progress). Kraft refuses a scoped rule (Bash(git *)), a glob (mcp__github__*) or a whole server (mcp__github) wherever the list is read, and the message names the field and the name to write instead.

What a harness does under an allowed_tools list:

HarnessUnder a list
gemini, antigravityRefuses to launch, because it has no tool-list capability.
codexEnforces the list through Kraft's permission hook, but its web tools never reach the hook, so a list that leaves out WebSearch is refused.
cursorEnforces the list through the hook, but its web tools never reach it, so a list that leaves out WebFetch and WebSearch is refused.

Allowing Bash allows its read-only use without a gate ask. Claude runs a read-only shell command (cat, ls, git status) itself, so it can read any file the worktree holds, gitignored ones included.

Copyright © 2026