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

shared-memory-mcp

v3.0.0

Published

MCP server for persistent, portable AI memory across conversations and IDEs. Cross-conversation memory with token-efficient CCL format.

Readme

Shared Memory MCP

Persistent, cross-session AI memory architecture using Compressed Conversation Logs (CCL) and multi-block organization for scalable, token-efficient context management.

Architecture Overview

Session Mode Workflow

Session Mode Workflow

The system operates in three distinct modes:

  • CREATE: Initialize new conversation sessions with write access
  • LOAD: Browse existing sessions in read-only mode for reference
  • EDIT: Modify and update existing session logs

CCL Architecture

CCL Architecture

Conversation data flows through a compression pipeline:

  1. AI conversation produces raw messages
  2. CCL Writer compresses and saves to session files
  3. Metadata index enables efficient filtering
  4. CCL Loader selectively loads relevant sessions
  5. Token-efficient context feeds back to AI

Multi-Block Memory Architecture

Multi-Block Memory

Memory blocks provide isolated contexts for different projects, services, or features. Blocks can be selected independently or combined for cross-cutting workflows.

Comparison with Standard Approaches

Memory Persistence

| Aspect | Standard Approach | Shared Memory MCP | |--------|------------------|-------------------| | Persistence mechanism | Ephemeral context window | External file-based CCL storage | | Session continuity | Lost between sessions | Full persistence across sessions | | IDE portability | Context lost on IDE switch | Shared across all MCP-compatible IDEs | | Token consumption | 15,000-25,000 per query | 1,200-2,000 per query | | Quality degradation | Begins after 1,000 messages | No degradation |

Memory Organization

| Aspect | Standard Approach | Shared Memory MCP | |--------|------------------|-------------------| | Structure | Flat, chronological messages | Hierarchical blocks by project/service | | Context isolation | Single global context | Independent memory blocks | | Scalability | Limited by context window | Unlimited with lazy loading | | Query efficiency | Full context scan | Indexed metadata lookup | | Cross-project memory | None | Selective block loading |

Format Efficiency

| Format | Token Count | Compression Ratio | Example | |--------|-------------|-------------------|---------| | Natural language | 50 tokens | Baseline | "The authentication system uses JWT tokens. Access tokens expire after 15 minutes. Refresh tokens expire after 7 days. Implementation: src/auth/jwt.ts" | | Markdown | 35 tokens | 30% reduction | "## Auth\n- JWT tokens\n- Access: 15m\n- Refresh: 7d\n- File: src/auth/jwt.ts" | | CCL notation | 12 tokens | 76% reduction | "auth: JWT | src/auth/jwt.ts | tokens(15m/7d)" |

Core Features

Compressed Conversation Log (CCL) Format

Symbolic notation system optimized for token efficiency:

✓  Decided / implemented
✗  Tried and rejected
!  Discovered gotcha / non-obvious bug
?  Open / unresolved / deferred
>  Code written or file changed
Q: Question posed
A: Answer / resolution
CONTEXT: External constraint

Example CCL entry:

2024-03-07 | auth-refactor
✓ JWT refresh rotation | Redis TTL = 7d
✗ Session cookies | CORS complications
! Token validation fails silently on exp mismatch
> src/auth/jwt.ts | validateToken() added exp check
? Should we implement token revocation list?
CONTEXT: Mobile clients cannot reliably store HttpOnly cookies

Multi-Block Organization

.ai-memory/
└── blocks/
    ├── auth-service/
    │   ├── block.json
    │   ├── sessions/
    │   │   ├── index.json
    │   │   ├── 2024-03-01.ccl
    │   │   └── 2024-03-07.ccl
    ├── api-gateway/
    └── frontend/

Each block maintains:

  • Independent session history
  • Isolated metadata index
  • Block-specific configuration

Session Modes

CREATE Mode

  • Initialize new conversation sessions
  • Automatic compression and metadata extraction
  • Write access enabled

LOAD Mode

  • Read-only session browsing
  • Filter by date, topic, gotchas, or open questions
  • Zero modification risk

