Skip to content

~95% on SimpleQA (e.g. Qwen3.6-27B on a 3090). Supports all local and cloud LLMs (llama.cpp, Ollama, Google, ...). 10+ search engines - arXiv, PubMed, your private documents. Everything Local & Encrypted.

docs: Update AI Code Reviewer README to be model-independent

LearningCircuit3cf5ce29a80f
diff --git a/docs/AI_Code_Reviewer_Setup.md b/docs/AI_Code_Reviewer_Setup.md
index 646ab0cc6e..541695077c 100644
--- a/docs/AI_Code_Reviewer_Setup.md
+++ b/docs/AI_Code_Reviewer_Setup.md
@@ -1,16 +1,16 @@
# AI Code Reviewer Setup Guide
-This guide explains how to set up the automated AI PR review system that uses GLM-4.6 via OpenRouter to review pull requests.
+This guide explains how to set up the automated AI PR review system using OpenRouter to analyze pull requests with your choice of AI model.
## Overview
-The AI Code Reviewer provides helpful, automated code reviews with four check types:
-1. **Security Review** 🔒 - Most critical, runs first
-2. **Performance Review** ⚡ - Runs only if security passes
-3. **Code Quality Review** 🎨 - Runs only if performance passes
-4. **Custom Requirements Review** 🔧 - Runs only if all above pass
+The AI Code Reviewer provides automated, comprehensive code reviews covering:
+- **Security** 🔒 - Hardcoded secrets, SQL injection, XSS, authentication issues, input validation
+- **Performance** ⚡ - Inefficient algorithms, N+1 queries, memory issues, blocking operations
+- **Code Quality** 🎨 - Readability, maintainability, error handling, naming conventions
+- **Best Practices** 📋 - Coding standards, proper patterns, type safety, dead code
-Each check can pass, warn, or fail. Failed checks prevent the PR from being merged.
+The review is posted as a single comprehensive comment on your pull request.
## Setup Instructions
@@ -31,20 +31,14 @@ Each check can pass, warn, or fail. Failed checks prevent the PR from being merg
5. Paste your OpenRouter API key
6. Click **Add secret**
-### 3. Configure Branch Protection (Recommended)
+### 3. Configure Workflow (Optional)
-To make the AI checks mandatory for merging:
+The workflow is pre-configured with sensible defaults, but you can customize it by editing `.github/workflows/ai-code-reviewer.yml`:
-1. Go to **Settings** → **Branches** → **Branch protection rules**
-2. Click **Add rule**
-3. Under "Branch name pattern", enter `main`
-4. Check **Require status checks to pass before merging**
-5. Select the following required checks:
- - 🔒 Security Review
- - ⚡ Performance Review
- - 🎨 Code Quality Review
- - 🔧 Custom Requirements Review
-6. Click **Create**
+- **AI_MODEL**: Change the AI model (see [OpenRouter models](https://openrouter.ai/models))
+- **AI_TEMPERATURE**: Adjust randomness (default: `0.1` for consistent reviews)
+- **AI_MAX_TOKENS**: Maximum response length (default: `2000`)
+- **MAX_DIFF_SIZE**: Maximum diff size in bytes (default: `800000` / 800KB)
## Usage
@@ -56,60 +50,40 @@ To trigger an AI review on a PR:
2. Click **Labels**
3. Add the label: `ai_code_review`
-The review will automatically start with the security check. If it passes, it will continue through the chain.
+The review will automatically start and post results as a comment when complete.
### Re-running Reviews
-To re-run the AI reviews after making changes:
+To re-run the AI review after making changes:
1. Remove the `ai_code_review` label
2. Add the `ai_code_review` label again
-This will restart the entire review chain.
+This will generate a fresh review of the current PR state.
## Review Results
-Each review type posts a separate comment with:
-- ✅ **PASSED** - No issues found
-- ⚠️ **WARNING** - Minor issues found (doesn't block merge)
-- ❌ **FAILED** - Critical issues found (blocks merge)
-
-If all checks pass, a final summary comment indicates the PR is ready for human review.
+The AI posts a comprehensive comment analyzing your code across all focus areas. The review is meant to assist human reviewers, not replace them.
## Cost Estimation
-Based on GLM-4.6 pricing ($0.50/M input tokens, $1.75/M output tokens):
-
-- Security check: ~$0.002
-- Performance check: ~$0.002
-- Code quality check: ~$0.002
-- Custom requirements check: ~$0.002
-- **Total per PR: ~$0.008** (less than 1 cent)
+Costs vary by model, but most code-focused models on OpenRouter are very affordable:
+- Typical small PR (< 1000 lines): $0.001 - $0.01
+- Large PR (1000-5000 lines): $0.01 - $0.05
-Failed checks are cheaper since the chain stops early.
+Check [OpenRouter pricing](https://openrouter.ai/models) for specific model costs.
## Customization
-### Changing the Model
-
-To use a different model (e.g., GLM-4.5-Air for cost savings):
-
-In `.github/workflows/ai-pr-gatekeeper.yml`, change:
-```yaml
-"model": "z-ai/glm-4.6"
-```
-to:
-```yaml
-"model": "z-ai/glm-4.5-air"
-```
+### Changing the Review Focus
-### Adding Custom Review Types
+Edit `github/scripts/ai-reviewer.sh` to modify the review prompt. The current focus areas are:
+- Security (secrets, injection attacks, authentication)
+- Performance (algorithms, queries, memory)
+- Code Quality (readability, maintainability, error handling)
+- Best Practices (standards, patterns, type safety)
-You can add new review types by copying one of the existing jobs and:
-1. Updating the job name and description
-2. Modifying the prompt to focus on your specific requirements
-3. Adding it to the job dependency chain
-4. Including it in the required status checks
+You can adjust these to match your team's priorities.
## Troubleshooting
@@ -125,22 +99,24 @@ You can add new review types by copying one of the existing jobs and:
- Verify OpenRouter account has sufficient credits
- Review GitHub Actions logs for specific error messages
-### Reviews Failing Unexpectedly
+### Diff Too Large Error
-- Review the AI comments for specific issues
-- Check if the model is being too strict
-- Consider adjusting prompts to be more lenient if needed
+If you get a "Diff is too large" error:
+- Split your PR into smaller, focused changes
+- Or increase `MAX_DIFF_SIZE` in the workflow file
+- Default limit is 800KB (~200K tokens)
## Security Considerations
-- API keys are stored securely in GitHub Secrets
-- Reviews only run on your repository's PRs, not forks
+- API keys are stored securely in GitHub Secrets and passed via environment variables
+- Reviews only run when the `ai_code_review` label is manually added
- All API calls are made through secure HTTPS connections
-- No code or data is stored by the AI service after analysis
+- Code diffs are sent to OpenRouter/AI provider - review their data policies
+- The workflow has minimal permissions (read contents, write PR comments)
## Support
For issues with:
- **OpenRouter API**: Check [OpenRouter documentation](https://openrouter.ai/docs)
- **GitHub Actions**: Check [GitHub Actions documentation](https://docs.github.com/en/actions)
-- **Workflow issues**: Review the GitHub Actions logs for specific error details
\ No newline at end of file
+- **Workflow issues**: Review the GitHub Actions logs for specific error details