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

mnemebrain

v0.1.0-alpha.1

Published

TypeScript SDK for MnemeBrain — Give your AI a real brain. Agents today store text. Mnemebrain stores beliefs — with evidence, confidence, provenance, and revision logic.

Readme

mnemebrain

TypeScript SDK for MnemeBrain — belief-based memory for AI agents.

CI npm License: MIT

Agents today store text. MnemeBrain stores beliefs — with evidence, confidence, provenance, and revision logic built on Belnap four-valued logic.

Install

npm install mnemebrain

Requires Node.js >= 18.

Quick Start

import { Brain } from "mnemebrain";

const brain = new Brain("my-agent", process.env.MNEMEBRAIN_URL ?? "http://localhost:8000");

// Store a belief with evidence
const belief = await brain.believe("User prefers dark mode", ["They toggled it on twice"]);
console.log(belief.truthState); // "true"
console.log(belief.confidence); // 0.63

// Query beliefs
const result = await brain.ask("What are the user's UI preferences?");
console.log(result.retrievedBeliefs); // ranked by confidence + similarity

Core Concepts

| Concept | Description | |---------|-------------| | Belief | A claim with a truth state (TRUE, FALSE, BOTH, NEITHER) | | Evidence | Append-only supporting/attacking evidence with weight and decay | | Confidence | Computed from evidence weights, decays over time | | Working Memory | Scoped frames for multi-step reasoning | | Sandbox | Isolated what-if environments for speculative reasoning |

API

Brain (High-Level)

import { Brain } from "mnemebrain";
const brain = new Brain("my-agent", "http://localhost:8000");

await brain.believe(claim, ["evidence string"]);
const result = await brain.ask(query);
// result.retrievedBeliefs: Array<{ claim, confidence, similarity }>

MnemeBrainClient (Full API)

import { MnemeBrainClient, EvidenceInput, Polarity } from "mnemebrain";

const client = new MnemeBrainClient("http://localhost:8000");

// Health check
await client.health();

// Belief operations
await client.believe("claim", [
  new EvidenceInput({ content: "source", polarity: Polarity.SUPPORTS }),
]);
await client.search("query");
await client.explain("claim");
await client.retract(evidenceId);
await client.revise(beliefId, [new EvidenceInput({ content: "new info" })]);

// Working memory frames
const frame = await client.frameOpen("agent-1");
await client.frameAdd(frame.frameId, "claim-1");
const ctx = await client.frameContext(frame.frameId);
await client.frameCommit(frame.frameId);
await client.frameClose(frame.frameId);

// List & filter beliefs
await client.listBeliefs({ truthState: "TRUE", minConfidence: 0.5 });

V4 Sub-Clients

// Sandboxes — isolated what-if reasoning
const sandbox = await client.sandbox.fork("experiment-1");
await client.sandbox.assume(sandbox.sandboxId, "hypothesis");
const diff = await client.sandbox.diff(sandbox.sandboxId);
await client.sandbox.commit(sandbox.sandboxId);

// Revision — policy-driven belief updates
await client.revision.setPolicy({ maxRevisionsPerHour: 10 });
await client.revision.revise(beliefId, { evidenceItems: [...] });

// Attacks — structured argumentation
await client.attacks.create({ sourceId, targetId, attackType: "REBUTS" });

// Goals & Policies
await client.goals.create({ description: "Learn user preferences" });
await client.policies.create({ name: "privacy", rules: [...] });

Running the Backend

cd backend
uv sync --extra dev
uv run python -m mnemebrain
# Server starts at http://localhost:8000

Development

npm install
npm run build        # Compile TypeScript
npm test             # Unit tests
npm run typecheck    # Type checking
npm run test:coverage # Coverage (100% enforced)

# Integration/E2E (requires running backend)
npm run test:integration
npm run test:e2e

See CONTRIBUTING.md for full details.

License

MIT