memory-engine
프로그래밍 에이전트 자기 학습 메모리 엔진
MCP(Model Context Protocol) 기반의 자기 학습 메모리 엔진으로, 프로그래밍 에이전트에게 "인지-반성-축적-적용" 4계층 폐루프 학습 능력을 제공합니다. 에이전트가 실수에서 학습하여 사용할수록 더 강력해집니다.
아키텍처 개요
┌──────────────────────────────────────────────────────┐
│ 编程智能体 │
│ (Claude Code / Cursor / 任何支持 MCP 的智能体) │
└──────────┬───────────────────────┬────────────────────┘
│ MCP Protocol │
┌──────▼──────┐ ┌──────▼──────┐
│ 应用层 │ │ 感知层 │
│ 检索+注入 │ │ 错误捕获 │
└──────┬──────┘ └──────┬──────┘
│ │
┌──────▼──────┐ ┌──────▼──────┐
│ 沉淀层 │ │ 反思层 │
│ 技能+记忆 │◄────────│ 根因分析 │
└──────┬──────┘ └─────────────┘
│
┌──────▼──────┐
│ 存储层 │
│ SQLite+FTS5 │
└─────────────┘Related MCP server: Self-Learning MCP
4계층 폐루프
계층 | 역할 | MCP 도구 |
인지 계층 Observation | 도구 실행 오류, 테스트 실패, 사용자 수정, 대화 신호 포착 |
|
반성 계층 Reflection | 근본 원인 분석, 재사용 가능한 경험 추출 |
|
축적 계층 Consolidation | 스킬 정제, SKILL.md 생성, 메모리 유지 |
|
적용 계층 Application | 관련 경험 검색, 작업 컨텍스트 주입 |
|
통계 | 엔진 상태 확인 |
|
설치
# 进入项目目录(替换为你本机的实际路径)
cd memory-engine
# 安装依赖(绕过代理)
pip install --no-proxy -e .
# 或手动安装
pip install --no-proxy mcp[cli] jiebaMCP 서버 구성
ZCode / Claude Code
MCP 구성 파일에 다음을 추가합니다:
{
"mcpServers": {
"memory-engine": {
"command": "python",
"args": ["-m", "memory_engine.server"],
"cwd": "<项目根目录的绝对路径>"
}
}
}
<프로젝트 루트 디렉터리의 절대 경로>를 이 프로젝트를 복제/보관한 실제 경로(즉pyproject.toml이 포함된 디렉터리)로 교체하세요. 예를 들어 Windows에서는D:/tools/memory-engine, macOS/Linux에서는/home/user/tools/memory-engine형태입니다.
Cursor / VS Code
.cursor/mcp.json 또는 VS Code의 MCP 설정에 동일한 구성을 추가합니다.
독립 실행(디버깅용)
cd memory-engine
python -m memory_engine.server핵심 워크플로우
0. 대화 신호 포착(인지 강화)
vibe coding 과정에서 작업자는 대화 중에 명시적 신호를 남기는 경우가 많습니다. "주의하세요", "기억하세요" 등의 강조 지시, 그리고 에이전트의 반복 실수로 인한 불만("왜 또...", "몇 번이나 말했어...") 등이 그것입니다. 이러한 문장은 가장 가치가 높은 학습 자료이므로 포착하여 메모리에 포함해야 합니다:
capture_conversation_signals(
conversation_text="用户: 请注意,bat文件必须用ANSI编码
用户: 怎么又是编码问题,我说过多少次了",
auto_record=true
)감지기는 네 가지 유형의 신호를 식별하고 우선순위에 따라 정렬합니다:
신호 | 식별 예시 | 의미 |
| "왜 또", "여전히 틀렸어", "몇 번이나 말했어" | 반복 실수로 인한 불만, 이전 교훈이 흡수되지 않았음을 의미(최우선순위) |
| "주의하세요", "기억하세요", "반드시", "절대" | 사용자가 명시적으로 강조한 규칙 |
| "앞으로는 모두", "나는 좋아해", "기본으로" | 사용자의 작업 방식 선호 |
| "어이없네", "너무 느려", "시간 낭비" | 불만 감정, 효율성/경험 문제 암시 |
감지 결과는 자동으로 conversation_signal 유형 관찰로 기록되며, 반성 시 전용 맞춤 프롬프트를 사용합니다
(이전 오류 추론 + 명령형 규칙으로 정제). 이후 프로세스는 오류 반성과 동일합니다.
1. 오류 기록(인지)
도구 실행이 실패하면 에이전트가 호출합니다:
record_observation(
obs_type="tool_error",
tool_name="Bash",
error_message="bat文件执行报错:编码错误",
context="在Windows上创建的bat文件包含中文注释",
tags="encoding,windows,bat"
)2. 반성 분석(반성)
분석 프롬프트 획득:
get_reflection_prompt(obs_id="abc123")에이전트는 반환된 프롬프트에 따라 근본 원인을 분석한 후 결과를 저장합니다:
reflect_and_save(
obs_id="abc123",
root_cause="Windows的cmd.exe默认使用系统ANSI编码,UTF-8编码的bat文件会导致中文注释被解析错误",
category="encoding",
lesson="在Windows上创建bat文件时,文件必须使用ANSI/GBK编码,而非UTF-8",
solution="将bat文件保存为ANSI编码,或使用chcp 65001切换代码页",
tags="encoding,windows,bat,cmd",
generalizable=true
)3. 스킬 정제(축적)
충분한 경험이 쌓이면 스킬 정제가 가능한지 확인합니다:
check_consolidation()스킬 생성:
create_skill(
name="windows-bat-encoding",
description="Windows bat文件中文编码问题的处理方法",
trigger_conditions="创建或编辑.bat文件\n在Windows上运行脚本失败且涉及中文",
steps="将文件保存为ANSI编码\n或使用chcp 65001 + UTF-8 BOM",
caveats="chcp 65001仅在当前cmd会话有效\n某些旧版Windows不支持UTF-8 BOM",
category="encoding"
)4. 검색 적용(적용)
새 작업을 시작하기 전에 관련 경험을 획득합니다:
get_context(task_description="需要创建一个Windows批处理脚本来部署应用")관련 스킬과 사례가 포함된 컨텍스트를 반환하며, 이를 프롬프트에 직접 주입합니다.
메모리 계층 구조
유형 | 설명 | 예시 |
상황 메모리 Episodic | 구체적인 "이야기", 특정 수정의 전체 기록 | "2024-01-15 XX 프로젝트의 bat 인코딩 문제 수정" |
의미 메모리 Semantic | 추상화된 규칙과 교훈 | "Windows에서 bat 파일은 ANSI 인코딩을 사용해야 함" |
스킬 Skill | 표준화된 실행 가능한 작업 가이드 | SKILL.md 파일 |
데이터 저장
SQLite 데이터베이스 (
data/memories.db): 구조화 저장, FTS5 전문 검색 지원JSONL 로그 (
data/observations.jsonl): 원시 관찰 기록의 추가 전용 로그Markdown 파일 (
data/skills/): 생성된 스킬 문서, 사람이 읽을 수 있고 버전 관리 가능
프로젝트 구조
memory-engine/
├── 开发思路.md # 设计文档
├── README.md # 本文件
├── pyproject.toml # Python 项目配置
├── requirements.txt # 依赖列表
├── config/
│ └── settings.json # 引擎配置
├── src/memory_engine/
│ ├── __init__.py
│ ├── server.py # MCP 服务器入口(15个工具)
│ ├── models/
│ │ └── schemas.py # 数据模型
│ ├── observation/
│ │ ├── collector.py # 感知层:错误收集器
│ │ └── signal_detector.py # 感知层:对话信号检测器
│ ├── reflection/
│ │ └── analyzer.py # 反思层:根因分析器
│ ├── consolidation/
│ │ ├── memory_store.py # 存储层:SQLite + FTS5
│ │ └── skill_generator.py # 沉淀层:技能生成器
│ └── application/
│ └── retriever.py # 应用层:记忆检索器
├── data/
│ ├── memories.db # SQLite 数据库(运行后生成)
│ ├── observations.jsonl # 观察日志(运行后生成)
│ └── skills/ # 技能 Markdown(运行后生成)
└── tests/
└── test_engine.py # 测试오류 카테고리
encoding | build_error | runtime_error | test_failure | dependency | configuration | platform_specific | performance | security | best_practice | api_usage | preference | communication | other
설계 철학
외부 LLM에 의존하지 않음: 반성과 스킬 정제는 호출자(에이전트 자체)가 수행하며, 엔진은 프레임워크와 저장소만 제공
MCP 네이티브: 표준 MCP 서버로 실행되며, MCP를 지원하는 모든 에이전트가 직접 연결 가능
인간-기계 협업: 모든 메모리와 스킬은 사람이 읽을 수 있는 형식(Markdown, JSON)으로 저장되어 검토와 유지보수가 용이
점진적 학습: 단일 오류 → 상황 메모리 → 의미 메모리 → 스킬, 계층적으로 추상화하고 점진적으로 정제
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Servers
- AlicenseNot gradedqualityCmaintenanceHelps AI coding agents remember what they learn across sessions by storing and retrieving atomic learnings, enabling persistent memory for AI tools.111MIT
- AlicenseNot gradedqualityBmaintenanceEnables AI agents to learn from their work by recording tasks, extracting patterns, detecting mistakes, and proactively surfacing insights, all using the agent's own model through a cooperative intelligence pattern.MIT
- AlicenseNot gradedqualityBmaintenanceEnables AI agents to store, retrieve, and self-improve procedural memories (lessons learned) based on relevance to the current task, pruning unused memories to reduce context load and prevent repetition of past mistakes.MIT
- AlicenseNot gradedqualityCmaintenanceProvides coding agents with durable, cross-session lessons-learned memory, enforcing that success or failure verdicts can only come from human approval, human correction, or objective metrics—never from the agent itself.Apache 2.0
Related MCP Connectors
Persistent memory and knowledge management for AI agents with semantic search and 50+ tools.
Persistent memory for AI agents — verbatim conversations, searchable by meaning.
Shared debugging memory for AI coding agents
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/top777/memory-engine'
If you have feedback or need assistance with the MCP directory API, please join our Discord server