Getting Started
LENS indexes your codebase locally and serves context packs to AI agents. No API keys required for local-only usage.
Install
Install LENS globally via npm.
$ npm install -g lens-engine
Quick Start
Initialize, register your repo, and query in seconds.
$ lens init Config written to ~/.lens/config.json $ lens repo register . Registered: my-project (847 files) $ lens index Scanning files... 847 files Building import graph... done Analyzing git history... done Index complete in 2.3s $ lens context "add auth middleware" Context pack: 12 files, 3.2KB src/middleware/auth.ts src/routes/login.ts src/lib/tokens.ts ...
Daemon Mode
Start the HTTP daemon for persistent access on port 4111.
$ lens daemon start
LENS daemon running on http://localhost:4111
$ curl http://localhost:4111/context \
-H "Content-Type: application/json" \
-d '{"goal": "add auth middleware"}'MCP Integration
Claude Code auto-discovers LENS via .mcp.json in your project root. Create the file:
{
"mcpServers": {
"lens": {
"command": "lens-daemon",
"args": ["--stdio"]
}
}
}Claude Code will spawn the daemon in MCP stdio mode and use it for context lookups automatically. No manual configuration needed.
CLI Reference
All available commands.
| Command | Description |
|---|---|
| lens init | Initialize LENS config in current directory |
| lens repo register <path> | Register a repo for indexing |
| lens repo list | List registered repos |
| lens repo remove <id> | Remove a registered repo |
| lens repo watch <id> | Enable file watcher for a repo |
| lens index | Index the current repo (or all registered) |
| lens context "<goal>" | Generate a context pack for a goal |
| lens daemon start | Start the HTTP daemon on :4111 |
| lens daemon stop | Stop the running daemon |
| lens daemon stats | Show daemon status and uptime |
| lens status | Show repo index status |
| lens config | Show current config |