Introduction
gnaw is a blazingly fast, AI-first, drop-in replacement for grep with advanced semantic code search capabilities.
Built in Rust and highly optimized for multi-core hardware and large codebases, gnaw offers blazing-fast pattern searches with minimal memory usage, full AI/LLM integration, and intelligent semantic code understanding.
Why gnaw?
Traditional text search tools like grep are limited to exact pattern matching. While powerful, they can't understand the semantic meaning of code or natural language queries. gnaw bridges this gap by combining:
- Traditional grep performance - 10x faster than grep on large files
- AI-powered semantic search - Find code by meaning, not just text
- Natural language queries - Describe what you're looking for in plain English
- Multi-threaded processing - Leverages all available CPU cores
- Streaming output - Get results as they're found
Key Features
Outperforms `grep` on large files by 10x with optimized multi-threaded processing
AI-powered semantic understanding of code structure and meaning
Use `--chat` to describe searches in plain English
Advanced AI-powered code analysis with `gnaw agent` subcommands
HNSW-based vector similarity search for semantic code understanding
Structured output for programmatic consumption
Three Modes of Operation
gnaw supports three main modes of operation:
1. Traditional Grep Mode
Fast pattern matching like grep, but with better performance:
gnaw "ERROR" test.log
2. Chat Mode
Natural language search descriptions:
gnaw --chat "Find all error messages in log files"
3. Agent Mode
AI-powered semantic code search and analysis:
gnaw agent ask "authentication functions"
Performance Benefits
gnaw leverages all available CPU cores for parallel processing, making it significantly faster than single-threaded alternatives.
Minimal memory footprint with efficient streaming for large files and datasets.
Intelligent caching mechanisms reduce redundant processing and improve performance over time.
Use Cases
- Code Exploration: Understand large codebases with semantic search
- Log Analysis: Fast pattern matching in large log files
- CI/CD Integration: Automated code analysis and monitoring
- Development Workflow: Natural language queries for code discovery
- Performance Monitoring: Real-time analysis of system logs and metrics
Getting Started
Ready to get started? Check out our Quick Start Guide or Installation Instructions.
gnaw is designed to be a drop-in replacement for `grep` in most workflows, while providing blazing-fast performance and AI-powered features.