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

@dreb/semantic-search

v2.6.1

Published

Semantic codebase search engine with embedding-based ranking and MCP server

Readme

@dreb/semantic-search

Semantic codebase search engine with embedding-based ranking and an MCP server. Extracts and indexes code using tree-sitter for AST-aware chunking and a transformer embedding model (all-MiniLM-L6-v2), then ranks results using 6-signal fusion via POEM.

Requirements

  • Node.js 22+ — uses the built-in node:sqlite module

Installation

npm install @dreb/semantic-search

Claude Code Plugin

The package ships as a Claude Code plugin. Add the dreb marketplace and install:

/plugin marketplace add aebrer/dreb
/plugin install semantic-search@dreb

Or from the CLI outside a session:

claude plugin marketplace add aebrer/dreb
claude plugin install semantic-search@dreb

Alternatively, register the MCP server directly without the plugin system:

claude mcp add --transport stdio semantic-search -- npx @dreb/semantic-search semantic-search-mcp

For local development from a cloned repo:

claude --plugin-dir ./packages/semantic-search

MCP Server

The package exposes a search tool over the Model Context Protocol (stdio transport). The tool accepts:

| Parameter | Required | Description | | ------------ | -------- | ------------------------------------------------ | | query | yes | Natural language, identifier, or path query | | projectDir | yes | Absolute path to the project directory to search | | path | no | Restrict search to files under this path | | limit | no | Maximum results to return (default: 20) | | rebuild | no | Force a clean index rebuild (default: false) |

Start the server standalone:

npx @dreb/semantic-search semantic-search-mcp

How Ranking Works

Results are ranked by fusing 6 independent signals using POEM (Pareto-Optimal Embedded Modeling) weights that vary per query type:

| Signal | Description | | --------------------- | -------------------------------------------------------------- | | BM25 | Keyword matching via FTS5 full-text search | | Cosine similarity | Embedding-based semantic similarity using all-MiniLM-L6-v2 | | Path match | Query terms appearing in the file path | | Symbol match | Query terms matching function, class, or type names | | Import graph | Proximity to high-scoring files in the import/dependency graph | | Git recency | Recently modified files ranked higher |

Queries are automatically classified as identifier, natural language, or path queries, and each type applies different POEM column weights. POEM constructs a Pareto front over all signal dimensions and assigns ranks based on dominance depth — no manual weight tuning required. See Pareto-Optimal Embedded Modeling for the theoretical foundation.

Library API

import { SearchEngine } from "@dreb/semantic-search";

const engine = new SearchEngine("/path/to/project", {
  indexDir: "/custom/index/path",         // default: <projectRoot>/.search-index
  globalMemoryDir: "~/.dreb/memory",      // additional directory to index
  modelCacheDir: "~/.cache/models",       // default: ~/.cache/semantic-search/models
  visibleDirs: (root) => [`${root}/.special`], // extra dirs (bypasses .gitignore)
});

// First call builds the index (10-60s); subsequent calls are fast
const results = await engine.search("where is auth handled", {
  limit: 20,
  pathFilter: "src/",
  onProgress: (phase, current, total) => console.log(`${phase}: ${current}/${total}`),
});

const stats = engine.getStats();    // { files, chunks } | null
await engine.resetIndex();          // delete index, next search rebuilds
await engine.close();               // dispose resources
SearchEngine.isAvailable();         // check for node:sqlite

What Gets Indexed

  • Code — tree-sitter AST chunks (functions, classes, methods, interfaces, etc.). TypeScript, JavaScript, Python, Go, Rust, Java, C, C++, GDScript.
  • Text — Markdown (by heading), YAML/TOML (by key), JSON, plaintext (by paragraph). Also indexes Godot scene (.tscn), resource (.tres), and project (.godot) files as plaintext.
  • Extra directories — via globalMemoryDir or visibleDirs, scanned even if gitignored.

The index is stored in .search-index/search.db at the project root (add .search-index/ to .gitignore).

License

MIT