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

opencode-mem-agents

v0.3.2

Published

Self-contained memory plugin for OpenCode — cross-session persistence with SQLite + FTS5, signal-based capture, role-scoped context, and agent coordination

Downloads

61

Readme

opencode-mem-agents

Persistent local memory plugin for OpenCode with:

  • SQLite + FTS5 storage
  • Automatic tool-result capture
  • Team-scoped memory tools
  • Local dashboard UI
  • Request/response trace journal for observability

Runtime

  • Node.js >=18
  • Default worker: http://127.0.0.1:37778
  • Default DB: ~/.opencode-mem/opencode-mem.db

Install

npm install
npm run build

Development

npm run build
npm test

Worker API

  • GET /api/health
  • GET /api/search
  • GET /api/timeline (format=text|json)
  • POST /api/observations/batch (optional project filter enforced server-side)
  • POST /api/memory/save
  • POST /api/session/tool-result
  • GET /api/context/session
  • GET /api/activity
  • GET /api/traces

All JSON responses include traceId for request correlation.

Architecture

Worker internals are split for maintainability:

  • src/worker/server.ts - HTTP lifecycle, auth/CORS, routing dispatch
  • src/worker/routes.ts - request parsing + response shaping
  • src/worker/repository.ts - SQLite schema + query/write logic
  • src/worker/http.ts - transport helpers + boundary error handling
  • src/worker/config.ts - runtime config loading

Observability

/api/traces returns recent inbound/outbound/error events from the worker trace journal.

Trace payloads are:

  • redacted for sensitive keys (authorization, token, password, secret, apiKey, cookie)
  • redacted for common secret-like inline values in free text (Bearer ..., sk-..., AKIA...)
  • size-capped before persistence
  • pruned by age (OPENCODE_MEM_TRACE_RETENTION_DAYS, default 7)

Example:

curl "http://127.0.0.1:37778/api/traces?limit=50"

Security Controls

  • Optional API auth token:
    • set OPENCODE_MEM_API_TOKEN
    • send Authorization: Bearer <token> on /api/* (except health/readiness)
  • Dashboard auth for protected endpoints:
    • use the in-memory token button in the UI (Set Token)
    • or open with ?token=... or #token=... (token is stripped from URL on load)
    • token is never persisted to localStorage/sessionStorage
  • CORS defaults to localhost origins only
  • Optional explicit CORS origin override:
    • OPENCODE_MEM_CORS_ORIGIN=https://your-origin.example
  • 500 responses are intentionally generic (Internal server error) to avoid leaking internals

Reliability Controls

  • Buffered observations are persisted to process-scoped disk queues (pending-observations-<pid>.json)
  • Failed sends are retried from the persisted queue
  • Flush retries are bounded and delivery concurrency is capped
  • Tool-result writes are deduped using (sessionId, callId, tool) capture keys
  • Timeline queries resolve around the true anchor at scale (not bounded to a fixed first-window scan)
  • Context injection cache is scoped by (sessionId, workflowId, agent, phase) to prevent cross-session leakage

Build Artifacts

The dashboard is built from dashboard/ and embedded into src/dashboard-html.ts during npm run build.