Purpose
Blind Auditor is a mandatory code auditing system based on MCP (Model Context Protocol), designed to improve the quality of code generated by AI agents. Through a unique "thought isolation" mechanism, it forces the AI, before outputting the final result, to enter an independent "audit phase" for self-review.
Core Mechanism: Thought Isolation
Traditional AI coding is usually "generate and output," which easily leaves behind errors and biases. Blind Auditor introduces an intermediate layer:
- Interception: When the agent wants to output code, it must first submit it to Blind Auditor.
- Isolation: Blind Auditor does not immediately return the result; instead, it injects a mandatory system instruction, forcing the agent to pause its current role and switch to the role of "ruthless auditor."
- Audit: In this isolated context, the agent must scan the generated code line by line according to the predefined rules.json.
- Release: Only when the audit score reaches the threshold (default > 80) and there are no serious issues will the code be unlocked and returned to the user.
Main Features
- Zero-Trust Architecture: By default, the agent's first draft is not trusted and must pass the audit.
- Zero Extra Cost: Reuses the current session model of the host IDE, with no additional API Key required.
- Eliminate Bias: Forces a perspective switch through prompt injection, breaking generation inertia.
- Strict Compliance: Hardcodes team code standards (rules.json) into the generation process, making it more effective than simple prompts.
- Automatic Repair Loop: When an audit fails, it automatically triggers a "repair-resubmit" loop until the requirements are met or the maximum number of retries is reached.
Usage
Prerequisites
Requires Python 3.10+ and uv.
Configure Audit Rules (rules.json)
Create or edit rules.json in the project root directory. This is the auditor's "rulebook." Configuration fields:
- severity: CRITICAL (fatal error; once found, it fails immediately, usually with a high score deduction); WARNING (warning; medium score deduction, accumulation can lead to failure); PREFERENCE (style preference; low score deduction).
- weight: The score deducted when a rule is violated (total score 100).
Configure IDE (Antigravity / Cursor / Windsurf)
To ensure the agent knows it must use this tool, add the corresponding instruction in .cursorrules or the IDE system prompt settings. At the same time, add the configuration in the MCP client configuration file (such as claude_desktop_config.json or IDE settings). Note: Replace /path/to/your/blind-auditor with the absolute path of the actual cloned repository.
Tool Interface
- submit_draft: Submit a code draft. Input: code (content), language (programming language). Behavior: Lock the session and return mandatory audit instructions.
- submit_audit_result: Submit the audit conclusion. Input: passed (boolean, whether it passed), issues (list of issues), score (0-100 points). Behavior: If score < 80, force passed=False; if passed, unlock the code; if failed, increment the retry count and require the agent to fix and resubmit.
- reset_session: Reset the state and clear the retry count.
Applicable Scenarios
Suitable for developers or teams using AI agents to write code, especially in scenarios that require enforcing code standards, improving the quality of generated code, and reducing the burden of manual review. Supports IDEs such as Antigravity, Cursor, and Windsurf.
Limitations
- Theoretically supports all programming languages. Blind Auditor itself does not parse code syntax, but instead relies on the agent's understanding of the descriptions in rules.json for matching.
- Before use, ensure the system prompt is configured correctly and clearly tell the agent "do not output code directly." You can also manually remind it in chat: "Please go through Blind Auditor for auditing first."
- If the code still fails with a score of 100, check whether a CRITICAL rule in rules.json has been triggered; the current logic mainly relies on the score passed by the agent, but if passed is True while score < 80, the system will forcibly reject it.