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

@mnemoscope/core

v0.2.0

Published

Core memory observability primitives for Mnemoscope: rot scoring, tiering, signed journal.

Readme

@mnemoscope/core

Core memory observability primitives for Mnemoscope — predictive context-rot scoring, working/episodic/semantic tiering, and an append-only Ed25519-signed hash-chained journal of agent operations on a Markdown vault. 100% local, no runtime dependencies, Node ≥ 22.

This package is the engine the MCP server, the CLI binaries, and the Obsidian plugin all sit on top of. Use it directly if you are integrating Mnemoscope into a custom client.

Install

npm install @mnemoscope/core

Usage

Score a vault before injection

import { extractSignature, computeRotScore } from "@mnemoscope/core";

const sig = await extractSignature("/path/to/vault");
const result = computeRotScore(sig);

console.log(result.score);            // 0..100
console.log(result.dominantFactor);   // e.g. "tokenVolume"
console.log(result.factors);          // 5-factor breakdown
console.log(result.topRiskNotes);     // top 5 highest-risk notes

Tier a vault for compacted context

import { extractSignature, tierVault } from "@mnemoscope/core";

const sig = await extractSignature("/path/to/vault");
const tiers = tierVault(sig, { workingMaxAgeDays: 7, episodicMaxAgeDays: 90 });

// tiers.working   — fresh, inject in full
// tiers.episodic  — older but still relevant, inject summary
// tiers.semantic  — index only, retrieve on demand

Append signed journal entries

import { Journal } from "@mnemoscope/core";

const journal = await Journal.open("/path/to/vault/.mnemoscope/journal.jsonl", "session-id");

await journal.record("write", "/path/to/vault/notes/foo.md", undefined, "new content");

const verified = await journal.verifyAll();
//   { entry: …, valid: true } | { entry: …, valid: false, reason: "signature mismatch" | "chain break: …" | "signed by unknown key …" }

The journal opens (or creates) a per-vault Ed25519 keypair at <vault>/.mnemoscope/keys/ed25519.{key,pub} with the private key chmoded 0600. Each entry's prevHash is the SHA-256 of the previous entry's signature, so field tampering, deletion, and reordering are all detectable.

Encrypted off-vault key escrow

import { backupPrivateKey, restorePrivateKey } from "@mnemoscope/core";

await backupPrivateKey("/vault/.mnemoscope/keys/ed25519.key", "/safe/backup.enc.json", passphrase);
await restorePrivateKey("/safe/backup.enc.json", "/vault/.mnemoscope/keys/ed25519.key", passphrase);

scrypt (N=2¹⁵, r=8, p=1) + AES-256-GCM, self-describing JSON envelope, no external dependencies. Lose the passphrase and the backup is unrecoverable. Full threat model in docs/key-escrow.md.

OpenTimestamps anchoring

import { digestForEntrySig, requestCalendarTimestamp, composeOtsFile } from "@mnemoscope/core";

const digest = digestForEntrySig(entry.sig);
const body   = await requestCalendarTimestamp({ digest, calendarUrl: "https://alice.btc.calendar.opentimestamps.org" });
const ots    = composeOtsFile(digest, body);
// write `ots` to <vault>/.mnemoscope/timestamps/<sigHashHex>.ots

Pending proofs become Bitcoin-anchored once the calendar's commitment lands in a block (~1 hour). Upgrade and verify with the upstream opentimestamps-client. Full flow in docs/timestamping.md.

Exported API

| Export | Purpose | |---|---| | extractSignature(rootPath) | Walk a Markdown vault, return its 5-factor structural signature | | computeRotScore(sig) | Predictive context-rot risk score (v0 heuristic baseline) | | tokenVolumeFactor, semanticRedundancyFactor, … | Individual factor functions, each citation-backed in source | | tierVault(sig, opts) | Working / episodic / semantic split | | Journal | Append-only Ed25519-signed, hash-chained journal | | backupPrivateKey, restorePrivateKey | Encrypted off-vault key escrow | | digestForEntrySig, requestCalendarTimestamp, composeOtsFile, parseOtsFile, verifyOtsHeaderForDigest | OpenTimestamps anchoring of journal entries |

See the package source for the full type declarations and per-function citations.

License

Apache-2.0 — explicit patent grant.