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

hivemind-pg

v0.8.7

Published

Shared memory for AI coding agents — SQLite (solo) + PostgreSQL (team) backend

Readme

📦 Package: hivemind-pg on npm — the self-hosted alternative to @deeplake/hivemind (Deeplake Cloud).

Same agent integrations, same Skillify engine, same recall — only the storage layer changed. Use @deeplake/hivemind if you want cloud-managed storage; use hivemind-pg if you want your data on your own PostgreSQL or SQLite.

One engineer's agent figures out a tricky migration on Monday.

Tuesday, every agent on the team can execute the pattern.

On LoCoMo, the public long-context memory benchmark, Hivemind is 25% cheaper, 1.7× fewer tokens, and 31% fewer turns than running without shared memory.

Beyond memory. Hivemind doesn't just remember. It mines your team's traces for repeated patterns and codifies them into reusable skills that propagate back into every agent on the team.

  • 📥 Captures every session's prompts, tool calls, and responses as structured traces in your local database
  • 🧠 Codifies patterns into reusable SKILL.md files, available to every agent on your team
  • 🔍 Searches traces and skills with hybrid lexical + semantic retrieval (BM25 fallback when embeddings off)
  • 🔗 Propagates capability across sessions, agents, teammates, and machines in real time
  • 📁 Intercepts file operations on ~/.hivemind-local/memory/ through a virtual filesystem backed by SQL
  • 📝 Summarizes sessions into AI-generated wiki pages via a background worker at session end
  • 🔒 Isolates org data with PostgreSQL Row-Level Security (RLS) — your data never leaves your infrastructure

What's Different from Deeplake Cloud Hivemind

| | @deeplake/hivemind | hivemind-pg | |---|---|---| | npm package | @deeplake/hivemind | hivemind-pg | | Login | Device Flow + account | Zero login (SQLite) / env vars (PostgreSQL) | | Data | Activeloop servers | Your machine / your PostgreSQL | | Offline | Must be online | Fully offline | | Latency | 50–200ms | <5ms (SQLite) / local network (PG) | | Cost | Billed per usage | Free | | Team sharing | Built-in org/workspace | PostgreSQL backend with RLS | | Skill review | Planned | Built-in (draft → active flow) |

What's the same? Hooks, Skillify mining, recall, goals, rules, VFS, codebase graph, proactive recall, embeddings — only the storage layer changed.

Quick start

Solo developer (SQLite — zero config)

npm install -g hivemind-pg
hivemind-pg install

That's it. Your first coding session will automatically capture patterns and build a local memory database at ~/.hivemind-local/hivemind.db.

Team (PostgreSQL)

npm install -g hivemind-pg

# Set up PostgreSQL connection
export HIVEMIND_BACKEND=postgres
export HIVEMIND_DATABASE_URL="postgresql://user:pass@host:5432/hivemind"
export HIVEMIND_ORG_ID=my-team
hivemind-pg install

See the Configuration section below for Docker / Supabase / Neon setup instructions.

Install for a specific assistant only:

hivemind-pg install --only claude
hivemind-pg claude install    # equivalent
hivemind-pg codex install
hivemind-pg cursor install
hivemind-pg hermes install
hivemind-pg pi install

Check what's wired up:

hivemind-pg status

Supported assistants:

| Platform | Integration | Auto-capture | Auto-recall | |------------------|--------------------------------------------------|--------------|-------------| | Claude Code | Marketplace plugin | ✅ | ✅ | | OpenClaw | Native extension | ✅ | ✅ | | Codex | Hooks (hooks.json) | ✅ | ✅ | | Cursor | Hooks (hooks.json 1.7+) | ✅ | ✅ | | Hermes Agent | Shell hooks + skill + MCP server | ✅ | ✅ | | pi | Extension API + skill + AGENTS.md | ✅ | ✅ |

Uninstall

hivemind-pg uninstall              # remove from every detected assistant
hivemind-pg codex uninstall        # remove from one

How it works

Capture → Codify → Propagate → Compound. Every coding-agent interaction is captured as a structured trace in your local SQLite or PostgreSQL database. A background worker mines traces for repeated patterns and codifies them into SKILL.md files. Codified skills propagate into every connected agent's context at inference time.

Alice codes → capture → stored in shared DB
                                ↓
Bob codes → recall → sees Alice's patterns → avoids same mistakes
                                ↓
