- Home
- Skills
- Code Quality & Review
- Search Guard — Deterministic AST Quality Gate & Search
Works with the AI Agents you already use
Search Guard — Deterministic AST Quality Gate & Search
Deterministic, zero-mock AST quality gate for AI coding agents with real test-suite execution and surgical AST code search.
$9
Search Guard — Deterministic AST Quality Gate & Search
Example session with this skill installed
I've refactored the authentication token refresh logic in auth/tokens.py. Run Search Guard to surgically verify our test coverage and ensure no mocks, silent exceptions, or broken AST nodes were introduced before we ship.
- Read your context and instructions
- Compiled the search guard
- Generated the document
Quality Gate Delivery Verdict: VERIFIED_PASS
Search Guard executed a complete 4-layer deterministic audit on auth/tokens.py and its test suite. Zero artificial mocks or AST anomalies were detected.
📊 Verification Ledger
| Layer / Verification Stage | Target / Engine | Result | Details |
|---|---|---|---|
| 1. Anti-Mock AST Guard | Tree-Sitter AST | PASSED | 0 production mocks (unittest.mock, MagicMock) or fake stubs detected. |
| 2. Deterministic Suite | pytest (real runner) | PASSED | 24 passed in 1.42s. 100% assertions executed against live test sandbox. |
| 3. AST Meta-Rules | Universal AST | PASSED | No floating promises, no unhandled exceptions, no silent except: pass. |
| 4. Circuit Breaker | Attempt 1 of 5 | CLEARED | First-pass delivery approval. Zero retries needed. |
🔍 Surgical Code Search Index
- Call Graph Traced:
TokenManager.refresh_access_token➔OAuthSessionStore.validate_jwt - Context Consumption: 682 tokens (saved 89% vs dumping raw files into context).
Next Steps:
- Changes in
auth/tokens.pymeet strict production invariants. - Code is verified deterministic and ready to be committed to
main.
search-guard-deterministic-ast-quality-g.pdf
PDF · document
Example file from a real run - the skill writes it into your workspace.
Connects securely to your tools. The creator never sees your data.
About this skill
Search Guard: Deterministic Code Validation & Surgical Search
AI coding agents (Claude Code, Cursor, Windsurf, Copilot) are notorious for two major flaws: they fake tests with mocks to trick you into thinking code works, and they burn your token budget with blind file dumps.
Search Guard solves this with a 100% deterministic, zero-ML architecture. It operates in two specialized, high-performance engines:
🛡️ ENGINE 1: The Deterministic Quality Gate (Primary Pillar)
Stop AI agents from cheating your test suite and shipping hallucinated fixes.
The core of Search Guard is an uncompromising verification engine that subjects any AI-generated code to a real, fail-fast validation pipeline:
- Anti-Mock AST Guardrail (Zero Tolerance):
- Tree-Sitter AST inspection immediately intercepts and rejects fake mocks, monkey-patches, and dummy fixtures in production and business logic.
- Eliminates the classic AI loophole of "modifying the test assertions until it turns green".
- Real Multi-Stack Execution:
- Automatically detects and executes real runners against real dependencies:
- Python (
pytestin sequential chunks) - TypeScript / Node (
vitest/jest) - Rust (
cargo test) - Go (
go test)
- Python (
- Rejects empty passes: zero executed assertions or skipped runners return
INCONCLUSIVE, never a false green.
- Automatically detects and executes real runners against real dependencies:
- AST Meta-Rules & Security Screening:
- Catches runtime-breaking patterns before they reach git: floating promises, unhandled promise rejections, empty
catch/except ...: passblocks, dangerouseval(), and raw SQL string concatenation.
- Catches runtime-breaking patterns before they reach git: floating promises, unhandled promise rejections, empty
- Universal 5-Attempt Circuit Breaker:
- Prevents agents from entering endless retry loops. If an agent fails to produce clean, passing code within 5 cycles, Search Guard trips the breaker and emits a formal Technical Feasibility Report.
🔍 ENGINE 2: Surgical AST & Hybrid Code Search (Context Protection)
Stop burning 2,000-line context windows on simple symbol lookups.
AI agents often spam grep or read entire directories, poisoning their context window and hallucinating architecture. Search Guard’s secondary engine provides pinpoint navigation:
- AST + Ripgrep + Reciprocal Rank Fusion (RRF):
- Combines lexical string search with semantic AST syntax graphs run 100% on CPU.
- Strict Token Economy:
- Delivers relevant call graphs, interface definitions, and function snippets in tight slices (500–1,500 tokens).
- Prevents prompt degradation and protects context limits across long coding sessions.
🚀 Quick Setup (MCP Server)
Add Search Guard to your agent's MCP settings (claude_desktop_config.json, .cursor/mcp.json, etc.):
{
"mcpServers": {
"search-guard": {
"command": "uvx",
"args": ["search-guard-agent"]
}
}
}
Once installed, drop the provided SKILL.md into your agent's skill directory. Your agent will immediately enforce deterministic validation on every task.
Requires Python 3.10+. Workspace must have a runnable test suite. Direct file reads capped at 300 lines. Limit of 5 gate attempts before termination.
How to use
- 1
Connect your agent to the Agensi MCP
Copy the prompt and paste it into Claude, ChatGPT, Cursor or any agent that supports MCP. It sets up the connection for you. Manual setup
- 2
Sign in to Agensi
Your agent shows a sign-in link. Sign in and click Allow.
- 3
Ask for what you need
Your agent loads this skill and uses it on your task. It always asks before any payment.
Reviews
No reviews yet
Be one of the first to try it. Every listed skill goes through the trust checks below.
Security scanned
Checked by our 8-point scan before listing
Fresh listing
Recently published to Agensi
Money-back guarantee
Doesn't do what its page promises? You get your money back.
Trust & safety
Security scan
Security scan passed 19 days ago
Requires
Permissions
File Scopes
Search Guard requires read and shell access strictly within the local workspace to run Tree-Sitter AST inspection and trigger local test runners (pytest, vitest, cargo). No data is sent to external servers or remote telemetry.