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

mentedb

v0.3.1

Published

The mind database for AI agents

Readme

mentedb

The mind database for AI agents. TypeScript/Node.js SDK powered by napi-rs.

MenteDB is a purpose built database engine for AI agent memory. It provides vector similarity search, a typed knowledge graph, token budget aware context assembly, and cognitive features such as contradiction detection and trajectory tracking. This package delivers the full Rust engine as a native Node.js addon with zero runtime dependencies.

Install

npm install mentedb

The package ships a prebuilt native binary. If no prebuild is available for your platform, npm run build compiles from source (requires Rust and napi-rs).

Quick start

import { MenteDB, MemoryType, EdgeType } from 'mentedb';

const db = new MenteDB('./my-agent-memory');

// Store a memory
const id = db.store({
  content: 'The deploy key rotates every 90 days',
  memoryType: MemoryType.Semantic,
  embedding: embeddingFromYourModel,
  tags: ['infra', 'security'],
});

// Vector similarity search
const hits = db.search(queryEmbedding, 5);

// MQL recall with token budget
const ctx = db.recall('RECALL similar("deploy key rotation") LIMIT 10');

// Relate memories
db.relate(id, otherId, EdgeType.Supersedes);

// Forget a memory
db.forget(id);

// Close the database
db.close();

Cognitive features

CognitionStream

Monitor an LLM token stream for contradictions and reinforcements against stored facts.

import { CognitionStream } from 'mentedb';

const stream = new CognitionStream(1000);
for (const token of llmTokens) {
  stream.feedToken(token);
}
const text = stream.drainBuffer();

TrajectoryTracker

Track the reasoning arc of a conversation and predict upcoming topics.

import { TrajectoryTracker } from 'mentedb';

const tracker = new TrajectoryTracker();

tracker.recordTurn('JWT auth design', 'investigating', [
  'Which algorithm?',
  'Token lifetime?',
]);
tracker.recordTurn('Token lifetime', 'decided:15 minutes');

const resume = tracker.getResumeContext();
const next = tracker.predictNextTopics();

API reference

MenteDB

| Method | Description | |--------|-------------| | new MenteDB(dataDir) | Open or create a database at the given path. | | store(options) | Store a memory. Returns its UUID string. | | recall(query) | Recall memories via an MQL query. Returns RecallResult. | | search(embedding, k) | Vector similarity search. Returns SearchResult[]. | | relate(source, target, edgeType?, weight?) | Create a typed edge between two memories. | | forget(memoryId) | Remove a memory by ID. | | close() | Flush and close the database. |

CognitionStream

| Method | Description | |--------|-------------| | new CognitionStream(bufferSize?) | Create a token stream monitor. | | feedToken(token) | Push a token into the ring buffer. | | drainBuffer() | Drain and return the accumulated text. |

TrajectoryTracker

| Method | Description | |--------|-------------| | new TrajectoryTracker(maxTurns?) | Create a trajectory tracker. | | recordTurn(topic, decisionState, openQuestions?) | Record a conversation turn. | | getResumeContext() | Build a resume context string. | | predictNextTopics() | Predict the next likely topics. |

Types

enum MemoryType {
  Episodic, Semantic, Procedural, AntiPattern, Reasoning, Correction
}

enum EdgeType {
  Caused, Before, Related, Contradicts, Supports, Supersedes, Derived, PartOf
}

interface StoreOptions {
  content: string;
  memoryType?: MemoryType;
  embedding?: number[];
  agentId?: string;
  tags?: string[];
}

interface RecallResult {
  text: string;
  totalTokens: number;
  memoryCount: number;
}

interface SearchResult {
  id: string;
  score: number;
}

Building from source

cd sdks/typescript
cargo check          # verify Rust compiles
npm run build        # build the native addon
npm test             # run tests

License

Apache 2.0