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 🙏

© 2025 – Pkg Stats / Ryan Hefner

universal-context-memory

v2.1.0

Published

Auto-indexing memory for AI coding assistants - baked into your project

Downloads

206

Readme


What is UCE?

Universal Context Engine indexes your codebase and provides intelligent context retrieval for AI coding assistants. Unlike cloud-based solutions, UCE runs 100% locally and stores everything in your project.

# Install and index your project
npm install universal-context-memory
npx ucm init

# That's it! Claude Code, Cursor, and Copilot now understand your codebase

v2.0 Highlights

  • Tree-sitter AST Parsing - 20+ languages with accurate symbol extraction
  • Incremental Indexing - Only re-index changed files
  • Knowledge Graph - Navigate code relationships (callers, inheritance, dependencies)
  • Hybrid Retrieval - BM25 + semantic search for best results
  • MCP Server - Direct integration with Claude Code and other AI tools
  • Watch Mode - Auto-update on file changes

Features

| Feature | Description | |---------|-------------| | Tree-sitter Parsing | Accurate AST-based symbol extraction for 20+ languages | | Knowledge Graph | Track function calls, class inheritance, and dependencies | | Hybrid Search | BM25 lexical + semantic vector search | | Incremental Index | Fast updates - only re-parse changed files | | MCP Server | Model Context Protocol server for AI assistants | | Watch Mode | Real-time index updates on file changes | | Multi-tool Output | Claude Code, Cursor, Copilot, any LLM | | 100% Local | No cloud, no uploads, complete privacy |

Supported Languages

TypeScript, JavaScript, Python, Rust, Go, Java, C#, Ruby, PHP, Swift, Kotlin, Scala, C, C++, and more.

Installation

# npm
npm install universal-context-memory

# yarn
yarn add universal-context-memory

# pnpm
pnpm add universal-context-memory

# global install
npm install -g universal-context-memory

See INSTALLATION.md for detailed setup instructions.

Quick Start

1. Initialize

npx ucm init

Creates:

your-project/
├── .context/index.json      # Codebase index
├── UCM.md                   # Universal context (any AI)
├── CONTEXT.md               # Generic LLM context
├── CLAUDE.md                # Claude Code specific
├── .cursorrules             # Cursor IDE
└── .github/copilot-instructions.md

2. View Stats

npx ucm stats

3. Search Your Code

npx ucm search "authentication"

4. Start Watch Mode

npx ucm watch

Commands

| Command | Description | |---------|-------------| | ucm init | Initialize UCE in a project | | ucm index | Re-index the codebase | | ucm watch | Watch for changes and auto-update | | ucm stats | Show index statistics | | ucm search <query> | Search codebase with BM25 | | ucm query <term> | Query symbols and files | | ucm graph | Export knowledge graph (JSON/DOT/Mermaid) | | ucm related <symbol> | Find related symbols | | ucm callers <function> | Find function callers | | ucm inheritance <class> | Show class hierarchy | | ucm serve | Start MCP server | | ucm config | Manage configuration | | ucm info | Show version and system info | | ucm clean | Remove generated files | | ucm export | Export index as JSON |

Examples

# Search for authentication code
npx ucm search "login validation"

# Find all callers of a function
npx ucm callers handleSubmit

# Show class inheritance tree
npx ucm inheritance BaseController

# Export graph as Mermaid diagram
npx ucm graph --format mermaid > architecture.md

# Start MCP server on custom port
npx ucm serve --port 4000

Configuration

Create .ucmrc.json:

{
  "projectName": "my-project",
  "ignore": ["**/dist/**", "**/*.min.js"],
  "priorityFiles": ["README.md", "src/index.ts"],
  "maxTokens": 50000,
  "enableEmbeddings": false,
  "output": {
    "ucmMd": true,
    "contextMd": true,
    "claudeMd": true,
    "cursorRules": true,
    "copilotInstructions": true
  }
}

Generate default config:

npx ucm config --init

API

Context Engine

import { ContextEngine } from 'universal-context-memory';

const engine = new ContextEngine({
  projectRoot: '/path/to/project',
  enableEmbeddings: false,
});

await engine.initialize();
await engine.index();

// Retrieve context for a query
const context = await engine.retrieve('how does auth work?');

// Search symbols
const results = engine.searchSymbols('User');

// Knowledge graph queries
const callers = engine.findCallers('handleLogin');
const hierarchy = engine.getInheritance('BaseService');
const deps = engine.getDependencies('src/auth.ts');

Legacy API (v1.x compatible)

import { Indexer, ContextGenerator, indexProject } from 'universal-context-memory';

// Quick one-liner
await indexProject('/path/to/project');

// Or manual control
const indexer = new Indexer({ projectRoot: '/path/to/project' });
const index = await indexer.index();

const generator = new ContextGenerator({ projectRoot: '/path/to/project', index });
generator.generateAll();

MCP Server

UCE includes a Model Context Protocol server for direct AI assistant integration.

Start Server

npx ucm serve --port 3333

Claude Code Integration

Add to your MCP configuration:

{
  "mcpServers": {
    "ucm": {
      "command": "npx",
      "args": ["ucm", "serve"],
      "cwd": "/path/to/project"
    }
  }
}

MCP Tools

| Tool | Description | |------|-------------| | retrieve | Get relevant context for a query | | search | Search symbols | | related | Find related code | | callers | Find function callers | | inheritance | Get class hierarchy | | dependencies | Get file dependencies | | stats | Index statistics |

Architecture

┌─────────────────────────────────────────────────────────────┐
│  Universal Context Engine v2.0 Architecture                  │
├─────────────────────────────────────────────────────────────┤
│                                                              │
│  ┌──────────────┐    ┌──────────────┐    ┌──────────────┐   │
│  │ Tree-sitter  │───▶│ Incremental  │───▶│  Knowledge   │   │
│  │   Parser     │    │   Indexer    │    │    Graph     │   │
│  └──────────────┘    └──────────────┘    └──────────────┘   │
│                                                 │            │
│                                                 ▼            │
│  ┌──────────────┐    ┌──────────────┐    ┌──────────────┐   │
│  │   Context    │◀───│    Hybrid    │◀───│    BM25      │   │
│  │   Engine     │    │  Retriever   │    │    Index     │   │
│  └──────────────┘    └──────────────┘    └──────────────┘   │
│         │                                                    │
│         ▼                                                    │
│  ┌──────────────┐    ┌──────────────┐    ┌──────────────┐   │
│  │ MCP Server   │    │  Generator   │    │    Watch     │   │
│  │              │    │  (MD files)  │    │    Mode      │   │
│  └──────────────┘    └──────────────┘    └──────────────┘   │
│                                                              │
└─────────────────────────────────────────────────────────────┘

Comparison

| Feature | UCE | Cloud Alternatives | |---------|-----|-------------------| | Data location | Your project | Their cloud | | Privacy | 100% local | Code uploaded | | Works offline | Yes | No | | Open source | Yes | Usually no | | Cost | Free | Paid | | Any LLM support | Yes | Vendor locked |

Contributing

We welcome contributions! See CONTRIBUTING.md for guidelines.

git clone https://github.com/Eskapeum/Context-Engine.git
cd Context-Engine
npm install
npm run build
npm test

License

MIT License - see LICENSE

Links