Skip to main content

MS8 — local memory system. Memory belongs to you, not to tools.

Project description

MS8 — 本地记忆引擎

记忆属于人,不属于工具。
Memory belongs to you, not to tools.

version python license tests platform


为什么是 MS8?

市面上很多 AI 记忆工具都在推云服务——你的记忆数据存在第三方服务器上。

MS8 不同。 你的记忆数据完全存在你自己的电脑上。没有云端,没有上传,没有订阅。

其他工具:  你的对话 → 云端存储 → 他们的服务器
MS8:       你的对话 → 本地存储 → 你的电脑

核心能力

能力 说明
🧠 记忆引擎 写入/检索/注入/压缩,JSONL + SQLite + 知识图谱
🛡️ 治理管道 5 路准入、9 种拦截规则、13 种 PII 检测、风险评分
🔌 MCP 连接 7 个 Tools + 3 个 Resources,支持 10 个 AI 工具
🔒 安全系统 AES-256-GCM 加密 + 影子系统(18 模块)
🔧 自维护 61 项自检查 + 24 条自修复策略 + 25 条维护策略
📊 多 LLM 路由 3 Provider 自动切换 + 语义缓存 + 批量处理

30 秒上手

# 安装
python3 -m venv .venv && source .venv/bin/activate
pip install -e ".[dev]"

# 验证
ms8 doctor

# 写入一条记忆
ms8 ask "remember: 我喜欢用 Python"

# 检索记忆
ms8 ask "我喜欢什么语言?"

# 查看概览
ms8 dashboard

提示:如果项目路径包含空格(例如 New project),pip install -e 在部分环境下可能导致 ms8 入口脚本找不到包。
遇到这种情况请改用 wheel 安装:

python -m build --wheel --outdir dist
pip install --force-reinstall dist/ms8-0.2.3-py3-none-any.whl

连接 AI 工具

MS8 通过 MCP (Model Context Protocol) 连接你的 AI 工具,让它们共享同一份记忆。

支持的工具

工具 状态 配置方式
Claude Desktop ✅ 已验证 ms8 connect apply --target claude_desktop
Claude Code ✅ 已验证 ms8 connect bootstrap --target claude_code
OpenAI Codex ✅ 已验证 ~/.codex/config.toml MCP 配置
Cursor ✅ 支持 ms8 connect apply --target cursor
Windsurf ✅ 支持 ms8 connect apply --target windsurf
Cline ✅ 支持 ms8 connect apply --target cline
Roo ✅ 支持 ms8 connect apply --target roo
Continue ✅ 支持 ms8 connect apply --target continue
Cherry Studio ✅ 支持 ms8 connect apply --target cherry_studio
Hermes ✅ 支持 ms8 connect apply --target hermes
OpenClaw ✅ 支持 ms8 connect apply --target openclaw

MCP 接入流程

# 查看支持的工具
ms8 connect list-targets

# 查看连接指南(手动 / 自动)
ms8 connect guide --mode both

# 查看 AGENTS 模板路径(可自定义)
ms8 connect template --target claude_desktop

# 生成配置
ms8 connect generate --target claude_desktop

# 应用配置
ms8 connect apply --target claude_desktop

# 验证连接
ms8 connect verify --target claude_desktop

两种连接方式

  • 手动连接:generate -> apply -> verify -> smoke
  • Agent 自动配置:bootstrap --target all 一次完成检测、写入、验证

文档入口:

MCP Tools & Resources

Tools (7 个):

Tool 功能
prepare_reply 聚合查询:获取记忆上下文用于回复
submit 写入单条记忆
batch_submit 批量写入多条记忆
query 语义搜索记忆
context 获取对话相关记忆上下文
status 返回系统状态
profile 返回用户画像

Resources (3 个):

Resource 功能
ms8://long-term 长期记忆
ms8://profile 用户画像
ms8://recent 近期记忆

CLI 命令

常用命令

ms8 version          # 版本
ms8 doctor           # 健康检查
ms8 ask "..."        # 快速写入/检索
ms8 dashboard        # 运行概览
ms8 demo             # 演示

维护命令

ms8 watch            # 定时巡检
ms8 backup           # 备份记忆
ms8 cleanup          # 清理旧备份
ms8 clean            # 清理缓存(安全)
ms8 reset            # 重置派生状态
ms8 uninstall        # 卸载

MCP 连接

ms8 connect list-targets     # 列出支持的工具
ms8 connect guide            # 连接说明(manual/agent)
ms8 connect template         # AGENTS 模板路径与快速步骤
ms8 connect bootstrap        # 自动检测+配置+验证
ms8 connect apply            # 应用配置
ms8 connect verify           # 验证连接
ms8 connect smoke            # 冒烟验证(save/search/context/status)
ms8 connect rollback         # 回滚配置

安全与维护

ms8 security enable          # 启用加密
ms8 shadow status            # 影子系统状态
ms8 ops self-check-report    # 自检查报告
ms8 ops self-repair-run      # 自修复
ms8 graph stats              # 知识图谱统计
ms8 review list              # 审批队列

LLM 配置

ms8 llm status               # LLM 状态
ms8 llm setup                # 交互式配置

Labs(实验能力,默认关闭)

MS8 主线默认只开放稳定能力。实验命令会被 gate,需显式开启:

