Codestral code review
You drive a focused code review of a diff using the Mistral codestral-latest model.
Workflow
Step 1 — Fetch the diff
If $ARGUMENTS contains a unified diff, use it. Otherwise:
- Check
git diff --staged first (most likely intent)
- If empty, fall back to
git diff HEAD~1..HEAD (last commit)
- If still empty, ask the user which range to review
Step 2 — Auto-detect the review focus
Inspect file paths and diff content to pick the most relevant lens:
| Signal |
Focus |
Files touching auth/, crypto/, secrets, .env, JWT/OAuth code, SQL queries with string concat, eval, file uploads |
security |
| Hot loops, big-O changes, async/parallelism, caching layer, DB queries, benchmark files |
performance |
| Public API surface: exported symbols, route handlers, schemas/contracts, breaking signature changes |
api_design |
| Anything else (refactor, bug fix, feature work) |
correctness |
If multiple apply, ask the user which to prioritize, or run two passes with different focus values.
Step 3 — Run the review
Call the MCP prompt codestral_review from the mistral server with:
diff : the diff from step 1
focus : the lens from step 2
Pass the resulting messages to mistral_chat:
model : codestral-latest
temperature : 0.2 (deterministic critique)
max_tokens : 1500
Output format
The review must end with a verdict: ship, change-requested, or block.
Findings should be:
- Concrete: cite exact lines or token ranges from the diff
- High-signal: prefer 3 strong findings over 10 shallow ones
- No invented issues: only flag real risks visible in the diff
Examples
/mistral-mcp:codestral-review — auto-detect from git diff --staged
/mistral-mcp:codestral-review security — force the security lens
/mistral-mcp:codestral-review <diff text> — review a pasted diff
1---2name: codestral-review3description: Reviews a code diff through Codestral with an auto-detected focus (correctness, performance, security, or api_design). Auto-fetches the diff via git diff if no argument is provided. Use when the user asks for code review, PR review, security audit of a diff, or critique of recent changes.4---56# Codestral code review78You drive a focused code review of a diff using the Mistral `codestral-latest` model.910## Workflow1112### Step 1 — Fetch the diff1314If `$ARGUMENTS` contains a unified diff, use it. Otherwise:15161. Check `git diff --staged` first (most likely intent)172. If empty, fall back to `git diff HEAD~1..HEAD` (last commit)183. If still empty, ask the user which range to review1920### Step 2 — Auto-detect the review focus2122Inspect file paths and diff content to pick the most relevant lens:2324| Signal | Focus |25|---|---|26| Files touching `auth/`, `crypto/`, `secrets`, `.env`, JWT/OAuth code, SQL queries with string concat, `eval`, file uploads | `security` |27| Hot loops, big-O changes, async/parallelism, caching layer, DB queries, benchmark files | `performance` |28| Public API surface: exported symbols, route handlers, schemas/contracts, breaking signature changes | `api_design` |29| Anything else (refactor, bug fix, feature work) | `correctness` |3031If multiple apply, ask the user which to prioritize, or run two passes with different focus values.3233### Step 3 — Run the review3435Call the MCP prompt `codestral_review` from the `mistral` server with:36- `diff` : the diff from step 137- `focus` : the lens from step 23839Pass the resulting messages to `mistral_chat`:40- `model` : `codestral-latest`41- `temperature` : `0.2` (deterministic critique)42- `max_tokens` : `1500`4344## Output format4546The review must end with a verdict: **`ship`**, **`change-requested`**, or **`block`**.4748Findings should be:49- **Concrete**: cite exact lines or token ranges from the diff50- **High-signal**: prefer 3 strong findings over 10 shallow ones51- **No invented issues**: only flag real risks visible in the diff5253## Examples5455- `/mistral-mcp:codestral-review` — auto-detect from `git diff --staged`56- `/mistral-mcp:codestral-review security` — force the security lens57- `/mistral-mcp:codestral-review <diff text>` — review a pasted diff