Autonomy
Quality & reliability
An agent that runs unattended needs guards. Brigade ships a layer of deterministic checks that keep output honest and runs resilient — none of them ask the model to grade itself.
Anti-slop quality gate#
A deterministic, zero-model detector scans generated text in four passes — vocabulary crutches, cliché phrases, formulaic openers, and structural patterns — and flags density, not single words. One robust in a technical answer is fine; three crutches plus a formulaic opener is slop. When output trips the threshold (default: 3 distinct hits, tunable per surface), it triggers one bounded repair retry, wired as a post-generation hook. It is an objective check — the anti-slop arm of the principle "independent verification, never the agent judging itself."
Two layers
Tool-loop detector#
Models sometimes get stuck calling the same tool with the same arguments over and over. The tool-loop detector catches it with two escalation levels:
| Level | Default | Action |
|---|---|---|
| Warning | 10 identical calls | Logged as a tool-blocked event; the call passes through. |
| Critical | 20 identical calls | Blocked with a synthetic tool-result that explains the loop, pushing the model to try something else. |
State is keyed per session (not per turn), so a model that loops across steer retries or quality re-prompts is still caught. It runs before the exec-gate, so a stuck model does not even reach the approval allowlist.
Error classification & retry#
Provider failures are classified into a taxonomy — auth, rate limit, overloaded, timeout, context overflow, model-not-found, billing, and more — and each category maps to a policy: transient vs permanent, how many retries, and the backoff curve. Same-model retries happen first; the loop only escalates when the failure category demands it.
Cross-model fallback#
When same-model retry is exhausted (or the failure demands a new candidate, like model-not-found), Brigade rotates across a candidate chain. Per-(provider, reason) cooldown slots stop a rate-limit storm from cycling every candidate in the same second. Only models in your agents.defaults.models allowlist are eligible as fallbacks — but the model you explicitly asked for always runs, even if it is off the list. There is also a thinking-fallback: if a model rejects a reasoning request at runtime, Brigade downgrades thinking to off and retries once.
Smart compaction#
Large tool results are bounded (head + tail with a clear notice) so a single huge output does not blow a small-context turn, and the loop recommends a context compaction when the window fills. You can tune the limits in config.
These compose