Skip to content

kernpunkt/llm-mem

Repository files navigation

LLM Memory Management Tools

A comprehensive suite of tools for managing and analyzing LLM memory systems, built with a modular architecture.

πŸ—οΈ Project Structure

This project is organized as a monorepo with four main packages:

  • @llm-mem/shared - Core utilities, memory services, and types
  • @llm-mem/cli - Command-line interface for memory coverage analysis
  • @llm-mem/mem-tools - CLI tools for memory management operations
  • @llm-mem/mcp - MCP server for LLM integration

πŸ”§ Package Configuration

Root package.json

  • Workspace Management: Uses pnpm workspaces
  • Scripts: Orchestrates builds across all packages
  • Dev Dependencies: Shared development tools

Package Dependencies

  • Shared Dependencies: Common across multiple packages
  • Workspace Dependencies: Internal package references using workspace:*
  • External Dependencies: Only included where needed

TypeScript Configuration

  • Root tsconfig.json: Base configuration for all packages
  • Package tsconfig.json: Extends root with package-specific settings
  • Shared Types: All packages can import from @llm-mem/shared

πŸš€ Quick Start

Prerequisites

  • Node.js 24+
  • pnpm 10.12.4+

Installation

stand alone - recommended mainly for taking part in developing the project

# Clone the repository
git clone git@github.com:kernpunkt/llm-mem.git
cd llm-mem

# Install dependencies
pnpm install

# allow build scripts this will automatically build all packages and rebuild sqlite3 for your plattform
pnpm approve-builds

πŸ“₯ Installation in Other Projects (Optional - for local development)

Installing as a Development Dependency

You can install the entire monorepo as an optional (since it is only used locally) dependency into any Node.js project to use the CLI and MCP tools:

# Install the entire monorepo (recommended)
pnpm add --save-optional git+ssh://git@github.com:kernpunkt/llm-mem.git#main
# allow build scripts, this will automatically install all dependencies and build all packages and rebuild sqlite3 for your plattform
pnpm approve-builds

Usage and Configuration

see individual README.md files in the package directories

πŸ“ File Organization

Shared Package

packages/shared/
β”œβ”€β”€ src/
β”‚   β”œβ”€β”€ memory/          # Memory management services
β”‚   β”œβ”€β”€ utils/           # Utility functions
β”‚   └── index.ts         # Main export file
β”œβ”€β”€ dist/                # Built JavaScript files
β”œβ”€β”€ package.json         # Package configuration
β”œβ”€β”€ tsconfig.json        # TypeScript configuration
└── README.md            # Package documentation

CLI Package

packages/cli/
β”œβ”€β”€ src/
β”‚   β”œβ”€β”€ cli.ts           # Main CLI entry point
β”‚   β”œβ”€β”€ coverage-service.ts
β”‚   β”œβ”€β”€ file-scanner.ts
β”‚   β”œβ”€β”€ source-parser.ts
β”‚   β”œβ”€β”€ report-generator.ts
β”‚   β”œβ”€β”€ config-parser.ts
β”‚   β”œβ”€β”€ validation.ts
β”‚   └── types.ts
β”œβ”€β”€ dist/                # Built CLI executable
β”œβ”€β”€ package.json         # Package configuration
β”œβ”€β”€ tsconfig.json        # TypeScript configuration
└── README.md            # Package documentation

Mem-Tools Package

packages/mem-tools/
β”œβ”€β”€ src/
β”‚   β”œβ”€β”€ cli.ts           # Main CLI entry point
β”‚   β”œβ”€β”€ commands/        # Command implementations
β”‚   β”œβ”€β”€ config.ts        # Configuration handling
β”‚   β”œβ”€β”€ config-parser.ts # Config file parsing
β”‚   └── types.ts         # Type definitions
β”œβ”€β”€ dist/                # Built CLI executable
β”œβ”€β”€ package.json         # Package configuration
β”œβ”€β”€ tsconfig.json        # TypeScript configuration
└── README.md            # Package documentation

MCP Package

packages/mcp/
β”œβ”€β”€ src/
β”‚   β”œβ”€β”€ index.ts         # MCP server entry point
β”‚   └── assets/          # Static assets
β”œβ”€β”€ dist/                # Built MCP server
β”œβ”€β”€ package.json         # Package configuration
β”œβ”€β”€ tsconfig.json        # TypeScript configuration
└── README.md            # Package documentation

πŸ”„ Build Process

Build Order

  1. Shared Package: Core utilities and services
  2. CLI Package: Depends on shared package
  3. Mem-Tools Package: Depends on shared package
  4. MCP Package: Depends on shared package

Build Artifacts

  • TypeScript Compilation: All packages compile to individual dist/ directories
  • Asset Copying: MCP package copies assets to dist
  • Executable Permissions: CLI package sets executable permissions

πŸ› οΈ Development

Available Scripts

# Build all packages
pnpm build

# Build specific package
pnpm build:shared
pnpm build:cli
pnpm build:mem-tools
pnpm build:mcp

# Development mode (watch for changes)
pnpm dev

πŸ§ͺ Testing

# Run all tests
pnpm test

# Run tests for specific package
pnpm test:shared
pnpm test:cli
pnpm test:mem-tools
pnpm test:mcp

# Watch mode
pnpm test:watch

# Coverage report
pnpm test:coverage

🀝 Contributing

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes
  4. Add tests for new functionality
  5. Ensure all tests pass
  6. Submit a pull request

πŸ“„ License

MIT License - see LICENSE for details.

πŸ†˜ Support

About

Memory System for LLMs think of it as Version 2 of cursor-md-mem

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors