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

openclaw-kb

v1.2.0

Published

Self-updating vector knowledge base for OpenClaw — semantic search over docs, code, and configs with automatic release tracking

Downloads

194

Readme

OpenClaw Knowledge Base

License: MIT Node.js Version

Self-updating vector knowledge base for OpenClaw — semantic search over docs, code, and configs with automatic release tracking.

Install

Via mise (recommended)

# mise.toml
[tools]
"npm:openclaw-kb" = "latest"

[env]
UPSTREAM_DIR = "{{ config_root }}/build/openclaw/.upstream"
KB_DATA_DIR = "{{ config_root }}/data/kb"

For development

git clone https://github.com/mrkhachaturov/openclaw-kb.git
cd openclaw-kb
just setup   # npm install

Usage

# Search documentation
openclaw-kb docs "sandbox configuration"

# Search source code
openclaw-kb code "TtsProviderSchema"

# Cross-reference docs + code
openclaw-kb verify "session persistence"

# Full query with filters
openclaw-kb query "webhook" --ios --json --top 5

# Offline keyword search (no API key needed)
openclaw-kb query "telegram" --offline

# Sync to latest upstream release
openclaw-kb sync --upstream-dir /path --data-dir /path

# Database info
openclaw-kb stats
openclaw-kb latest
openclaw-kb history
openclaw-kb since v2026.2.21

# Install auto-sync timer
openclaw-kb install-service --interval 2h \
  --upstream-dir /path/.upstream \
  --data-dir /path/data \
  --env-file /path/.env

CLI Reference

| Command | Description | |---------|-------------| | query <text> | Hybrid search (vector + keyword + RRF fusion) | | docs <text> | Search documentation only | | code <text> | Search source code only | | skills <text> | Search skills only | | verify <text> | Two-pass: docs then related code | | index | Reindex the knowledge base | | sync | Fetch latest upstream tag and reindex | | stats | Show database statistics | | latest | Show current indexed version | | history | Show last 10 releases | | since <version> | What changed since a version | | install-service | Generate systemd/launchd auto-sync |

Query flags

| Flag | Effect | |------|--------| | --docs | Filter to documentation | | --code | Filter to source code | | --skills | Filter to skills | | --ios | Filter to iOS Swift sources | | --macos | Filter to macOS Swift sources | | --shared | Filter to shared Swift package | | --releases | Filter to release notes | | --verify | Two-pass: docs then code | | --json | Machine-readable JSON output | | --top <n> | Number of results (default: 8) | | --offline | FTS-only keyword search, no API key needed |

Exit codes

| Code | Meaning | |------|---------| | 0 | Success | | 1 | Runtime error | | 2 | Configuration error | | 3 | No results found |

Environment Variables

| Variable | Purpose | Default | |----------|---------|---------| | UPSTREAM_DIR | OpenClaw source checkout | ./source | | KB_DATA_DIR | SQLite DB + logs directory | ./data | | OPENAI_API_KEY | For embedding generation | required (openai provider) | | KB_EMBEDDING_MODEL | OpenAI embedding model | text-embedding-3-small | | KB_EMBEDDING_PROVIDER | openai or local | openai | | KB_LOCAL_MODEL | ONNX model for local provider | all-MiniLM-L6-v2 | | KB_LOG_DIR | Override log directory | $KB_DATA_DIR/log |

Precedence: CLI flags → env vars → defaults.

Local Embedding (no API key)

# Install optional dependency
npm install @huggingface/transformers

# Index and query fully offline
KB_EMBEDDING_PROVIDER=local openclaw-kb index --force
KB_EMBEDDING_PROVIDER=local openclaw-kb query "sandbox" --docs

A DB built with local embeddings is not compatible with openai embeddings (different dimensions). Switching providers requires a full reindex.

Multi-Machine Setup

Run sync on one machine, distribute the DB file via Syncthing/rsync/S3:

Server (cron): openclaw-kb sync → updates upstream.db
                    │
                    │  file sync
                    ▼
Client (read-only): openclaw-kb query --offline

Metadata commands (stats, latest, history, since) work without API key. Use --offline for queries without an API key.

How It Works

  1. Indexing: Discovers files via glob patterns → chunks by semantic boundaries → embeds via OpenAI or local ONNX → stores in SQLite with sqlite-vec
  2. Querying: Expands query with synonyms → embeds query → hybrid search (vector similarity + BM25 keyword) → RRF fusion ranking
  3. Syncing: Fetches upstream git tags → diffs KB-relevant files → checks out new tag → reindexes changed files

Performance

  • Index time: ~10-15 min (~7700 chunks from 2500 files)
  • Query time: <100ms
  • Storage: ~80MB SQLite
  • Cost: ~$0.15/reindex (OpenAI) or free (local)

MCP Server

Expose the KB as an MCP server for native AI tool integration (Claude Desktop, Cursor, Claude Code):

{
  "mcpServers": {
    "openclaw-kb": {
      "command": "openclaw-kb",
      "args": ["mcp-serve"],
      "env": {
        "KB_DATA_DIR": "/path/to/data",
        "UPSTREAM_DIR": "/path/to/upstream"
      }
    }
  }
}

Available tools: search, search_docs, search_code, search_skills, search_ios, get_stats, get_latest, get_history, get_since

AI Agent Integration

See AGENTS.md for integration with Claude Code, Cursor, and custom agents.

License

MIT