Warden
beta · v4.12.0
beta · v4.12.0
Documentation

Engine Thresholds

Warden’s engines use configurable thresholds to control intervention timing and sensitivity. All of them have compiled defaults — configuration is optional.

Every section on this page belongs in rules.toml, either the global ~/.warden/rules.toml or a project’s .warden/rules.toml. None of them are read from config.toml.

Loopbreaker

Controls retry and thrash detection.

SettingDefaultDescription
max_retries3Consecutive failures of the same command before an advisory fires
semantic_threshold0.5Jaccard similarity above which two differently-worded commands count as the same intent
read_spiral_min7Consecutive reads without an edit before the spiral advisory fires
[loopbreaker]
max_retries = 4
semantic_threshold = 0.6
read_spiral_min = 8

Compass

Controls drift detection.

SettingDefaultDescription
drift_threshold0.7Drift score above which the advisory can fire

Focus

Controls when a low focus score becomes an advisory.

SettingDefaultDescription
advisory_threshold40Focus score below which the focus advisory can fire

Dream

Controls the background learning worker and how much it retains.

SettingDefaultDescription
enabledtrueEnable background dream processing
max_sequences50Action sequences retained
max_repair_patterns30Error-to-fix patterns retained
max_conventions20Learned project conventions retained

Oversight

Tracks how much Warden auto-approves without a prompt, and how much of that is mutating work.

SettingDefaultDescription
enabledtrueEnable oversight quality tracking
fatigue_window_turns12Turns to look back for fatigue signals

Session and I/O thresholds

These live under [thresholds] rather than a per-engine section.

SettingDefaultDescription
max_read_size_kb50Largest file Read governance will serve, in kilobytes
max_mcp_output_kb15Budget for one MCP result, in kilobytes — see below
max_string_len2000Longest string in a Warden MCP response before trimming
max_array_len30Longest array in a Warden MCP response before trimming
doom_loop_threshold3Identical tool calls before a warning is injected
offload_threshold_kb8Output size above which the result is written to a scratch file
token_budget_advisory_k700Token budget advisory threshold, in thousands of tokens
progressive_read_advisory_turn50Turn at which read tightening starts advising
progressive_read_deny_turn80Turn at which read tightening starts denying
error_slope_threshold0.5Error slope above which the heuristic advisory fires
stale_milestone_turns10Turns without a milestone before the stale-session advisory
token_burn_threshold_k15Tokens per turn, in thousands, above which burn is flagged
stagnation_turns3Consecutive stagnation snapshots before an advisory
[thresholds]
max_read_size_kb = 100     # this project has large generated files
doom_loop_threshold = 6
stagnation_turns = 8

Note that max_read_size_kb is in kilobytes, not bytes. 50 means 50KB.

How the MCP budget is enforced

A hook cannot rewrite another server’s tool result — no supported host exposes a field for it, so a result that has already run is already in the context window. max_mcp_output_kb is therefore enforced at the two points that do work:

  • Before the call. When a request carries a bounding argument — limit, page_size, max_results, top_k and similar — and its value is larger than the budget allows, Warden clamps it down. An argument that is absent is never invented: MCP servers validate against their own schema, and an unknown property turns a large result into a failed call.
  • After the call. An over-budget result is written to a scratch file and the agent is told which argument would have bounded it, so the next call costs less. Nothing is reported as saved, because nothing was.

Warden’s own MCP responses are the exception — it owns those end to end, and max_string_len and max_array_len trim them before they are returned.