Filter AI output before it reaches your users.
Strip banned phrases, internal leaks, and thinking artifacts from LLM responses. Configurable per project via TOML. Ships with sane defaults.
cargo install --git https://github.com/aspelldenny/quality-gateRequires Rust 1.70+ (stable).
Quality Gate has three modes: filter, check, and serve.
Read from stdin, write cleaned output to stdout:
echo "Great! Based on pipeline COMPLEX, Claude Opus analyzed..." | quality-gate filter
# Output: "Great! Based on , analyzed..."
# With project-specific rules:
echo "..." | quality-gate filter --rules .quality-gate.tomlCheck a file for violations. Exit 0 = clean, exit 1 = violations found:
quality-gate check --input response.txt
quality-gate check --input response.txt --rules .quality-gate.tomlStart an MCP stdio server for integration with Claude Code and other AI tooling:
quality-gate serveExposes two tools over JSON-RPC: filter_text and check_text.
| Command | Description | Key Flags |
|---|---|---|
filter |
Pipe filter — stdin to stdout | --rules <path> |
check |
Lint file for violations | --input <path>, --rules <path> |
serve |
MCP stdio server | — |
- Thinking artifacts —
<thinking>...</thinking>,<reflection>...</reflection>blocks - Model/vendor names — Claude Opus/Sonnet/Haiku, Gemini Flash/Pro, GPT-3/4, OpenRouter, OpenAI, Anthropic
Drop a .quality-gate.toml in your project root to add project-specific rules. All sections are optional:
[banned_phrases]
items = [
"Based on the information",
"That's a great question",
]
[internal_leaks]
patterns = [
"pipeline",
"Sprint\\s*\\d+",
"READY_FOR_SPREAD",
]
[thinking]
strip = true # default — set false to keep thinking blocks- Banned phrases — exact text, case-insensitive, stripped from output
- Leak patterns — regex, case-insensitive, stripped from output
- Thinking — toggle stripping of
<thinking>blocks (on by default)
Project rules merge with base rules (union). They never replace them.
TOML escaping note: regex backslashes need double-escaping in TOML basic strings.
\sbecomes\\s,\d+becomes\\d+.
If --rules is not provided:
- Quality Gate looks for
.quality-gate.tomlin the current directory - If not found, only base rules apply
In MCP mode, the client passes rules_path as a tool parameter.
v0.1 — rules engine and CLI scaffold are functional. Filter pipeline and MCP server are stubbed and under active development. The rules loading, merging, and validation layer is complete and tested.
quality-gate/
├── src/
│ ├── main.rs # CLI entry point (clap derive)
│ ├── lib.rs # Core API: error types, re-exports
│ └── rules/
│ ├── mod.rs # RuleSet struct + merge logic
│ ├── loader.rs # TOML → RuleSet parser with regex validation
│ └── defaults.rs # Embeds base.toml at compile time
├── rules/
│ └── base.toml # Base rules shipped with the binary
└── tests/
└── rules_test.rs # Integration tests for rules loading + merge
- Rust stable (1.70+)
- No runtime dependencies — single static binary