Memorykit

io.github.rapozoantonio由 GitHub 账号 rapozoantonio 发布v1.4.2更新于 Oct 24, 2026

Cognitive memory for AI coding assistants — persistent memory across sessions

已验证STDIO仅桌面知识与记忆开发者工具

概览

AI 生成的概览

一个本地 MCP 服务器,为 AI 编程助手提供跨会话的持久分层记忆,让偏好和历史上下文得以延续。

可以做什么
通过分层记忆模型(工作记忆、语义记忆、情景记忆、程序性记忆)跨会话保存对话上下文和用户偏好。按重要性对记忆打分并整合,支持自动事实提取和模式学习。根据问题意图规划需要查询哪些记忆层。README 描述了包含会话、消息和查询接口的 REST API,但清单未列出任何工具,因此具体的 MCP 工具范围没有文档说明。
适用场景
当你希望编程助手记住你的偏好、过往决策和之前的会话,而不是每次都从空白上下文开始,并且愿意自行运行和配置后端服务时,值得添加。
运行要求
以本地 stdio 进程运行,来自 npm 包 memorykit-mcp-server,需要 Node.js。README 描述了一个 .NET 9 后端,依赖 Azure 服务(Redis、表存储、Blob 存储、AI Search、Azure OpenAI)和 API 密钥认证;清单未声明任何环境变量或请求头。
安装前请注意
README 说明使用 API 密钥认证,并会保存对话历史和提取出的事实,应把存储的记忆视为敏感数据。它还描述了 Azure OpenAI 调用和 Azure 基础设施,可能产生费用。多项 Azure 集成和真实的 OpenAI 集成被列为尚未完成,因此实际行为可能受限或仅使用内存实现。

安装

在 SourceWeft 中

  1. 打开 控制台中的 Memorykit,将其添加到工作区。
  2. 为需要使用其工具的对话启用该服务。

Desktop only,通过 STDIO。 STDIO 服务会启动本地进程,因此需要 SourceWeft 桌面宿主。

其他 MCP 客户端

参照 仓库 中的启动说明。

README

🧠 MemoryKit

[CI/CD Pipeline] [License: MIT] [.NET] [PRs Welcome]

Enterprise-grade, neuroscience-inspired memory infrastructure for LLM applications

Because your AI shouldn't have the memory of a goldfish 🐠

Quick Start · Documentation · Architecture · API Docs


🐠 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:

ApproachTokens/QueryCost/QueryMonthly (10K users)
Naive (full context)50,000$1.50$750,000 💸
MemoryKit800$0.024$12,000 ✨
You Save98.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 RegionFunctionDurationWhat It Stores
Prefrontal CortexWorking MemorySeconds-MinutesActive conversation (7±2 items)
HippocampusEncoding & IndexingHours-DaysRecent experiences, decides what to keep
NeocortexSemantic MemoryMonths-YearsFacts, concepts, knowledge
AmygdalaEmotional Tagging-Importance scoring ("remember THIS!")
Basal GangliaProcedural MemoryYearsSkills, 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

FeatureMemoryKitMem0LettaLangChain
Language.NET 9PythonPythonPython
ArchitectureBrain-inspiredVector DBHierarchicalFlat
Procedural Memory✅ Yes❌ No⚠️ Basic❌ No
Cost Reduction98-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 buildgit clone https://github.com/rapozoantonio/memorykit.gitcd memorykitdotnet restore && dotnet build
# Run the APIdotnet run --project src/MemoryKit.API
# Open Swagger UIstart https://localhost:5001/swagger

Your First Query

csharp
// Create conversationPOST /api/v1/conversations{  "userId": "user_123",  "title": "My Coding Session"}
// Add messagesPOST /api/v1/conversations/{id}/messages{  "role": "user",  "content": "I prefer Python with type hints"}
// Later... Query with memoryPOST /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 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 ✅)

OperationTargetActual (p95)
Working Memory Read< 5ms3ms ✅
Semantic Search< 30ms25ms ✅
Episodic Search< 120ms95ms ✅
Full Context Assembly< 150ms135ms ✅
End-to-End with LLM< 2s1.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-compliant deletion
✅ Multi-tenancy isolation
✅ Comprehensive audit logging
✅ Performance benchmarks (BenchmarkDotNet)
✅ Security hardening (OWASP compliance)


📚 Documentation

Getting Started

Technical Deep-Dives


🔧 Technology Stack