EDIT Mode

  • Modify existing sessions
  • Update metadata and content
  • Maintains version history

Installation

npm install shared-memory-mcp

Configuration

Claude Desktop

{
  "mcpServers": {
    "shared-memory": {
      "command": "node",
      "args": ["/path/to/shared-memory-mcp/dist/index.js"],
      "env": {
        "AI_MEMORY_PATH": "/home/user/.ai-memory"
      }
    }
  }
}

VS Code / Cursor

Add to .vscode/mcp.json:

{
  "mcpServers": {
    "shared-memory": {
      "command": "node",
      "args": ["./node_modules/shared-memory-mcp/dist/index.js"],
      "env": {
        "AI_MEMORY_PATH": "${workspaceFolder}/.ai-memory"
      }
    }
  }
}

MCP Tools Reference

Block Management

| Tool | Description | Parameters | |------|-------------|------------| | memory_create_block | Create new memory block | name, description? | | memory_list_blocks | List all blocks | None | | memory_select_blocks | Set active blocks | blocks: string[] | | memory_delete_block | Remove block | name |

Session Operations

| Tool | Description | Parameters | |------|-------------|------------| | memory_set_mode | Set session mode | mode: 'create'\|'load'\|'edit' | | memory_save_session | Save CCL session | block, topic, content | | memory_load_sessions | Load sessions | block, filter? | | memory_list_sessions | List session metadata | block |

Session Filters

  • recent: N most recent sessions (default: 3)
  • topic:<keyword>: Filter by topic match
  • date:YYYY-MM-DD: Sessions from specific date
  • gotchas: Sessions with discovered bugs
  • open: Sessions with unresolved questions
  • constraints: Sessions with external context notes
  • rejections: Sessions documenting rejected approaches

Workflow Example

// Initialize block
memory_create_block({name: "auth-service"})
memory_select_blocks({blocks: ["auth-service"]})

// Start session
memory_set_mode({mode: "create"})

// After conversation work...
memory_save_session({
  block: "auth-service",
  topic: "JWT refresh rotation",
  content: `
✓ Implemented token refresh rotation
✗ Rejected sliding window approach
! Redis TTL must match refresh expiry
> src/auth/jwt.ts | Added rotateRefreshToken()
? Need to handle concurrent refresh requests?
CONTEXT: Mobile clients may retry failed refreshes
`
})

// Later session - load relevant history
memory_set_mode({mode: "load"})
memory_load_sessions({
  block: "auth-service",
  filter: "topic:JWT"
})

Technical Specifications

Stack

  • TypeScript 5.3+
  • Node.js 18+
  • @modelcontextprotocol/sdk 1.0+
  • tiktoken 1.0+ (token counting)
  • zod 3.24+ (schema validation)

Performance Metrics

| Metric | Value | |--------|-------| | Average session size | 200-400 tokens | | Compression ratio | 76% vs natural language | | Lazy load overhead | < 50ms per session | | Index lookup time | < 10ms | | Memory footprint | < 5MB per 100 sessions |

File Structure

src/
├── index.ts              # Entry point
├── server.ts             # MCP server implementation
├── types.ts              # TypeScript definitions
└── memory/
    ├── blockManager.ts   # Block lifecycle management
    ├── blockContext.ts   # Per-block state management
    ├── cclWriter.ts      # Session compression and saving
    ├── cclLoader.ts      # Session filtering and loading
    └── tokenizer.ts      # Token counting utilities

Use Cases

Long-Running Projects

Maintain consistent AI context across weeks or months of development without context window degradation.

Multi-Service Architectures

Isolate memory for microservices, frontend, infrastructure, and documentation in separate blocks.

Team Collaboration

Share .ai-memory directories via Git for consistent AI context across team members.

Cross-IDE Workflows

Switch between VS Code, Cursor, Windsurf, or Claude Desktop while maintaining full conversation history.

Bug Investigation

Query past sessions for similar issues, gotchas, and proven solutions using topic and symbol filters.

License

MIT

Repository

https://github.com/kedarvartak/shared-memory