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

@xache/langchain

v0.7.0

Published

LangChain.js integration for Xache Protocol - verifiable AI agent memory

Readme

@xache/langchain

LangChain.js integration for Xache Protocol - verifiable AI agent memory with cryptographic receipts, collective intelligence, ephemeral working memory, knowledge graph, and portable ERC-8004 reputation.

Installation

npm install @xache/langchain @langchain/core langchain

Quick Start

One-Line Memory Replacement

// Before (standard LangChain)
import { BufferMemory } from 'langchain/memory';
const memory = new BufferMemory();

// After (with Xache - one line change!)
import { XacheMemory } from '@xache/langchain';
const memory = new XacheMemory({
  walletAddress: '0x...',
  privateKey: '0x...',
});

// Everything else stays the same
const chain = new ConversationChain({ llm, memory });

Features

Memory Storage

Persistent memory that survives across sessions with cryptographic receipts:

import { XacheMemory } from '@xache/langchain';

const memory = new XacheMemory({
  walletAddress: '0xYourWallet',
  privateKey: '0xYourPrivateKey',
  apiUrl: 'https://api.xache.xyz',
  chain: 'base',
});

Retrieval (RAG)

Semantic search for retrieval-augmented generation:

import { XacheRetriever } from '@xache/langchain';
import { RetrievalQAChain } from 'langchain/chains';

const retriever = new XacheRetriever({
  walletAddress: '0x...',
  privateKey: '0x...',
  k: 5,
});

const qa = RetrievalQAChain.fromLLM(llm, retriever);

Collective Intelligence

import {
  createCollectiveContributeTool,
  createCollectiveQueryTool,
} from '@xache/langchain';

const contributeTool = createCollectiveContributeTool({
  walletAddress: '0x...',
  privateKey: '0x...',
});

const queryTool = createCollectiveQueryTool({
  walletAddress: '0x...',
  privateKey: '0x...',
});

Memory Extraction

import { XacheExtractor } from '@xache/langchain';

const extractor = new XacheExtractor({
  walletAddress: '0x...',
  privateKey: '0x...',
  mode: 'xache-managed',
});

const result = await extractor.extract(
  'User asked about quantum computing...',
  { autoStore: true }
);

Knowledge Graph

Build and query a privacy-preserving knowledge graph:

import {
  createGraphExtractTool,
  createGraphQueryTool,
  createGraphAskTool,
  createGraphLoadTool,
  createGraphAddEntityTool,
  createGraphAddRelationshipTool,
  createGraphMergeEntitiesTool,
  createGraphEntityHistoryTool,
  XacheGraphRetriever,
} from '@xache/langchain';

const config = {
  walletAddress: '0x...',
  privateKey: '0x...',
  llmProvider: 'anthropic',
  llmApiKey: 'sk-ant-...',
};

const extractTool = createGraphExtractTool(config);
const queryTool = createGraphQueryTool(config);
const askTool = createGraphAskTool(config);
const loadTool = createGraphLoadTool(config);

// Use graph as a retriever for RAG
const graphRetriever = new XacheGraphRetriever({
  walletAddress: '0x...',
  privateKey: '0x...',
  k: 10,
});

Ephemeral Context (Working Memory)

Short-lived scratch sessions for multi-turn workflows with 6 named slots (conversation, facts, tasks, cache, scratch, handoff):

import {
  createEphemeralCreateSessionTool,
  createEphemeralWriteSlotTool,
  createEphemeralReadSlotTool,
  createEphemeralPromoteTool,
  createEphemeralStatusTool,
} from '@xache/langchain';

const config = {
  walletAddress: '0x...',
  privateKey: '0x...',
};

// Create tools for your agent
const createSessionTool = createEphemeralCreateSessionTool(config);
const writeSlotTool = createEphemeralWriteSlotTool(config);
const readSlotTool = createEphemeralReadSlotTool(config);
const promoteTool = createEphemeralPromoteTool(config);
const statusTool = createEphemeralStatusTool(config);

// Add to agent's toolkit
const tools = [createSessionTool, writeSlotTool, readSlotTool, promoteTool, statusTool];

Or use class-based wrappers:

import {
  XacheEphemeralCreateSessionTool,
  XacheEphemeralWriteSlotTool,
  XacheEphemeralReadSlotTool,
  XacheEphemeralPromoteTool,
  XacheEphemeralStatusTool,
} from '@xache/langchain';

const createSession = new XacheEphemeralCreateSessionTool(config);
const tool = createSession.asTool();

Reputation

import { createReputationTool, XacheReputationChecker } from '@xache/langchain';

const repTool = createReputationTool({
  walletAddress: '0x...',
  privateKey: '0x...',
});

const checker = new XacheReputationChecker({
  walletAddress: '0x...',
  privateKey: '0x...',
});

Chat History

import { XacheChatMessageHistory } from '@xache/langchain';
import { BufferMemory } from 'langchain/memory';

const history = new XacheChatMessageHistory({
  walletAddress: '0x...',
  privateKey: '0x...',
  sessionId: 'unique-session-id',
});

const memory = new BufferMemory({ chatHistory: history });

Pricing

All operations use x402 micropayments (auto-handled):

| Operation | Price | |-----------|-------| | Memory Store | $0.002 | | Memory Retrieve | $0.003 | | Collective Contribute | $0.002 | | Collective Query | $0.011 | | Ephemeral Session | $0.005 | | Ephemeral Promote | $0.05 | | Extraction (managed) | $0.011 | | Graph Operations | $0.002 | | Graph Ask (managed) | $0.011 |

Resources

License

MIT