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

xindex

v1.0.18

Published

Local semantic code search — index codebase, search by meaning or keywords

Downloads

2,517

Readme

xindex

grep matches text. xindex matches meaning. Fully local, no cloud, no API keys, instant response.

Ask "where is auth handled?" — get the right files, even when they don't contain the word auth.

Local semantic code search for your codebase, w/ an MCP so Claude Code searches your repo directly.

Fewer hallucinations, fewer round-trips.

Install

Requires Node ≥22.

npm i -g xindex

First run downloads a small embedding model (~23MB). After that, fully offline.

Quick start

cd /path/to/your/project
xindex-index .                         # build the index
xindex-search "where is auth handled"  # ask a question

Index lives in ./.xindex/ — add it to .gitignore.

Use with Claude Code (MCP)

Zero-install, all projects

claude mcp add --scope user xindex -- npx xindex
# remove later: claude mcp remove xindex --scope user

Per-project

Drop this into .mcp.json at the repo root — npx fetches on demand:

{
  "mcpServers": {
    "xindex": {
      "command": "npx",
      "args": ["xindex"]
    }
  }
}

With a global install

  1. npm i -g xindex
  2. In .mcp.json, set "command": "xindex-mcp" with "args": [].

Open the project in Claude Code — it picks up the xindex MCP server and can call xindex_search, xindex_index, and xindex_reset directly.

Features

  • Local — everything runs on your machine; embeddings cached on disk
  • Semantic search — natural-language queries, not substring match
  • MCP server — plugs into Claude Code via .mcp.json
  • Watch mode — keeps the index warm while you code
  • Gitignore-aware — respects .gitignore + custom ignore rules
  • Zero config — works with defaults; .xindex.json is optional
  • Tolerant — unreadable, oversize, empty, binary files and symlinks are skipped;

Claude Code skills (@xi)

Two optional Claude Code skills wrap the MCP tools so you don't have to think about them:

  • ask-xi — read-only discovery. @xi where is auth handled drafts several focused queries, runs xindex_search for each, and returns ranked file paths with matched keywords. Use it as a cheap first step before grepping or asking a heavier model.
  • xindex — index management (xindex_index, xindex_reset). Reset requires explicit confirmation every time.

Keeping them separate keeps @xi safe to fire casually while destructive ops stay behind the xindex skill.

Install

Pick a scope — project (checked in, shared with the repo) or user-global (available in every project):

# project-scoped
SKILLS=.claude/skills
# OR user-global
SKILLS=~/.claude/skills

Then copy-paste the block below to create both skills:

mkdir -p "$SKILLS/ask-xi" "$SKILLS/xindex"

cat > "$SKILLS/ask-xi/SKILL.md" <<'EOF'
---
name: ask-xi
description: Discovers relevant files via xindex semantic search — preps queries, auto-indexes on empty, returns file links with keywords. Triggered by @xi.
argument-hint: "[question]"
---
Surface-level codebase discovery via xindex. Tool: `xindex_search` (natural-language, meaning-based). Must trigger search when a session starts, a new task starts, or any codebase lookup is needed.

**Steps:**
1. Draft 3–5 queries from $ARGUMENTS (entry points, routing, config, tests, patterns); run `xindex_search` in parallel.
2. If empty/sparse/stale → scoped `xindex_index` on relevant root folders (one path per call, e.g. `src`, `skills`, `agents`), then re-search. Prefer scoped over full-repo.
3. Think, then run 3+ narrower follow-ups in parallel based on round-1 hits.
4. Return file paths + brief keywords showing why each matched.

Output = file links + keywords, not analysis. **Escalate to `/ask-cursor` by default** (cheap codebase reasoning); only go to `/ask-claude` for multi-file/pattern analysis or `/ask-claude-opus` for trade-offs. For reset or full re-index, delegate to `/xindex` (owns safety rules).
EOF

