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

ai-vector-memories

v1.0.0

Published

AI Vector Memories is an open-source library that provides a powerful and efficient way to manage and utilize vector-based memories for AI applications. It offers a simple API for storing, retrieving, and manipulating high-dimensional vector representatio

Downloads

210

Readme

AI Vector Memories for OpenCode

Persistent memory plugin for OpenCode with SQLite + RuVector retrieval and cognitive memory management.

Why This Project Exists

AI coding sessions lose context quickly. This plugin stores reusable knowledge from conversations so the assistant can remember:

  • User preferences
  • Project decisions
  • Long-lived constraints
  • High-signal semantic facts

The goal is practical continuity across sessions with low runtime overhead.

What You Get

  • Persistent memory with global and project scopes
  • Hybrid retrieval (Jaccard + optional embeddings)
  • Decision-aware reconsolidation (duplicate/conflict/complement)
  • Injection quotas and optional adaptive balancing
  • Optional compression under token pressure
  • Fail-open plugin behavior to avoid blocking host workflows

Quick Start

1. Install in OpenCode

Add the plugin name to your OpenCode config:

{
  "plugin": ["ai-vector-memories"],
}

Restart OpenCode.

2. Runtime Directory

On first run, the plugin creates:

  • ~/.ai-vector-memories/config.jsonc
  • ~/.ai-vector-memories/plugin-debug.log
  • SQLite database files (path controlled by config)

3. Local Development Setup

bun install
bun run typecheck
bun run build

Configuration

Default config file: ~/.ai-vector-memories/config.jsonc

{
  "injectionMode": 1,
  "subagentMode": 1,
  "embeddingsEnabled": 0,
  "maxMemories": 20,
}

Config Fields

  • injectionMode
    • 0: inject only at session start
    • 1: inject on every prompt
  • subagentMode
    • 0: disable injection in subagents
    • 1: enable injection in subagents
  • embeddingsEnabled
    • 0: Jaccard-only retrieval
    • 1: hybrid retrieval with embeddings
  • maxMemories
    • max items injected per prompt

Environment Variable Overrides

  • TRUE_MEM_INJECTION_MODE
  • TRUE_MEM_SUBAGENT_MODE
  • TRUE_MEM_EMBEDDINGS
  • TRUE_MEM_MAX_MEMORIES

Common Commands

  • bun run dev: watch and rebuild plugin bundle
  • bun run build: production build + type declarations + worker bundle
  • bun run typecheck: strict TypeScript validation
  • bun run metrics:injection: injection metrics snapshot
  • bun run metrics:report: baseline/current metrics report

Architecture at a Glance

  • src/index.ts: plugin bootstrap, hook registration, fail-open runtime behavior
  • src/adapters/opencode/: OpenCode integration and hook handling
  • src/memory/: classification, retrieval, reconsolidation, quotas, compression
  • src/extraction/: async extraction queue
  • src/storage/: SQLite access and persistence logic

Read the full architecture guide: docs/architecture.md.

For New Developers

Use this reading order:

  1. docs/index.md
  2. docs/project-overview.md
  3. docs/architecture.md
  4. docs/development-guide.md
  5. docs/source-tree-analysis.md

Troubleshooting

  • Plugin appears loaded but no memory injection:
    • Check ~/.ai-vector-memories/plugin-debug.log
    • Confirm injectionMode and maxMemories
  • Unexpected retrieval behavior:
    • Verify embeddingsEnabled and related model initialization
    • Inspect reconsolidation and scoring settings in config
  • Build issues:
    • Run bun install again
    • Run bun run typecheck and resolve reported errors first

Contributing

Contributions are welcome.

  • Keep TypeScript strictness intact
  • Preserve fail-open behavior in runtime hooks
  • Keep async heavy work out of transaction blocks
  • Prefer small, focused pull requests

References

  • AGENTS.md: repository conventions for coding agents
  • docs/index.md: complete documentation map
  • RuVector docs: https://github.com/ruvnet/RuVector/blob/main/docs/INDEX.md

License

MIT. See LICENSE.