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

@pensyve/langchain

v1.3.0

Published

Pensyve memory store for LangChain.js / LangGraph.js — BaseStore-compatible with semantic search

Readme

@pensyve/langchain

Persistent AI memory for LangChain.js / LangGraph.js agents via Pensyve. Two complementary features:

  1. Working-memory substrate — A system-prompt document (SUBSTRATE_PROMPT.md) that gives your LangGraph.js agent the reasoning discipline to recall before answering and capture lessons as they land.
  2. Memory store backendPensyveStore: a drop-in BaseStore-compatible backend backed by Pensyve's 8-signal fusion retrieval engine.

What It Does

The working-memory substrate is a reasoning layer — not a library — that you load into your agent's system prompt. Once loaded, the agent will:

  • Recall before substantive answers using pensyve_recall, scoped by entity.
  • Capture lessons in-flight using pensyve_observe when a root cause is confirmed, a decision lands, or an approach is abandoned.
  • Manage episode lifecycle lazily: open an episode on the first observe, reuse it throughout the conversation.
  • Surface memory lightly — one line per recall or capture, never narrating empty recalls.
  • Wrap up sessions by presenting memory candidates for user confirmation before storage.

Install

bun add @langchain/anthropic @langchain/langgraph @langchain/mcp-adapters

# Memory store backend (optional — separate from the substrate)
bun add @pensyve/langchain

Set your API key:

export PENSYVE_API_KEY="psy_your_key_here"
export ANTHROPIC_API_KEY="sk-ant-..."

Create an API key at pensyve.com/settings/api-keys.


Quick Start

cd integrations/langchain-ts
bun run examples/pensyve-agent.ts

The example connects a LangGraph.js ReAct agent to the Pensyve MCP server and loads SUBSTRATE_PROMPT.md as the system prompt.


System Prompt

SUBSTRATE_PROMPT.md consolidates all eight substrate rules into a single document. Load it into your agent:

import { readFileSync } from "node:fs";
import { join } from "node:path";
import { createReactAgent } from "@langchain/langgraph/prebuilt";

const substrate = readFileSync(join(__dirname, "SUBSTRATE_PROMPT.md"), "utf-8");
const agent = createReactAgent({ llm, tools, prompt: substrate });

MCP Connection

import { MultiServerMCPClient } from "@langchain/mcp-adapters";

const client = new MultiServerMCPClient({
  pensyve: {
    transport: "streamable_http",
    url: "https://mcp.pensyve.com/mcp",
    headers: { Authorization: `Bearer ${process.env.PENSYVE_API_KEY}` },
  },
});
const tools = await client.getTools();
// ... use agent, then:
await client.close();

Memory Behavior Model

| Trigger | Action | MCP call | |---|---|---| | Before substantive answer | Recall by entity | pensyve_recall(query, entity, types, limit=5) | | Root cause confirmed | Capture episodic | pensyve_observe(episode_id, content, source_entity="langchain-ts", about_entity) | | Decision accepted | Capture semantic | pensyve_remember(entity, fact, confidence=0.9) | | Reusable workflow found | Capture procedural | pensyve_observe(... content="[procedural] ...") | | Session ending | Present candidates | User confirms before storage |


Memory Types

  • Semantic — durable facts that remain true across sessions.
  • Episodic — what happened in this thread (outcomes, root causes, abandoned approaches).
  • Procedural — reusable workflows stored via pensyve_observe with a [procedural] prefix.

Opt-Out

To disable the substrate, remove SUBSTRATE_PROMPT.md from the agent's prompt argument. The PensyveStore backend is unaffected.


Links

License

Apache 2.0 — see LICENSE.