ms8 labs status              # 查看实验开关状态
ms8 labs enable              # 开启实验命令
ms8 labs disable             # 关闭实验命令

常见实验命令(示例):

ms8 synthetic list
ms8 ops meta-run
ms8 ops advanced-insight-status

如果你看到 “labs command disabled by default”,先执行 ms8 labs enable

完整命令列表:ms8 --help(26 个一级命令 + 56 个 ops 子命令)


架构

src/ms8/                           215 文件, 50,566 行
│
├── cli.py                         CLI 入口(26 个命令)
├── runtime.py                     运行时调度
├── paths.py                       统一路径解析
│
├── app/                           治理管道层
│   ├── pipeline/                  准入引擎(5 路由 + 风险评分)
│   ├── rules/                     规则系统(10 个模块)
│   └── review/                    审批服务
│
├── connect/                       MCP 连通层
│   ├── mcp_server/                MCP Server(stdio)
│   │   ├── stdio_server.py        协议处理
│   │   ├── mcp_server.py          Tools/Resources 路由
│   │   └── memory_service_interface.py  统一服务接口
│   └── scripts/                   连接/验证/配置
│
└── engine_core/                   核心引擎层
    ├── core.py                    记忆系统核心(153 方法)
    ├── knowledge_graph.py         知识图谱
    ├── auto_memory.py             自动记忆提取
    ├── security/                  安全层(加密 + 影子系统)
    └── maintenance/               自维护(61 检查 + 24 修复)

数据存储

所有数据存储在本地 ~/.ms8_runtime/ 目录:

~/.ms8_runtime/
├── memory/
│   ├── auto_memory_records.jsonl   # 主记忆记录
│   ├── auto_memory_index.json      # 索引
│   ├── knowledge_graph.db          # 知识图谱
│   ├── memory.db                   # SQLite 存储
│   ├── MEMORY.md                   # 长期记忆文本
│   └── backups/                    # 自动备份
├── health/                         # 健康报告
└── connect/                        # MCP 连接状态

环境变量覆盖路径:

export MS8_HOME=~/custom_path
export MS8_DATA_DIR=~/custom_data
export MS8_CONFIG_DIR=~/custom_config
export MS8_LOG_DIR=~/custom_logs

安全

特性 说明
AES-256-GCM 内存记录加密
Argon2id 密钥派生
影子系统 18 模块,链式哈希事件账本
PII 检测 13 种模式(邮箱/手机/身份证/银行卡等)
9 种拦截规则 阻止敏感内容写入
隔离区 损坏数据自动隔离

自维护

MS8 能自己诊断和修复问题:

  • 61 项自检查:分 L1(快速)→ L4(趋势)四级
  • 24 条自修复策略:分 L1(安全自动)/ L2(半自动)/ L3(需人工确认)
  • 25 条维护策略:调度检查频率和修复时机
  • 自动备份:每 24 小时
# 查看健康状态
ms8 doctor

# 运行自检查
ms8 ops self-check-report

# 运行自修复
ms8 ops self-repair-run --dry-run

说明:

  • l4_capture_trend 出现 warn 时,如果提示“无质量样本(仅噪声/策略丢弃样本)”,属于可解释告警,不代表系统故障。

开发

运行测试

pytest -q                    # 全量测试(123 个)
pytest src/ms8/engine_core/tests/ -q   # 引擎测试

代码检查

ruff check src/ms8/

构建

python -m build --no-isolation

开发者发布与安全流程请见仓库文档(docs/RELEASE_SECURITY.md)。

系统要求

  • Python ≥ 3.10
  • macOS / Linux(Windows 适配计划中)
  • 磁盘空间:约 50MB(引擎)+ 记忆数据

许可证

MIT License


"记忆是习惯的载体。它改变人,也改变模型。记忆是个人资产。"

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ms8-0.2.4.tar.gz (686.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

ms8-0.2.4-py3-none-any.whl (575.3 kB view details)

Uploaded Python 3

File details

Details for the file ms8-0.2.4.tar.gz.

File metadata

  • Download URL: ms8-0.2.4.tar.gz
  • Upload date:
  • Size: 686.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.3

File hashes

Hashes for ms8-0.2.4.tar.gz
Algorithm Hash digest
SHA256 7f04681799c97682e3a92669ec70f2f933748fa0ab1135f9d93b0f30bc8e04f2
MD5 1fd64ba1157fb3224af24324e31b7cc5
BLAKE2b-256 0d22f4ce61ee32a80b639e2c2de9cc9e1de2bd3d3b0e0db308dc9341fa8613f4

See more details on using hashes here.

File details

Details for the file ms8-0.2.4-py3-none-any.whl.

File metadata

  • Download URL: ms8-0.2.4-py3-none-any.whl
  • Upload date:
  • Size: 575.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.3

File hashes

Hashes for ms8-0.2.4-py3-none-any.whl
Algorithm Hash digest
SHA256 053e2b40083ec7e63d6017fd8bab78f45f43d54c7ac72e9de332bdca4b4e5508
MD5 97815589fd3d14536d362be7d22d5d5d
BLAKE2b-256 889615a246d59f5f042073bce6604e1656d3a84d33ec34b0a107007d23a703f3

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page