LLM-based code analysis tool for detecting suspicious or inconsistent code regions written in Rust ๐ฆ
Rust
7
32 commits
updated Jan 4, 2026
LLM-based code analysis tool for detecting suspicious or inconsistent code regions.
Ouakha (ูุงุฎุง) means "agree" or "okay" in Moroccan Darija (dialect). The name captures the core concept: this tool finds places where the LLM model doesn't agree with your code; highlighting tokens that seem surprising, inconsistent, or potentially buggy.
When the model "ouakha" (agrees) with your code, everything looks fine. When it doesn't? That's where you should look closer.
Ouakha uses local LLMs to evaluate next-token predictions and find locations where the model "disagrees" with the actual code; indicating potentially surprising, inconsistent, or suspicious code.
Heatmap visualization showing model confidence โ red highlights indicate low confidence (potential issues)
Ouakha uses vLLM as the default backend for inference. Install it before running:
pip install vllm
Download the latest release for your platform from GitHub Releases:
ouakha-linux-x86_64.tar.gzouakha-macos-x86_64.tar.gzouakha-macos-aarch64.tar.gz# Example for macOS Apple Silicon
tar -xzf ouakha-macos-aarch64.tar.gz
sudo mv ouakha /usr/local/bin/
# Clone the repository
git clone https://github.com/yourusername/ouakha.git
cd ouakha
# Build (requires Rust 1.83+)
cargo build --release
# With Metal support (macOS)
cargo build --release --features metal
# With CUDA support (Linux)
cargo build --release --features cuda
# 1. Start vLLM server (vLLM is the default backend)
vllm serve bigcode/starcoder2-3b --port 8000
# 2. Analyze with TUI (default)
ouakha analyze src/main.rs
# Output to stdout
ouakha analyze src/main.rs --disable-tui --format=quickfix
# Use a different model
ouakha analyze src/main.rs --model codellama/CodeLlama-7b-hf
For local inference without a separate server (useful for quick tests):
# Use Candle backend for local inference
ouakha analyze src/main.rs --backend candle
# Force CPU inference
ouakha analyze src/main.rs --backend candle --cpu
# Analyze all supported files in a project
ouakha project ./my-project --extensions=rs,py,js
Ouakha can analyze only files with uncommitted changes and filter results to show only issues in changed lines:
# Analyze unstaged changes in working directory
ouakha git working
# Analyze staged changes only
ouakha git staged
# Analyze all changes (staged + unstaged)
ouakha git all
# Compare against a branch
ouakha git branch --base=main
The git integration:
# Start web server
ouakha web --addr=127.0.0.1:8080
# With pre-loaded results
ouakha web --results=analysis.json
ouakha tui src/main.rs
| Key | Action |
|---|---|
h/j/k/l | Move cursor left/down/up/right |
gg | Jump to top of file |
G | Jump to bottom of file |
w/b | Word forward/backward |
Ctrl-d/u | Half-page down/up |
/pattern | Search forward |
n/N | Next/previous search match |
]d | Next flagged region (low confidence) |
[d | Previous flagged region |
t | Toggle confidence threshold |
q | Quit |
# Generate quickfix-compatible output
ouakha --file-path src/main.rs --disable-tui --format=quickfix > /tmp/ouakha.qf
# In Vim/Neovim
:cfile /tmp/ouakha.qf
:copen
Add to your Neovim config:
-- ~/.config/nvim/lua/plugins/ouakha.lua
return {
dir = "/path/to/ouakha/nvim",
config = function()
require("ouakha").setup({
threshold = 0.5,
auto_analyze = false,
signs = true,
})
end,
}
Commands:
:OuakhaAnalyze - Analyze current buffer:OuakhaNext / :OuakhaPrev - Navigate flagged regions:OuakhaQuickfix - Send results to quickfix list:OuakhaClear - Clear analysis resultssummary - Human-readable summary (default)quickfix - Vim quickfix formatjson - Structured JSON outputlocationlist - Vim location list formatHUGGINGFACE_TOKEN - HuggingFace API token (required for model download)--backend <BACKEND> Backend to use: vllm, candle [default: vllm]
--backend-url <URL> URL for HTTP backends [default: http://localhost:8000]
--model <MODEL> Model to use [default: depends on backend]
--threshold <FLOAT> Confidence threshold for flagging [default: 0.5]
--cpu Force CPU inference (Candle only)
--disable-cache Disable result caching
--save-cache Save analysis results to cache
--cache-dir <PATH> Custom cache directory
--clear-cache Clear all cached results
Ouakha uses a versioned cache system (v2) to store analysis results:
~/.cache/ouakha/Note: After upgrading Ouakha, old cache entries will be ignored due to version changes. This is intentional to ensure consistency.
vLLM Backend (default, HTTP server):
bigcode/starcoder2-3b (default)Candle Backend (local inference):
bigcode/starcoderbase-1b (default, ~2GB)bigcode/starcoderbase-3b (~6GB)bigcode/starcoderbase-7b (~14GB)# Run tests
cargo test
# Run with debug output
RUST_LOG=debug cargo run -- --file-path test.rs
# Format code
cargo fmt
# Lint
cargo clippy
src/
โโโ analysis/ # Core analysis logic
โ โโโ code_agreement.rs # Token/char level probability data
โ โโโ chunker.rs # Large file chunking with overlap merging
โ โโโ project.rs # Multi-file project analysis
โโโ backend/ # LLM backend implementations
โ โโโ mod.rs # Backend trait
โ โโโ candle.rs # Candle/StarCoder (local)
โ โโโ vllm.rs # vLLM HTTP backend
โโโ cache.rs # Versioned cache system (v2)
โโโ model/ # Neural network models
โ โโโ big_coder.rs
โโโ tui/ # Terminal UI
โ โโโ input.rs # Input state machine
โ โโโ search.rs # Search functionality
โ โโโ view.rs # Rendering
โโโ web/ # Web UI
โ โโโ handlers.rs # HTTP request handlers
โ โโโ templates.rs # HTML templates
โ โโโ code_renderer.rs # Syntax-highlighted heatmap rendering
โโโ git/ # Git integration
โ โโโ scanner.rs # Working/staged/branch change detection
โ โโโ diff.rs # Unified diff parsing
โโโ output/ # Output formatters
โ โโโ quickfix.rs
โ โโโ json.rs
โโโ main.rs # CLI entry point
For files exceeding the model's context window, Ouakha:
MIT
32 commits
Rust
96.9%
Lua
3.1%
LLM-based code analysis tool for detecting suspicious or inconsistent code regions written in Rust ๐ฆ
Rust
7
32 commits
updated Jan 4, 2026
LLM-based code analysis tool for detecting suspicious or inconsistent code regions.
Ouakha (ูุงุฎุง) means "agree" or "okay" in Moroccan Darija (dialect). The name captures the core concept: this tool finds places where the LLM model doesn't agree with your code; highlighting tokens that seem surprising, inconsistent, or potentially buggy.
When the model "ouakha" (agrees) with your code, everything looks fine. When it doesn't? That's where you should look closer.
Ouakha uses local LLMs to evaluate next-token predictions and find locations where the model "disagrees" with the actual code; indicating potentially surprising, inconsistent, or suspicious code.
Heatmap visualization showing model confidence โ red highlights indicate low confidence (potential issues)
Ouakha uses vLLM as the default backend for inference. Install it before running:
pip install vllm
Download the latest release for your platform from GitHub Releases:
ouakha-linux-x86_64.tar.gzouakha-macos-x86_64.tar.gzouakha-macos-aarch64.tar.gz# Example for macOS Apple Silicon
tar -xzf ouakha-macos-aarch64.tar.gz
sudo mv ouakha /usr/local/bin/
# Clone the repository
git clone https://github.com/yourusername/ouakha.git
cd ouakha
# Build (requires Rust 1.83+)
cargo build --release
# With Metal support (macOS)
cargo build --release --features metal
# With CUDA support (Linux)
cargo build --release --features cuda
# 1. Start vLLM server (vLLM is the default backend)
vllm serve bigcode/starcoder2-3b --port 8000
# 2. Analyze with TUI (default)
ouakha analyze src/main.rs
# Output to stdout
ouakha analyze src/main.rs --disable-tui --format=quickfix
# Use a different model
ouakha analyze src/main.rs --model codellama/CodeLlama-7b-hf
For local inference without a separate server (useful for quick tests):
# Use Candle backend for local inference
ouakha analyze src/main.rs --backend candle
# Force CPU inference
ouakha analyze src/main.rs --backend candle --cpu
# Analyze all supported files in a project
ouakha project ./my-project --extensions=rs,py,js
Ouakha can analyze only files with uncommitted changes and filter results to show only issues in changed lines:
# Analyze unstaged changes in working directory
ouakha git working
# Analyze staged changes only
ouakha git staged
# Analyze all changes (staged + unstaged)
ouakha git all
# Compare against a branch
ouakha git branch --base=main
The git integration:
# Start web server
ouakha web --addr=127.0.0.1:8080
# With pre-loaded results
ouakha web --results=analysis.json
ouakha tui src/main.rs
| Key | Action |
|---|---|
h/j/k/l | Move cursor left/down/up/right |
gg | Jump to top of file |
G | Jump to bottom of file |
w/b | Word forward/backward |
Ctrl-d/u | Half-page down/up |
/pattern | Search forward |
n/N | Next/previous search match |
]d | Next flagged region (low confidence) |
[d | Previous flagged region |
t | Toggle confidence threshold |
q | Quit |
# Generate quickfix-compatible output
ouakha --file-path src/main.rs --disable-tui --format=quickfix > /tmp/ouakha.qf
# In Vim/Neovim
:cfile /tmp/ouakha.qf
:copen
Add to your Neovim config:
-- ~/.config/nvim/lua/plugins/ouakha.lua
return {
dir = "/path/to/ouakha/nvim",
config = function()
require("ouakha").setup({
threshold = 0.5,
auto_analyze = false,
signs = true,
})
end,
}
Commands:
:OuakhaAnalyze - Analyze current buffer:OuakhaNext / :OuakhaPrev - Navigate flagged regions:OuakhaQuickfix - Send results to quickfix list:OuakhaClear - Clear analysis resultssummary - Human-readable summary (default)quickfix - Vim quickfix formatjson - Structured JSON outputlocationlist - Vim location list formatHUGGINGFACE_TOKEN - HuggingFace API token (required for model download)--backend <BACKEND> Backend to use: vllm, candle [default: vllm]
--backend-url <URL> URL for HTTP backends [default: http://localhost:8000]
--model <MODEL> Model to use [default: depends on backend]
--threshold <FLOAT> Confidence threshold for flagging [default: 0.5]
--cpu Force CPU inference (Candle only)
--disable-cache Disable result caching
--save-cache Save analysis results to cache
--cache-dir <PATH> Custom cache directory
--clear-cache Clear all cached results
Ouakha uses a versioned cache system (v2) to store analysis results:
~/.cache/ouakha/Note: After upgrading Ouakha, old cache entries will be ignored due to version changes. This is intentional to ensure consistency.
vLLM Backend (default, HTTP server):
bigcode/starcoder2-3b (default)Candle Backend (local inference):
bigcode/starcoderbase-1b (default, ~2GB)bigcode/starcoderbase-3b (~6GB)bigcode/starcoderbase-7b (~14GB)# Run tests
cargo test
# Run with debug output
RUST_LOG=debug cargo run -- --file-path test.rs
# Format code
cargo fmt
# Lint
cargo clippy
src/
โโโ analysis/ # Core analysis logic
โ โโโ code_agreement.rs # Token/char level probability data
โ โโโ chunker.rs # Large file chunking with overlap merging
โ โโโ project.rs # Multi-file project analysis
โโโ backend/ # LLM backend implementations
โ โโโ mod.rs # Backend trait
โ โโโ candle.rs # Candle/StarCoder (local)
โ โโโ vllm.rs # vLLM HTTP backend
โโโ cache.rs # Versioned cache system (v2)
โโโ model/ # Neural network models
โ โโโ big_coder.rs
โโโ tui/ # Terminal UI
โ โโโ input.rs # Input state machine
โ โโโ search.rs # Search functionality
โ โโโ view.rs # Rendering
โโโ web/ # Web UI
โ โโโ handlers.rs # HTTP request handlers
โ โโโ templates.rs # HTML templates
โ โโโ code_renderer.rs # Syntax-highlighted heatmap rendering
โโโ git/ # Git integration
โ โโโ scanner.rs # Working/staged/branch change detection
โ โโโ diff.rs # Unified diff parsing
โโโ output/ # Output formatters
โ โโโ quickfix.rs
โ โโโ json.rs
โโโ main.rs # CLI entry point
For files exceeding the model's context window, Ouakha:
MIT
32 commits
Rust
96.9%
Lua
3.1%