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

@yamo/memory-mesh

v4.2.0

Published

Portable semantic memory system with Layer 0 Scrubber for YAMO agents (v3 Singularity Edition)

Readme

MemoryMesh (Singularity Edition)

Portable, semantic memory system for AI agents with automatic Layer 0 sanitization and Autonomous Kernel Integration.

Built on the YAMO Protocol for transparent agent collaboration with structured workflows and immutable provenance.

🌌 Singularity Edition Highlights

  • Intelligent Installer: Automatically detects OpenClaw workspaces and performs a full kernel upgrade.
  • YAMO Unified OS: Natively includes the complete Macro (Specification) and Micro (Execution) workflow suite.
  • Ghost Protection: Self-healing AGENTS.md injection to prevent narrative drift and maintain cognitive alignment.
  • Autonomous Bootstrap: Deploys BOOTSTRAP.yamo as the primary agent entry point for protocol-native execution.
  • Surgical Deployment: Intelligently skips global CLI clutter when working in project-specific modes.

Features

  • Persistent Vector Storage & Native FTS: Powered by LanceDB for semantic vector search and native Tantivy-based Full-Text Search (FTS) with BM25 scoring and in-memory TF-IDF fallback.
  • Situated Context / Contextual Retrieval: Automatically extracts and prepends document global context (from metadata or document structure/headings) to segments during chunking to maintain query attention on fragmented chunks.
  • Graph-RAG 2-Hop Traversal: Unified neighborhood search boosting that traverses 1-hop (1.15x boost) and 2-hop (1.07x boost) relation networks, capped at a 1.0 maximum score.
  • Decision Context Graph: Records decisions as a traversable lineage in a dedicated decision_edges table — typed supersedes/depends-on/justified-by/contradicts links between memories — so you can ask why a decision was made and what still depends on a reversed one. Outcomes feed back into retrieval ranking. Kept separate from the Graph-RAG boost graph.
  • LanceDB V2 Schema (Active): Top-level columns memory_type, importance_score, access_count, last_accessed, session_id, agent_id — populated on every write, queried server-side (WHERE clause) instead of full-table scans.
  • Layer 0 Scrubber: Automatically sanitizes, deduplicates, and cleans content before embedding.
  • Local Embeddings: Runs 100% locally using ONNX (no API keys required).
  • Portable CLI: Simple flag-based interface for any agent or language (tools/memory_mesh.mjs).
  • YAMO Skills Integration: Includes the Unified OS workflow system with automatic memory learning.
  • Pattern Recognition: Workflows automatically store and retrieve execution patterns for optimization.
  • LLM-Powered Reflections: Generate insights from memories using configurable LLM providers.
  • YAMO Audit Trail: Automatic emission of structured blocks for all memory operations.

Installation

npm install @yamo/memory-mesh

Usage

🚀 Singularity Setup (OpenClaw)

To upgrade your workspace to full fidelity:

npx memory-mesh-setup

The installer will:

  1. Configure your .env substrate.
  2. Deploy the BOOTSTRAP.yamo kernel entry point.
  3. Inject Ghost Protection into AGENTS.md.
  4. Deploy Native Kernel Modules to yamo-native-agent/.

CLI

The memory-mesh CLI provides twenty commands covering CRUD/recall, curated priming, lifecycle states, belief revision, history, portability, and health:

# Store a memory (automatically scrubbed & embedded)
memory-mesh store --content "My important memory" --type insight

# Store with full provenance metadata
memory-mesh store -c "Insight text" -t decision -r "Improves latency" -h "Caching reduces p95"

# Bulk-ingest a directory (recursive, by extension)
memory-mesh pull ./docs --extension ".md,.yamo" --type documentation

# Semantic search
memory-mesh search "query about orchestration" --limit 5

# Retrieve a specific record by ID
memory-mesh get --id mem_abc123

# Delete a record by ID
memory-mesh delete --id mem_abc123

