🚀 Big News:Socket Has Acquired Secure Annex.Learn More
Socket
Book a DemoSign in
Socket

llmemory-palace

Package Overview
Dependencies
Maintainers
1
Versions
17
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

llmemory-palace

LLMemory-Palace: Code genome system for LLM context transfer. Maps codebases into portable format for LLM understanding. Now with MCP server and reference-based minimal context (90%+ token savings).

latest
Source
npmnpm
Version
3.0.6
Version published
Maintainers
1
Created
Source

🏛️ LLMemory-Palace

npm version npm downloads License: MIT Bun Node

📦 npm | 💻 GitHub | 📖 Docs | 🗺️ Roadmap | 🐛 Issues

The Problem

You're working with Claude or ChatGPT. You paste your codebase files one by one. The context fills up. The AI forgets what it saw first. You explain again. Context overflows. You start over.

The Solution

LLMemory-Palace maps your code into a portable format. Not your actual code—a structural map. Patterns, flows, fingerprints. One string replaces dozens of file pastes.

Install

npm install llmemory-palace
# or
bun add llmemory-palace

Node.js 18+ | Bun 1.0+

Quick Start

npx palace init
npx palace scan
npx palace genome

Commands

CommandDescription
initCreate .palace/ directory
scanAnalyze codebase structure
genomeGenerate genome string
exportExport to CXML/JSON/YAML/MessagePack
rebuildReconstruct from genome
packCreate portable package
mergeMerge package into project
refreshIncremental update with --ripple for dependents
patternsView detected patterns
flowsView behavior graphs
depsAnalyze dependencies
statusShow current state
queryInteractive LLM query
validateSecurity check genome

Options

--output, -o      Output file/directory
--format, -f      cxml | json | yaml | msgpack | genome
--level, -l       Compression 1-4 (default: 3)
--ripple, -r      Update dependents (refresh command)
--dry-run, -d     Preview without changes
--metrics, -m     Show before/after metrics

Security

  • No eval()
  • Input validation
  • Path traversal protection
  • Injection protection
  • Safe genome parsing (JSON only)
  • 28 security tests passing

API

import { Palace } from 'llmemory-palace';

const palace = new Palace({ projectPath: './my-project' });
await palace.init();
await palace.scan();
const genome = await palace.generateGenome();
console.log(genome);

Documentation

Export Formats

  • CXML (default) - Compressed, token-efficient
  • JSON - Human-readable
  • YAML - Configuration-friendly
  • MessagePack - Binary serialization

Token Efficiency

Reference-based output saves 90%+ tokens:

  • palace:// URIs for on-demand resolution
  • Compressed genomes: ~20KB for large projects
  • Incremental scans with LRU caching

MCP Server

90%+ token savings with reference-based minimal context:

// ~/.claude.json
{
  "mcpServers": {
    "palace": {
      "type": "stdio",
      "command": "npx",
      "args": ["-y", "llmemory-palace", "mcp"]
    }
  }
}

Tools:

  • mcp__palace__init - Initialize project
  • mcp__palace__scan - Scan with reference output (97% token savings)
  • mcp__palace__genome - Generate compressed genome (99% savings)
  • mcp__palace__resolve_ref - Resolve palace:// URIs at depth 1-3
  • mcp__palace__status - Check project status

Token Savings:

OperationFullReferenceSavings
scan500015097%
genome2000020099%

Performance

  • LRU cache for faster rescans
  • Worker threads for parallel scanning
  • Chunked processing for files >100MB

Plugin System

import { HookSystem } from 'llmemory-palace/plugins';
hooks.on('scan', async (result) => { /* ... */ }, { priority: 10 });

Large Files

import { LargeFileHandler } from 'llmemory-palace/streaming';
const handler = new LargeFileHandler({ chunkSize: 1024 * 1024 });
handler.exportChunked(data, 'output');

AI Integration

import { PromptTemplates } from 'llmemory-palace/ai/prompts';
const prompts = new PromptTemplates(palace);
prompts.formatForLLM('claude', query);

License

MIT

Keywords

llm

FAQs

Package last updated on 17 Mar 2026

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts