Repository navigation
Description
The problem
The default guardrail rule set (internal/app/guardrails.go:173, defaultGuardrailSpecs) ships every rule in advisory mode:
var defaultGuardrailSpecs = []modelhook.RuleSpec{
{Match: "WebSearch", Phases: []string{"pre", "post"}, Mode: string(modelhook.ModeAdvisory)},
{Match: "WebFetch", Phases: []string{"post"}, Mode: string(modelhook.ModeAdvisory)},
{Match: "mcp__*", Phases: []string{"pre", "post"}, Mode: string(modelhook.ModeAdvisory)},
}The ADR 0021 rationale was "the operator measures the false-positive rate before promoting a rule to block/sanitize." But combined with #170 (advisory findings are invisible to the TUI), advisory mode was a black hole: findings fired, vanished into the operator log, and never got promoted because the signal never surfaced in the operator's primary interface. An operator who enables a security control expects enforcement, not an invisible observe-only mode that requires log-grepping to discover it's working.
Proposed change
Flip the default rule set to block; make advisory an opt-in.
When a guardrail model is configured but the operator authors no explicit rules: list, the built-in default rules ship in block mode:
| Tool matcher | Phases | Mode (new default) |
|---|---|---|
WebSearch |
pre + post | block |
WebFetch |
post | block |
mcp__* |
pre + post | block |
Advisory becomes something the operator explicitly opts into — either per-rule (mode: advisory in an explicit rules: list) or via a global default-mode toggle (see below).
Global default-mode toggle
Add an operator-tier config key that sets the mode the built-in default rules ship in, so the operator can choose the posture without authoring a full rule list:
guardrails:
model: deepseek/deepseek-v4-flash
defaultMode: block # default; "advisory" opts into observe-only; "sanitize" for rewriteResolution:
defaultModesets theModefield on every entry indefaultGuardrailSpecsat compile time.- An explicit
rules:list still replaces the defaults entirely (unchanged behaviour —effectiveGuardrailSpecs,guardrails.go:189). - Per-rule
modein an explicit list overrides the globaldefaultMode(the per-rule value wins;defaultModeonly fills in for the built-in defaults).
What changes in code
defaultGuardrailSpecsentries change fromModeAdvisorytoModeBlock(the literal default).foldOperatorGuardrails(guardrails.go:21) reads the newdefaultModeYAML key ontoConfig.effectiveGuardrailSpecs(guardrails.go:189) appliesdefaultModeto the built-in specs when no explicit rules are configured (theusedDefaultspath).permconfigparsesdefaultMode(strict, operator-tier-only — same discipline as the rest ofguardrails:).- ADR 0021 (Default rule set section),
docs/architecture.md,docs/usage.mdupdated. - Tests: default rules compile to
block;defaultMode: advisorydowngrades; explicitrules:ignoresdefaultMode; the e2e guardrails test (e2e/guardrails_test.go) updated for the new default.
Rationale
- Enabling guardrails is already the opt-in to spend. An operator who configures a checker model expects protection, not an invisible observe-only mode.
- With guardrails: surface advisory findings to the TUI (client-visible, model-invisible) #170 landing (advisory findings surface to the TUI), advisory mode becomes a legitimate "observe before enforcing" posture — but it should be the opt-in, not the default. The default for a security control is enforcement.
- This aligns with the operator's position across guardrails: remove maxChecks per-session call-count cap (security footgun) #168/guardrails: add global checker-down posture toggle (warn default / fail opt-in) #169/guardrails: surface advisory findings to the TUI (client-visible, model-invisible) #170: a security control that silently degrades, silently fires, or silently observes is a footgun. Default-block makes "I enabled guardrails" mean "I am guarded."
Out of scope
- The maxChecks removal (guardrails: remove maxChecks per-session call-count cap (security footgun) #168) — separate, though the auto-200 default-cap logic (
guardrails.go:139-148) interacts: with block as the default the "surprise-bill on MCP-heavy session" concern is even more acute, so guardrails: remove maxChecks per-session call-count cap (security footgun) #168 should land alongside or before this. - The checker-down posture toggle (guardrails: add global checker-down posture toggle (warn default / fail opt-in) #169) — orthogonal (checker unavailable vs. checker found something).
- Advisory TUI visibility (guardrails: surface advisory findings to the TUI (client-visible, model-invisible) #170) — orthogonal (how findings surface, not what the default mode is), but this issue depends on guardrails: surface advisory findings to the TUI (client-visible, model-invisible) #170 for advisory to be a useful opt-in.
Activity
JAORMX commentedon Jun 24, 2026
Dependency note: this issue depends on #170 (advisory findings surface to the TUI) for advisory mode to be a useful opt-in. If #170 hasn't landed, an operator who sets
defaultMode: advisorygets the same invisible-findings black hole this issue's rationale argues against.docs(guardrails): document per-rule prompt override + defaultMode fie…