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

@nguyentamdat/mempalace

v1.0.3

Published

Give your AI a memory. No API key required.

Readme

mempalace

Give your AI a memory. No API key required.

A structured, persistent memory system for AI agents — featuring a palace metaphor (wings → rooms → drawers), a temporal knowledge graph, the AAAK compression dialect, and a 4-layer memory stack.

This is a Bun/TypeScript port of the original mempalace by milla-jovovich.

OpenCode users: See opencode-mempalace for plug-and-play integration.

Requirements

Install

npm install @nguyentamdat/mempalace
# or
git clone https://github.com/nguyentamdat/mempalace-js.git
cd mempalace-js
bun install

Setup

1. Start ChromaDB

# Docker (recommended)
docker run -d --name chromadb -p 127.0.0.1:8001:8000 \
  -v chromadb-data:/chroma/chroma --restart unless-stopped \
  chromadb/chroma:latest

# Or pip
pip install chromadb
chroma run --port 8001

2. Configure

The default ChromaDB URL is http://localhost:8000. Override via environment variable or config:

# Environment variable
export CHROMA_URL=http://localhost:8001

# Or in ~/.mempalace/config.json
{
  "chroma_url": "http://localhost:8001",
  "palace_path": "~/.mempalace/palace",
  "collection_name": "mempalace_drawers",
  "topic_wings": ["work", "personal", "technical", "creative"]
}

3. Initialize

bun run src/index.ts init /path/to/project

Usage

CLI

# Mine project files into the palace
bun run src/index.ts mine --mode projects --path ./my-project

# Mine conversation transcripts
bun run src/index.ts mine --mode convos --path ./transcripts

# Search memories
bun run src/index.ts search "some query"

# Compress memories with AAAK dialect (~30x reduction)
bun run src/index.ts compress

# Load memory layers (wake-up)
bun run src/index.ts wake-up

# Split mega transcript files
bun run src/index.ts split --path ./mega-file.txt

# Palace status
bun run src/index.ts status

MCP Server

Run as a JSON-RPC MCP server over stdin/stdout (19 tools):

CHROMA_URL=http://localhost:8001 bun run src/mcp-server.ts

Tools: mempalace_search, mempalace_kg_query, mempalace_kg_timeline, mempalace_kg_add, mempalace_kg_invalidate, mempalace_diary_write, mempalace_diary_read, mempalace_status, mempalace_list_wings, mempalace_list_rooms, mempalace_get_taxonomy, mempalace_add_drawer, mempalace_delete_drawer, mempalace_check_duplicate, mempalace_traverse, mempalace_find_tunnels, mempalace_graph_stats, mempalace_get_aaak_spec.

Architecture

Palace Structure

~/.mempalace/
├── palace/           (ChromaDB collection data reference)
├── config.json       (palace configuration)
├── entity_registry.json
├── identity.txt      (Layer 0 — who am I)
└── knowledge_graph.db (SQLite)

Palace (in ChromaDB)
├── Wings (top-level categories: work, personal, technical, etc.)
│   └── Rooms (specific topics within a wing)
│       └── Drawers (individual memories with metadata)
├── Diary wing (per-agent daily entries)
└── Embeddings (DefaultEmbeddingFunction)

Memory Layers

| Layer | Content | Size | |-------|---------|------| | Layer 0 | identity.txt — who am I | ~100 tokens | | Layer 1 | Auto-generated from top drawers | ~500-800 tokens | | Layer 2 | On-demand wing/room filtered | Variable | | Layer 3 | Deep semantic search | Variable |

AAAK Compression Dialect

A compact encoding format for memories that reduces token usage ~30x while preserving meaning. Uses 3-letter entity codes, emotion markers, pipe-separated fields, and importance stars (★–★★★★★).

Knowledge Graph

SQLite-based temporal entity-relationship graph with validity windows and confidence scores. Supports entities (people, projects, concepts) and triples (subject → predicate → object).

Modules

| Module | Description | |--------|-------------| | config.ts | Palace configuration (env vars, config.json, defaults) | | mcp-server.ts | JSON-RPC MCP server (19 tools) | | knowledge-graph.ts | Temporal entity-relationship graph (bun:sqlite) | | dialect.ts | AAAK compression dialect | | layers.ts | 4-layer memory stack | | searcher.ts | Semantic search via ChromaDB | | palace-graph.ts | Graph traversal and tunnel detection | | miner.ts | Project file mining | | convo-miner.ts | Conversation mining | | normalize.ts | Chat export normalization (Claude, ChatGPT, Slack) | | general-extractor.ts | Extract decisions, preferences, milestones | | entity-registry.ts | Persistent entity registry with Wikipedia lookup | | entity-detector.ts | Auto-detect people/projects from text | | onboarding.ts | Interactive setup wizard | | room-detector-local.ts | Room detection from folder structure | | spellcheck.ts | Optional spell correction | | split-mega-files.ts | Split concatenated transcripts |

Tests

bun test

Related

Acknowledgements

This project is a Bun/TypeScript port of the original mempalace by milla-jovovich. All credit for the palace architecture, AAAK compression dialect, knowledge graph design, memory layer system, and MCP tool definitions goes to their work.

License

MIT