Skillify mines Alice's session → creates a skill
                                ↓
Auto-pull gives Bob the skill → Bob's agent auto-uses it
                                ↓
CTO writes a coding rule → all agents auto-follow

Features

🔍 Natural search

Just ask your agent naturally:

"What was Emanuele working on?"
"Search traces for authentication bugs we've solved"
"What did we decide about the API design?"
"Show me skills my team has codified for handling migrations"

🔒 Privacy controls

Disable capture entirely:

HIVEMIND_CAPTURE=false claude

Disable capture for a specific directory tree by dropping a .hivemind file with { "collect": false }.

Enable debug logging:

HIVEMIND_DEBUG=1 claude

🛡️ Row-Level Security (PostgreSQL)

When using PostgreSQL, RLS is enabled by default. Each org can only see its own data — enforced at the database level. Even if two orgs share the same database, they cannot read each other's memory.

⚠️ Important: RLS does not apply to PostgreSQL superusers. Create a non-superuser app user for hivemind-pg connections.

✅ Skill Approval Flow

When skillApprovalFlow is enabled, newly mined skills start as draft and require approval before teammates can see them:

export HIVEMIND_SKILL_APPROVAL_FLOW=true
hivemind-pg install

hivemind-pg skillify list --status draft     # see pending skills
hivemind-pg skillify approve my-skill        # approve → now everyone sees it
hivemind-pg skillify reject bad-skill        # reject → removed

🔄 Optimistic Locking (PostgreSQL)

For teams: concurrent edits to the same skill or rule use compare-and-swap on the version column. On conflict, the second writer gets a clear error message instead of silently overwriting.

⚠️ Data collection notice

This plugin captures session activity and stores it locally in your SQLite or PostgreSQL database:

| Data | What's captured | |-----------------------|------------------------------------| | User prompts | Every message you send | | Tool calls | Tool name + full input | | Tool responses | Full tool output | | Assistant responses | The agent's final response | | Subagent activity | Subagent tool calls and responses | | Codified skills | Patterns extracted from traces |

Your data stays on your machine. No cloud, no telemetry, no external API calls for storage.

Configuration

Environment Variables

| Variable | Default | Description | |---|---|---| | HIVEMIND_BACKEND | sqlite | sqlite, postgres, or deeplake | | HIVEMIND_SQLITE_PATH | ~/.hivemind-local/hivemind.db | SQLite database path | | HIVEMIND_DATABASE_URL | — | PostgreSQL connection string | | HIVEMIND_ORG_ID | — | Org identifier for multi-tenant | | HIVEMIND_WORKSPACE_ID | default | Workspace within the org | | HIVEMIND_ENABLE_RLS | true (postgres) | Enable Row-Level Security | | HIVEMIND_SKILL_APPROVAL_FLOW | false | Require approval for new skills | | HIVEMIND_TOKEN | — | API token (only for deeplake backend) | | HIVEMIND_API_URL | https://api.deeplake.ai | API endpoint (only for deeplake backend) | | HIVEMIND_CAPTURE | true | Set to false to disable capture | | HIVEMIND_MEMORY_PATH | ~/.hivemind-local/memory | Path that triggers interception | | HIVEMIND_EMBEDDINGS | true | Set to false to force lexical-only mode | | HIVEMIND_PROACTIVE_RECALL_DISABLED | — | Set to 1 to disable proactive recall | | HIVEMIND_DEBUG | — | Set to 1 for verbose hook debug logs |

.hivemind File (per-directory)

Drop a .hivemind JSON file at the root of a project to override settings:

{
  "orgId": "my-team",
  "workspaceId": "project-alpha",
  "collect": true
}

| Field | Effect | |---|---| | orgId | Route this tree to this org — captured traces and memory reads | | workspaceId | Route to this workspace | | collect | falsenever capture traces from this tree |

An HIVEMIND_ORG_ID / HIVEMIND_WORKSPACE_ID in your environment wins over a .hivemind file.

CLI Commands