# Synthesize insights from recent memories
memory-mesh reflect --topic "bugs" --lookback 10

# Database health and statistics
memory-mesh stats

# Curated recall: pinned memories verbatim + newly-due deferrals + contextual matches
memory-mesh prime "current task context"

# Lifecycle: pin, defer, supersede
memory-mesh pin mem_abc123
memory-mesh defer mem_abc123 2026-09-01
memory-mesh set-state mem_abc123 deprecated

# Portability: deterministic vector-free JSONL (git-committable), idempotent re-import
memory-mesh export backup.jsonl
memory-mesh import backup.jsonl

# Health: mechanical checks (exits nonzero on failure)
memory-mesh doctor

Command Reference:

Core CRUD & recall

| Command | Key Options | Description | |---------|-------------|-------------| | store (alias ingest) | -c/--content (required), -t/--type, -r/--rationale, -h/--hypothesis, -d/--document-context, -k/--key, --pin, --defer-until <date>, --depends-on/--justified-by/--contradicts <ids> | Persist a semantic memory (with optional belief-revision key and decision edges) | | pull | <path> (required), -e/--extension, -t/--type | Bulk-ingest a directory | | search | <query> (required), -l/--limit, -m/--mode (hybrid|vector|keyword), -f/--filter <sql> | Semantic recall with optional SQL filter on V2 columns | | get | -i/--id (required) | Fetch a record by ID | | delete | -i/--id (required) | Remove a record by ID (snapshot kept for restore) | | reflect | -t/--topic, -l/--lookback | Synthesize insights from memories | | stats | — | DB health, count, embedding model |

Curated recall & lifecycle

| Command | Key Options | Description | |---------|-------------|-------------| | prime | [query], -l/--limit | Emit pinned memories verbatim, newly-due deferred memories, and contextual matches (the bd prime analog) | | pin / unpin | <idOrKey> | Pin/unpin a memory (by id or stable metadata.key) so prime always surfaces it | | set-state | <id> <state> | Set lifecycle state: active | superseded | deprecated | archived | | defer | <id> [until], --clear | Suppress from recall until an ISO date, then resurface (bd defer analog) |

Belief revision & decision graph

| Command | Key Options | Description | |---------|-------------|-------------| | stale-beliefs | [id] | List memories still resting on refuted decisions (exits nonzero if any) | | orphans | — | List decision edges whose endpoints no longer resolve (exits nonzero if any) |

History & portability

| Command | Key Options | Description | |---------|-------------|-------------| | history | <id> | Append-only revision history for a memory or skill id | | restore | <id> | Restore a deleted memory from its revision snapshot | | export | <path> | Deterministic, vector-free JSONL export (git-committable) | | import | <path> | Import a JSONL export, re-embedding content locally (idempotent) |

Health

| Command | Key Options | Description | |---------|-------------|-------------| | doctor | — | Mechanical health checks (dangling edges, vector index, superseded-state drift, skill metadata); exits nonzero on failure | | stale | -d/--days (default 90), -l/--limit | List active memories untouched for N days (bd stale analog) |

Node.js API

import { MemoryMesh } from '@yamo/memory-mesh';

const mesh = new MemoryMesh();
await mesh.init();

// Store memory with explicit document context (Situated Context)
await mesh.add('The database handle must be refreshed during IO error retries.', {
  type: 'insight',
  documentContext: 'LanceDB integration hardening for stability'
});

// Search can utilize 'hybrid' (combining semantic and native FTS keyword search), 'vector', or 'keyword' modes
const results = await mesh.search('database handle retry', {
  limit: 5,
  mode: 'hybrid' // supports 'vector' | 'keyword' | 'hybrid'
});

Enhanced Reflections with LLM

MemoryMesh supports LLM-powered reflection generation that synthesizes insights from stored memories:

import { MemoryMesh } from '@yamo/memory-mesh';

