← Discover MCPs and Agents
a
MCPAI & MLGitHub

ai-guard

让AI互相「找茬」— Multi-model AI code assistant for VS Code with hallucination prevention. Generate + Review + Rule Check pipeline. Fork it, hack it, make it yours!

Links

README

From the repo.

AI Guard

License: MIT VS Code Version

🌍 English | 中文 | 日本語 | Deutsch | Français | Español | Português | 한국어 | Русский | العربية | Italiano | Türkçe | हिन्दी | ภาษาไทย | Tiếng Việt

Let AIs find each other's mistakes. — Multi-model AI code assistant for VS Code with hallucination prevention.

AI Guard - Real development scene
Real dev scene: me coding in the trenches, AIs reviewing from the sidelines

Fork it, hack it, make it yours! Contributions welcome!

Overview

AI Guard uses a three-stage pipeline to generate safer, more reliable AI-assisted code:

  1. Generate — A production model generates code from your prompt
  2. Review — A separate review model checks the generated code for issues
  3. Rule Check — Built-in and custom rules validate the output (import validation, syntax check, security patterns)

By using different models for generation and review, AI Guard catches hallucinations and errors that a single model might miss.

Features

  • Multi-model pipeline — Use any OpenAI-compatible models for generation and review
  • Multi-agent review — Configure multiple review agents to run in parallel for broader coverage
  • ESLint integration — Static analysis via ESLint (uses workspace config or sensible defaults)
  • Custom rules — Extend with your own rules via .ai-guard/rules/
  • Configurable stage order — Reorder pipeline stages; optionally skip review when rule check finds errors (saves tokens)
  • Diff view — Visual comparison when the review model suggests changes
  • Sidebar UI — Dedicated panel showing pipeline results and status
  • Configurable — Full control over models, endpoints, and pipeline behavior

Quick Start

  1. Install the extension in VS Code
  2. Configure your API keys in Settings → AI Guard
  3. Open a file and press Ctrl+Shift+G (Cmd+Shift+G on Mac) to run the full pipeline

Commands

CommandDescription
AI Guard: Generate CodeGenerate code from a prompt
AI Guard: Review SelectionReview selected code
AI Guard: Run Full PipelineGenerate + Review + Rule Check
AI Guard: Show Review DiffDisplay diff between generated and reviewed code
AI Guard: Configure ModelsOpen model configuration panel

Configuration

Models

AI Guard supports any OpenAI-compatible API endpoint. Configure via VS Code settings:

{
  "aiGuard.productionModel.endpoint": "https://api.openai.com/v1",
  "aiGuard.productionModel.model": "gpt-4o",
  "aiGuard.productionModel.apiKey": "your-key",
  "aiGuard.reviewModel.endpoint": "https://api.openai.com/v1",
  "aiGuard.reviewModel.model": "claude-sonnet-4-20250514",
  "aiGuard.reviewModel.apiKey": "your-key"
}

Rules

SettingDefaultDescription
aiGuard.rules.enableBuiltIntrueEnable built-in rules
aiGuard.rules.enableEslinttrueUse ESLint for static analysis
aiGuard.rules.customRulesPath.ai-guard/rulesCustom rules directory
aiGuard.rules.enableImportValidationfalse(Legacy) Check if imports exist
aiGuard.rules.enableSyntaxCheckfalse(Legacy) Validate syntax
aiGuard.rules.enableSecurityPatternsfalse(Legacy) Detect security issues

Pipeline

SettingDefaultDescription
aiGuard.pipeline.autoReviewtrueAuto-run review after generation
aiGuard.pipeline.autoRuleChecktrueAuto-run rules after generation
aiGuard.pipeline.showDiffOnIssuestrueShow diff when issues found
aiGuard.pipeline.stageOrder["ruleCheck", "review"]Order of post-generation stages
aiGuard.pipeline.skipReviewOnErrortrueSkip AI review when rule check finds errors (saves tokens)

Multi-Agent Review

You can configure multiple review agents to run in parallel. When set, this overrides the single reviewModel:

{
  "aiGuard.reviewAgents": [
    {
      "name": "Claude",
      "endpoint": "https://api.anthropic.com/v1",
      "model": "claude-sonnet-4-20250514",
      "apiKey": "your-key"
    },
    {
      "name": "DeepSeek",
      "endpoint": "https://api.deepseek.com/v1",
      "model": "deepseek-chat",
      "apiKey": "your-key"
    }
  ]
}

## Custom Rules

Create `.js` files in `.ai-guard/rules/`:

```javascript
module.exports = {
  id: 'my-rule',
  name: 'My Custom Rule',
  description: 'What this rule checks',
  async check(context) {
    const issues = [];
    // Analyze context.code, context.language, etc.
    return { issues };
  }
};

Development

npm install
npm run build    # Build extension
npm run watch    # Watch mode
npm run package  # Package as .vsix

Architecture

src/
├── extension.ts          # Entry point
├── config/               # Settings management
├── models/               # AI model providers (OpenAI-compatible)
├── pipeline/             # Three-stage pipeline engine
│   ├── generate-stage    # Stage 1: Code generation
│   ├── review-stage      # Stage 2: AI review
│   └── rule-check-stage  # Stage 3: Rule validation
├── rules/                # Hallucination detection rules
│   ├── built-in/         # Import, syntax, security checks
│   └── custom/           # Custom rule loader
├── diff/                 # Diff visualization
└── ui/                   # Sidebar, status bar, settings panel

Contributing

See CONTRIBUTING.md for guidelines.

License

MIT

Collected info

  • 1 stars
  • Language: TypeScript
  • Source updated: 3/20/2026

Config for your environment

Replace {MCP_ENDPOINT_URL} with this MCP’s endpoint URL (from its repo or docs above). No API key — you connect directly.

Tool

OS

Config file: ~/.cursor/mcp.json

{
  "mcpServers": {
    "mcp-server": {
      "url": "{MCP_ENDPOINT_URL}"
    }
  }
}

Paste into mcpServers in the config file. Restart Cursor after saving.

If this MCP is also published on mcpchannel.ai, you can subscribe from Browse and use the gateway config there instead.