Review commands
kluster.ai's CLI provides three ways to review code from the terminal — staged changes, diffs against branches or commits, and individual files — each suited to a different stage of your workflow. All commands support instant and deep analysis modes.
| Command | What it reviews | Requires git? |
kluster review staged | Staged changes (git add) | Yes |
kluster review diff <target> | Diff against a branch or commit range | Yes |
kluster review file <path> | One or more files | No |
Review staged changes
Review everything you have staged before committing:
kluster review staged → Reviewing code [████████████████████████████████████████] 100% ✓ Reviewing code complete! Review: 507f1f77bcf86cd799439011 Found 2 issue(s) #1 CRITICAL [P0] security SQL injection vulnerability detected in user input handling. User-provided data is concatenated directly into SQL query without sanitization. at src/db/queries.go:45-52 More details The function buildQuery() takes user input from the request body and concatenates it directly into the SQL string. Fix Use parameterized queries: db.Query("SELECT * FROM users WHERE id = ?", userID) ──────────────────────────────────────────────────────────────────────── #2 HIGH [P1] logical Potential null pointer dereference. The variable 'config' may be nil when accessed on line 78. at cmd/server.go:78 Fix Add a nil check before accessing config properties.
No staged changes?
If nothing is staged, the CLI will prompt you to git add files first.
Review a diff
Compare your current work against a branch or between commits:
Against a branch:
kluster review diff main → Reviewing code [████████████████████████████████████████] 100% ✓ Reviewing code complete! Review: 507f1f77bcf86cd799439016 Found 2 issue(s) #1 MEDIUM [P4] quality Function exceeds 200 lines without decomposition at src/handlers/upload.go:34-240 ──────────────────────────────────────────────────────────────────────── #2 LOW [P5] knowledge Error return value not checked on file close at src/handlers/upload.go:189
Between commits:
kluster review diff HEAD~3..HEAD
kluster review diff HEAD~3..HEAD → Reviewing code [████████████████████████████████████████] 100% ✓ Reviewing code complete! Review: 507f1f77bcf86cd799439017 ✓ Code review complete - no issues found!
Shell completions autocomplete branch names when available. See Installation to set this up.
Review files
Review specific files without needing a git repository:
kluster review file src/auth.go src/middleware.go
kluster review file src/auth.go src/middleware.go → Reviewing code [████████████████████████████████████████] 100% ✓ Reviewing code complete! Review: 507f1f77bcf86cd799439018 Found 1 issue(s) #1 CRITICAL [P2] security JWT token verification skips expiration check at src/auth.go:67-72 Fix Add token expiration validation before processing claims.
This is useful for reviewing standalone scripts, config files, or code outside a git repository.
Analysis modes
All review commands support two analysis modes via the --mode flag:
- Instant: Completes in about five seconds. Detects most issues and is suited for fast review and iteration cycles.
- Deep: Takes up to a few minutes. Conducts deeper analysis to uncover even subtle edge cases, ideal for critical code and final reviews.
Use the --mode flag to select:
kluster review staged --mode deep
kluster review staged --mode deep → Reviewing code [████████████████████████████████████████] 100% ✓ Reviewing code complete! Review: 507f1f77bcf86cd799439019 Found 2 issue(s) #1 HIGH [P1] logical Race condition in concurrent map access at src/cache/store.go:45-67 ──────────────────────────────────────────────────────────────────────── #2 MEDIUM [P2] performance N+1 query pattern in user listing endpoint at src/handlers/users.go:89-102
The default mode is instant.
CI/CD and scripting
For automation, prefer machine-readable output and check the command exit code.
Example (JSON output via environment variable):
KLUSTER_OUTPUT=json kluster review staged
See CLI reference for exit codes and Output formats for configuration options.
Review history
List recent reviews
kluster log → Fetching review history... Review: 507f1f77bcf86cd799439011 Date: 2026-02-09 14:32 Issues: 3 [CRITICAL] SQL injection vulnerability detected in user input handling... [HIGH] Potential null pointer dereference in config access... [MEDIUM] Unused variable 'tempResult' declared but never used ──────────────────────────────────────────────────────────────────────── Review: 507f1f77bcf86cd799439010 Date: 2026-02-09 11:15 Issues: No issues ──────────────────────────────────────────────────────────────────────── Review: 507f1f77bcf86cd799439009 Date: 2026-02-08 16:45 Issues: 1 [LOW] Consider adding error context to wrapped errors Showing 3 of 47 reviews
Use --limit to control how many reviews are shown (default: 20, max: 100):
View review details
Use the review ID from kluster log to see the full report:
kluster show 507f1f77bcf86cd799439011 → Fetching review details... Review: 507f1f77bcf86cd799439011 Date: 2026-02-09 14:32:15 Project: my-awesome-app Found 2 issue(s) #1 HIGH [P1] security Hardcoded credentials detected in configuration file. at config/database.go:12-15 More details The database password is hardcoded as a string literal. This is a security risk as credentials may be exposed in version control. Fix Use environment variables or a secrets manager. Replace the hardcoded value with os.Getenv("DB_PASSWORD"). ──────────────────────────────────────────────────────────────────────── #2 MEDIUM [P2] performance Inefficient loop detected - database query inside loop iteration. at internal/users/sync.go:45-60 Fix Batch the database queries by collecting IDs first, then executing a single query with WHERE id IN (...) clause.
Long output is automatically paged using your system pager (less, more, or most).
Next steps
- Git hooks: Automate reviews on every commit or push.
- Reference: Configuration, exit codes, and full command reference.