// Enable LLM integration (requires API key or local model)
const mesh = new MemoryMesh({
  enableLLM: true,
  llmProvider: 'openai',  // or 'anthropic', 'ollama'
  llmApiKey: process.env.OPENAI_API_KEY,
  llmModel: 'gpt-4o-mini'
});

// Store some memories
await mesh.add('Bug: type mismatch in keyword search', { type: 'bug' });
await mesh.add('Bug: missing content field', { type: 'bug' });

// Generate reflection (automatically stores result to memory)
const reflection = await mesh.reflect({ topic: 'bugs', lookback: 10 });

console.log(reflection.reflection);
// Output: "Synthesized from 2 memories: Bug: type mismatch..., Bug: missing content..."

console.log(reflection.confidence);  // 0.85
console.log(reflection.yamoBlock);    // YAMO audit trail

CLI Usage:

# With LLM (default)
memory-mesh reflect '{"topic": "bugs", "limit": 10}'

# Without LLM (prompt-only for external LLM)
memory-mesh reflect '{"topic": "bugs", "llm": false}'

YAMO Audit Trail

MemoryMesh automatically emits YAMO blocks for all operations when enabled:

const mesh = new MemoryMesh({ enableYamo: true });

// All operations now emit YAMO blocks
await mesh.add('Memory content', { type: 'event' });      // emits 'retain' block
await mesh.search('query');                                 // emits 'recall' block
await mesh.reflect({ topic: 'test' });                      // emits 'reflect' block

// Query YAMO log
const yamoLog = await mesh.getYamoLog({ operationType: 'reflect', limit: 10 });
console.log(yamoLog);
// [{ id, agentId, operationType, yamoText, timestamp, ... }]

Decision Context Graph

Decisions can be wired into a traversable lineage graph, distinct from the Graph-RAG boost graph. Edges live in their own decision_edges table and use a controlled vocabulary; source_id is always the newer memory, target_id always pre-exists.

| Relation | Meaning | Source | |----------|---------|--------| | supersedes | the new decision replaces the target | emitted automatically from belief revision (replaces_memory_id / key) | | depends-on | the new decision rests on a still-active target | metadata.depends_on | | justified-by | the new decision is grounded in the target evidence | metadata.justified_by | | contradicts | the new decision conflicts with a retained target | metadata.contradicts |

const mesh = new MemoryMesh();

const base = await mesh.add('Use Postgres as the primary store', { type: 'decision' });

// A decision that depends on / is justified by other memories.
const wal = await mesh.add('Enable WAL journal mode', {
  type: 'decision',
  reasoning: 'concurrent reads during writes',
  depends_on: [base.id],          // string | string[]
});

// Lineage traversal (BFS over decision_edges, not the RAG boost graph):
await mesh.decisionLineage(wal.id, { direction: 'ancestors' });
//   what this decision supersedes / depends on / is justified by

await mesh.decisionLineage(base.id, { direction: 'dependents' });
//   "base was reversed — what still-active decisions rested on it?"

await mesh.decisionLineage(base.id, { direction: 'dependents', relations: ['supersedes'], maxHops: 3 });

// Close the feedback loop — resets importance_score by outcome
// (validated 0.9 / mixed 0.5 / refuted 0.2) so ranking reflects whether it worked.
await mesh.recordOutcome(base.id, { status: 'refuted', note: 'switched to local-first' });

Edges are written fire-and-forget and only for decision writes (gated), so non-decision add() calls pay nothing. Duplicate (target, relation) pairs within a single write are collapsed.

CLI Usage:

# Create decision edges at store time (comma-separated memory IDs)
memory-mesh store -c "Enable WAL journal mode" -t decision \
  --depends-on "mem_abc,mem_def" --justified-by "mem_ghi"

Read-time grounding — the [UNGROUNDED] fence