Backend

  • .NET 9.0 (C# 13)
  • ASP.NET Core Web API
  • MediatR (CQRS)
  • FluentValidation

Azure Services

  • Redis Cache (Working Memory)
  • Table Storage (Semantic/Procedural)
  • Blob Storage + AI Search (Episodic)
  • Azure OpenAI (Embeddings + LLM)

Architecture

  • Clean Architecture
  • Domain-Driven Design
  • SOLID Principles
  • Dependency Injection

Testing & Quality

  • xUnit (Unit/Integration tests)
  • BenchmarkDotNet (Performance)
  • Moq (Mocking)
  • FluentAssertions

🤝 Contributing

We'd love your help making MemoryKit even better!

Quick Start for Contributors

bash
# Fork and clonegit clone https://github.com/YOUR_USERNAME/memorykit.gitcd memorykit
# Create feature branchgit checkout -b feature/amazing-feature
# Make changes# ... code code code ...
# Run testsdotnet test
# Commit with conventional commitsgit commit -m "feat: add amazing feature"
# Push and create PRgit push origin feature/amazing-feature

Resources for Contributors


📈 Project Status

Version: 1.0.0

What's Complete ✅

  • ✅ Four-layer memory architecture
  • ✅ Neuroscience-inspired cognitive components
  • ✅ Clean Architecture (zero circular dependencies)
  • ✅ CQRS with MediatR
  • ✅ In-memory implementations
  • ✅ REST API with Swagger
  • ✅ Production hardening (auth, rate limiting, monitoring)
  • ✅ Comprehensive documentation

What's Next 🚧

  • ⚠️ Azure service implementations (Redis, Tables, Blob, AI Search)
  • ⚠️ Real Azure OpenAI integration
  • ⚠️ Comprehensive test coverage
  • 📋 Client SDKs (.NET, Python, JS)
  • 📋 Background consolidation jobs
  • 📋 Advanced analytics dashboard

See PROJECT_STATUS.md for full details.


🎓 Learn More

Research & Inspiration

MemoryKit is built on decades of cognitive neuroscience research:

  • Baddeley & Hitch (1974) - Working memory model
  • Tulving (1972) - Episodic vs. semantic memory
  • Squire (2004) - Memory systems of the brain
  • McGaugh (2000) - Memory consolidation
  • Miller (1956) - The magical number 7±2

See docs/SCIENTIFIC_OVERVIEW.md for the full scientific background.

Why This Matters

Traditional LLM memory solutions treat memory as a flat vector database. MemoryKit recognizes that human memory is hierarchical, importance-weighted, and query-dependent.

By mimicking how the brain actually works, we achieve:

  • Better relevance - Only retrieve what matters
  • Lower cost - Don't load irrelevant history
  • Faster response - Parallel layer retrieval
  • Procedural learning - Remember user preferences
  • Emotional context - Important messages remembered better

🔒 Security

We take security seriously:

  • API Key Authentication - Secure access control
  • Rate Limiting - Prevent abuse
  • Input Validation - Prevent injection attacks
  • HTTPS Only - Encrypted in transit
  • Azure Security - Encryption at rest
  • GDPR Compliant - User data deletion
  • Regular Scans - Trivy + CodeQL

See SECURITY.md for security policy and reporting.


📝 License

This project is licensed under the MIT License - see LICENSE for details.

TL;DR: Free to use commercially, modify, distribute. Just keep the copyright notice.


🌟 Show Your Support

If MemoryKit helps your project, please consider:

  • ⭐ Star this repo on GitHub
  • 🐦 Tweet about it - help others discover it
  • 📝 Write a blog post - share your experience
  • 🤝 Contribute - PRs are welcome!
  • 💬 Provide feedback - open an issue or discussion

📞 Contact & Support


🎯 Ready to give your AI a real memory?

Get Started · Read the Docs · Join the Discussion


Made with 🧠 and ❤️ by Antonio Rapozo

Inspired by 50+ years of cognitive neuroscience research

来源:README.md,提交 35e85fa

工具

0
SourceWeft 尚未在沙箱中启动过该软件包,因此其工具未知。

版本历史

1
  1. v1.4.2最新Sep 16, 2026

评分

已满足适用检查项的 50%

该评分衡量此收录条目的完整程度,依据注册中心条目、端点与公开来源计算得出。它不是对服务器本身的评价,也不表示服务器安全或当前可用:可连通性是带日期的检查结果,评分也不包含安装量或用户评价。

  • 近 30 天内可连通25 分

    请保持端点能够响应 MCP 握手;SourceWeft 每 30 天探测一次。

  • 已声明认证方式10 分

    请在注册中心条目中声明凭据请求头,或保持端点能够响应探测,以便判定其认证方式。

  • 已列出工具15 分

    请让服务器在无凭据时响应 tools/list,或发布可在沙箱中无凭据启动的软件包。

  • 描述必需15 分
  • 图标10 分
  • 文档15 分
  • 许可证10 分