vibe-gate-mcp 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.env.example +51 -0
- package/CHANGELOG.md +27 -0
- package/LICENSE +21 -0
- package/README.md +112 -0
- package/dist/index.mjs +3547 -0
- package/docs/INSTALLATION.md +104 -0
- package/docs/SEMANTIC_DIFF_PAYLOAD.md +76 -0
- package/docs/TROUBLESHOOTING.md +62 -0
- package/docs/USAGE.md +125 -0
- package/docs/VIBE-GATE.md +66 -0
- package/docs/project/VARIABLES.md +50 -0
- package/docs/project/api/mcp-tools.md +115 -0
- package/examples/cursor-mcp.project.json +13 -0
- package/examples/cursor-mcp.user-local-dev.json +16 -0
- package/package.json +96 -0
- package/rules.json +42 -0
- package/schemas/rules.schema.json +38 -0
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
# Installation Guide
|
|
2
|
+
|
|
3
|
+
## Prerequisites
|
|
4
|
+
|
|
5
|
+
- **Node.js** ≥24
|
|
6
|
+
- A Critic LLM API key (see [`.env.example`](../.env.example))
|
|
7
|
+
|
|
8
|
+
## Consumers (npm) — recommended
|
|
9
|
+
|
|
10
|
+
### 1. Configure keys
|
|
11
|
+
|
|
12
|
+
You need **one** provider. Put keys in MCP `env` and/or a `.env` file loaded by vibe-gate.
|
|
13
|
+
|
|
14
|
+
Minimal (OpenAI):
|
|
15
|
+
|
|
16
|
+
```env
|
|
17
|
+
CRITIC_PROVIDER=openai
|
|
18
|
+
OPENAI_API_KEY=YOUR_OPENAI_API_KEY
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
OpenCode:
|
|
22
|
+
|
|
23
|
+
```env
|
|
24
|
+
CRITIC_PROVIDER=opencode
|
|
25
|
+
OPENCODE_API_KEY=...
|
|
26
|
+
OPENCODE_PLAN=go
|
|
27
|
+
CRITIC_MODEL=minimax-m3
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
See [project/VARIABLES.md](project/VARIABLES.md) for every variable.
|
|
31
|
+
|
|
32
|
+
### 2. Cursor MCP
|
|
33
|
+
|
|
34
|
+
Copy [examples/cursor-mcp.project.json](../examples/cursor-mcp.project.json) into your project’s `.cursor/mcp.json` (or user MCP), and add your key:
|
|
35
|
+
|
|
36
|
+
```json
|
|
37
|
+
{
|
|
38
|
+
"mcpServers": {
|
|
39
|
+
"vibe-gate": {
|
|
40
|
+
"command": "npx",
|
|
41
|
+
"args": ["-y", "vibe-gate-mcp"],
|
|
42
|
+
"env": {
|
|
43
|
+
"VIBE_WORKSPACE_ROOT": "${workspaceFolder}",
|
|
44
|
+
"CRITIC_PROVIDER": "openai",
|
|
45
|
+
"OPENAI_API_KEY": "YOUR_OPENAI_API_KEY"
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
`${workspaceFolder}` is required so `files[]` resolves inside the open repo.
|
|
53
|
+
|
|
54
|
+
### 3. Use `files[]`
|
|
55
|
+
|
|
56
|
+
```json
|
|
57
|
+
{
|
|
58
|
+
"phaseId": "my-feature",
|
|
59
|
+
"report": "…",
|
|
60
|
+
"files": ["src/a.ts"],
|
|
61
|
+
"round": 1
|
|
62
|
+
}
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
## Developers (this repository)
|
|
66
|
+
|
|
67
|
+
```bash
|
|
68
|
+
git clone https://github.com/mustafacagri/vibe-gate-mcp.git
|
|
69
|
+
cd vibe-gate-mcp
|
|
70
|
+
corepack yarn install
|
|
71
|
+
npm run build
|
|
72
|
+
cp .env.example .env # fill Critic key — REQUIRED before reviews work
|
|
73
|
+
npm test
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
Local MCP template: [examples/cursor-mcp.user-local-dev.json](../examples/cursor-mcp.user-local-dev.json).
|
|
77
|
+
|
|
78
|
+
After rebuild: **toggle** vibe-gate MCP (do not rely on Reload Window alone).
|
|
79
|
+
|
|
80
|
+
## Multi-repo layout
|
|
81
|
+
|
|
82
|
+
| Layer | Responsibility |
|
|
83
|
+
| ------------------ | ------------------------------------------------------------------------------------------------------------------------------ |
|
|
84
|
+
| User / project MCP | `npx -y vibe-gate-mcp` (or `node dist/index.mjs` while developing) + `VIBE_WORKSPACE_ROOT=${workspaceFolder}` + Critic key env |
|
|
85
|
+
| Consumer repo | Agents call `submit_phase_review` with `files[]` |
|
|
86
|
+
|
|
87
|
+
Never hardcode one consumer absolute path as `VIBE_WORKSPACE_ROOT`.
|
|
88
|
+
|
|
89
|
+
## Publish checklist
|
|
90
|
+
|
|
91
|
+
```bash
|
|
92
|
+
npm run prepublishOnly
|
|
93
|
+
npm pack --dry-run
|
|
94
|
+
npm publish
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
Package name on npm: **`vibe-gate-mcp`** (`bin`: `vibe-gate-mcp` → `dist/index.mjs`).
|
|
98
|
+
|
|
99
|
+
## References
|
|
100
|
+
|
|
101
|
+
- [USAGE.md](USAGE.md)
|
|
102
|
+
- [SEMANTIC_DIFF_PAYLOAD.md](SEMANTIC_DIFF_PAYLOAD.md)
|
|
103
|
+
- [TROUBLESHOOTING.md](TROUBLESHOOTING.md)
|
|
104
|
+
- [project/VARIABLES.md](project/VARIABLES.md)
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
# Semantic diff payload sources
|
|
2
|
+
|
|
3
|
+
`submit_phase_review` always reviews a **FILE:…CONTENT:** corpus (full file bodies, not git diff). Agents choose **exactly one** payload source:
|
|
4
|
+
|
|
5
|
+
| Priority | Field | When to use |
|
|
6
|
+
| ----------------- | ------------------ | --------------------------------------------------------------------------------------- |
|
|
7
|
+
| **1 (preferred)** | `files: string[]` | Normal batches. Workspace-relative source paths; MCP reads disk and builds the payload. |
|
|
8
|
+
| 2 | `semanticDiffPath` | Pre-built payload file already on disk (CI artifacts, offline dumps). |
|
|
9
|
+
| 3 | `semanticDiff` | Tiny one-file smoke payloads. |
|
|
10
|
+
|
|
11
|
+
## Why `files[]` is best practice
|
|
12
|
+
|
|
13
|
+
| Layer | `files[]` | Inline `semanticDiff` |
|
|
14
|
+
| -------------------------- | ----------------------- | ------------------------------------------------------ |
|
|
15
|
+
| Agent / MCP tool-call JSON | Path list only | Full source in args (burns IDE context + chat history) |
|
|
16
|
+
| Critic LLM | Full source (MCP-built) | Full source (same) |
|
|
17
|
+
|
|
18
|
+
`files[]` does **not** reduce Critic tokens. It stops the IDE agent from re-serializing every file into the tool call.
|
|
19
|
+
|
|
20
|
+
Limits (SSoT: `SEMANTIC_DIFF_SOURCE_FILES` in `src/constants.ts`):
|
|
21
|
+
|
|
22
|
+
- Max **10** paths per call
|
|
23
|
+
- Max **1 MiB** per file
|
|
24
|
+
- Max **5 MiB** total
|
|
25
|
+
|
|
26
|
+
Paths must be **relative to `VIBE_WORKSPACE_ROOT`**. Absolute paths and `..` traversal are rejected.
|
|
27
|
+
|
|
28
|
+
## Example (preferred)
|
|
29
|
+
|
|
30
|
+
```json
|
|
31
|
+
{
|
|
32
|
+
"phaseId": "phase-6-§1a",
|
|
33
|
+
"report": "…",
|
|
34
|
+
"files": ["features/compliance/constants.ts", "packages/compliance/src/export-zip.ts"],
|
|
35
|
+
"round": 1
|
|
36
|
+
}
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
## `semanticDiffPath` (optional)
|
|
40
|
+
|
|
41
|
+
Write the same FILE:…CONTENT: string to a UTF-8 file under the workspace (raw text or JSON `{"semanticDiff":"..."}`), then pass the relative path. Size ≤ 5 MiB (`SEMANTIC_DIFF_FILE.MAX_BYTES`).
|
|
42
|
+
|
|
43
|
+
## Inline `semanticDiff`
|
|
44
|
+
|
|
45
|
+
Same FILE:…CONTENT: string as the tool argument. Prefer `files[]`.
|
|
46
|
+
|
|
47
|
+
## Payload format (what the Critic sees)
|
|
48
|
+
|
|
49
|
+
```
|
|
50
|
+
FILE: packages/shared/src/result.ts
|
|
51
|
+
CONTENT:
|
|
52
|
+
[FULL FILE CONTENT]
|
|
53
|
+
|
|
54
|
+
FILE: packages/shared/src/domain-error.ts
|
|
55
|
+
CONTENT:
|
|
56
|
+
[FULL FILE CONTENT]
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
Markers are SSoT: `SEMANTIC_DIFF_PAYLOAD_MARKERS` in `src/constants.ts`.
|
|
60
|
+
|
|
61
|
+
## Soft advisory
|
|
62
|
+
|
|
63
|
+
If any FILE block exceeds `SEMANTIC_DIFF_FILE.SOFT_WARN_LINES_PER_FILE_BLOCK` (default 500), responses may include `semanticDiffHints` (non-blocking).
|
|
64
|
+
|
|
65
|
+
## Status updates on ACCEPT
|
|
66
|
+
|
|
67
|
+
By default ACCEPT writes `.vibe/status.json`. Skip pollution for probes:
|
|
68
|
+
|
|
69
|
+
- `updateStatus: false`, or
|
|
70
|
+
- `phaseId` starting with `mcp-smoke-` / `vibe-gate-probe-` (`PHASE_STATUS_POLICY`)
|
|
71
|
+
|
|
72
|
+
## Workspace root (multi-repo / public)
|
|
73
|
+
|
|
74
|
+
Set **`VIBE_WORKSPACE_ROOT`** to the **consumer project** root (Cursor: `${workspaceFolder}` in **project** `.cursor/mcp.json`). Do **not** hardcode a single repo path in user-level MCP config — that breaks other projects.
|
|
75
|
+
|
|
76
|
+
See `examples/cursor-mcp.project.json` and [INSTALLATION.md](INSTALLATION.md).
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
# Troubleshooting
|
|
2
|
+
|
|
3
|
+
## Common Issues
|
|
4
|
+
|
|
5
|
+
### "No LLM provider available"
|
|
6
|
+
|
|
7
|
+
**Cause:** Missing API key or wrong `CRITIC_PROVIDER`.
|
|
8
|
+
|
|
9
|
+
**Fix:**
|
|
10
|
+
|
|
11
|
+
1. Set the correct API key for your provider: `OPENAI_API_KEY`, `ANTHROPIC_API_KEY`, `GOOGLE_GENERATIVE_AI_API_KEY`, `MINIMAX_API_KEY`, or `OPENCODE_API_KEY`.
|
|
12
|
+
2. Ensure `CRITIC_PROVIDER` matches one of: `openai`, `anthropic`, `google`, `minimax`, `opencode`.
|
|
13
|
+
3. Verify `.env` is loaded (MCP config must pass `env` or the process must inherit it).
|
|
14
|
+
|
|
15
|
+
### MCP server not connecting
|
|
16
|
+
|
|
17
|
+
**Cause:** Wrong `cwd`, missing build/dependencies, or env not passed.
|
|
18
|
+
|
|
19
|
+
**Fix:**
|
|
20
|
+
|
|
21
|
+
1. Use `npx -y vibe-gate-mcp`, or an absolute `node dist/index.mjs` path while developing.
|
|
22
|
+
2. Ensure `npm run build` completes from the project root.
|
|
23
|
+
3. Pass API keys in `env` in the MCP config.
|
|
24
|
+
|
|
25
|
+
### Status and Roadmap out of sync
|
|
26
|
+
|
|
27
|
+
**Cause:** Phase completed without using `submit_phase_review`, or manual edits.
|
|
28
|
+
|
|
29
|
+
**Fix:** Manually update `.vibe/status.json` to match the completed phase.
|
|
30
|
+
|
|
31
|
+
### Wrong workspace root (monorepo)
|
|
32
|
+
|
|
33
|
+
**Cause:** MCP runs from monorepo root; project is in a subdirectory.
|
|
34
|
+
|
|
35
|
+
**Fix:** Set `VIBE_WORKSPACE_ROOT=/path/to/subproject` in env (project `.cursor/mcp.json` → `${workspaceFolder}`).
|
|
36
|
+
|
|
37
|
+
### IDE shows empty `submit_phase_review` properties / missing `files`
|
|
38
|
+
|
|
39
|
+
**Cause:** The running MCP process has not been restarted after a build, or the tool input schema is not exposed as a plain object — MCP SDK then advertises `properties: {}`.
|
|
40
|
+
|
|
41
|
+
**Fix:**
|
|
42
|
+
|
|
43
|
+
1. Run `npm run build` in the package directory.
|
|
44
|
+
2. **Toggle/restart** the vibe-gate MCP server in the IDE after rebuilding. Reload the IDE if necessary.
|
|
45
|
+
3. Confirm tool description mentions `files` and properties include `files`, `semanticDiffPath`, `semanticDiff`.
|
|
46
|
+
4. The server registers `submitPhaseReviewFieldsSchema` (plain object) for ListTools.
|
|
47
|
+
|
|
48
|
+
### `files` / `semanticDiffPath` file not found
|
|
49
|
+
|
|
50
|
+
**Cause:** `VIBE_WORKSPACE_ROOT` points at the wrong repo (often hardcoded in **user-level** MCP), or path is absolute / outside the workspace.
|
|
51
|
+
|
|
52
|
+
**Fix:** Set `VIBE_WORKSPACE_ROOT` only in **project** `.cursor/mcp.json` → `${workspaceFolder}`. Paths must be relative to that root. Remove hardcoded consumer paths from user-level MCP.
|
|
53
|
+
|
|
54
|
+
### Debug logging
|
|
55
|
+
|
|
56
|
+
**Cause:** Need to see parse/read failures.
|
|
57
|
+
|
|
58
|
+
**Fix:** Set `DEBUG=1` in env. Logs go to stderr.
|
|
59
|
+
|
|
60
|
+
## References
|
|
61
|
+
|
|
62
|
+
- [docs/project/VARIABLES.md](project/VARIABLES.md) — Env reference
|
package/docs/USAGE.md
ADDED
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
# Usage Guide
|
|
2
|
+
|
|
3
|
+
## First Run
|
|
4
|
+
|
|
5
|
+
1. Ensure `.env` and MCP config are set (see [INSTALLATION.md](INSTALLATION.md)).
|
|
6
|
+
2. Restart your IDE or Cursor so it picks up the MCP server.
|
|
7
|
+
3. Create `.vibe/` in your project root (or let the tool create it).
|
|
8
|
+
|
|
9
|
+
## Project Setup
|
|
10
|
+
|
|
11
|
+
### rules.json (optional)
|
|
12
|
+
|
|
13
|
+
Define hard and soft rules for the Critic:
|
|
14
|
+
|
|
15
|
+
```json
|
|
16
|
+
{
|
|
17
|
+
"hardRules": [{ "id": "SEC-1", "description": "No hardcoded secrets", "category": "security" }],
|
|
18
|
+
"softRules": [{ "id": "STYLE-1", "description": "Prefer named exports", "category": "style" }]
|
|
19
|
+
}
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
### DEBT.md (optional)
|
|
23
|
+
|
|
24
|
+
Created automatically when the Critic issues a DEBT verdict and the Implementer accepts:
|
|
25
|
+
|
|
26
|
+
```
|
|
27
|
+
## Records
|
|
28
|
+
|
|
29
|
+
### YYYY-MM-DD - Duplicate subject
|
|
30
|
+
|
|
31
|
+
- **Phase:** example-phase
|
|
32
|
+
- **Rationale:** ...
|
|
33
|
+
- **Status:** Open
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
## Configuration & API Keys
|
|
37
|
+
|
|
38
|
+
Vibe-Gate requires an AI provider API key. You can place your configuration (`API_KEY`, `CRITIC_PROVIDER`, `CRITIC_MODEL`, `CRITIC_PERSONA`, etc.) in **any** of the following locations:
|
|
39
|
+
|
|
40
|
+
1. **Your Project's `.env` (Recommended for Monorepos/Projects):**
|
|
41
|
+
Simply place a `.env` file in the root of the project you are working on (the one defined by `VIBE_WORKSPACE_ROOT`). Vibe-Gate will automatically read it.
|
|
42
|
+
2. **MCP Config (`mcpServers.vibe-gate.env`):**
|
|
43
|
+
Add it directly to your IDE's MCP settings. Variables here overwrite any `.env` files.
|
|
44
|
+
3. **Package-local `.env` (local development):**
|
|
45
|
+
Copy `.env.example` to `.env` in the package directory, or set the same keys in MCP `env`.
|
|
46
|
+
|
|
47
|
+
> **Tip:** You can mix and match. For example, define `CRITIC_PROVIDER` broadly in the MCP config, but set a specific `OPENAI_API_KEY` inside your current project's `.env` file.
|
|
48
|
+
|
|
49
|
+
### OpenAI (default)
|
|
50
|
+
|
|
51
|
+
```env
|
|
52
|
+
CRITIC_PROVIDER=openai
|
|
53
|
+
OPENAI_API_KEY=YOUR_OPENAI_API_KEY
|
|
54
|
+
# CRITIC_MODEL=gpt-5.4 # optional, default
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
### Anthropic
|
|
58
|
+
|
|
59
|
+
```env
|
|
60
|
+
CRITIC_PROVIDER=anthropic
|
|
61
|
+
ANTHROPIC_API_KEY=YOUR_ANTHROPIC_API_KEY
|
|
62
|
+
# CRITIC_MODEL=claude-4.6-sonnet # optional
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
### Google Gemini
|
|
66
|
+
|
|
67
|
+
```env
|
|
68
|
+
CRITIC_PROVIDER=google
|
|
69
|
+
GOOGLE_GENERATIVE_AI_API_KEY=YOUR_GOOGLE_API_KEY
|
|
70
|
+
# CRITIC_MODEL=gemini-3.1-pro # optional
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
### MiniMax
|
|
74
|
+
|
|
75
|
+
```env
|
|
76
|
+
CRITIC_PROVIDER=minimax
|
|
77
|
+
MINIMAX_API_KEY=...
|
|
78
|
+
# CRITIC_MODEL=MiniMax-M3 # default; also: MiniMax-M2.7, MiniMax-M2.5
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
MiniMax uses an Anthropic-compatible API endpoint. Default model: `MiniMax-M3`. Also available: `MiniMax-M2.7`, `MiniMax-M2.5`, and high-speed variants.
|
|
82
|
+
|
|
83
|
+
### OpenCode (Zen or Go)
|
|
84
|
+
|
|
85
|
+
```env
|
|
86
|
+
CRITIC_PROVIDER=opencode
|
|
87
|
+
OPENCODE_API_KEY=...
|
|
88
|
+
OPENCODE_PLAN=go
|
|
89
|
+
# CRITIC_MODEL=minimax-m3
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
OpenCode has two plans sharing the same API key from [opencode.ai/auth](https://opencode.ai/auth):
|
|
93
|
+
|
|
94
|
+
| Plan | `OPENCODE_PLAN` | Base URL | Billing |
|
|
95
|
+
| ----------------------- | --------------- | ------------------------------- | -------------------- |
|
|
96
|
+
| **Go** (subscription) | `go` | `https://opencode.ai/zen/go/v1` | Monthly subscription |
|
|
97
|
+
| **Zen** (pay-as-you-go) | `zen` | `https://opencode.ai/zen/v1` | Per-token credits |
|
|
98
|
+
|
|
99
|
+
**Important:** On Go, `minimax-m3` uses the Anthropic `/messages` endpoint (not chat completions). On Zen, it uses `/chat/completions`.
|
|
100
|
+
|
|
101
|
+
Model IDs are lowercase (`minimax-m3`). Display names like `MiniMax-M3` are accepted as aliases.
|
|
102
|
+
|
|
103
|
+
For the **direct MiniMax provider** (`CRITIC_PROVIDER=minimax`), use PascalCase: `MiniMax-M3`.
|
|
104
|
+
|
|
105
|
+
### Personas
|
|
106
|
+
|
|
107
|
+
```env
|
|
108
|
+
CRITIC_PERSONA=security-first # or performance-freak, clean-code-monk
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
## MCP Tools
|
|
112
|
+
|
|
113
|
+
| Tool | Purpose |
|
|
114
|
+
| --------------------- | ---------------------------------------------------- |
|
|
115
|
+
| `submit_phase_review` | Implementer reports phase completion; Critic reviews |
|
|
116
|
+
| `log_human_decision` | Judge records decision on deadlock |
|
|
117
|
+
|
|
118
|
+
`submit_phase_review` — **prefer `files[]`** (workspace-relative source paths; MCP builds FILE:…CONTENT:). Alternatives: `semanticDiffPath` or inline `semanticDiff` — exactly one. Use `updateStatus: false` for probes. See [SEMANTIC_DIFF_PAYLOAD.md](SEMANTIC_DIFF_PAYLOAD.md).
|
|
119
|
+
|
|
120
|
+
See [docs/project/api/mcp-tools.md](project/api/mcp-tools.md) for full API docs.
|
|
121
|
+
|
|
122
|
+
## References
|
|
123
|
+
|
|
124
|
+
- [docs/VIBE-GATE.md](VIBE-GATE.md) — Purpose and flow
|
|
125
|
+
- [docs/TROUBLESHOOTING.md](TROUBLESHOOTING.md) — Common issues
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
# Vibe-Gate: Purpose and Features
|
|
2
|
+
|
|
3
|
+
## Purpose
|
|
4
|
+
|
|
5
|
+
Vibe-Gate is a **Model Context Protocol (MCP)** server designed for developers who write code with AI-assisted IDEs (Cursor, Windsurf, Antigravity, etc.) using a "vibe coding" workflow — rapid iteration with minimal friction.
|
|
6
|
+
|
|
7
|
+
**Core problem:** When coding quickly with AI, security, architectural consistency, and long-term maintainability often get deprioritized. Reviewing entire codebases with another AI is expensive and hits context limits.
|
|
8
|
+
|
|
9
|
+
**Solution:** Vibe-Gate acts as an **Adversarial Quality Gate**. The IDE AI (Implementer) reports what it changed; a separate Critic AI reviews only the changed artifacts and side effects. The two models debate; the human (Judge) steps in only when they deadlock.
|
|
10
|
+
|
|
11
|
+
## Features
|
|
12
|
+
|
|
13
|
+
### 1. Three-Actor Model & Multi-Model Support
|
|
14
|
+
|
|
15
|
+
To prevent "echo chambers," the Critic should ideally be a different LLM than the Implementer. Vibe-Gate is LLM-agnostic, allowing you to configure the Critic with your preferred flagship model (e.g., Gemini 3.1 Pro, Claude 4.6 Sonnet, GPT-5.4) via standard API keys.
|
|
16
|
+
|
|
17
|
+
| Role | Actor | Responsibility |
|
|
18
|
+
| --------------- | ---------------- | ----------------------------------------------------------------------------- |
|
|
19
|
+
| **Implementer** | IDE AI | Writes code, triggers the `submit_phase_review` MCP tool at phase completion. |
|
|
20
|
+
| **Critic** | Vibe-Gate MCP AI | Reviews reports against rules, challenges violations. |
|
|
21
|
+
| **Judge** | Human | Resolves deadlocks; decisions feed project-specific learning. |
|
|
22
|
+
|
|
23
|
+
### 2. Roadmap Tracking & Phase Execution
|
|
24
|
+
|
|
25
|
+
Vibe-Gate tracks project progress via a local `.vibe/status.json` or `ROADMAP.md` file. It monitors the debate rounds (e.g., `count: x`) for each sub-phase. A phase is only marked as complete after a successful resolution between the AIs or a direct Judge override.
|
|
26
|
+
|
|
27
|
+
### 3. Rule System
|
|
28
|
+
|
|
29
|
+
- **Hard Rules:** Non-negotiable. Security (injection, secrets), core architecture, data integrity. No exceptions.
|
|
30
|
+
- **Soft Rules:** Deferrable. Style, refactoring, performance. If the Implementer objects, items are logged to `DEBT.md` instead of blocking.
|
|
31
|
+
|
|
32
|
+
### 4. Conflict Loop (Max 3 Rounds)
|
|
33
|
+
|
|
34
|
+
1. **Round 1:** Implementer reports → Critic responds with risks and gaps.
|
|
35
|
+
2. **Rounds 2–3:** Implementer fixes or argues (e.g., "Soft rule, log to debt").
|
|
36
|
+
3. **Deadlock:** If no agreement after 3 rounds → Conflict Alert → Judge decides.
|
|
37
|
+
|
|
38
|
+
### 5. Smart Context (Cost Control)
|
|
39
|
+
|
|
40
|
+
Vibe-Gate does not send full codebases to the Critic. It sends targeted payloads:
|
|
41
|
+
|
|
42
|
+
- **Project Blueprint:** Framework conventions (e.g., Nuxt 3 structures, Node.js workers, WebSocket handling).
|
|
43
|
+
- **Semantic Diff:** Logical changes and structural side effects.
|
|
44
|
+
- **Dependency List:** New packages (analyzed for bundle bloat and known CVEs).
|
|
45
|
+
- **Critical Snippets:** Only high-risk areas like Auth, DB schemas, or API endpoints.
|
|
46
|
+
|
|
47
|
+
### 6. Personas
|
|
48
|
+
|
|
49
|
+
The Critic can run in different modes (configurable):
|
|
50
|
+
|
|
51
|
+
- **Security First:** Strict on security, token leaks, and compliance.
|
|
52
|
+
- **Performance Freak:** Focus on latency, memory leaks, and bundle size.
|
|
53
|
+
- **Clean Code Monk:** Focus on readability, DRY principles, and maintainability.
|
|
54
|
+
|
|
55
|
+
### 7. Project-Local Learning
|
|
56
|
+
|
|
57
|
+
Judge decisions are written to a `preferences.log` file in the workspace. The Critic reads this on subsequent runs to align with the Judge’s specific coding style. Learning is strictly per-project (no automatic cross-project sharing).
|
|
58
|
+
|
|
59
|
+
---
|
|
60
|
+
|
|
61
|
+
## Language Policy (npm Publish)
|
|
62
|
+
|
|
63
|
+
- **No duplicate content** — single source, no TR/EN split.
|
|
64
|
+
- **Published files:** English only (`README.md`, `package.json`, `rules.json`, `docs/`, `.env.example`).
|
|
65
|
+
- **All project files:** English only. No TR/EN split.
|
|
66
|
+
- **Vibe-Gate output in user projects:** Always English.
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
# Environment Variables
|
|
2
|
+
|
|
3
|
+
Copy [`.env.example`](../../.env.example) → `.env` in the package directory **or** set the same keys in MCP `env`. Without a Critic key, `submit_phase_review` cannot run.
|
|
4
|
+
|
|
5
|
+
## Required (pick one provider)
|
|
6
|
+
|
|
7
|
+
| Variable | When required | Description |
|
|
8
|
+
| ------------------------------ | ------------------------------ | -------------------------------------------------------------- |
|
|
9
|
+
| `CRITIC_PROVIDER` | Recommended (default `openai`) | `openai` \| `anthropic` \| `google` \| `minimax` \| `opencode` |
|
|
10
|
+
| `OPENAI_API_KEY` | `CRITIC_PROVIDER=openai` | OpenAI API key |
|
|
11
|
+
| `ANTHROPIC_API_KEY` | `CRITIC_PROVIDER=anthropic` | Anthropic API key |
|
|
12
|
+
| `GOOGLE_GENERATIVE_AI_API_KEY` | `CRITIC_PROVIDER=google` | Google Gemini API key |
|
|
13
|
+
| `MINIMAX_API_KEY` | `CRITIC_PROVIDER=minimax` | MiniMax API key |
|
|
14
|
+
| `OPENCODE_API_KEY` | `CRITIC_PROVIDER=opencode` | From https://opencode.ai/auth |
|
|
15
|
+
|
|
16
|
+
## Optional
|
|
17
|
+
|
|
18
|
+
| Variable | Default | Description |
|
|
19
|
+
| --------------------- | ------------------------- | ------------------------------------------------------------------------- |
|
|
20
|
+
| `VIBE_WORKSPACE_ROOT` | auto (`cwd` package root) | **Consumer project root.** In Cursor set `${workspaceFolder}` in mcp.json |
|
|
21
|
+
| `CRITIC_MODEL` | provider default | Model id override |
|
|
22
|
+
| `CRITIC_PERSONA` | `clean-code-monk` | `security-first` \| `performance-freak` \| `clean-code-monk` |
|
|
23
|
+
| `OPENCODE_PLAN` | `go` | `go` (subscription) or `zen` (pay-as-you-go) |
|
|
24
|
+
| `DEBUG` | unset | Log parse/read failures to stderr |
|
|
25
|
+
|
|
26
|
+
## Priority
|
|
27
|
+
|
|
28
|
+
1. Process / MCP `env` block
|
|
29
|
+
2. `VIBE_WORKSPACE_ROOT/.env` (consumer)
|
|
30
|
+
3. Package-local `.env` (local development)
|
|
31
|
+
|
|
32
|
+
## Cursor example
|
|
33
|
+
|
|
34
|
+
```json
|
|
35
|
+
{
|
|
36
|
+
"mcpServers": {
|
|
37
|
+
"vibe-gate": {
|
|
38
|
+
"command": "npx",
|
|
39
|
+
"args": ["-y", "vibe-gate-mcp"],
|
|
40
|
+
"env": {
|
|
41
|
+
"VIBE_WORKSPACE_ROOT": "${workspaceFolder}",
|
|
42
|
+
"CRITIC_PROVIDER": "openai",
|
|
43
|
+
"OPENAI_API_KEY": "YOUR_OPENAI_API_KEY"
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
**SEC-002:** Never commit real keys. Prefer local `.env` over committing secrets into mcp.json when possible.
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
# MCP Tools API
|
|
2
|
+
|
|
3
|
+
Vibe-Gate exposes tools via MCP (Model Context Protocol). No HTTP API.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## submit_phase_review
|
|
8
|
+
|
|
9
|
+
**Purpose:** Implementer (IDE AI) submits phase completion report for Critic review.
|
|
10
|
+
|
|
11
|
+
**Handler:** `handleSubmitPhaseReview` (`src/tools/submit-phase-review.ts`)
|
|
12
|
+
|
|
13
|
+
### Data Flow
|
|
14
|
+
|
|
15
|
+
```
|
|
16
|
+
MCP Client → tools/call submit_phase_review
|
|
17
|
+
↓
|
|
18
|
+
args: { phaseId, report, files | semanticDiffPath | semanticDiff, updateStatus?, ... }
|
|
19
|
+
↓
|
|
20
|
+
exactly one payload source:
|
|
21
|
+
files[] → buildSemanticDiffFromSourceFiles (read each path under VIBE_WORKSPACE_ROOT)
|
|
22
|
+
semanticDiffPath → loadSemanticDiffFromWorkspacePath
|
|
23
|
+
semanticDiff → use inline string
|
|
24
|
+
↓
|
|
25
|
+
parseSemanticDiff() → filesChanged count / context
|
|
26
|
+
↓
|
|
27
|
+
buildContextBlock() → blueprint, deps, FILE:…CONTENT: corpus
|
|
28
|
+
↓
|
|
29
|
+
provider.complete([system, user]) → Critic LLM
|
|
30
|
+
↓
|
|
31
|
+
parseVerdictFromResponse → ACCEPT | REJECT | …
|
|
32
|
+
↓
|
|
33
|
+
if ACCEPT && shouldPersistPhaseStatus(phaseId, updateStatus) → updatePhaseOnAccept → .vibe/status.json
|
|
34
|
+
↓
|
|
35
|
+
Response JSON: { verdict, model, usage, statusUpdated, statusSkipped?, statusError?, … }
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
### Input Schema
|
|
39
|
+
|
|
40
|
+
| Field | Type | Required | Description |
|
|
41
|
+
| ---------------- | -------- | -------- | ---------------------------------------------------------------------------------------------- |
|
|
42
|
+
| phaseId | string | yes | Phase identifier (e.g. `phase-6-§1a`) |
|
|
43
|
+
| report | string | yes | Implementer report |
|
|
44
|
+
| files | string[] | xor† | **Preferred.** Workspace-relative source paths; MCP builds FILE:…CONTENT:. Max 10. |
|
|
45
|
+
| semanticDiffPath | string | xor† | Pre-built payload file under `VIBE_WORKSPACE_ROOT` (raw or JSON `{"semanticDiff":"..."}`). |
|
|
46
|
+
| semanticDiff | string | xor† | Inline FILE:…CONTENT: payload (not git diff). |
|
|
47
|
+
| updateStatus | boolean | no | `false` skips status.json on ACCEPT. Default skips `mcp-smoke-` / `vibe-gate-probe-` prefixes. |
|
|
48
|
+
| dependencies | string[] | no | New/updated packages |
|
|
49
|
+
| round | number | no | Round (1–3), default 1 |
|
|
50
|
+
| logToDebt | object | no | When DEBT: `{ subject, rationale }` |
|
|
51
|
+
|
|
52
|
+
† **Exactly one** of `files` (non-empty), `semanticDiffPath` (non-empty), or `semanticDiff` (non-empty). See [SEMANTIC_DIFF_PAYLOAD.md](../../SEMANTIC_DIFF_PAYLOAD.md).
|
|
53
|
+
|
|
54
|
+
**ListTools note:** MCP registers `submitPhaseReviewFieldsSchema` (plain ZodObject). Exactly-one rules run in the handler via `submitPhaseReviewInputSchema`.
|
|
55
|
+
|
|
56
|
+
### Output
|
|
57
|
+
|
|
58
|
+
```json
|
|
59
|
+
{
|
|
60
|
+
"verdict": "ACCEPT | REJECT | BLOCK | DEBT | CONCERNS_ADDRESSED | LOW_QUALITY | INSUFFICIENT_REVIEW",
|
|
61
|
+
"model": "gpt-5.4",
|
|
62
|
+
"usage": { "promptTokens": 0, "completionTokens": 0 },
|
|
63
|
+
"statusUpdated": true,
|
|
64
|
+
"statusSkipped": false,
|
|
65
|
+
"statusError": "optional, when ACCEPT but status write failed"
|
|
66
|
+
}
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
- `statusUpdated`: `true` when verdict is ACCEPT and `.vibe/status.json` was updated.
|
|
70
|
+
- `statusSkipped`: `true` when ACCEPT but status write was skipped (probe policy / `updateStatus: false`).
|
|
71
|
+
- `statusError`: Present when ACCEPT but status update failed (e.g., permission denied).
|
|
72
|
+
- `semanticDiffHints` (optional): Soft advisory when a FILE block exceeds line threshold.
|
|
73
|
+
|
|
74
|
+
File-load errors return `{ error, code? }` (e.g. `PATH_OUTSIDE_WORKSPACE`, `FILE_TOO_LARGE`, `TOO_MANY_FILES`, `JSON_SCHEMA`, `REALPATH_FAILED`).
|
|
75
|
+
|
|
76
|
+
---
|
|
77
|
+
|
|
78
|
+
## log_human_decision
|
|
79
|
+
|
|
80
|
+
**Purpose:** Judge (human) records decision on deadlock; appends to `.vibe/preferences.log`.
|
|
81
|
+
|
|
82
|
+
### Data Flow
|
|
83
|
+
|
|
84
|
+
```
|
|
85
|
+
MCP Client → tools/call log_human_decision
|
|
86
|
+
↓
|
|
87
|
+
args: { caseId, decision, rationale?, confirmationToken? }
|
|
88
|
+
↓
|
|
89
|
+
if VIBE_HUMAN_CONFIRMATION_TOKEN set → require matching confirmationToken
|
|
90
|
+
↓
|
|
91
|
+
mkdir(.vibe) if needed
|
|
92
|
+
↓
|
|
93
|
+
append new entry → writeFile(preferences.log)
|
|
94
|
+
↓
|
|
95
|
+
Response: { success, path, message } | { success:false, code: HUMAN_CONFIRMATION_REQUIRED }
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
### Input Schema
|
|
99
|
+
|
|
100
|
+
| Field | Type | Required | Description |
|
|
101
|
+
| ----------------- | ------ | -------- | ------------------------------------------------------------------------------------- |
|
|
102
|
+
| caseId | string | yes | Conflict case identifier |
|
|
103
|
+
| decision | string | yes | ACCEPT_IMPLEMENTER \| ACCEPT_CRITIC \| CUSTOM |
|
|
104
|
+
| rationale | string | no | Optional rationale |
|
|
105
|
+
| confirmationToken | string | when env | Required when `VIBE_HUMAN_CONFIRMATION_TOKEN` is set (blocks implementer self-unlock) |
|
|
106
|
+
|
|
107
|
+
### Structured ≠ prose
|
|
108
|
+
|
|
109
|
+
`submit_phase_review` may return `code: STRUCTURED_PROSE_MISMATCH`. Resolve by **another Critic round** (`submit_phase_review`) — not `ACCEPT_IMPLEMENTER`, not a human. Mid-loop `ACCEPT_IMPLEMENTER` returns `CONTINUE_CRITIC_DEBATE`.
|
|
110
|
+
|
|
111
|
+
### Output
|
|
112
|
+
|
|
113
|
+
```json
|
|
114
|
+
{ "success": true, "path": ".vibe/preferences.log", "message": "Decision logged to preferences.log" }
|
|
115
|
+
```
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
{
|
|
2
|
+
"mcpServers": {
|
|
3
|
+
"vibe-gate": {
|
|
4
|
+
"command": "node",
|
|
5
|
+
"args": ["/ABSOLUTE/PATH/TO/vibe-gate-mcp/dist/index.mjs"],
|
|
6
|
+
"cwd": "/ABSOLUTE/PATH/TO/vibe-gate-mcp",
|
|
7
|
+
"env": {
|
|
8
|
+
"VIBE_WORKSPACE_ROOT": "${workspaceFolder}",
|
|
9
|
+
"CRITIC_PROVIDER": "opencode",
|
|
10
|
+
"CRITIC_MODEL": "minimax-m3",
|
|
11
|
+
"OPENCODE_API_KEY": "YOUR_OPENCODE_API_KEY",
|
|
12
|
+
"OPENCODE_PLAN": "go"
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
}
|