Derived memories — consolidation, reflection, RAPTOR summary_l* levels and lesson — are claims synthesized from other memories. When every memory a derived row was built on has since been superseded, archived, deferred or deleted, the claim has nothing left standing under it. Rather than persisting truth-maintenance state, search() computes grounding at read time:

  1. For each derived hit, the cited sources are collected — depends-on / justified-by edges in decision_edges first (the LLM-cited premises), then metadata.cited_ids, metadata.source_memory_ids (what reflect() / raptor() write) and finally metadata.source_ids (batch membership — a noisy signal, kept as the last resort).
  2. The sources that currently pass the active-state clause are counted and attached as grounding_live / grounding_total on the result.
  3. A derived row with cited sources but zero live ones gets ungrounded: true, its score is multiplied by UNGROUNDED_SCORE_FACTOR (default 0.25) and it sinks in the ranking; formatResults() marks it [UNGROUNDED], wraps it in [UNGROUNDED BEGIN/END] and adds a directive telling the LLM not to assert it as fact.

The join runs after the cross-encoder rerank and after the contradiction penalty, so a stale summary cannot win on rerank score. It is recomputed on every query — re-activating or restoring a source un-fences the row with no bookkeeping. A derived row with no recorded provenance at all (grounding_total 0) is left untouched: absence of evidence is not invalidation. Primary (non-derived) rows are never annotated.

const rows = await mesh.search('deploy cadence');
for (const r of rows) {
  if (r.ungrounded) {
    console.log(`${r.id}: ${r.grounding_live}/${r.grounding_total} sources live — do not assert`);
  }
}

The same change closes a recall gap: the in-memory BM25 fallback used when native FTS is unavailable now re-checks its hits against the same active-state clause the FTS path applies, so a row superseded or archived by another process cannot re-enter through keyword hits.

yamo-os caveat. The feature is live in the mesh and testable with superseded rows, but yamo-os today never supersedes or deletes the memories its consolidations cite — so in that runtime grounding is always 100 % and the fence never fires. It starts biting only once yamo-os grows a supersession/deletion path. Signal quality also depends on provenance quality: grounding over LLM-cited premises (cited_ids, depends_on) is meaningful; grounding over batch-membership source_ids is mostly noise.

Using in a Project

To use MemoryMesh with your Claude Code skills (like yamo-super) in a new project:

1. Install the Package

npm install @yamo/memory-mesh

2. Run Setup

This installs YAMO skills to ~/.claude/skills/memory-mesh/ and tools to ./tools/:

npx memory-mesh-setup

The setup script will:

  • Copy YAMO skills (yamo-super, scrubber) to Claude Code
  • Copy CLI tools to your project's tools/ directory
  • Prompt before overwriting existing files

3. Use the Skills

Your skills are now available in Claude Code with automatic memory integration:

# Use yamo-super workflow system
# Automatically retrieves similar past workflows and stores execution patterns
claude /yamo-super

Memory Integration Features:

  • Workflow Orchestrator: Searches for similar past workflows before starting
  • Design Phase: Stores validated designs with metadata
  • Debug Phase: Retrieves similar bug patterns and stores resolutions
  • Review Phase: Stores code review outcomes and quality metrics
  • Complete Workflow: Stores full execution pattern for future optimization

YAMO agents will automatically find tools in tools/memory_mesh.js.

Docker

docker run -v $(pwd)/data:/app/runtime/data \
  yamo/memory-mesh store "Content"

Integration with yamo-os

@yamo/memory-mesh is the memory subsystem used by yamo-os. The YamoKernel in yamo-os wraps it as KernelBrain and calls it on every kernel.execute() invocation:

  • Every execution writes an interaction record to LanceDB via brain.add()
  • kernel.heartbeat() triggers consolidation cycles that synthesise memories into skills
  • The kernel injects _kernel_execute into MemoryMesh for recursive skill synthesis
  • LanceDB path: runtime/data/lancedb/ (configurable via LANCEDB_URI or brain.path in yamo_config.json)

When used standalone (without yamo-os), MemoryMesh operates as a pure semantic memory store — yamo-os integration is opt-in.

Using with yamo-os

import { YamoKernel } from "yamo-os";

