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

@vectorize-io/opencode-hindsight

v0.1.4

Published

Hindsight memory plugin for OpenCode - Give your AI coding agent persistent long-term memory

Downloads

785

Readme

@vectorize-io/opencode-hindsight

Hindsight memory plugin for OpenCode — give your AI coding agent persistent long-term memory across sessions.

Features

  • Custom tools: hindsight_retain, hindsight_recall, hindsight_reflect — the agent calls these explicitly
  • Auto-retain: Captures conversation on session.idle and stores to Hindsight
  • Memory injection: Recalls relevant memories when a new session starts
  • Compaction hook: Injects memories during context compaction so they survive window trimming

Quick Start

1. Enable the plugin

Add to your opencode.json (project) or ~/.config/opencode/opencode.json (global):

{
  "$schema": "https://opencode.ai/config.json",
  "plugin": ["@vectorize-io/opencode-hindsight"]
}

OpenCode auto-installs plugins listed here on startup — no npm install required.

2. Point to your Hindsight server

# Self-hosted
export HINDSIGHT_API_URL="http://localhost:8888"

# Optional: override the memory bank ID
export HINDSIGHT_BANK_ID="my-project"

Using Hindsight Cloud

Get an API key at ui.hindsight.vectorize.io/connect, then either export env vars:

export HINDSIGHT_API_URL="https://api.hindsight.vectorize.io"
export HINDSIGHT_API_TOKEN="your-api-key"

Or configure inline in opencode.json:

{
  "$schema": "https://opencode.ai/config.json",
  "plugin": [
    [
      "@vectorize-io/opencode-hindsight",
      {
        "hindsightApiUrl": "https://api.hindsight.vectorize.io",
        "hindsightApiToken": "your-api-key"
      }
    ]
  ]
}

Configuration

Plugin Options

Pass options directly in opencode.json:

{
  "plugin": [
    [
      "@vectorize-io/opencode-hindsight",
      {
        "hindsightApiUrl": "http://localhost:8888",
        "bankId": "my-project",
        "autoRecall": true,
        "autoRetain": true,
        "recallBudget": "mid"
      }
    ]
  ]
}

Config File

Create ~/.hindsight/opencode.json for persistent configuration:

{
  "hindsightApiUrl": "http://localhost:8888",
  "hindsightApiToken": "your-api-key",
  "recallBudget": "mid",
  "retainEveryNTurns": 10,
  "debug": false
}

Environment Variables

| Variable | Description | Default | | ----------------------------- | ----------------------------------- | -------------- | | HINDSIGHT_API_URL | Hindsight API base URL | (required) | | HINDSIGHT_API_TOKEN | API key for authentication | (none) | | HINDSIGHT_BANK_ID | Static memory bank ID | opencode | | HINDSIGHT_AGENT_NAME | Agent name for dynamic bank IDs | opencode | | HINDSIGHT_AUTO_RECALL | Auto-recall on session start | true | | HINDSIGHT_AUTO_RETAIN | Auto-retain on session idle | true | | HINDSIGHT_RETAIN_MODE | full-session or last-turn | full-session | | HINDSIGHT_RECALL_BUDGET | Recall budget: low, mid, high | mid | | HINDSIGHT_RECALL_MAX_TOKENS | Max tokens for recall results | 1024 | | HINDSIGHT_DYNAMIC_BANK_ID | Enable dynamic bank ID derivation | false | | HINDSIGHT_BANK_MISSION | Bank mission/context | (none) | | HINDSIGHT_DEBUG | Enable debug logging | false |

Configuration Priority

Settings are loaded in this order (later wins):

  1. Built-in defaults
  2. ~/.hindsight/opencode.json
  3. Plugin options from opencode.json
  4. Environment variables

Tools

hindsight_retain

Store information in long-term memory. The agent uses this to save important facts, user preferences, project context, and decisions.

hindsight_recall

Search long-term memory. The agent uses this proactively before answering questions where prior context would help.

hindsight_reflect

Generate a synthesized answer from long-term memory. Unlike recall (raw memories), reflect produces a coherent summary.

Dynamic Bank IDs

For multi-project setups, enable dynamic bank ID derivation:

export HINDSIGHT_DYNAMIC_BANK_ID=true

The bank ID is composed from granularity fields (default: agent::project). Supported fields: agent, project, channel, user.

Note: The bank ID is derived once when the plugin loads, from environment variables set before OpenCode starts. These dimensions are process-scoped — they don't change per session within a running OpenCode process. For per-user isolation, set the env vars before launching each user's OpenCode instance:

export HINDSIGHT_CHANNEL_ID="slack-general"
export HINDSIGHT_USER_ID="user123"

Development

npm install
npm test        # Run tests
npm run build   # Build to dist/

License

MIT