@klitchevo/code-council 0.1.3 → 0.2.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/README.md CHANGED
@@ -1,117 +1,87 @@
1
1
  # Code Council
2
2
 
3
+ **One AI can miss things. A council of AIs catches more.**
4
+
3
5
  [![npm version](https://img.shields.io/npm/v/@klitchevo/code-council.svg)](https://www.npmjs.com/package/@klitchevo/code-council)
4
6
  [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
5
7
  [![CI](https://github.com/klitchevo/code-council/workflows/CI/badge.svg)](https://github.com/klitchevo/code-council/actions)
6
8
  [![codecov](https://codecov.io/gh/klitchevo/code-council/branch/main/graph/badge.svg)](https://codecov.io/gh/klitchevo/code-council)
7
9
 
10
+ **[View Documentation](https://klitchevo.github.io/code-council/)** | [npm](https://www.npmjs.com/package/@klitchevo/code-council)
11
+
12
+ Code Council runs your code through multiple AI models simultaneously, then shows you where they **agree**, where they **disagree**, and what **only one model caught**.
13
+
8
14
  ![Code Council](assets/code-council.png)
9
15
 
10
- **Your AI Code Review Council** - Get diverse perspectives from multiple AI models in parallel.
16
+ ## Example Output
11
17
 
12
- An MCP (Model Context Protocol) server that provides AI-powered code review using multiple models from [OpenRouter](https://openrouter.ai). Think of it as assembling a council of AI experts to review your code, each bringing their unique perspective.
18
+ ```
19
+ ## Consensus Analysis
13
20
 
14
- ## Features
21
+ ### Unanimous (All 4 models agree) - High Confidence
15
22
 
16
- - 🔍 **Multi-Model Code Review** - Get diverse perspectives by running reviews across multiple AI models simultaneously
17
- - 🎨 **Frontend Review** - Specialized reviews for accessibility, performance, and UX
18
- - 🔒 **Backend Review** - Security, architecture, and performance analysis
19
- - 📋 **Plan Review** - Review implementation plans before writing code
20
- - 📝 **Git Changes Review** - Review staged, unstaged, branch diffs, or specific commits
21
- - 💬 **Council Discussions** - Multi-turn conversations with the AI council for deeper exploration
22
- - 🏭 **TPS Audit** - Toyota Production System analysis for flow, waste, bottlenecks, and quality
23
- - ⚡ **Parallel Execution** - All models run concurrently for fast results
23
+ **Critical: SQL Injection Vulnerability**
24
+ Location: src/api/users.ts:42
24
25
 
25
- ## Quick Start
26
+ The user input is directly interpolated into the SQL query without sanitization.
27
+ Use parameterized queries instead.
26
28
 
27
- ### Using with npx (Recommended)
29
+ ---
28
30
 
29
- The easiest way to use this MCP server is via npx. Configure your MCP client with environment variable for the API key:
31
+ ### Majority (3 of 4 models) - Moderate Confidence
30
32
 
31
- #### Claude Desktop
33
+ **High: Missing Input Validation**
34
+ Location: src/api/users.ts:38
32
35
 
33
- Add to your `claude_desktop_config.json`:
36
+ The userId parameter is used without validation. Add type checking.
34
37
 
35
- ```json
36
- {
37
- "mcpServers": {
38
- "code-council": {
39
- "command": "npx",
40
- "args": ["-y", "@klitchevo/code-council"],
41
- "env": {
42
- "OPENROUTER_API_KEY": "your-api-key-here"
43
- }
44
- }
45
- }
46
- }
47
- ```
38
+ ---
48
39
 
49
- **With custom models:**
40
+ ### Disagreement - Your Judgment Needed
50
41
 
51
- ```json
52
- {
53
- "mcpServers": {
54
- "code-council": {
55
- "command": "npx",
56
- "args": ["-y", "@klitchevo/code-council"],
57
- "env": {
58
- "OPENROUTER_API_KEY": "your-api-key-here",
59
- "CODE_REVIEW_MODELS": ["anthropic/claude-sonnet-4.5", "openai/gpt-4o"],
60
- "FRONTEND_REVIEW_MODELS": ["anthropic/claude-sonnet-4.5"],
61
- "BACKEND_REVIEW_MODELS": ["openai/gpt-4o", "google/gemini-2.0-flash-exp"]
62
- }
63
- }
64
- }
65
- }
66
- ```
42
+ **Session Token Expiration**
43
+ Location: src/api/auth.ts:28
67
44
 
68
- #### Cursor
45
+ - Kimi K2.5: "Tokens should expire after 24 hours"
46
+ - DeepSeek V3.2: "Current 7-day expiration is reasonable for this use case"
47
+ - Minimax M2.1: "No issue found"
69
48
 
70
- Add to your Cursor MCP settings (`.cursor/mcp.json` or similar):
49
+ ---
71
50
 
72
- ```json
73
- {
74
- "mcpServers": {
75
- "code-council": {
76
- "command": "npx",
77
- "args": ["-y", "@klitchevo/code-council"],
78
- "env": {
79
- "OPENROUTER_API_KEY": "your-api-key-here"
80
- }
81
- }
82
- }
83
- }
51
+ ### Single Model Finding - Worth Checking
52
+
53
+ **Low: Magic Number**
54
+ Location: src/utils/pagination.ts:12
55
+ Found by: GLM 4.7
56
+
57
+ The value 20 should be extracted to a named constant.
84
58
  ```
85
59
 
86
- #### Other MCP Clients
60
+ ## Why Multiple Models?
87
61
 
88
- For any MCP client that supports environment variables:
62
+ Different AI models have different strengths:
89
63
 
90
- ```json
91
- {
92
- "command": "npx",
93
- "args": ["-y", "@klitchevo/code-council"],
94
- "env": {
95
- "OPENROUTER_API_KEY": "your-openrouter-api-key"
96
- }
97
- }
98
- ```
64
+ - **One model** might miss a security issue another catches
65
+ - **Unanimous findings** are almost certainly real problems
66
+ - **Disagreements** highlight where you should look closer
67
+ - **Single-model findings** might be noise, or might be the one model that saw something others missed
99
68
 
100
- ### Installation (Alternative)
69
+ Think of it as getting 4 senior engineers to review your code at once.
101
70
 
102
- If you prefer to install globally:
71
+ ![How Consensus Works](assets/consensus-demo.svg)
103
72
 
104
- ```bash
105
- npm install -g @klitchevo/code-council
106
- ```
73
+ ## Quick Start
74
+
75
+ ### MCP Server (Claude Desktop, Cursor, etc.)
107
76
 
108
- Then configure without npx:
77
+ Add to your Claude Desktop config (`~/Library/Application Support/Claude/claude_desktop_config.json` on macOS):
109
78
 
110
79
  ```json
111
80
  {
112
81
  "mcpServers": {
113
82
  "code-council": {
114
- "command": "@klitchevo/code-council",
83
+ "command": "npx",
84
+ "args": ["-y", "@klitchevo/code-council"],
115
85
  "env": {
116
86
  "OPENROUTER_API_KEY": "your-api-key-here"
117
87
  }
@@ -120,505 +90,179 @@ Then configure without npx:
120
90
  }
121
91
  ```
122
92
 
123
- ## Getting an API Key
124
-
125
- 1. Sign up at [OpenRouter](https://openrouter.ai)
126
- 2. Go to [Keys](https://openrouter.ai/keys) in your dashboard
127
- 3. Create a new API key
128
- 4. Add credits to your account at [Credits](https://openrouter.ai/credits)
129
-
130
- ## Security Best Practices
131
-
132
- ⚠️ **CRITICAL SECURITY WARNING**: Never commit your OpenRouter API key to git!
133
-
134
- ### MCP Config File Locations (Safe - Not in Git)
93
+ Get your API key at [OpenRouter](https://openrouter.ai/keys).
135
94
 
136
- MCP client configurations are stored **outside your project directory** and won't be committed:
95
+ That's it. Ask Claude: *"Use review_code to check this function: [paste code]"*
137
96
 
138
- - **Claude Desktop**:
139
- - macOS: `~/Library/Application Support/Claude/claude_desktop_config.json`
140
- - Windows: `%APPDATA%\Claude\claude_desktop_config.json`
141
- - Linux: `~/.config/Claude/claude_desktop_config.json`
142
- - **Cursor**: Global settings (not in project)
143
- - **Other MCP Clients**: Typically in user config directories
97
+ ### CLI (GitHub Actions, CI/CD)
144
98
 
145
- These files are **safe to put your API key in** because they're not in your git repository.
146
-
147
- ### ✅ SAFE:
148
- - Putting the API key in MCP client config files (they're outside git)
149
- - Using system environment variables and referencing them
150
- - Keeping configs in user directories (`~/.config/`, `~/Library/`, etc.)
151
-
152
- ### ❌ NEVER DO:
153
- - Don't create `.mcp.json` or config files **inside your project directory**
154
- - Don't commit any file containing your API key to git
155
- - Don't share config files containing API keys
156
- - Don't hardcode API keys in code
157
-
158
- ### Using Environment Variables (Extra Security)
159
-
160
- For added security, store the key in your shell environment:
99
+ Run reviews directly from command line:
161
100
 
162
101
  ```bash
163
- # Add to ~/.zshrc or ~/.bashrc
164
- export OPENROUTER_API_KEY="sk-or-v1-..."
165
- ```
102
+ # Review git changes
103
+ npx @klitchevo/code-council review git --review-type diff
166
104
 
167
- Then reference it in your MCP config:
168
- ```json
169
- {
170
- "env": {
171
- "OPENROUTER_API_KEY": "${OPENROUTER_API_KEY}"
172
- }
173
- }
174
- ```
105
+ # Review with inline PR comments format (for GitHub Actions)
106
+ npx @klitchevo/code-council review git --review-type diff --format pr-comments
175
107
 
176
- ## Available Tools
108
+ # Review code from stdin
109
+ echo "function foo() {}" | npx @klitchevo/code-council review code
177
110
 
178
- ### `review_code`
179
-
180
- Review code for quality, bugs, performance, and security issues.
181
-
182
- **Parameters:**
183
- - `code` (required): The code to review
184
- - `language` (optional): Programming language
185
- - `context` (optional): Additional context about the code
186
- - `output_format` (optional): `markdown`, `json`, or `html` (default: `markdown`)
187
-
188
- **Example usage in Claude:**
189
- ```
190
- Use review_code to check this TypeScript function:
191
- [paste your code]
192
- ```
111
+ # Review with custom models
112
+ npx @klitchevo/code-council review git --models "anthropic/claude-sonnet-4,openai/gpt-4o"
193
113
 
194
- ### `review_frontend`
195
-
196
- Review frontend code with focus on accessibility, performance, and UX.
197
-
198
- **Parameters:**
199
- - `code` (required): The frontend code to review
200
- - `framework` (optional): Framework name (e.g., react, vue, svelte)
201
- - `review_type` (optional): `accessibility`, `performance`, `ux`, or `full` (default)
202
- - `context` (optional): Additional context
203
- - `output_format` (optional): `markdown`, `json`, or `html` (default: `markdown`)
204
-
205
- **Example usage in Claude:**
206
- ```
207
- Use review_frontend with review_type=accessibility to check this React component:
208
- [paste your component]
209
- ```
210
-
211
- ### `review_backend`
212
-
213
- Review backend code for security, performance, and architecture.
214
-
215
- **Parameters:**
216
- - `code` (required): The backend code to review
217
- - `language` (optional): Language/framework (e.g., node, python, go, rust)
218
- - `review_type` (optional): `security`, `performance`, `architecture`, or `full` (default)
219
- - `context` (optional): Additional context
220
- - `output_format` (optional): `markdown`, `json`, or `html` (default: `markdown`)
221
-
222
- **Example usage in Claude:**
223
- ```
224
- Use review_backend with review_type=security to analyze this API endpoint:
225
- [paste your code]
114
+ # Show help
115
+ npx @klitchevo/code-council review --help
226
116
  ```
227
117
 
228
- ### `review_plan`
118
+ > **More setup options:** See [Configuration Guide](docs/configuration.md) for Cursor, VS Code, custom models, and advanced options.
229
119
 
230
- Review implementation plans BEFORE coding to catch issues early.
120
+ ## GitHub Actions
231
121
 
232
- **Parameters:**
233
- - `plan` (required): The implementation plan to review
234
- - `review_type` (optional): `feasibility`, `completeness`, `risks`, `timeline`, or `full` (default)
235
- - `context` (optional): Project constraints or context
236
- - `output_format` (optional): `markdown`, `json`, or `html` (default: `markdown`)
122
+ Automatically review PRs with multiple AI models. Findings appear as **inline comments** on the exact lines of code.
237
123
 
238
- **Example usage in Claude:**
239
- ```
240
- Use review_plan to analyze this implementation plan:
241
- [paste your plan]
242
- ```
243
-
244
- ### `review_git_changes`
124
+ ### Quick Setup
245
125
 
246
- Review git changes directly from your repository.
126
+ Generate the workflow file automatically:
247
127
 
248
- **Parameters:**
249
- - `review_type` (optional): `staged`, `unstaged`, `diff`, or `commit` (default: `staged`)
250
- - `staged` - Review staged changes (`git diff --cached`)
251
- - `unstaged` - Review unstaged changes (`git diff`)
252
- - `diff` - Review branch diff (`git diff main..HEAD`)
253
- - `commit` - Review a specific commit (requires `commit_hash`)
254
- - `commit_hash` (optional): Commit hash to review (required when `review_type` is `commit`)
255
- - `context` (optional): Additional context about the changes
256
- - `output_format` (optional): `markdown`, `json`, or `html` (default: `markdown`)
257
-
258
- **Example usage in Claude:**
259
- ```
260
- Use review_git_changes to review my staged changes
261
- ```
262
-
263
- ```
264
- Use review_git_changes with review_type=commit and commit_hash=abc123 to review that commit
128
+ ```bash
129
+ npx @klitchevo/code-council setup workflow
265
130
  ```
266
131
 
267
- ### `discuss_with_council`
132
+ This creates `.github/workflows/code-council-review.yml` with inline PR comments enabled.
268
133
 
269
- Have multi-turn conversations with the AI council. Start a discussion, get feedback from all models, then ask follow-up questions while maintaining context.
134
+ **Options:**
135
+ - `--simple` - Use markdown format instead of inline comments
136
+ - `--force` - Overwrite existing workflow file
270
137
 
271
- **Parameters:**
272
- - `message` (required): Your message or question for the council
273
- - `session_id` (optional): Session ID to continue an existing discussion (omit to start new)
274
- - `discussion_type` (optional): `code_review`, `plan_review`, or `general` (default: `general`)
275
- - `context` (optional): Additional context (code snippets, plan details, etc.)
138
+ ### Manual Setup
276
139
 
277
- **Example usage in Claude:**
278
- ```
279
- Use discuss_with_council to ask: What's the best way to implement error handling in a Node.js API?
280
- ```
140
+ Or create the workflow manually:
281
141
 
282
- **Continuing a discussion:**
283
- ```
284
- Use discuss_with_council with session_id=<id-from-previous-response> to ask: Can you elaborate on the circuit breaker pattern you mentioned?
285
- ```
142
+ ```yaml
143
+ name: Code Council Review
286
144
 
287
- **Key features:**
288
- - Each model maintains its own conversation history for authentic diverse perspectives
289
- - Sessions persist for 30 minutes of inactivity
290
- - Rate limited to 10 requests per minute per session
291
- - Context windowing keeps conversations efficient
145
+ on:
146
+ pull_request:
147
+ types: [opened, synchronize, ready_for_review, reopened]
292
148
 
293
- ### `tps_audit`
149
+ jobs:
150
+ review:
151
+ runs-on: ubuntu-latest
152
+ if: github.event.pull_request.draft == false
153
+ permissions:
154
+ contents: read
155
+ pull-requests: write
294
156
 
295
- Analyze any codebase using Toyota Production System (TPS) principles. Generates beautiful HTML reports with scores for flow, waste, bottlenecks, and quality.
157
+ steps:
158
+ - uses: actions/checkout@v4
159
+ with:
160
+ fetch-depth: 0
296
161
 
297
- **Parameters:**
298
- - `path` (optional): Path to repository root (auto-detects git root if not provided)
299
- - `focus_areas` (optional): Specific areas to focus on (e.g., `["flow", "security", "performance"]`)
300
- - `max_files` (optional): Maximum files to analyze (default: 50, max: 100)
301
- - `file_types` (optional): File extensions to include (default: common source files)
302
- - `include_sensitive` (optional): Include potentially sensitive files (default: false)
303
- - `output_format` (optional): `html`, `markdown`, or `json` (default: `html`)
162
+ - uses: actions/setup-node@v4
163
+ with:
164
+ node-version: '20'
304
165
 
305
- **Example usage in Claude:**
306
- ```
307
- Use tps_audit to analyze this repository
308
- ```
166
+ - name: Run Code Council Review
167
+ env:
168
+ OPENROUTER_API_KEY: ${{ secrets.OPENROUTER_API_KEY }}
169
+ run: |
170
+ npx @klitchevo/code-council review git \
171
+ --review-type diff \
172
+ --format pr-comments \
173
+ > review.json
309
174
 
175
+ - name: Post Review
176
+ env:
177
+ GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
178
+ run: |
179
+ gh api repos/${{ github.repository }}/pulls/${{ github.event.pull_request.number }}/reviews \
180
+ --method POST \
181
+ --input review.json
310
182
  ```
311
- Use tps_audit with output_format=markdown and focus_areas=["security", "performance"]
312
- ```
313
-
314
- **What it analyzes:**
315
- - **Flow**: How data and control flow through the system, entry points, pathways
316
- - **Muda (Waste)**: The 7 wastes - defects, overproduction, waiting, transportation, inventory, motion, extra-processing
317
- - **Bottlenecks**: Where flow is constrained, severity and impact
318
- - **Jidoka**: Built-in quality, fail-fast patterns, error handling
319
- - **Recommendations**: Prioritized improvements with effort/impact ratings
320
183
 
321
- **Security features:**
322
- - Automatically skips sensitive files (`.env`, credentials, keys, tokens)
323
- - Scans file contents for embedded secrets (AWS keys, GitHub PATs, etc.)
324
- - Validates paths to prevent directory traversal attacks
325
- - Enforces size limits to prevent resource exhaustion
184
+ Add `OPENROUTER_API_KEY` to your repository secrets (Settings > Secrets > Actions).
326
185
 
327
- **Output:**
328
- Reports are saved to `.code-council/` directory:
329
- - `tps-audit.html` - Interactive styled report with glass-morphism dark theme
330
- - `tps-audit.md` - Markdown version
331
- - `tps-audit.json` - Raw JSON data
186
+ ## Use Cases
332
187
 
333
- ### `list_review_config`
188
+ | Scenario | Tool | What You Get |
189
+ |----------|------|--------------|
190
+ | About to merge a PR | `review_git_changes` | Multi-model review of your diff |
191
+ | Automated PR reviews | CLI `review git` | Multi-model review in GitHub Actions |
192
+ | Planning a refactor | `review_plan` | Catch design issues before coding |
193
+ | Reviewing React components | `review_frontend` | Accessibility + performance + UX focus |
194
+ | Securing an API endpoint | `review_backend` | Security + architecture analysis |
195
+ | Want deeper discussion | `discuss_with_council` | Multi-turn conversation with context |
196
+ | Audit entire codebase | `tps_audit` | Flow, waste, bottlenecks analysis |
334
197
 
335
- Show which AI models are currently configured for each review type.
198
+ > **Full tool reference:** See [Tools Reference](docs/tools-reference.md) for all parameters and examples.
336
199
 
337
- ### `init_config`
200
+ ## Reading the Results
338
201
 
339
- Generate a Code Council configuration file with default values.
202
+ Code Council shows confidence levels for each finding:
340
203
 
341
- **Parameters:**
342
- - `location` (optional): Where to create the config file
343
- - `directory` (default) - Creates `.code-council/config.ts`
344
- - `root` - Creates `code-council.config.ts` in project root
345
- - `format` (optional): Config file format
346
- - `typescript` (default) - TypeScript with full type support
347
- - `javascript` - Plain JavaScript
348
- - `include_comments` (optional): Include explanatory comments (default: `true`)
349
- - `force` (optional): Overwrite existing config file (default: `false`)
350
-
351
- **Example usage in Claude:**
352
- ```
353
- Use init_config to generate a configuration file
354
- ```
355
-
356
- ```
357
- Use init_config with location=root and format=javascript
358
- ```
204
+ | Level | Meaning | Action |
205
+ |-------|---------|--------|
206
+ | **Unanimous** | All models agree | High confidence - fix this |
207
+ | **Majority** | Most models agree | Likely valid - investigate |
208
+ | **Disagreement** | Models conflict | Your judgment needed |
209
+ | **Single** | One model found this | Worth checking |
359
210
 
360
211
  ## Configuration
361
212
 
362
- Code Council supports two configuration methods:
363
- 1. **Config file** (recommended) - TypeScript/JavaScript config file with full type support
364
- 2. **Environment variables** - Quick setup via MCP client config
365
-
366
- ### Config File (Recommended)
367
-
368
- Create a config file in your project for full type support and autocompletion:
369
-
370
- **Option 1: `.code-council/config.ts`** (recommended)
371
- ```typescript
372
- import { defineConfig } from "@klitchevo/code-council/config";
373
-
374
- export default defineConfig({
375
- models: {
376
- codeReview: ["anthropic/claude-sonnet-4", "openai/gpt-4o"],
377
- frontendReview: ["anthropic/claude-sonnet-4"],
378
- backendReview: ["openai/gpt-4o", "google/gemini-2.0-flash-exp"],
379
- },
380
- llm: {
381
- temperature: 0.3,
382
- maxTokens: 16384,
383
- },
384
- });
385
- ```
386
-
387
- **Option 2: `code-council.config.ts`** (project root)
388
- ```typescript
389
- import { defineConfig } from "@klitchevo/code-council/config";
213
+ Code Council works out of the box with sensible defaults. For customization:
390
214
 
391
- export default defineConfig({
392
- // Same options as above
393
- });
394
- ```
215
+ - **[Configuration Guide](docs/configuration.md)** - MCP client setup, config files, environment variables
216
+ - **[Model Selection](docs/models.md)** - Choose models, pricing, performance tradeoffs
217
+ - **[Tools Reference](docs/tools-reference.md)** - Detailed tool parameters and examples
395
218
 
396
- **Generate a config file via CLI:**
397
- ```bash
398
- npx @klitchevo/code-council init
399
- ```
219
+ ### Custom Models Example
400
220
 
401
- **CLI Options:**
402
- ```bash
403
- npx @klitchevo/code-council init [options]
404
-
405
- Options:
406
- --ts, --typescript Generate TypeScript config (default)
407
- --js, --javascript Generate JavaScript config
408
- --root Create config in project root (code-council.config.ts)
409
- --dir, --directory Create config in .code-council/ directory (default)
410
- --no-comments Generate config without explanatory comments
411
- --force, -f Overwrite existing config file
412
-
413
- Examples:
414
- npx @klitchevo/code-council init # Creates .code-council/config.ts
415
- npx @klitchevo/code-council init --js --root # Creates code-council.config.js
416
- npx @klitchevo/code-council init --force # Overwrite existing config
417
- ```
418
-
419
- **Or use the MCP tool:**
420
- ```
421
- Use init_config to generate a configuration file
422
- ```
423
-
424
- #### Complete Config Options
425
-
426
- ```typescript
427
- import { defineConfig } from "@klitchevo/code-council/config";
428
-
429
- export default defineConfig({
430
- // Models for each review type
431
- models: {
432
- defaultModels: ["model1", "model2"], // Fallback for all types
433
- codeReview: ["model1", "model2"], // General code reviews
434
- frontendReview: ["model1"], // Frontend reviews
435
- backendReview: ["model1", "model2"], // Backend reviews
436
- planReview: ["model1"], // Plan reviews
437
- discussion: ["model1", "model2"], // Council discussions
438
- tpsAudit: ["model1", "model2"], // TPS audits
439
- },
440
-
441
- // Consensus analysis settings (all reviews use consensus by default)
442
- consensus: {
443
- modelWeights: { // Weight models differently
444
- "anthropic/claude-sonnet-4": 1.2, // Higher = more influence
445
- "openai/gpt-4o": 1.0,
446
- },
447
- highConfidenceThreshold: 0.8, // Threshold for high confidence
448
- moderateConfidenceThreshold: 0.5, // Threshold for moderate confidence
449
- },
450
-
451
- // LLM behavior
452
- llm: {
453
- temperature: 0.3, // 0.0-2.0, lower = more focused
454
- maxTokens: 16384, // Max response length
455
- },
456
-
457
- // Session settings for council discussions
458
- session: {
459
- maxSessions: 100, // Max concurrent sessions
460
- maxMessagesPerModel: 20, // Messages before context windowing
461
- ttlMs: 1800000, // Session timeout (30 min default)
462
- rateLimitPerMinute: 10, // Rate limit per session
463
- },
464
-
465
- // Input limits
466
- inputLimits: {
467
- maxCodeLength: 100000, // Max code input length
468
- maxContextLength: 50000, // Max context length
469
- maxModels: 10, // Max models per review
470
- },
471
- });
472
- ```
473
-
474
- ### Environment Variables
475
-
476
- For quick setup without a config file, use environment variables in your MCP client configuration.
477
-
478
- **Available Environment Variables:**
479
- - `CODE_REVIEW_MODELS` - Models for general code reviews
480
- - `FRONTEND_REVIEW_MODELS` - Models for frontend reviews
481
- - `BACKEND_REVIEW_MODELS` - Models for backend reviews
482
- - `PLAN_REVIEW_MODELS` - Models for plan reviews
483
- - `DISCUSSION_MODELS` - Models for council discussions
484
- - `TPS_AUDIT_MODELS` - Models for TPS codebase audits
485
- - `TEMPERATURE` - Control response randomness (0.0-2.0, default: 0.3)
486
- - `MAX_TOKENS` - Maximum response tokens (default: 16384)
487
-
488
- **Format:** Model arrays use JSON array format
489
-
490
- **Example:**
491
221
  ```json
492
222
  {
493
- "mcpServers": {
494
- "code-council": {
495
- "command": "npx",
496
- "args": ["-y", "@klitchevo/code-council"],
497
- "env": {
498
- "OPENROUTER_API_KEY": "your-api-key",
499
- "CODE_REVIEW_MODELS": ["anthropic/claude-sonnet-4.5", "openai/gpt-4o", "google/gemini-2.0-flash-exp"],
500
- "FRONTEND_REVIEW_MODELS": ["anthropic/claude-sonnet-4.5"],
501
- "BACKEND_REVIEW_MODELS": ["openai/gpt-4o", "anthropic/claude-sonnet-4.5"],
502
- "TEMPERATURE": "0.5",
503
- "MAX_TOKENS": "32000"
504
- }
505
- }
223
+ "env": {
224
+ "OPENROUTER_API_KEY": "your-api-key",
225
+ "CODE_REVIEW_MODELS": ["anthropic/claude-sonnet-4.5", "openai/gpt-4o"]
506
226
  }
507
227
  }
508
228
  ```
509
229
 
510
- ### Configuration Priority
511
-
512
- Config file settings take priority over environment variables:
513
- 1. Config file value (if set)
514
- 2. Environment variable (if set)
515
- 3. Default value
516
-
517
- ### Default Models
518
-
519
- If you don't specify models, the server uses these defaults:
520
- - `minimax/minimax-m2.1` - Fast, cost-effective reasoning
521
- - `z-ai/glm-4.7` - Strong multilingual capabilities
522
- - `moonshotai/kimi-k2.5` - Advanced reasoning with thinking
523
- - `deepseek/deepseek-v3.2` - State-of-the-art open model
524
-
525
- ### Finding Models
526
-
527
- Browse all available models at [OpenRouter Models](https://openrouter.ai/models). Popular choices include:
528
- - `anthropic/claude-sonnet-4.5` - Latest Sonnet, excellent for code review
529
- - `anthropic/claude-opus-4.5` - Frontier reasoning model for complex tasks
530
- - `openai/gpt-4o` - Latest GPT-4 Omni model
531
- - `google/gemini-2.0-flash-exp` - Fast and affordable
532
- - `meta-llama/llama-3.3-70b-instruct` - Latest open source option
533
-
534
- ### Local Development
230
+ ## Cost
535
231
 
536
- 1. Clone the repository:
537
- ```bash
538
- git clone <your-repo-url>
539
- cd multi-agent
540
- ```
232
+ Default models are chosen for cost-effectiveness (~$0.01-0.05 per review).
541
233
 
542
- 2. Install dependencies:
543
- ```bash
544
- npm install
545
- ```
234
+ Swap in Claude/GPT-4 for higher quality at higher cost (~$0.10-0.30 per review).
546
235
 
547
- 3. Create `.env` file:
548
- ```bash
549
- cp .env.example .env
550
- # Edit .env and add your OPENROUTER_API_KEY
551
- ```
236
+ See [Model Selection Guide](docs/models.md) for pricing details and optimization tips.
552
237
 
553
- 4. Build:
554
- ```bash
555
- npm run build
556
- ```
557
-
558
- 5. Run:
559
- ```bash
560
- npm start
561
- # or use the convenience script:
562
- ./run.sh
563
- ```
564
-
565
- 6. For development with auto-rebuild:
566
- ```bash
567
- npm run dev
568
- ```
569
-
570
- ## How It Works
571
-
572
- 1. The MCP server exposes tools that Claude (or other MCP clients) can call
573
- 2. When you ask Claude to review code, it calls the appropriate tool
574
- 3. The server sends your code to multiple AI models via OpenRouter in parallel
575
- 4. Results from all models are aggregated and returned
576
- 5. Claude presents you with diverse perspectives from different AI models
577
-
578
- ## Cost Considerations
238
+ ## Requirements
579
239
 
580
- - Each review runs across multiple models simultaneously
581
- - Costs vary by model - check [OpenRouter pricing](https://openrouter.ai/models)
582
- - You can reduce costs by:
583
- - Using fewer models in your configuration
584
- - Choosing cheaper models
585
- - Using specific `review_type` options instead of `full` reviews
586
- - Lowering `MAX_TOKENS` (default: 16384) for shorter responses
240
+ - Node.js >= 18.0.0
241
+ - [OpenRouter](https://openrouter.ai) API key
242
+ - MCP-compatible client (Claude Desktop, Cursor, etc.)
587
243
 
588
244
  ## Troubleshooting
589
245
 
590
- ### "OPENROUTER_API_KEY environment variable is required"
591
-
592
- Make sure you've added the API key to the `env` section of your MCP client configuration, not just in a separate `.env` file.
593
-
594
- ### Reviews are slow
246
+ **"OPENROUTER_API_KEY environment variable is required"**
247
+ Add the API key to the `env` section of your MCP client configuration.
595
248
 
596
- - This is expected when using multiple models in parallel
597
- - Consider using fewer models or faster models
598
- - Check OpenRouter status at [status.openrouter.ai](https://status.openrouter.ai)
249
+ **Reviews are slow**
250
+ This is expected when using multiple models. Consider using fewer models or faster models like Gemini Flash.
599
251
 
600
- ### Models returning errors
252
+ **Models returning errors**
253
+ Check your OpenRouter credits and model availability at [status.openrouter.ai](https://status.openrouter.ai).
601
254
 
602
- - Check that you have sufficient credits in your OpenRouter account
603
- - Some models may have rate limits or temporary availability issues
604
- - The server will show which models succeeded and which failed
605
-
606
- ## Requirements
255
+ ## Contributing
607
256
 
608
- - Node.js >= 18.0.0
609
- - OpenRouter API key
610
- - MCP-compatible client (Claude Desktop, Cursor, etc.)
257
+ Contributions welcome! Please open an issue or PR.
611
258
 
612
259
  ## License
613
260
 
614
261
  MIT
615
262
 
616
- ## Contributing
617
-
618
- Contributions welcome! Please open an issue or PR.
619
-
620
263
  ## Links
621
264
 
265
+ - [Documentation](https://klitchevo.github.io/code-council/) - Full docs and examples
622
266
  - [OpenRouter](https://openrouter.ai) - Multi-model AI API
623
267
  - [Model Context Protocol](https://modelcontextprotocol.io) - MCP specification
624
268
  - [Claude Desktop](https://claude.ai/download) - MCP-compatible AI assistant