npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

lens-engine

v0.1.21

Published

LENS — Local-first repo context engine for AI agents

Readme

LENS

Local-first repo context engine for AI agents.

LENS indexes your codebase — TF-IDF scoring, import graph traversal, co-change analysis — and delivers ranked files in one call. Fewer tokens wasted, smarter output.

Install

npm install -g lens-engine

Requires Node.js 20+.

Quick Start

# Start the background daemon
lens daemon start

# Register and auto-index a repo
cd my-project
lens repo register

# Query with intent
lens context "add auth middleware"
Context pack: 12 files, 3.2KB
  src/middleware/auth.ts
  src/routes/login.ts
  src/lib/tokens.ts
  ...

What It Does

  1. Diff scan — detects changed files since last index
  2. TF-IDF keyword scoring — code-domain stopwords, path tokens, exports, docstrings
  3. Concept expansion — static synonyms + repo-specific vocab clusters
  4. Import graph traversal — 2-hop dependency analysis, hub-file boosting
  5. Git co-change analysis — files that change together get surfaced together
  6. Semantic boost (Pro) — Voyage vector search for meaning-level matching
  7. Cache — ~10ms cached, under 1s cold

Your code never leaves your machine. No cloud dependency for local usage.

Daemon & Dashboard

The daemon runs on port 4111 — serves the REST API, MCP stdio, and a full local dashboard. Manage repos, watch indexing jobs, build context packs, and browse indexed data from the browser.

lens daemon start
lens dashboard          # opens http://localhost:4111/dashboard/

Dashboard pages: Overview (system stats, repo cards), Context (interactive query builder), Repositories (status table), Jobs (indexing progress), Requests (live log), Data Browser, Usage, Billing.

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

MCP Integration

lens repo register writes .mcp.json automatically. Claude Code, Cursor, and any MCP-compatible agent auto-discovers LENS. To re-create it manually: lens repo mcp.

{
  "mcpServers": {
    "lens": {
      "command": "lens-daemon",
      "args": ["--stdio"]
    }
  }
}

Pro

LENS is free for local use — TF-IDF, import graph, co-change, and caching all work without an account. Pro unlocks two additional pipeline stages that improve retrieval accuracy for larger or more complex codebases.

Semantic Embeddings

Every file chunk is embedded for semantic search. LENS runs cosine similarity against all vectors to find files that are semantically relevant — even when they share zero keywords with your prompt.

Example: Query "handle expired sessions" surfaces tokenRefresh.ts and authMiddleware.ts. Neither contains the word "session".

Vocab Clusters

Export names across your repo are embedded and clustered by cosine similarity (threshold >0.75). When a query matches one term in a cluster, all related terms are pulled in — automatic query expansion tuned to your codebase.

Example: Query "auth" expands to verifyToken, sessionMiddleware, loginHandler, requireAuth.

Together they add ~100-300ms per query. After logging in, run lens index --force to embed everything immediately, or leave it — LENS embeds new and changed files on each incremental index, so coverage grows automatically as you work.

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

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

# Optional: force full re-index to embed everything now
lens index --force

CLI Reference

All commands support --json for machine-readable output.

| Command | Description | |---------|-------------| | lens daemon start | Start the HTTP daemon on :4111 | | lens daemon stop | Stop the running daemon | | lens daemon stats | Show global statistics | | lens repo register | Register current repo for indexing | | lens repo list | List registered repos | | lens repo remove | Remove current repo | | lens repo watch | Start file watcher for current repo | | lens repo unwatch | Stop file watcher for current repo | | lens repo watch-status | Show watcher status | | lens repo mcp | Write .mcp.json for agent integration | | lens index | Index the current repo | | lens context "<goal>" | Build a context pack for a goal | | lens status | Show repo index/embedding status | | lens dashboard | Open local dashboard in browser | | lens login | Authenticate via OAuth (GitHub/Google) | | lens logout | Clear cloud authentication | | lens config get <key> | Get a config value | | lens config set <key> <val> | Set a config value |

License

MIT