Pi coding agent extension for ColGREP — semantic code search powered by ColBERT late-interaction embeddings.
Benchmark Results: See BENCHMARK.md for full paper-grade benchmark comparing ColGREP (CPU + GPU) vs grep on 20 corpora × 60 queries.
We ran a paper-grade benchmark on 20 local corpora (3 medium Rust repos + 17 Terminal Bench tasks) with 60 natural-language queries.
| Metric | ColGREP-GPU | ColGREP-CPU | grep | Δ (GPU vs grep) |
|---|---|---|---|---|
| MRR | 0.683 | 0.596 | 0.415 | +64.6% |
| Recall@10 | 0.790 | 0.498 | 0.395 | +100.0% |
| P@1 | 0.567 | 0.500 | 0.317 | +78.9% |
| NDCG@10 | 0.542 | 0.475 | 0.336 | +61.3% |
| System | p50 Latency | Cold Start | Throughput | Best For |
|---|---|---|---|---|
| ColGREP-GPU-Edge | 16.5 ms | ~2.1 s | 22.3 QPS | Interactive semantic search |
| ColGREP-GPU-149M | 28.8 ms | ~2.1 s | 23.9 QPS | Batch semantic search |
| ColGREP-CPU-Edge | ~50 ms | ~8 s | ~2 QPS | CPU-only environments |
| ColGREP-CPU-149M | 731 ms | 11.7 s | 0.11 QPS | Large corpora (PLAID index) |
| grep | 2.6 ms | ~3 ms | 319 QPS | Exact identifier search |
Key insight: GPU brute-force MaxSim (no index) outperforms CPU PLAID in both accuracy (+12-13% MRR) and latency (-94% p50). Edge 17M model is optimal for small-to-medium corpora.
Full methodology, per-repository breakdown, and LaTeX-ready figure data: BENCHMARK.md
If you are an AI coding agent (Claude, GPT, Codex, pi, etc.) installing this extension, use these commands:
# 1. Install ColGREP CLI (required dependency)
curl --proto '=https' --tlsv1.2 -LsSf https://github.com/lightonai/next-plaid/releases/latest/download/colgrep-installer.sh | sh
export PATH="$HOME/.local/bin:$PATH"
# 2. Install as pi package (recommended)
pi install git:github.com/sionic-ai/pi-colgrep-plugins
# 3. Verify installation
colgrep --version
pi list | grep colgrep
What this gives you:
semantic_search tool — search code by meaning, not just keywordscolgrep CLI — direct terminal access to semantic searchFirst-time indexing (do this once per repo):
colgrep init -y .
semantic_search tool and session hooksThe standard way to install pi extensions:
# Prerequisites: ColGREP CLI
brew install lightonai/tap/colgrep
# or
curl --proto '=https' --tlsv1.2 -LsSf https://github.com/lightonai/next-plaid/releases/latest/download/colgrep-installer.sh | sh
# Install the pi package
pi install git:github.com/sionic-ai/pi-colgrep-plugins
# Verify
pi list
For environments without network access or when you need full control:
git clone https://github.com/sionic-ai/pi-colgrep-plugins
cd pi-colgrep-plugins
# Show all available commands
make help
# Vendor dependencies for offline builds
make init
# Build and install everything
make install
# Verify
make smoke-test
Makefile targets:
| Target | Description |
|---|---|
make install | Full build + install (CLI + extension + skills) |
make init | Vendor dependencies for air-gapped builds |
make build | Build only (no install) |
make smoke-test | Verify installation works |
make uninstall | Remove everything |
make help | Show all targets |
npm install
npm run build
mkdir -p ~/.pi/agent/extensions ~/.pi/agent/skills
cp dist/extensions/colgrep.js ~/.pi/agent/extensions/
cp -r skills/* ~/.pi/agent/skills/
The extension registers a semantic_search tool that the model can use:
User: Find code that handles database connection pooling
Assistant: I'll search for database connection pooling code.
[Uses semantic_search with query: "database connection pooling"]
Found 5 matches:
src/db/pool.rs:45: pub fn create_pool(config: &DbConfig) -> Pool<...>
...
# Semantic search
colgrep "authentication middleware"
# Regex + semantic hybrid
colgrep -e "async fn" "error handling"
# Filter by file type
colgrep --include="*.ts" "React component"
# Search specific directory
colgrep "logging setup" ./src/utils
# GPU acceleration (if available)
colgrep --force-gpu "containerized execution"
Parameters:
query (string, required): Natural language description of what you're looking forpattern (string, optional): Regex pre-filter (e.g., "async fn")include (string, optional): Glob filter (e.g., "*.py")path (string, optional): Directory to search (default: current directory)k (number, optional): Max results (default: 10)When to use:
When NOT to use:
Example tool calls:
{"query": "authentication middleware", "path": "./src"}
{"query": "error handling", "pattern": "async fn", "include": "*.rs"}
{"query": "React form validation", "k": 20}
┌─────────────────────────────────────────────────────────────────────────┐
│ ColGREP Pipeline │
├─────────────────────────────────────────────────────────────────────────┤
│ 1. Tree-sitter → Parse code into functions/classes │
│ 2. Analysis → Extract signatures, calls, imports │
│ 3. LateOn-Code → Generate multi-vector embeddings │
│ 4. PLAID Index → Quantized, memory-mapped storage (CPU) │
│ 5. MaxSim Search → Token-level matching + RRF fusion │
│ 6. GPU BruteForce → CUDA-accelerated exact MaxSim (GPU) │
└─────────────────────────────────────────────────────────────────────────┘
pi-colgrep is designed for code search, where every repository is effectively its own domain. Late interaction models keep richer token-level representations and defer part of the matching step until retrieval time, preserving fine-grained evidence during ranking.
For code search, this matters because:
When a CUDA-capable GPU is available, ColGREP can use PyTorch brute-force MaxSim instead of PLAID indexing:
| Aspect | CPU (PLAID) | GPU (Brute-force) |
|---|---|---|
| Index build | Required (~8-12s) | Not needed |
| Cold start | Model load + index build | Model load only (~2s) |
| Warm latency | ~587 ms (149M) | ~29 ms (149M) |
| Accuracy | MRR 0.596 | MRR 0.676 (+13.3%) |
| Memory | ~500 MB (mmap index) | ~2-3 GB (full embeddings) |
Trade-off: GPU uses more memory but is dramatically faster and more accurate for small-to-medium corpora. For >100K files, PLAID indexing is still required.
The extension reads ColGREP's native config at ~/.config/colgrep/config.json.
colgrep settings --k 20 # Default result count
colgrep settings --n 10 # Context lines
colgrep settings --int8 # Faster inference
colgrep settings --relative-paths # Shorter output
GPU-specific settings:
# Force GPU mode (if auto-detection fails)
colgrep --force-gpu "query"
# Use Edge model (faster, smaller)
colgrep --model lightonai/LateOn-Code-edge "query"
colgrep: command not foundexport PATH="$HOME/.local/bin:$PATH"
command -v colgrep
colgrep --version
The first query builds the index. Pre-build it:
colgrep init -y /path/to/project
Or use GPU mode (no index build needed):
colgrep --force-gpu "query" /path/to/project
# Check CUDA
nvidia-smi
python3 -c "import torch; print(torch.cuda.is_available())"
# ColGREP auto-detects GPU; if it fails, use --force-gpu
colgrep --force-gpu "test query"
semantic_search tool# Reinstall and restart
pi remove git:github.com/sionic-ai/pi-colgrep-plugins
pi install git:github.com/sionic-ai/pi-colgrep-plugins
# Then restart pi
colgrep status
colgrep clear && colgrep init -y .
See INSTALL.md for detailed platform-specific instructions.
pi-colgrep-plugins/
├── extensions/
│ └── colgrep.ts # Main extension (semantic_search tool)
├── skills/
│ ├── colgrep-usage/ # General usage guidance
│ └── colgrep-semantic-search/ # Tool-specific guidance
├── package.json # Pi package manifest (pi.extensions, pi.skills)
├── BENCHMARK.md # Full benchmark report (20 corpora × 60 queries)
├── README.md # This file
└── Makefile # Offline build automation
MIT
2 commits
Rust
60.6%
Python
33.6%
HTML
2.2%
Pi coding agent extension for ColGREP — semantic code search powered by ColBERT late-interaction embeddings.
Benchmark Results: See BENCHMARK.md for full paper-grade benchmark comparing ColGREP (CPU + GPU) vs grep on 20 corpora × 60 queries.
We ran a paper-grade benchmark on 20 local corpora (3 medium Rust repos + 17 Terminal Bench tasks) with 60 natural-language queries.
| Metric | ColGREP-GPU | ColGREP-CPU | grep | Δ (GPU vs grep) |
|---|---|---|---|---|
| MRR | 0.683 | 0.596 | 0.415 | +64.6% |
| Recall@10 | 0.790 | 0.498 | 0.395 | +100.0% |
| P@1 | 0.567 | 0.500 | 0.317 | +78.9% |
| NDCG@10 | 0.542 | 0.475 | 0.336 | +61.3% |
| System | p50 Latency | Cold Start | Throughput | Best For |
|---|---|---|---|---|
| ColGREP-GPU-Edge | 16.5 ms | ~2.1 s | 22.3 QPS | Interactive semantic search |
| ColGREP-GPU-149M | 28.8 ms | ~2.1 s | 23.9 QPS | Batch semantic search |
| ColGREP-CPU-Edge | ~50 ms | ~8 s | ~2 QPS | CPU-only environments |
| ColGREP-CPU-149M | 731 ms | 11.7 s | 0.11 QPS | Large corpora (PLAID index) |
| grep | 2.6 ms | ~3 ms | 319 QPS | Exact identifier search |
Key insight: GPU brute-force MaxSim (no index) outperforms CPU PLAID in both accuracy (+12-13% MRR) and latency (-94% p50). Edge 17M model is optimal for small-to-medium corpora.
Full methodology, per-repository breakdown, and LaTeX-ready figure data: BENCHMARK.md
If you are an AI coding agent (Claude, GPT, Codex, pi, etc.) installing this extension, use these commands:
# 1. Install ColGREP CLI (required dependency)
curl --proto '=https' --tlsv1.2 -LsSf https://github.com/lightonai/next-plaid/releases/latest/download/colgrep-installer.sh | sh
export PATH="$HOME/.local/bin:$PATH"
# 2. Install as pi package (recommended)
pi install git:github.com/sionic-ai/pi-colgrep-plugins
# 3. Verify installation
colgrep --version
pi list | grep colgrep
What this gives you:
semantic_search tool — search code by meaning, not just keywordscolgrep CLI — direct terminal access to semantic searchFirst-time indexing (do this once per repo):
colgrep init -y .
semantic_search tool and session hooksThe standard way to install pi extensions:
# Prerequisites: ColGREP CLI
brew install lightonai/tap/colgrep
# or
curl --proto '=https' --tlsv1.2 -LsSf https://github.com/lightonai/next-plaid/releases/latest/download/colgrep-installer.sh | sh
# Install the pi package
pi install git:github.com/sionic-ai/pi-colgrep-plugins
# Verify
pi list
For environments without network access or when you need full control:
git clone https://github.com/sionic-ai/pi-colgrep-plugins
cd pi-colgrep-plugins
# Show all available commands
make help
# Vendor dependencies for offline builds
make init
# Build and install everything
make install
# Verify
make smoke-test
Makefile targets:
| Target | Description |
|---|---|
make install | Full build + install (CLI + extension + skills) |
make init | Vendor dependencies for air-gapped builds |
make build | Build only (no install) |
make smoke-test | Verify installation works |
make uninstall | Remove everything |
make help | Show all targets |
npm install
npm run build
mkdir -p ~/.pi/agent/extensions ~/.pi/agent/skills
cp dist/extensions/colgrep.js ~/.pi/agent/extensions/
cp -r skills/* ~/.pi/agent/skills/
The extension registers a semantic_search tool that the model can use:
User: Find code that handles database connection pooling
Assistant: I'll search for database connection pooling code.
[Uses semantic_search with query: "database connection pooling"]
Found 5 matches:
src/db/pool.rs:45: pub fn create_pool(config: &DbConfig) -> Pool<...>
...
# Semantic search
colgrep "authentication middleware"
# Regex + semantic hybrid
colgrep -e "async fn" "error handling"
# Filter by file type
colgrep --include="*.ts" "React component"
# Search specific directory
colgrep "logging setup" ./src/utils
# GPU acceleration (if available)
colgrep --force-gpu "containerized execution"
Parameters:
query (string, required): Natural language description of what you're looking forpattern (string, optional): Regex pre-filter (e.g., "async fn")include (string, optional): Glob filter (e.g., "*.py")path (string, optional): Directory to search (default: current directory)k (number, optional): Max results (default: 10)When to use:
When NOT to use:
Example tool calls:
{"query": "authentication middleware", "path": "./src"}
{"query": "error handling", "pattern": "async fn", "include": "*.rs"}
{"query": "React form validation", "k": 20}
┌─────────────────────────────────────────────────────────────────────────┐
│ ColGREP Pipeline │
├─────────────────────────────────────────────────────────────────────────┤
│ 1. Tree-sitter → Parse code into functions/classes │
│ 2. Analysis → Extract signatures, calls, imports │
│ 3. LateOn-Code → Generate multi-vector embeddings │
│ 4. PLAID Index → Quantized, memory-mapped storage (CPU) │
│ 5. MaxSim Search → Token-level matching + RRF fusion │
│ 6. GPU BruteForce → CUDA-accelerated exact MaxSim (GPU) │
└─────────────────────────────────────────────────────────────────────────┘
pi-colgrep is designed for code search, where every repository is effectively its own domain. Late interaction models keep richer token-level representations and defer part of the matching step until retrieval time, preserving fine-grained evidence during ranking.
For code search, this matters because:
When a CUDA-capable GPU is available, ColGREP can use PyTorch brute-force MaxSim instead of PLAID indexing:
| Aspect | CPU (PLAID) | GPU (Brute-force) |
|---|---|---|
| Index build | Required (~8-12s) | Not needed |
| Cold start | Model load + index build | Model load only (~2s) |
| Warm latency | ~587 ms (149M) | ~29 ms (149M) |
| Accuracy | MRR 0.596 | MRR 0.676 (+13.3%) |
| Memory | ~500 MB (mmap index) | ~2-3 GB (full embeddings) |
Trade-off: GPU uses more memory but is dramatically faster and more accurate for small-to-medium corpora. For >100K files, PLAID indexing is still required.
The extension reads ColGREP's native config at ~/.config/colgrep/config.json.
colgrep settings --k 20 # Default result count
colgrep settings --n 10 # Context lines
colgrep settings --int8 # Faster inference
colgrep settings --relative-paths # Shorter output
GPU-specific settings:
# Force GPU mode (if auto-detection fails)
colgrep --force-gpu "query"
# Use Edge model (faster, smaller)
colgrep --model lightonai/LateOn-Code-edge "query"
colgrep: command not foundexport PATH="$HOME/.local/bin:$PATH"
command -v colgrep
colgrep --version
The first query builds the index. Pre-build it:
colgrep init -y /path/to/project
Or use GPU mode (no index build needed):
colgrep --force-gpu "query" /path/to/project
# Check CUDA
nvidia-smi
python3 -c "import torch; print(torch.cuda.is_available())"
# ColGREP auto-detects GPU; if it fails, use --force-gpu
colgrep --force-gpu "test query"
semantic_search tool# Reinstall and restart
pi remove git:github.com/sionic-ai/pi-colgrep-plugins
pi install git:github.com/sionic-ai/pi-colgrep-plugins
# Then restart pi
colgrep status
colgrep clear && colgrep init -y .
See INSTALL.md for detailed platform-specific instructions.
pi-colgrep-plugins/
├── extensions/
│ └── colgrep.ts # Main extension (semantic_search tool)
├── skills/
│ ├── colgrep-usage/ # General usage guidance
│ └── colgrep-semantic-search/ # Tool-specific guidance
├── package.json # Pi package manifest (pi.extensions, pi.skills)
├── BENCHMARK.md # Full benchmark report (20 corpora × 60 queries)
├── README.md # This file
└── Makefile # Offline build automation
MIT
2 commits
Rust
60.6%
Python
33.6%
HTML
2.2%