Scan agent output (specifically implementor patches) for accidentally leaked secrets before applying them to a branch.
Detection targets: API keys, tokens, passwords, private keys, connection strings matching common patterns (AWS keys, GitHub tokens, generic high-entropy strings in assignment contexts).
Implementation point: the policy gate on CreateRevisionFromPatch commands. Before the patch is applied, scan the diff content. If a pattern matches, reject the command and surface the
finding in the TUI.
Consider using an existing pattern library (e.g., gitleaks patterns) rather than rolling custom regexes. False positives are acceptable (operator can override) — false negatives are not.