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

Start the daemon, register your repo, and query in seconds.

$ lens daemon start
LENS daemon running on http://localhost:4111

$ lens repo register
Registered: my-project
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

The daemon runs on port 4111 and serves the REST API, MCP stdio, and local dashboard.

$ lens daemon start
LENS daemon running on http://localhost:4111

$ lens dashboard
Opening http://localhost:4111/dashboard/

$ curl http://localhost:4111/context \
  -H "Content-Type: application/json" \
  -d '{"goal": "add auth middleware"}'

Pro Features

Authenticate to unlock Voyage semantic embeddings, purpose summaries, and vocab clusters.

$ lens login --github
Authenticated as [email protected]

$ lens status
Pro: active
Embeddings: 847/847 files
Vocab clusters: 42 clusters

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 commands support --json for machine-readable output.

CommandDescription
lens daemon startStart the HTTP daemon on :4111
lens daemon stopStop the running daemon
lens daemon statsShow global statistics
lens repo registerRegister current repo for indexing
lens repo listList registered repos
lens repo removeRemove current repo
lens repo watchStart file watcher for current repo
lens repo unwatchStop file watcher for current repo
lens repo watch-statusShow watcher status
lens indexIndex the current repo
lens context "<goal>"Build a context pack for a goal
lens statusShow repo index/embedding status
lens dashboardOpen local dashboard in browser
lens loginAuthenticate via OAuth (GitHub/Google)
lens logoutClear cloud authentication
lens config get <key>Get a config value
lens config set <key> <val>Set a config value