Project-agnostic constitutional AI system with file-based rules, automatic detection, and per-project isolation.
Note: This is an enhanced fork of the original vibe-check-mcp-server by Pruthvi Bhat, tailored for local deployment with file-based constitutional rules and project-agnostic workflows.
This enhanced version of Vibe Check MCP provides:
- β File-Based Constitutional Rules - JSON-based rules with inheritance (Base β Project β Session)
- β Automatic Project Detection - Zero manual configuration, auto-detects project name from directory path
- β
Per-Project Isolation - Each project gets its own
history-{projectName}.jsonandvibe-log-{projectName}.json - β Metacognitive Vibe Checking - Catch tunnel vision before cascading errors (from original vibe-check)
- β Pattern Learning - Record mistakes and solutions for institutional memory
- β Hot Reload (Optional) - Live rule updates during development without restart
- β Pre-Flight Validation - Catch configuration errors before runtime
| Feature | Original vibe-check-mcp | This Enhanced Version |
|---|---|---|
| Deployment | Global npm package (npx @pv-bhat/vibe-check-mcp) |
Local per-project installation |
| Constitutional Rules | Runtime-only (in-memory via update_constitution) |
File-based with JSON inheritance |
| Project Awareness | Single global instance | Per-project isolation with auto-detection |
| Configuration | Manual environment variables | Auto-configured via init script |
| Storage | Generic filenames (history.json, vibe-log.json) |
Project-specific filenames (history-{projectName}.json) |
| Setup | npm install + manual config | Zero-config with automatic setup |
This enhanced version is designed to run locally per project, not as a global npm package.
- Node.js 18.x or higher
- npm 9.x or higher
- A Gemini API key (get one at https://makersuite.google.com/app/apikey)
# 1. Clone the repository
git clone https://github.com/ArtificialMonks/vibe-workflow
cd vibe-workflow
# 2. Run initialization script (sets up everything automatically)
bash init.sh /path/to/your/project
# 3. (Optional) Generate intelligent constitutional templates from your CLAUDE.md
cd /path/to/your/project/.vibe-check/enhanced-mcp-server
npx tsx scripts/intelligent-constitution-generator.ts /path/to/your/project
# 4. Add your Gemini API key to .mcp.json (if not entered during init)
# 5. Restart Claude CodeThe init script creates a complete, production-ready installation:
- β
Full TypeScript source code (
src/) - β
Compiled JavaScript ready to run (
build/) - β All helper scripts for intelligent generation
- β Complete package with dependencies installed
- β
12 foundational rules that apply to ALL projects
- 5 CRITICAL rules (Vitest-only, NestJS 10.4.20, pg.Pool, security, deployment)
- 5 HIGH priority rules (TypeScript strict, testing, error handling, code review, accessibility)
- 2 MEDIUM rules (documentation, performance)
- β JSON Schema for rule validation (VS Code integration)
- β Inheritance system - Your project rules extend base rules
- β
7 project-agnostic templates ready to customize:
api-development.json- REST API standardsdatabase-migrations.json- Schema change patternstesting.json- Test coverage and qualitydeployment.json- Production deployment safetyintegration-development.json- Third-party integrationsui-components.json- Frontend component standardsworkflow-automation.json- Browser automation patterns
- β
constitutional-rules.json- Your project's custom rules - β
.mcp.json- MCP server configuration with absolute paths - β
Auto-created on first use:
history-{projectName}.json,vibe-log-{projectName}.json
After initialization, you can auto-generate customized rules:
cd /path/to/your/project/.vibe-check/enhanced-mcp-server
npx tsx scripts/intelligent-constitution-generator.ts /path/to/your/projectWhat it does:
- π§ Analyzes codebase - Scans
package.json,CLAUDE.md, directory structure - π§ Discovers work types - Detects ML, blockchain, payments, auth, realtime, GraphQL
- π§ Customizes templates - Merges generic rules with your project-specific patterns
- π§ Generates new templates - Creates templates for discovered specialized domains
- π§ Extracts rules from CLAUDE.md - Maps sections to work-type templates automatically
- π§ 100% project-aware - Complete constitutional system tailored to YOUR project
Example output:
Analyzed codebase: NestJS, React, Prisma, Stripe detected
Discovered 3 new work types: payment-processing, auth-security, realtime-communication
Extracted 89 rules from CLAUDE.md
Customized 7 templates with project-specific rules
Generated 3 new templates
Total: 10 templates with 168 rules β
See SETUP.md for detailed installation guide and examples/saas-starter/ for a complete working example.
After running init.sh, your project will have this structure:
your-project/
βββ .vibe-check/ # Created by init.sh
β βββ constitutional-rules.json # β
Project-specific rules (auto-generated)
β β
β βββ shared/ # β
Base rules (copied from template/)
β β βββ base-constitutional-rules.json # 12 universal foundational rules
β β βββ schema/
β β β βββ constitutional-rules.schema.json # JSON Schema for validation
β β βββ README.md # Documentation
β β
β βββ constitutions/ # β
Work-type templates (copied from template/)
β β βββ api-development.json # REST API standards
β β βββ database-migrations.json # Schema change patterns
β β βββ testing.json # Test coverage and quality
β β βββ deployment.json # Production deployment safety
β β βββ integration-development.json # Third-party integrations
β β βββ ui-components.json # Frontend component standards
β β βββ workflow-automation.json # Browser automation patterns
β β βββ README.md # Templates guide
β β
β βββ enhanced-mcp-server/ # β
Complete MCP server (copied from template/)
β β βββ build/ # Compiled JavaScript (ready to run)
β β βββ src/ # TypeScript source code
β β βββ scripts/ # Helper scripts
β β β βββ intelligent-constitution-generator.ts
β β β βββ load-work-type-constitution.ts
β β β βββ generate-rules-from-docs.ts
β β βββ node_modules/ # Dependencies (npm install)
β β βββ package.json
β β βββ tsconfig.json
β β
β βββ history-your-project.json # β³ Auto-created on first vibe_check
β βββ vibe-log-your-project.json # β³ Auto-created on first vibe_learn
β
βββ .mcp.json # β
MCP configuration (auto-created by init.sh)
Legend:
- β
Created by
init.shduring installation - β³ Auto-created on first use (runtime)
The init.sh script automatically creates all configuration files with absolute paths.
You don't need to manually create these files - they're generated during installation.
The init script creates this file with correct absolute paths:
{
"mcpServers": {
"pv-bhat-vibe-check-mcp-server": {
"type": "stdio",
"command": "node",
"args": [
"/absolute/path/to/your-project/.vibe-check/enhanced-mcp-server/build/index.js"
],
"env": {
"MCP_TRANSPORT": "stdio",
"GEMINI_API_KEY": "your-gemini-api-key",
"DEFAULT_LLM_PROVIDER": "gemini",
"DEFAULT_MODEL": "gemini-2.5-flash",
"USE_LEARNING_HISTORY": "true",
"VIBE_CHECK_STORAGE_DIR": "/absolute/path/to/your-project/.vibe-check",
"VIBE_CHECK_RULES_FILE": "/absolute/path/to/your-project/.vibe-check/constitutional-rules.json",
"VIBE_CHECK_HOT_RELOAD": "false"
}
}
}
}Note: You only need to add your Gemini API key if you didn't enter it during init.sh.
The init script creates this file with your project name:
{
"$schema": "shared/schema/constitutional-rules.schema.json",
"version": "1.0.0",
"extends": ["shared/base-constitutional-rules.json"],
"description": "Constitutional rules for your-project",
"rules": {
"your-project-rule-1": {
"id": "your-project-rule-1",
"name": "Your Project Rule Example",
"description": "ALWAYS follow your-project-specific patterns",
"category": "best-practices",
"severity": "HIGH",
"enabled": true
}
}
}After configuration, restart Claude Code to load the enhanced MCP server.
The server automatically extracts your project name from the directory path:
VIBE_CHECK_STORAGE_DIR = /path/to/MY-PROJECT/.vibe-check
β (auto-extract)
PROJECT_NAME = "MY-PROJECT"
β
history-MY-PROJECT.json β
Auto-created
vibe-log-MY-PROJECT.json β
Auto-created
No manual configuration needed! Each project automatically gets isolated storage.
Located in .vibe-check/shared/base-constitutional-rules.json:
CRITICAL Rules (5):
- vitest-only - Always use Vitest for testing (NEVER Jest)
- nestjs-version-pinning - Use NestJS 10.4.20 exactly (NEVER 11.x)
- database-with-pg-pool - Use pg.Pool for PostgreSQL (NEVER TypeORM in NestJS)
- security-best-practices - Follow OWASP security guidelines
- deployment-safety - Test in staging before production
HIGH Priority Rules (5): 6. typescript-strict-mode - Enable TypeScript strict mode 7. test-before-commit - Run tests before committing code 8. explicit-error-handling - Always handle errors explicitly 9. code-review-standards - Require code review before merging 10. accessibility-requirements - Meet WCAG 2.1 Level AA standards
MEDIUM Priority Rules (2): 11. documentation-requirements - Document public APIs and decisions 12. performance-considerations - Profile before optimizing
These rules apply to ALL projects and are inherited automatically.
Add project-specific rules in .vibe-check/constitutional-rules.json:
{
"extends": ["shared/base-constitutional-rules.json"],
"rules": {
"api-versioning": {
"id": "api-versioning",
"name": "REST API Versioning",
"description": "ALWAYS version API endpoints as /api/v1/...",
"category": "architecture",
"severity": "CRITICAL",
"enabled": true
}
}
}Inheritance Chain:
Base Rules (12 universal)
β extends
Project Rules (your custom rules)
β loaded into
Session Constitution (runtime)
Catch tunnel vision and prevent cascading errors:
vibe_check({
goal: "Implement user authentication",
plan: "1. Add JWT middleware 2. Create login endpoint 3. Test",
uncertainties: ["Should we use OAuth or JWT?"],
sessionId: "auth-feature-001"
})
// Returns thoughtful critique:
// "Have you considered password reset flow?
// What about rate limiting on login attempts?"Record mistakes and solutions for future prevention:
vibe_learn({
type: "mistake",
mistake: "Forgot to add database indexes before deploying",
category: "Premature Implementation",
solution: "Always run performance validation before production"
})Manage session-specific rules dynamically (inherited from original vibe-check).
Catch configuration errors before runtime:
cd .vibe-check/enhanced-mcp-server
npm run validate
# Output:
# β
Rules File: constitutional-rules.json
# β
Inheritance Chain: base β project (14 rules)
# β
Severity: 3 CRITICAL, 6 HIGH, 5 MEDIUM
# β
Validation PASSEDEnable file watching for live rule updates:
"VIBE_CHECK_HOT_RELOAD": "true"Note: Use new sessionId after hot reload to get updated rules.
cd .vibe-check/enhanced-mcp-server
npm install
npm run build
npm run validateSet in .mcp.json:
GEMINI_API_KEY- Your Gemini API key (required)VIBE_CHECK_STORAGE_DIR- Absolute path to.vibe-check/directoryVIBE_CHECK_RULES_FILE- Absolute path toconstitutional-rules.jsonVIBE_CHECK_HOT_RELOAD- Enable file watching (true/false)DEFAULT_LLM_PROVIDER- LLM provider (gemini,openai,anthropic)DEFAULT_MODEL- Model name (e.g.,gemini-2.5-flash)
Cause: Incorrect extends path in constitutional-rules.json
Fix:
// β
Correct (relative to rules file):
"extends": ["shared/base-constitutional-rules.json"]
// β Wrong:
"extends": [".vibe-check/shared/base-constitutional-rules.json"]Cause: JSON syntax error or missing required fields
Fix:
npm run validate # See detailed error with line/columnCause: Stale MCP server
Fix:
- Check
.mcp.jsonhas correct absolute paths - Restart Claude Code
- Run
npm run validateto verify rules
- Original Vibe-Check MCP: pv-bhat/vibe-check-mcp-server by Pruthvi Bhat
- Constitutional AI: Anthropic's constitutional AI research
- Model Context Protocol: Anthropic's MCP specification
- CPI Research: Chain-Pattern Interrupt (MURST)
MIT License - see LICENSE file for details.
- Original vibe-check-mcp: https://github.com/PV-Bhat/vibe-check-mcp-server
- MCP Specification: https://anthropic.com/mcp
- CPI Research Paper: http://dx.doi.org/10.13140/RG.2.2.18237.93922
Built with β€οΈ for project-agnostic Constitutional AI workflows
Enhanced for local deployment and file-based rule management