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

@nyxis-studio/openindex

v0.2.0

Published

Standalone OpenCode plugin for OpenCode Desktop and TUI that adds local semantic indexing. Commands are registered by the plugin server at runtime, so they work outside the TUI.

Readme

OpenCode Embedding Cache Plugin

Standalone OpenCode plugin for OpenCode Desktop and TUI that adds local semantic indexing. Commands are registered by the plugin server at runtime, so they work outside the TUI.

It also adds:

  • /embedding-status to inspect index status.
  • /embedding-test <query> to validate semantic retrieval.
  • /embedding-setup to store a Google API key for OpenIndex.

Native tool exposed to the agent:

  • index_search (vector search over local indexed chunks).

Documentation skill included in this repository:

  • skills/index-tool/SKILL.md (usage guide and troubleshooting).

Automatic indexing:

  • on workspace load, the plugin checks and indexes what changed.
  • while editing files, it reindexes automatically (with debounce).
  • on first load, the plugin bootstraps the project-level .index/ folder.

Standard plugin setup (recommended)

Add the package name in your OpenCode config:

{
  "$schema": "https://opencode.ai/config.json",
  "plugin": ["@nyxis-studio/openindex"]
}

Then set your Google API key in either of these ways.

Recommended environment variable:

setx GOOGLE_API_KEY "YOUR_KEY_HERE"

Or use the TUI command when running the terminal UI:

/embedding-setup

/embedding-setup stores the key outside the project at ~/.config/opencode/openindex/google_api_key and links the project config to that file.

In OpenCode Desktop, run /embedding-setup for setup instructions. Avoid pasting the key directly into chat history; prefer GOOGLE_API_KEY or googleApiKeyFile.

Restart OpenCode and run:

/embedding

To monitor and test:

/embedding-status
/embedding-test "high damage champion"

To explicitly ask the agent to use the tool:

Use the index_search tool to fetch context about "your query".

No manual per-project setup is required. When OpenCode loads the plugin, OpenIndex creates the required local project files if they do not already exist, injects command definitions, and exposes the bundled skill path.

When package lifecycle scripts are enabled, installation also copies the index-tool skill to ~/.config/opencode/skills/index-tool via scripts/postinstall.mjs. At runtime, the plugin copies the skill according to where the plugin was configured: project config uses .opencode/skills/index-tool, while global config uses ~/.config/opencode/skills/index-tool.

Manual install fallback

If you prefer manual install from this repository:

powershell -ExecutionPolicy Bypass -File .\scripts\install.ps1

The installer copies the plugin to ~/.config/opencode/plugins/embedding-cache-plugin, installs global commands in ~/.config/opencode/commands/, and installs index-tool in ~/.agents/skills/index-tool.

What it does

  • Scans project files while respecting .gitignore.
  • Filters binaries, sensitive files, and large files.
  • Generates embeddings with Google (gemini-embedding-002).
  • Keeps vectors in memory during the session.
  • Persists project index data locally.

In TUI, command menu entries are also available:

  • Embedding status
  • Embedding test

Files created automatically in the target project:

  • .index/.gitignore
  • .index/indexing.config.json
  • .index/openindex.install.json
  • .index/state.json
  • .index/manifest.json
  • .index/vectors/**/*.json (per-file shards)

Do not commit .index/. The plugin creates .index/.gitignore with * to keep config, state, and vector shards out of Git. Vector shards contain code chunk text and embeddings for local retrieval.

Installation detection:

  • if the plugin server/TUI loads, the plugin itself is installed and active.
  • .index/openindex.install.json records per-project bootstrap status.
  • .index/indexing.config.json controls indexing behavior.
  • commands are injected into OpenCode config by the plugin server: /embedding, /embedding-status, /embedding-test, /embedding-setup.
  • the native tool index_search is registered by the plugin server.
  • the bundled skill is exposed from the plugin package and copied to .opencode/skills/index-tool for project-scoped plugin configs or ~/.config/opencode/skills/index-tool for global plugin configs.
  • API-key readiness is detected in this order: environment variable, googleApiKeyFile, then googleApiKey.

If the plugin is installed but no key is configured, auto-indexing is skipped and OpenIndex logs/shows:

OpenIndex installed. Set GOOGLE_API_KEY or run /embedding-setup.

Indexer logs:

  • ~/.local/share/opencode/log/embedding-indexer.log
  • optional override: OPENCODE_INDEXER_LOG_FILE

Optional per-project config

To customize behavior, create .index/indexing.config.json in the project. On first use, the plugin auto-creates this file with a small editable baseline. If parsing fails or fields are missing, internal defaults are used as fallback.

Optional fields for auto-indexing and telemetry:

{
  "respectGitIgnore": true,
  "autoIndexOnStartup": false,
  "autoIndexOnChange": true,
  "autoIndexDebounceMs": 1500,
  "googleModel": "gemini-embedding-002",
  "googleApiKeyEnv": "GOOGLE_API_KEY",
  "googleApiKeyFile": "~/.config/opencode/openindex/google_api_key",
  "googleEmbeddingCostPer1MInputTokensUsd": 0,
  "googleEmbeddingMode": "sync",
  "googleEmbedBatchSize": 16,
  "googleBatchPollIntervalMs": 5000,
  "googleBatchTimeoutMs": 1800000,
  "googleApiMinIntervalMs": 200,
  "debug": {
    "enabled": false,
    "level": "warn",
    "logPerformance": false,
    "logApiCalls": false,
    "logCosts": false
  }
}

respectGitIgnore is enabled by default and skips files ignored by the project's .gitignore.

With debug enabled, ~/.local/share/opencode/log/embedding-indexer.log records metrics such as:

  • cache load time
  • total indexing time and stage breakdown
  • embedding API calls (start/completion/failure)
  • estimated/reported input tokens
  • estimated cost (when googleEmbeddingCostPer1MInputTokensUsd > 0)
  • returned context size in index_search

Rate-limit and cost controls:

  • googleEmbedBatchSize: sends multiple chunks per embedding call (fewer requests).
  • googleEmbeddingMode: batch uses the Google Batch API for document indexing; sync uses direct embedContent.
  • googleBatchPollIntervalMs / googleBatchTimeoutMs: polling controls for asynchronous Batch API jobs.
  • googleApiMinIntervalMs: minimum delay between embedding calls (helps with 429).
  • Retry with exponential backoff + jitter for 429, 5xx, and timeouts.