hivemind-pg install                    # set up hooks for your agent
hivemind-pg status                     # show what's wired up
hivemind-pg skillify status            # show mining scope, team, tracked projects
hivemind-pg skillify scope <me|team>   # set mining scope
hivemind-pg skillify pull              # fetch skills from shared DB
hivemind-pg skillify push <name>       # push a local skill to shared DB
hivemind-pg skillify list [--status draft]  # list skills
hivemind-pg skillify approve <name>    # approve a draft skill
hivemind-pg skillify reject <name>     # reject a draft skill
hivemind-pg workspace list             # list workspaces (postgres)
hivemind-pg workspace create <name>    # create a workspace
hivemind-pg workspace switch <name>    # switch current workspace
hivemind-pg rules add "rule text"      # add a team rule
hivemind-pg rules list                 # list active rules
hivemind-pg goal add "objective"       # add a goal
hivemind-pg goal list [--all|--mine]   # list goals

Semantic search (optional)

Hivemind ships with a local embedding daemon (nomic-embed-text-v1.5) for hybrid semantic + lexical search. Off by default (~600 MB dependency footprint). Enable with hivemind-pg embeddings install. Without it, search degrades silently to BM25/lexical-only.

For PostgreSQL, install the pgvector extension for native vector similarity search. Without it, vector search falls back to brute-force.

Proactive recall

On a recall-worthy prompt, Hivemind automatically searches team summaries and injects a relevant snippet into the agent's context — so prior work shows up unprompted.

On by default. Disable with HIVEMIND_PROACTIVE_RECALL_DISABLED=1.

Skills (skillify)

Hivemind codifies recurring patterns from your team's recent sessions into reusable skills that propagate to every agent on your team, automatically.

hivemind-pg skillify                            # show current scope, team, per-project state
hivemind-pg skillify scope <me|team>            # who counts as "in scope" for mining
hivemind-pg skillify pull                       # install teammates' skills locally

Rules (cross-agent team principles)

Hivemind shares team rules across every agent in the org, injected at SessionStart.

hivemind-pg rules add "no DROP TABLE on prod creds"
hivemind-pg rules list                          # latest 10 active
hivemind-pg rules edit <rule-id> "<new text>"   # bumps version
hivemind-pg rules done <rule-id>                # mark closed

Goals + KPIs

Personal / team objectives + measurable targets live in the virtual filesystem under ~/.hivemind-local/memory/goal/ and ~/.hivemind-local/memory/kpi/.

hivemind-pg goal add "ship the search bar"
hivemind-pg goal list [--all|--mine]
hivemind-pg goal done <goal_id>

Architecture

                    ┌─────────────────────────┐
                    │    StorageBackend        │
                    │  (src/storage/backend.ts)│
                    └──────┬──────────┬───────┘
                           │          │
               ┌───────────┤          ├───────────┐
               ▼           ▼          ▼           ▼
        SqliteBackend  PostgresBackend  DeeplakeBackend
        (default)      (team/RLS)      (backward compat)
               │           │
               ▼           ▼
         ~/.hivemind-   PostgreSQL +
         local/         pgvector +
         hivemind.db    RLS policies
  • SqliteBackend — zero config, single user, WAL mode, <5ms latency
  • PostgresBackend — multi-tenant, RLS org isolation, pgvector, optimistic locking
  • DeeplakeBackend — adapter for backward compatibility with @deeplake/hivemind
  • Factory (createBackend()) — auto-selects by config, auto-injects RLS context

Per-agent integration mechanisms: docs/ARCHITECTURE.md.

Security & storage

Local-first

  • No cloud. All data stored in SQLite (local) or your own PostgreSQL server
  • No telemetry. No external API calls for storage or analytics
  • No account required. SQLite backend works with zero login
  • TLS between agents and PostgreSQL (if configured)
  • RLS enforces org isolation at the database level

Code-level controls

  • SQL values escaped with sqlStr(), sqlLike(), sqlIdent()
  • ~70 allowlisted builtins run in the virtual FS; unrecognized commands are denied
  • Credentials stored with mode 0600, config dir with mode 0700

Backward compatibility

The deeplake backend preserves full compatibility with the original @deeplake/hivemind cloud service. Set HIVEMIND_BACKEND=deeplake; HIVEMIND_TOKEN=<your-token> to use it.

Development

git clone https://github.com/mingfeiqiao/hivemind.git
cd hivemind
npm install
npm run build     # tsc + esbuild
npm test          # vitest

Test locally with Claude Code:

claude --plugin-dir claude-code

License

Apache License 2.0, © Activeloop, Inc. See LICENSE for details.

Fork maintained by mingfeiqiao. Upstream: activeloopai/hivemind.