const kernel = new YamoKernel({
  brain: {
    path: "./runtime/data/lancedb",
    enableMemory: true,
  },
});
await kernel.boot();
// MemoryMesh is now available as kernel.brain
const results = await kernel.brain.search("previous interactions");

For full deployment including the bridge coordination plane, see yamo-infra.

About YAMO Protocol

Memory Mesh is built on the YAMO (Yet Another Model Ontology) Protocol - a structured language for transparent AI agent collaboration with immutable provenance tracking.

YAMO Protocol Features:

  • Structured Agent Workflows: Semicolon-terminated constraints, explicit handoff chains
  • Meta-Reasoning Traces: Hypothesis, rationale, confidence, and observation annotations
  • Blockchain Integration: Immutable audit trails via Model Context Protocol (MCP)
  • Multi-Agent Coordination: Designed for transparent collaboration across organizational boundaries

Learn More:

  • YAMO Protocol Organization: github.com/yamo-protocol
  • Protocol Specification: See the YAMO RFC documents for core syntax and semantics
  • Ecosystem: Explore other YAMO-compliant tools and skills

Memory Mesh implements YAMO v2.1.0 compliance with:

  • MemorySystemInitializer agent for graceful degradation
  • Context passing between agents (from_AgentName.output)
  • Structured logging with meta-reasoning
  • Priority levels and constraint-based execution
  • Automatic workflow pattern storage for continuous learning

Related YAMO Projects:

  • yamo-chain - Blockchain integration for agent provenance

Documentation

Configuration

LLM Provider Configuration

# Required for LLM-powered reflections
LLM_PROVIDER=openai          # Provider: 'openai', 'anthropic', 'ollama'
LLM_API_KEY=sk-...            # API key for OpenAI/Anthropic
LLM_MODEL=gpt-4o-mini         # Model name
LLM_BASE_URL=https://...      # Optional: Custom API base URL

Supported Providers:

  • OpenAI: GPT-4, GPT-4o-mini, etc.
  • Anthropic: Claude 3.5 Haiku, Sonnet, Opus
  • Ollama: Local models (llama3.2, mistral, etc.)

YAMO Configuration

# Optional YAMO settings
ENABLE_YAMO=true              # Enable YAMO block emission (default: true)
YAMO_DEBUG=true               # Enable verbose YAMO logging

Retrieval Tuning

# Score multiplier for a derived memory (consolidation / reflection /
# summary_l* / lesson) whose every cited source is gone — see
# "Read-time grounding". Finite, in (0, 1]; 1 keeps the ranking but still
# renders the [UNGROUNDED] fence; anything else falls back to the default.
UNGROUNDED_SCORE_FACTOR=0.25

LanceDB Configuration

# Vector database settings
LANCEDB_URI=./runtime/data/lancedb
LANCEDB_MEMORY_TABLE=memory_entries

Embedding Configuration

# Embedding model settings
EMBEDDING_MODEL_TYPE=local    # 'local', 'ollama', 'openai', 'cohere'

# Recommended: Gemma-300m for v3.0 Singularity Fidelity (matches OpenClaw)
EMBEDDING_MODEL_NAME=hf_ggml-org_embeddinggemma-300m-qat-Q8_0.gguf
EMBEDDING_DIMENSION=384

# Lightweight Default (fallback)
# EMBEDDING_MODEL_NAME=Xenova/all-MiniLM-L6-v2
# EMBEDDING_DIMENSION=384

Example .env File

# LLM for reflections
LLM_PROVIDER=openai
LLM_API_KEY=sk-your-key-here
LLM_MODEL=gpt-4o-mini

# YAMO audit
ENABLE_YAMO=true
YAMO_DEBUG=false

# Vector DB
LANCEDB_URI=./data/lancedb

# Embeddings (local default)
EMBEDDING_MODEL_TYPE=local
EMBEDDING_MODEL_NAME=hf_ggml-org_embeddinggemma-300m-qat-Q8_0.gguf