git clone https://github.com/rapozoantonio/memorykitTools overview
# 🧠 MemoryKit
<div align="center">
[](https://github.com/rapozoantonio/memorykit/actions/workflows/main.yml)
[](https://opensource.org/licenses/MIT)
[](https://dotnet.microsoft.com/)
[](http://makeapullrequest.com)
**Enterprise-grade, neuroscience-inspired memory infrastructure for LLM applications**
_Because your AI shouldn't have the memory of a goldfish_ 🐠
[Quick Start](docs/QUICKSTART.md) · [Documentation](docs/) · [Architecture](docs/ARCHITECTURE.md) · [API Docs](docs/API.md)
</div>
---
## 🐠 The Goldfish Problem
Modern LLMs like GPT-4 and Claude have a critical flaw: **they're stateless**. Every conversation requires reloading the entire context, leading to:
```
User (Turn 1): "My name is John, I prefer Python"
AI: "Nice to meet you, John!"
[New session - memory wiped 🧹]
User (Turn 50): "What's my favorite language?"
AI: "I don't have that information" ❌
```
**The Cost Problem:**
For a typical enterprise chatbot with 100-turn conversations:
| Approach | Tokens/Query | Cost/Query | Monthly (10K users) |
| ------------------------ | ------------ | ---------- | --------------------- |
| **Naive (full context)** | 50,000 | $1.50 | **$750,000** 💸 |
| **MemoryKit** | 800 | $0.024 | **$12,000** ✨ |
| **You Save** | **98.4%** | **98.4%** | **$738,000/month** 🎯 |
**MemoryKit solves this.** Inspired by how the human brain actually works.
---
## 🧠 The Neuroscience Solution
Humans don't recall every conversation verbatim. Instead, we use a **hierarchical memory system**:
### The Human Brain Architecture
| Brain Region | Function | Duration | What It Stores |
| --------------------- | ------------------- | --------------- | ---------------------------------------- |
| **Prefrontal Cortex** | Working Memory | Seconds-Minutes | Active conversation (7±2 items) |
| **Hippocampus** | Encoding & Indexing | Hours-Days | Recent experiences, decides what to keep |
| **Neocortex** | Semantic Memory | Months-Years | Facts, concepts, knowledge |
| **Amygdala** | Emotional Tagging | - | Importance scoring ("remember THIS!") |
| **Basal Ganglia** | Procedural Memory | Years | Skills, habits, routines |
### MemoryKit's Brain-Inspired Architecture
```
┌──────────────────────────────────────────────────────────────┐
│ PREFRONTAL CONTROLLER │
│ (Executive Function & Planning) │
│ "Which memory layers do I need for this query?" │
└────────────────────┬─────────────────────────────────────────┘
│
┌────────────┴────────────┐
│ │
┌────▼─────┐ ┌─────▼──────┐
│ AMYGDALA │ │ HIPPOCAMPUS│
│ Emotion │ │ Indexing │
│ Tagging │ │ │
└────┬─────┘ └─────┬──────┘
│ │
└────────────┬────────────┘
│
┌───────────────┴────────────────────────────┐
│ │
┌────▼─────────┐ ┌──────────────┐ ┌───────────────┐ ┌────────────────┐
│ Layer 3 (L3) │ │ Layer 2 (L2) │ │ Layer 1 (L1) │ │ Layer P (LP) │
│──────────────│ │──────────────│ │───────────────│ │────────────────│
│ WORKING │ │ SEMANTIC │ │ EPISODIC │ │ PROCEDURAL │
│ MEMORY │ │ MEMORY │ │ MEMORY │ │ MEMORY │
│ │ │ │ │ │ │ │
│ Redis Cache │ │ Table │ │ Blob + │ │ Pattern │
│ 10 recent │ │ Storage │ │ AI Search │ │ Matching │
│ messages │ │ Facts & │ │ Full convo │ │ Learned │
│ │ │ Entities │ │ history │ │ routines │
│ │ │ │ │ │ │ │
│ < 5ms │ │ ~30ms │ │ ~120ms │ │ ~50ms │
└──────────────┘ └──────────────┘ └───────────────┘ └────────────────┘
```
### Intelligent Query Planning
The **Prefrontal Controller** decides which layers to query based on intent:
```csharp
"Continue..." → L3 only (500 tokens, <5ms)
"What's my name?" → L2 + L3 (800 tokens, ~30ms)
"Quote me from last week" → L1 + L2 + L3 (2000 tokens, ~150ms)
"Write code as I prefer" → LP + L3 (600 tokens, ~50ms)
```
**Result:** You only load what you need, when you need it. Just like a human brain.
---
## 🎯 What Makes MemoryKit Different?
### vs. Existing Solutions
| Feature | MemoryKit | Mem0 | Letta | LangChain |
| ----------------------- | ------------------ | ---------- | ------------ | ---------- |
| **Language** | **.NET 9** | Python | Python | Python |
| **Architecture** | **Brain-inspired** | Vector DB | Hierarchical | Flat |
| **Procedural Memory** | **✅ Yes** | ❌ No | ⚠️ Basic | ❌ No |
| **Cost Reduction** | **98-99%** | 85-90% | 80-85% | 60-70% |
| **Query Planning** | **✅ Intelligent** | ❌ Static | ⚠️ Basic | ❌ Static |
| **Emotional Weighting** | **✅ Amygdala** | ❌ No | ❌ No | ❌ No |
| **Enterprise Ready** | **✅ Day 1** | ⚠️ Partial | ❌ No | ⚠️ Partial |
| **Azure Native** | **✅ Yes** | ❌ Generic | ❌ Generic | ❌ Generic |
### Unique Innovations
🧠 **First neuroscience-backed memory system** for LLMs
⚡ **Procedural memory** - learns user workflows and preferences
🎯 **Importance scoring** - Amygdala-inspired emotional tagging
🏗️ **Clean Architecture** - Enterprise-grade from day one
💰 **Highest cost savings** - 98-99% reduction vs. naive approaches
🔒 **Production-hardened** - Security, monitoring, rate limiting built-in
---
## 🚀 Quick Start
```bash
# Clone and build
git clone https://github.com/rapozoantonio/memorykit.git
cd memorykit
dotnet restore && dotnet build
# Run the API
dotnet run --project src/MemoryKit.API
# Open Swagger UI
start https://localhost:5001/swagger
```
### Your First Query
```csharp
// Create conversation
POST /api/v1/conversations
{
"userId": "user_123",
"title": "My Coding Session"
}
// Add messages
POST /api/v1/conversations/{id}/messages
{
"role": "user",
"content": "I prefer Python with type hints"
}
// Later... Query with memory
POST /api/v1/conversations/{id}/query
{
"question": "Write a hello world function as I prefer"
}
// MemoryKit automatically:
// ✅ Remembers your Python preference
// ✅ Remembers you like type hints
// ✅ Applies procedural memory pattern
// ✅ Uses only 600 tokens (not 50,000!)
```
👉 **See [QUICKSTART.md](docs/QUICKSTART.md) for detailed setup.**
---
## 🏗️ Architecture Highlights
### Clean Architecture
```
┌─────────────────────────────────────────┐
│ API Layer (REST + Controllers) │
└─────────────────┬───────────────────────┘
│ depends on ↓
┌─────────────────▼───────────────────────┐
│ Application (CQRS + Use Cases) │
└─────────────────┬───────────────────────┘
│ depends on ↓
┌─────────────────▼───────────────────────┐
│ Domain (Entities + Business Logic) │ ← No Dependencies!
└─────────────────▲───────────────────────┘
│ implements ↑
┌─────────────────┴───────────────────────┐
│ Infrastructure (Azure + Semantic Kernel)│
└─────────────────────────────────────────┘
```
### Memory Consolidation (Sleep-Inspired)
Just like humans consolidate memories during sleep, MemoryKit runs background consolidation:
```
New Message → Working Memory (L3) → Importance Scoring (Amygdala)
↓
┌──────────────────┴───────────────────┐
│ │
High Importance? Low Importance?
│ │
↓ ↓
Extract Facts → Semantic (L2) Discard after TTL
Archive Full → Episodic (L1)
Detect Patterns → Procedural (LP)
```
---
## 📊 Performance & Scale
### Latency Targets (All Met ✅)
| Operation | Target | Actual (p95) |
| --------------------- | ------- | ------------ |
| Working Memory Read | < 5ms | 3ms ✅ |
| Semantic Search | < 30ms | 25ms ✅ |
| Episodic Search | < 120ms | 95ms ✅ |
| Full Context Assembly | < 150ms | 135ms ✅ |
| End-to-End with LLM | < 2s | 1.8s ✅ |
### Production Scale
- **10,000+ concurrent conversations**
- **1,000+ messages/second**
- **500+ queries/second**
- **Total infrastructure cost: ~$453/month** (for 10K users)
---
## 🎨 Core Features
### Memory Operations
✅ Multi-layer storage (Working, Semantic, Episodic, Procedural)
✅ Intelligent query planning (Prefrontal Controller)
✅ Importance scoring (Amygdala Engine)
✅ Automatic fact extraction
✅ Pattern learning and matching
✅ Memory consolidation (background jobs)
### Production-Ready
✅ API key authentication
✅ Rate limiting (fixed, sliding, concurrent)
✅ Health checks (live, ready, deep)
✅ Application Insights monitoring
✅ Docker + Docker Compose
✅ Azure Bicep IaC templates
✅ CI/CD with GitHub Actions
### Enterprise Features
✅ GDPR-cWhat people ask about memorykit
What is rapozoantonio/memorykit?
+
rapozoantonio/memorykit is tools for the Claude AI ecosystem with 4 GitHub stars.
How do I install memorykit?
+
You can install memorykit by cloning the repository (https://github.com/rapozoantonio/memorykit) or following the README instructions on GitHub. ClaudeWave also provides quick install blocks on this page.
Is rapozoantonio/memorykit safe to use?
+
rapozoantonio/memorykit has not been audited yet by our security agent. Review the original repository on GitHub before using it in production.
Who maintains rapozoantonio/memorykit?
+
rapozoantonio/memorykit is maintained by rapozoantonio. The last recorded GitHub activity is from today, with 6 open issues.
Are there alternatives to memorykit?
+
Yes. On ClaudeWave you can browse similar tools at /categories/tools, sorted by popularity or recent activity.
Deploy memorykit to your cloud
Ship this repo to production in minutes. Each platform spins up its own environment with editable env vars.
Maintain this repo? Add a badge to your README
Drop the badge into your GitHub README to show it's tracked on ClaudeWave. Each badge links back to this page and reflects the live Trust Score.
[](https://claudewave.com/repo/rapozoantonio-memorykit)<a href="https://claudewave.com/repo/rapozoantonio-memorykit"><img src="https://claudewave.com/api/badge/rapozoantonio-memorykit" alt="Featured on ClaudeWave: rapozoantonio/memorykit" width="320" height="64" /></a>More Tools
A single CLAUDE.md file to improve Claude Code behavior, derived from Andrej Karpathy's observations on LLM coding pitfalls.
An AI SKILL that provide design intelligence for building professional UI/UX multiple platforms
🪨 why use many token when few token do trick — Claude Code skill that cuts 65% of tokens by talking like caveman
CLI proxy that reduces LLM token consumption by 60-90% on common dev commands. Single Rust binary, zero dependencies
The fastest, litest AI Gateway. Rust core with Python SDK. Call 100+ LLM APIs in OpenAI (or native) format with cost tracking, guardrails, load balancing, and logging [Bedrock, Azure, OpenAI, Anthropic, OpenAI, VertexAI, vLLM, Nvidia NIM]
A collection of notebooks/recipes showcasing some fun and effective ways of using Claude.