cat > "$SKILLS/xindex/SKILL.md" <<'EOF'
---
name: xindex
description: Manages xindex semantic search — index, search, reset via MCP tools. For research questions, use /ask-xi.
argument-hint: "[search query | index | reset]"
---
Full xindex tool management. For research, use `/ask-xi`. Install: `npm i -g xindex` ([npm](https://www.npmjs.com/package/xindex)).

**Tools:**
- `xindex_search` — find files by meaning (synonyms, semantics). Try before grepping blindly.
- `xindex_index` — index a path (recursive, respects .gitignore). **MUST** run one path per call.
- `xindex_reset` — destructive wipe+rebuild. **MUST** get explicit user confirmation every time; if ambiguous, don't run.

**Workflow:** stale/corrupt → confirm → `xindex_reset` → `xindex_index(["."])` → `xindex_search`. Incremental → one-path `xindex_index(["changed/path"])` calls.

**Scoped indexing (preferred):** index only task-relevant content-heavy folders, sequentially. Full-repo `xindex_index(["."])` only for cross-cutting discovery.

$ARGUMENTS
EOF

Both skills assume the xindex MCP server is registered (see the section above). Restart Claude Code after adding.


CLI reference

All five binaries run from any directory; they index/search the current working directory.

xindex-index [paths...]

Build or update the index. Defaults to ..

xindex-index .
xindex-index apps features

xindex-search <query...>

Search the index. Args are joined into one query. Default limit: 7.

xindex-search "database migration logic"
xindex-search file watcher debounce

xindex-watch [paths...]

Initial index + filesystem watch for incremental updates. Lockfile coordinates concurrent watchers; Ctrl+C releases cleanly.

Bundled inside xindex-mcp — no need to run separately in the primary MCP use case.

xindex-watch .

xindex-reset

Wipe and recreate the index. Destructive.

xindex-reset

xindex-mcp

MCP stdio server; background watcher by default. Flags: --watch-disabled, --watch-dir=./src — rare use cases; defaults are fine for most setups.

MCP tools

  • xindex_search — semantic search. query: string, limit?: number (default 7, max 50).
  • xindex_index — index paths. inputs: string[] (at least one).
  • xindex_reset — wipe index (destructive). No input.

Configuration

.xindex.json (optional)

Project-root file. All fields optional; unknown keys ignored; missing/empty → defaults.

  • ignoreKeywordsstring[], default []. Tokens stripped before embedding — add project slang/boilerplate polluting results. Entries ≤1 char warn.
  • ignoreFilesstring[], default ['.xindex', 'node_modules']. Extra globs excluded during walk/watch, on top of .gitignore. Setting this replaces the default — re-include .xindex and node_modules if you still want them skipped.
  • maxLinesnumber, default 30. Lines per chunk — tune if chunks feel over/under-sized.
  • maxFileBytesnumber, default 50000. Skip files over this (50 KB) — raise to index larger generated files.
  • followSymlinksboolean, default false. When false, symlinks are skipped with a log line. true follows them (cycles broken via realpath dedup).

Full example with every option (copy-paste and trim what you don't need):

{
  "ignoreKeywords": ["import", "export", "function", "const"],
  "ignoreFiles": [".xindex", "node_modules", "dist/**"],
  "maxLines": 30,
  "maxFileBytes": 50000,
  "followSymlinks": false
}

Override only what you need; re-run xindex-index . (or let the watcher pick it up on restart). Invalid JSON or unreadable config warns and falls back to defaults; wrong-typed fields fall back silently.

.xindex/ folder

Auto-created. Contains:

  • semantic/ — the semantic index (vectors + metadata)
  • lock.json — watcher lock (coordinates watch/MCP processes)

Always gitignore it — it's already excluded from the walk by default, this is just for git:

.xindex
node_modules/

How it fits together

  your repo                      xindex
  ─────────                      ──────
  *.ts / *.md  ──►  walk  ──►  embed  ──►  .xindex/
  .gitignore                                (semantic index)
                                                ▲
  CLI / MCP  ◄──  search  ◄──  embed  ◄──  "question"  ┘

Project layout

apps/        entry points (run.*.ts) + app composers (IndexApp, SearchApp, McpApp, ...)
bin/         shebang wrappers invoked by npm and .mcp.json
componets/   shared building blocks: config, walk, watch, embed, index adapter, logger
features/    domain operations: indexContent, searchIndex, removeContent, resetIndex
packages/    small internal libs (streamx, fun)
.xindex/     runtime data (gitignored)
.xindex.json optional config
.mcp.json    MCP registration for Claude Code / compatible clients

See CLAUDE.md for contributor conventions (HOF pattern, logger rules, task workflow).

Development

Working on xindex itself? From your working copy:

yarn install        # or npm install
npm link            # exposes xindex-* binaries from this checkout
yarn test.compilation

License

MIT

Links