Skip to main content
Glama
README.md
<div align="center">

![MEMI Logo](memi.png)

# 🧠 MEMI - Memory Management Interface

**Advanced Memory System for AI Agents via Model Context Protocol (MCP)**

[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
[![TypeScript](https://img.shields.io/badge/TypeScript-007ACC?logo=typescript&logoColor=white)](https://www.typescriptlang.org/)
[![Node.js](https://img.shields.io/badge/Node.js-43853D?logo=node.js&logoColor=white)](https://nodejs.org/)
[![SQLite](https://img.shields.io/badge/SQLite-07405E?logo=sqlite&logoColor=white)](https://sqlite.org/)

</div>

MEMI is a sophisticated graph-based memory management system that provides AI agents with persistent, organized, and intelligent memory capabilities. Built as an MCP server, it seamlessly integrates with any MCP-compatible AI client.

## ✨ Key Features

<div align="center">

| πŸ—‚οΈ **Project Organization** | πŸ” **Semantic Search** | πŸ“ **Memory CRUD** |
|:---:|:---:|:---:|
| Separate contexts by project | Natural language queries | Full lifecycle management |
| **🏷️ Tag Management** | **πŸ“Š Analytics** | **πŸ”— Relationships** |
| Smart organization & merging | Timeline & insights | Manual & auto connections |
| **πŸ†“ Zero Cost** | **⚑ Lightning Fast** | **πŸ”’ Privacy First** |
| Works completely offline | Millisecond responses | Local data storage |

</div>

### 🎯 **Core Capabilities**

- πŸ—‚οΈ **Project-Based Organization** - Separate memories by project/context to avoid confusion
- πŸ” **Advanced Semantic Search** - Natural language queries with intelligent filtering
- πŸ“ **Complete Memory CRUD** - Create, read, update, delete, and relate memories
- 🏷️ **Smart Tag Management** - Organize, merge, and analyze tags across projects
- πŸ“Š **Memory Analytics** - Detailed insights and timeline analysis
- πŸ”— **Relationship Management** - Manual and automatic memory connections
- πŸ†“ **Zero-Cost Operation** - Works completely offline with TF-IDF embeddings
- ⚑ **Lightning Fast** - Millisecond response times with SQLite storage

## πŸ“ˆ **Project Stats**

<div align="center">

![Tools](https://img.shields.io/badge/MCP_Tools-19-blue?style=for-the-badge)
![TypeScript](https://img.shields.io/badge/TypeScript-100%25-blue?style=for-the-badge)
![Tests](https://img.shields.io/badge/Tests-Passing-green?style=for-the-badge)
![Coverage](https://img.shields.io/badge/Coverage-100%25-green?style=for-the-badge)

</div>

## πŸ› οΈ Available Tools (19 Total)

### πŸ“ **Project Management**
- `mem-project-create` - Create new project contexts
- `mem-project-list` - List all available projects
- `mem-project-switch` - Switch active project context

### πŸ’Ύ **Memory Operations**
- `mem-store` - Store new memories (auto-assigns to current project)
- `mem-search` - Advanced search with filters (tags, dates, projects)
- `mem-get` - Retrieve specific memory by ID
- `mem-update` - Update memory content and metadata
- `mem-delete` - Remove memories safely
- `mem-search-similar` - Find semantically similar memories

### πŸ”— **Relationship Management**
- `mem-relate` - Create manual relationships between memories
- `mem-reconstruct` - Rebuild narratives from connected memories

### 🏷️ **Tag Operations**
- `mem-tags-list` - View all tags with usage statistics
- `mem-tags-merge` - Combine similar tags
- `mem-tags-rename` - Rename tags across all memories

### πŸ“Š **Analytics & Insights**
- `mem-analyze` - Comprehensive memory analysis
- `mem-timeline` - Generate temporal timelines
- `mem-graph` - Graph statistics and operations

## πŸš€ Quick Start

### Prerequisites

- **Node.js** 18+
- **npm** or **yarn**
- **Git**

### Installation

```bash
# Clone the repository
git clone https://github.com/Rixmerz/MEMI.git
cd MEMI

# Install dependencies
npm install

# Build the project
npm run build

# Test the installation (optional)
npm test
```

> πŸ’‘ **Tip**: The build process compiles TypeScript to JavaScript and sets up the MCP server for use.

### Configuration

Add MEMI to your MCP client configuration:

```json
{
  "mcpServers": {
    "memi": {
      "command": "node",
      "args": ["/path/to/MEMI/dist/index.js", "--stdio"],
      "env": {
        "MEMI_DB_PATH": "~/.memi/memory.db",
        "MEMI_LOG_LEVEL": "info",
        "MEMI_EMBEDDING_PROVIDER": "tfidf"
      }
    }
  }
}
```

## 🎬 **Demo**

<div align="center">

### πŸ”„ **Typical Workflow**

```mermaid
graph LR
    A[Create Project] --> B[Store Memories]
    B --> C[Search & Analyze]
    C --> D[Create Relations]
    D --> E[Generate Insights]
    E --> F[Export Results]
```

</div>

## πŸ’‘ Usage Examples

### Basic Workflow

```javascript
// 1. Create a project
mem-project-create {
  "name": "my-web-app",
  "description": "E-commerce web application",
  "tags": ["web", "ecommerce", "react"]
}

// 2. Switch to the project
mem-project-switch {
  "projectName": "my-web-app"
}

// 3. Store memories
mem-store {
  "content": "User authentication implemented with JWT tokens and refresh token rotation",
  "source": "development-notes",
  "tags": ["auth", "jwt", "security"]
}

// 4. Search memories
mem-search {
  "query": "authentication security",
  "filters": {
    "tags": ["auth"],
    "sourceType": ["document"]
  }
}

// 5. Analyze project
mem-analyze {
  "type": "project"
}
```

## 🎯 Benefits

### For AI Agents
- **Persistent Context** - Remember conversations and learnings across sessions
- **Organized Knowledge** - Separate different projects and contexts
- **Smart Retrieval** - Find relevant information quickly with semantic search
- **Relationship Awareness** - Understand connections between different pieces of information

### For Developers
- **Zero Setup** - Works out of the box with no API keys required
- **Privacy First** - All data stored locally, no external services
- **Extensible** - Easy to add new embedding providers and features
- **Production Ready** - Robust error handling and comprehensive testing

### For Teams
- **Project Isolation** - Keep different projects' memories separate
- **Collaborative** - Share memory databases across team members
- **Analytics** - Understand knowledge patterns and gaps
- **Maintenance** - Built-in tools for cleaning and organizing memories

## πŸ”§ Configuration Options

### Environment Variables

- `MEMI_DB_PATH` - Database file location (default: `./memi_memory.db`)
- `MEMI_LOG_LEVEL` - Logging level: `error`, `warn`, `info`, `debug`
- `MEMI_EMBEDDING_PROVIDER` - Embedding provider: `tfidf`, `openai`
- `OPENAI_API_KEY` - Required only if using OpenAI embeddings

### Embedding Providers

**TF-IDF (Default - Free)**
- No API key required
- Works completely offline
- Good for most use cases
- Fast and lightweight

**OpenAI (Premium)**
- Requires OpenAI API key
- Higher quality embeddings
- Better semantic understanding
- Costs per API call

## πŸ“Š Architecture

MEMI uses a graph-based architecture where:

- **Memories** are stored as nodes with rich metadata
- **Relationships** connect related memories automatically and manually
- **Projects** provide organizational boundaries
- **Tags** enable flexible categorization
- **Embeddings** power semantic search capabilities

## πŸ—ΊοΈ **Roadmap**

### 🎯 **Upcoming Features**

- [ ] 🌐 **Web Interface** - Optional GUI for memory management
- [ ] πŸ“± **Mobile App** - Companion app for on-the-go access
- [ ] πŸ”Œ **More Embeddings** - Support for additional providers
- [ ] πŸ”„ **Sync & Backup** - Cloud synchronization options
- [ ] πŸ€– **AI Integrations** - Enhanced AI-specific features
- [ ] πŸ“Š **Advanced Analytics** - More detailed insights and reports

### πŸŽ‰ **Completed**

- [x] βœ… **Core MCP Server** - Full protocol implementation
- [x] βœ… **19 Tools** - Complete tool suite
- [x] βœ… **Project Management** - Context organization
- [x] βœ… **Semantic Search** - TF-IDF embeddings
- [x] βœ… **Memory Analytics** - Timeline and insights
- [x] βœ… **Relationship Management** - Manual connections

## 🀝 Contributing

We welcome contributions! Please:

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

Only maintainers can push directly to main branch.

### πŸ› οΈ **Development Setup**

```bash
# Clone your fork
git clone https://github.com/YOUR_USERNAME/MEMI.git
cd MEMI

# Install dependencies
npm install

# Run in development mode
npm run dev

# Run tests
npm test

# Build for production
npm run build
```

## πŸ“„ License

MIT License - see [LICENSE](LICENSE) file for details.

## πŸ†˜ Support

- πŸ“– [Documentation](https://github.com/Rixmerz/MEMI/wiki)
- πŸ› [Issue Tracker](https://github.com/Rixmerz/MEMI/issues)
- πŸ’¬ [Discussions](https://github.com/Rixmerz/MEMI/discussions)
- πŸ“§ [Contact](mailto:support@memi.dev)

## πŸ™ **Acknowledgments**

- **Model Context Protocol** - For the excellent MCP specification
- **OpenAI** - For inspiring AI-first development
- **SQLite** - For reliable local storage
- **TypeScript** - For type-safe development
- **The AI Community** - For continuous feedback and support

---

<div align="center">

### 🌟 **Star this repo if MEMI helps you!** 🌟

[![GitHub stars](https://img.shields.io/github/stars/Rixmerz/MEMI?style=social)](https://github.com/Rixmerz/MEMI/stargazers)
[![GitHub forks](https://img.shields.io/github/forks/Rixmerz/MEMI?style=social)](https://github.com/Rixmerz/MEMI/network/members)

**Built with ❀️ for the AI community**

*Making AI agents smarter, one memory at a time.*

</div>