
Tetrad
io.github.SamoraDCPublished by GitHub account SamoraDCv0.1.12Updated Nov 10, 2026
Quadruple consensus MCP server for code validation using Codex, Gemini, and Qwen
Overview
MCP server that sends code, plans and tests written by an AI assistant to Codex, Gemini and Qwen CLIs and returns a consensus verdict.
- What you can do
- Review plans, code and tests before they are saved or finalized
- Confirm agreement with received feedback and run a final pre-commit check
- Check the health and availability of the configured evaluator CLIs
- Aggregate per-model votes into a pass or block decision with scores and suggestions
- Store and reuse learned code patterns in a local SQLite ReasoningBank, with history, export and import commands
- When to use it
- Useful when you want a second, third and fourth opinion on AI-generated code before it is committed, especially for critical or security-sensitive changes. It fits teams already using Claude Code who want an automated review gate rather than manual cross-checking.
- Requirements
- Runs locally over stdio via the npm package, so Node.js is needed. At least one of the Codex, Gemini or Qwen CLI tools must be installed and authenticated; API keys such as OPENAI_API_KEY, GEMINI_API_KEY or DASHSCOPE_API_KEY are optional if you log in with an existing subscription or account. Network access is required for the evaluator CLIs.
Installation
In SourceWeft
- Open Tetrad in the dashboard and add it to a workspace.
- Enable the server for the chats that should use its tools.
Desktop only via STDIO. STDIO servers start a local process, so they need the SourceWeft desktop host.
Other MCP clients
Follow the launch instructions in the repository.
README
Tetrad
[CI] [MCP Registry] [npm] [Crates.io] [Rust] [License: MIT]
Quadruple Consensus MCP Server for Claude Code
Tetrad is a high-performance MCP (Model Context Protocol) server written in Rust that orchestrates three AI-powered CLI code evaluation tools (Codex, Gemini CLI, Qwen) to validate all code produced by Claude Code.
The system implements a quadruple consensus protocol where no code or plan is accepted without approval from four intelligences: the three external evaluators + Claude Code itself.
Features
- Quadruple Consensus: 4 AI models must agree to approve code
- ReasoningBank: Continuous learning system with RETRIEVE→JUDGE→DISTILL→CONSOLIDATE cycle
- High Performance: Written in Rust with parallel execution via Tokio
- MCP Server: JSON-RPC 2.0 server over stdio for Claude Code integration
- Full CLI: Intuitive commands (
init,serve,status,doctor,config, etc.) - LRU Cache: Result caching with configurable TTL
- Hook System: Pre/post evaluation callbacks for customization
- Extensible: Plugin system for custom executors
- Cross-session: SQLite persistence for patterns and history
Quick Start
1. Install Tetrad
1.1 Initialize in Your Project (Optional)
This will:
- Create
tetrad.tomlconfiguration file - Create
.tetrad/directory for the database - Add
.tetrad/to your.gitignore
2. Install and Configure External CLI Tools
Tetrad requires at least one of the following AI CLI tools. Good news: you don't need separate API keys if you have existing subscriptions!
Codex CLI (OpenAI)
Authentication options:
Note: For headless/remote servers, use
codex login --device-authand follow the device code flow.
📖 Codex CLI Authentication Docs
Gemini CLI (Google)
Authentication options:
Free Tier: With a personal Google account, you get access to Gemini 2.5 Pro with 1M token context window at no cost!
📖 Gemini CLI Authentication Docs
Qwen CLI (Alibaba)
Authentication options:
Regional Endpoints:
- Singapore:
dashscope-intl.aliyuncs.com- Virginia:
dashscope-us.aliyuncs.com- Beijing:
dashscope.aliyuncs.com
3. Verify Installation
4. Add to Claude Code CLI
Alternative installation methods
Note: Tetrad is published on the MCP Registry for discoverability and documentation.
5. Alternative: Manual Configuration
Create or edit .mcp.json in your project root:
Or for global user configuration in ~/.claude.json (mcpServers section):
How It Works
When you ask Claude Code to write code, Tetrad automatically validates it:
When Issues Are Found:
CLI Commands
MCP Tools
When running as MCP server, Tetrad exposes 6 tools:
Workflow Example
Architecture
Executor Specializations
Consensus Rules
ReasoningBank
The ReasoningBank is a continuous learning system that stores and consolidates code patterns:
Learning Cycle
Pattern Types
- AntiPattern: Patterns to avoid (bugs, vulnerabilities, code smells)
- GoodPattern: Patterns to follow (best practices, idiomatic patterns)
- Ambiguous: Patterns with uncertain classification (needs more data)
ReasoningBank Commands
Configuration
The tetrad.toml file is created automatically with tetrad init:
Interactive Configuration
Use tetrad config for interactive configuration:
LRU Cache
The system includes an LRU cache to avoid unnecessary re-evaluations:
- Capacity: Configurable (default: 1000 entries)
- TTL: Configurable time-to-live (default: 5 minutes)
- Key: Hash of code + language + evaluation type
- Invalidation: Automatic by TTL or manual
Hook System
Hooks allow customizing behavior at specific points:
Built-in Hooks
- LoggingHook: Records all evaluations
- MetricsHook: Collects usage statistics
Project Structure
Development
Troubleshooting
"CLI not found"
"stdin is not a terminal" (Codex)
Make sure your config uses exec --json:
"Response does not contain valid JSON" (Gemini)
Make sure your config uses -o json:
Check MCP status in Claude Code
Inside Claude Code, run:
Prerequisites
To use Tetrad, you need at least one of the AI CLIs installed and authenticated:
Check availability with:
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add some amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
License
MIT
Author
SamoraDC
Links:
Source: README.md at commit dc5874e
Tools
0Version history
1- v0.1.12LatestSep 16, 2026
Score
50% of the applicable checks met
How complete this listing is, computed from the registry entry, the endpoint and public sources. Not a rating of the server and not a statement that it is safe or working today: reachability is a dated check, and no installs or reviews go into the score.
- Reached in the last 30 days25 pts
Keep the endpoint answering the MCP handshake; SourceWeft probes it every 30 days.
- Auth declared10 pts
Declare the credential headers in the registry entry, or keep the endpoint answering the probe so its auth can be classified.
- Tools listed15 pts
Answer tools/list without a credential, or ship a package that starts in a sandbox without one.
- DescriptionRequired15 pts
- Logo10 pts
- Documentation15 pts
- License10 pts