# Memmy 更新日志 (/docs/cn/changelog) Memmy Desktop、Agent、Memory 与 CLI 的最新更新 [查看全部 GitHub Release](https://github.com/MemTensor/memmy-agent/releases) ## 知识库 v1.1.7 2026-09-21 ### 新功能 - 新增知识库:开启召回后,Agent 任务过程中可以使用知识库,并支持多人分享。 ### 改进与问题修复 - 过滤 Codex 噪声数据,避免污染对话轮次。 - 任务页面现在自动生成标题和摘要,不再显示原始消息内容。 ## Computer History、Computer Use v1.1.6 2026-09-21 ### 新功能 - 新增 Computer History:仅支持 macOS,持续记录桌面操作并自动生成摘要,Agent 对话时可检索这些记录作为上下文。 - 新增 Computer Use,让 Memmy 可以操控电脑。 - 本地模式新增 StepFun 和小米 MiMo 协议支持。 ### 改进与问题修复 - Agent Skill 按内容去重,避免同一 Skill 跨 Agent 重复导入。 - 修复登录后本地任务丢失的问题。 - 修复 Cursor hooks 重复的问题。 - 修复截断的模型推理内容被错误替换为空回复的问题。 ## Bug 修复 v1.1.5 2026-09-15 ### 改进与问题修复 - 放开文件上传个数、大小限制。 ## 记忆服务后台独立运行及问题修复 v1.1.2–v1.1.4 2026-09-09 ### 新功能 - 架构调整,将记忆服务从 Memmy 拆分出来,支持在后台独立运行,用户可以在「设置-偏好」修改该配置。 ### 问题修复 - 修复 1.1.2 中版本升级导致的记忆服务启动失败问题; - 修复 1.1.3 中记忆自动全量扫描所有对话的问题; - 备注1:如果您目前处于 1.1.2 或 1.1.3 版本,请尽快升级至 1.1.4 版本,该版本运行稳定; - 备注2:如果您处于 1.1.3 版本,同时由于记忆全量扫描,而发生了记忆量过大导致服务不断重启的问题,请尝试在「跨 Agent 接入 - 数据管理」中清除本地所有记忆,并升级至 1.1.4,此举动不会影响您本地的原始对话记录。 我们为带给您的不便深感抱歉,感谢您的理解;如有任何问题,欢迎联系:memmy_bot@outlook.com ## Linux 版本、CLI Goal 命令与模型配置修复 v1.1.1 2026-08-26 ### 新功能 - 新增 Linux 一行安装脚本,并更新文档; - 新增 memmy goal CLI 命令,支持从脚本或 CI 中启动和恢复 Goal 任务,无需交互终端。 ### 改进与问题修复 - 修复本地模式配置时 Embedding 模型选择丢失的问题,切换账号模式时选择状态保持同步; - 删除模型时自动清理残留的工作区绑定和运行时配置; - 支持指定检索特定记忆层,可显式配置; - Windows 修复更新安装器的 Unicode 路径问题。 ## 场域认知记忆支持项目隔离、新增用户记忆 v1.1.0 2026-08-24 ### 新功能 - L3 场域认知记忆支持按照项目隔离,自动学习工作区环境、工作约定和领域知识,对话时注入相关记忆; - 新增用户记忆 User Memory,记录用户事实、生活偏好和稳定工作偏好。 ### 改进与问题修复 - Agent 长任务中途可压缩旧上下文,保留当前轮结果和完整存档,不再因上下文溢出中断; - 文件编辑改用带校验的 patch 格式,多文件操作失败时整体回滚; - Windows 升级优化,不再丢失配置; - 修复 Win 系统 Deepseek Harness 扫描失败的问题; - 记忆服务启动改为后台执行,不再启动失败;修复连接与工具连接失败问题,支持后端启动后热加载。 ## Git 工作区、Skill 扫描与召回、应用内更新 v1.0.9 2026-08-20 ### 新功能 - 会话页面新增 Git 信息展示,支持查看文件变更与渲染 diff,可直接切换或创建本地分支; - 除了自动沉淀 Skill,现在支持自动扫描用户安装在不同 Agent 的 Skill 并写入记忆,支持对话时跨 Agent 召回,用户无需再多次安装; - 桌面端新增应用内更新提醒。 ### 改进与问题修复 - TUI 中可直接调整正在执行的 Goal,无需等待当前轮次结束; - Agent 会话历史扫描移入独立进程,导入时更加稳定; - 降低记忆召回最低分阈值,减少相关记忆被误过滤的情况; - 修复国内与国际版登录态串扰问题。 ## 改进与问题修复 v1.0.8 2026-08-18 ### 改进与问题修复 - 「添加更多 Agent」流程简化,可以手动指定对话历史文件/目录路径,也可以让 Memmy 自动发现; - Agent 任务轮次路由和记忆检索现在并行执行,减少每轮对话开始时的等待时间,同时仍然保留路由决策的依据; - 记忆服务优化了关闭和启动时的锁处理,减少异常退出后的启动失败; - Windows/macOS 打包加固。 ## Deepseek Harness 适配、Goal 模式、支持添加多个自有模型 API v1.0.7 2026-08-17 ### 新功能 - 已适配 Deepseek Harness,接入长期、历史记忆; - 新增 Goal 模式,长任务下可保留目标和进度,并在其他对话中继续执行,输入“/”唤起; - 现已支持添加多个自有 API 模型配置,在会话中随时切换任务模型; - IM 渠道的所有历史消息,已支持在任务列表中展示。 ### 改进与问题修复 - 优化设置页分栏、模型配置方式; - 改进任务路由、召回查询与 episode 处理,减少记忆捕获和检索状态不一致; - 终端会在配置迁移完成后连接 Gateway,并改进启动、重启与会话恢复; - 改进记忆处理,包含会话准入、取消、转录同步和工具结果处理,减少重复或不完整的消息状态。 ## 适配更多 Agent、问题修复 v1.0.6 2026-08-12 这次更新适配更多 Agent,新增 Windows 清理工具,并修复本地工具接入、Claude Code 工具结果、报错提示、接口用量和时间偏移问题。 ### 新功能 - 本次迭代已适配 Pi、QwenWork; - 新增 Windows 清理工具,可按确认范围移除 Memmy 安装、运行数据、更新器状态和 CLI 产物。 ### 改进与问题修复 - 修复 Windows Hook 命令路径在 cmd.exe 和 PowerShell 下的引号处理,降低本地工具接入失败概率; - 修复 Claude Code 工具结果被误认为是用户提问的问题; - 改进 Agent 任务和记忆处理报错,提示更清晰; - OpenAI 兼容的 Chat Completions 接口改进为返回真实 token 用量; - 统一 Agent 配置、Memory 捕获与召回、日期筛选和仪表盘中的时间偏移,减少跨时区场景下的时间展示误差。 ## 记忆支持时间感知、飞书接入更便捷 v1.0.5 2026-08-06 这次更新增强了带时间范围的记忆召回、飞书机器人接入和关联内容跳转,并提升记忆写入、错误提示和桌面安装包可靠性。 ### 新功能 - 记忆召回支持时间感知:带有明确时间范围的问题,L1 记忆召回更准确。 - 工具与连接:飞书机器人新增二维码配置方式,接入更便捷。 - 记忆、任务、经验、场域认知、技能页面新增关联内容跳转,可快速定位。 ### 改进与问题修复 - 取消、中断或不完整的会话不再占用 episode,也不会生成 L1 记忆,提升记忆写入可靠性。 - 优化首次报告和本地 AI 工具接入交接,并将生成的报告保存为真实对话和交接记忆,避免首次体验后重复运行 Agent。 - 错误提示优化:额度不足、无效 Agent 配置和 Memory 服务不可用等情况,会给出更明确的报错提示,减少静默回退。 - 提升桌面安装包可靠性:剔除无关文件,并内置默认本地 embedding 模型资源。 ## 项目工作区、浏览器自动化与长期记忆 v1.0.4 2026-07-30 这次更新让 Memmy 能围绕项目组织工作,并提升 Agent 浏览器操作、长期记忆和本地数据安全。 ### 新功能 - 新增项目级桌面工作区,让对话、工作目录和文件访问始终绑定到所选项目。 - 新增内置浏览器自动化和 ui-craft Skill,可完成网页交互、调试、本地预览与界面视觉验收。 - 新增按需 Agent Memory 接入,可导入所选本地 AI 工具的历史并持续增量同步。 ### 改进与问题修复 - 命令取消或超时时会结束子进程树,减少残留任务和输出流。 - 改进长期记忆的子目标与避错经验提取,并让完成的对话更快可检索、失败原因更易诊断。 - 升级说明:首次启动会迁移旧工作区,并保留已有消息、标题、置顶和归档状态。 - 记忆数据库导出现在会包含已提交的 WAL 数据,避免得到不完整的 SQLite 快照。 ## 更可靠的 Agent 与 Memory v1.0.3 2026-07-24 这次更新重点增强 Agent 恢复、文件记忆控制和 Memory 处理的可靠性与诊断能力。 ### 新功能 - 新增 fileMemory.enabled 开关,可独立控制本地文件记忆、Recent History 和 Dream 功能。 - Agent 修改受支持文件后会进行有针对性的格式与语法校验。 ### 改进与问题修复 - 升级会保留登录状态和本地 BYOK 配置,并改进 Token 配额状态、任务切换与 Markdown 展示。 - 改进 Agent Gateway 恢复和长回复能力;历史导入遇到损坏的 JSONL 记录时会跳过该记录,而不是中断全部同步。 - 增强记忆导入、嵌入、检索、摘要和演化流程的重试、回退、模型路由与诊断。 - 升级说明:文件记忆默认关闭,需要手动启用 fileMemory.enabled;旧版内置 my 工具及相关配置已移除。 ## 可恢复的记忆同步与更清晰的更新体验 v1.0.2 2026-07-21 这次更新让历史与记忆处理可以从中断处继续,并改善桌面更新、错误提示和数据迁移。 ### 新功能 - 新增“回到最新”控件,可快速返回对话的最新内容。 ### 改进与问题修复 - Agent 历史同步加入持久化检查点和增量扫描,中断或失败后可继续处理。 - 记忆处理会展示失败阶段、服务商原因和重试状态,并更准确地区分模型端点的无效响应。 - 桌面更新会展示下载进度并等待 Memory 健康检查,同时修复 macOS 隐私设置变化后的重新打开问题。 - 升级说明:schema-v3 数据库会先备份再迁移到 v4;memmy-memory --version 现在只输出版本号。 ## 首个公开桌面版本 v1.0.1 2026-07-17 Memmy 首次提供面向 macOS Apple Silicon 和 Windows x64 的公开桌面安装包。 ### 新功能 - 首次公开提供适用于 macOS Apple Silicon 和 Windows x64 的 Memmy 桌面安装包。 ### 改进与问题修复 - 补充首次安装指引,说明如何在 macOS 隐私与安全性设置或 Windows SmartScreen 中允许 Memmy 运行。 # Memmy (/docs/cn) 让所有 AI,都记得同一个你。 Memmy 是你的**个人记忆中枢**,也是懂你的专属 Agent,让**所有 AI 连接同一份记忆,在协同中持续进化**。 它将你的知识、偏好和项目经验沉淀为个人记忆,并让 Cursor、Claude Code、Codex、OpenClaw 等不同 Agent 共享同一份上下文。 提供桌面应用、CLI 和 API,让你以不同方式使用同一套长期记忆。一次积累,多处使用。 * 下载 Memmy 桌面应用,几分钟完成引导 * BYOK 模式,接入你已有的模型额度 * 把 Cursor、Claude Code、Codex 的历史变成记忆 ## Memmy 是什么 [#memmy-是什么] Memmy 不是只有一个聊天窗口的应用,而是一套完整的本地 Agent Runtime: * **桌面端**提供任务工作台、桌宠、记忆面板、工具连接和设置页。 * **Agent Runtime** 负责对话、工具调用、MCP、定时任务、长任务、会话和技能。 * **Memory 服务**负责记忆的写入、检索、归档和分析,默认使用本地 SQLite。 * **本地后端**负责账号、配置、集成、Agent 来源扫描、Skill 安装和本机 API。 * **CLI 和 HTTP API** 让外部 Agent、脚本或其他产品也能接入 Memmy。 ### 适合谁 [#适合谁] * 同时使用多个 AI 编码/对话工具(Cursor、Claude Code、Codex、Opencode、OpenClaw、Hermes),希望它们共享同一套记忆的人。 * 希望数据本地优先、自带 API Key 的开发者。 * 想要一个常驻桌面、随叫随到的 Agent 入口(桌宠)的日常用户。 ## 你需要准备 [#你需要准备] * 一台 macOS 或 Windows 设备(桌面端),或 Node.js `>=22` 环境(CLI / 源码态)。 * 账号模式:一个 Memmy 账号(含平台体验 Token)。 * 或 API Key 模式:任一支持的模型 Provider 的 API Key。 ## 工作原理 [#工作原理] Memmy 系统架构 ## 核心能力 [#核心能力] * 扫描 Cursor、Claude Code、Codex 等来源的历史对话,去重入库,统一检索。 * 配置在 `~/.memmy/config.yaml`,记忆在本地 SQLite,接口用 token 保护。 * 多会话任务、流式输出、附件、语音输入和 Slash command。 * 透明置顶小窗,随时接收文本或语音任务,与主工作台同步。 * Telegram、微信、飞书、钉钉等渠道,GitHub、Notion、Slack 等托管集成。 * OpenAI 兼容、Anthropic、Gemini、DeepSeek、Ollama 等众多 Provider。 ## 快速开始 [#快速开始] 1. 下载并启动 Memmy 桌面应用;或编译 `App/memmy-agent` 后使用 CLI。 2. 选择账号模式或 API Key 模式,配置主模型并完成一次连接测试。CLI 用户运行: ```bash memmy onboard ``` 3. 在主工作台发送第一条任务;或在终端里: ```bash memmy agent --message "你好,介绍一下当前工作区" ``` 建议第一个里程碑保持很小:先让桌面端或 CLI 成功发出一轮普通回复,再继续配置工具、渠道、MCP、记忆扫描和桌宠。 ## 配置 [#配置] 主配置默认在 `~/.memmy/config.yaml`,支持 `${ENV_NAME}` 环境变量引用: ```yaml agents: defaults: model: openai/gpt-4.1 provider: openai timezone: "+08:00" providers: openai: apiKey: ${OPENAI_API_KEY} ``` ## 接下来 [#接下来] 完整安装与首次配置概览、条目、策略、世界模型与日志把 Memmy 接进你的 IMmemmy 与 memmy-memory 命令进程、端口与数据流FAQ 与排障入口 # 消息渠道 (/docs/cn/channels) Memmy 可以接入常用 IM,让你在聊天软件里直接使唤 Agent。已支持: **Telegram · Discord · iMessage · WeChat · Feishu · DingTalk** ## 连接方式 [#连接方式] | 渠道 | 方式 | | ----------------------------- | ------------------------------------------------ | | WeChat | 扫码登录,弹窗内轮询扫码结果 | | Feishu | `appId` + `appSecret` 表单;权限不足时解析缺失 scope 并给出申请链接 | | DingTalk | `clientId` + `clientSecret` 表单 | | Telegram / Discord / iMessage | 在工具页按弹窗指引连接 | 连接状态每 5 秒自动刷新;已连接渠道可随时断开。渠道配置由本地后端通过 memmy-agent admin client 写入运行时。 # 本地架构 (/docs/cn/concepts/architecture) Memmy 桌面端、Agent Runtime、Memory 服务与本地后端的组件关系。 Memmy 系统架构 ## 核心概念 [#核心概念] | 概念 | 说明 | | -------------- | ---------------------------------------------------------------------------- | | Workspace | Agent 工作目录,默认 `~/.memmy/workspace`,运行时同步模板、内置技能和记忆文件 | | Config | `~/.memmy/config.yaml`,可用 `MEMMY_CONFIG` 或 `--config` 覆盖 | | Agent Runtime | 模型调用、消息循环、工具注册、MCP、会话、长任务、技能、自动压缩、记忆钩子 | | Memory Service | 本地优先记忆底座,入口 `Memory/src/server/index.ts`,默认 `:18960` | | Local Backend | 桌面本地 API 后端:SQLite app state、权限、Cloud/Memory client、来源扫描、Skill 写入、Fastify 路由 | | Agent Source | 外部 Agent 历史的读取适配器 + 可选 Skill 安装目标 | | Dream | 记忆整理机制,手动或周期触发 | # 完整功能列表 (/docs/cn/concepts/features) ## 亮点 [#亮点] 九种外部 Agent 来源,扫描去重入库多会话、附件、语音、Slash command透明置顶小窗,随叫随到20+ 托管集成 + 自定义 MCP6 种 IM 渠道接入15+ Provider,自有额度。 ## 完整列表 [#完整列表] ### 记忆 [#记忆] * 外部来源扫描:Cursor、Claude Code、Codex、OpenCode、OpenClaw、Hermes、WorkBuddy、Pi、qwenwork * 记忆面板:概览、条目、任务、策略、世界模型、技能、分析、日志 * Dream 整理:手动 / 周期触发,可查看日志和回滚 * memmy-memory CLI 与 Memory Runtime HTTP API * 外部 Agent Skill 安装(主动读写记忆) ### 桌面端 [#桌面端] * 多会话任务列表:分组、置顶、归档、搜索、未读提示 * 流式输出、停止 / 重启、Agent 状态面板 * 附件(图片 + 常见办公文档)、语音输入(ASR) * Slash command、Agent 产物预览 * 桌宠模式:输入气泡、多任务气泡、回答预览、会话续接 ### 模型与认证 [#模型与认证] * 账号模式(平台 Token)与 API Key 模式(BYOK) * 主模型、Embedding、记忆摘要、技能进化、ASR、图像生成六类模型独立配置 * 15+ Provider,含 OAuth 登录 ### 工具与自动化 [#工具与自动化] * 内置工具:文件、shell、Web 搜索与抓取、定时任务、长任务、图像生成等 * Composio 托管集成 + 自定义 MCP server(stdio / sse / streamableHttp) * 6 种消息渠道 ### 接口 [#接口] * OpenAI 兼容 API(`memmy serve`) * Memory Runtime API、桌面本地 API、SSE 事件流 # 桌宠模式 (/docs/cn/desktop/pet) 桌宠是透明置顶的小窗入口,适合随手发任务、不打断当前工作。 ## 交互 [#交互] * 单击展开输入气泡,`Enter` 发送,支持录音转写。 * 双击退出桌宠,打开完整工作台。 * 左键拖动移动窗口;右键菜单可打开完整模式。 * 运行中或有未读完成任务时显示数字徽标,点击展开 mini 任务列表(最多 6 个)。 ## 会话续接 [#会话续接] * 有运行中任务时续接同一 session;最近 5 分钟内完成的任务也会续接。 * 点击「新会话」后,下次发送创建新 session。 * 桌宠和完整模式共享 WebUI thread,切换后上下文不丢。 # 设置 (/docs/cn/desktop/settings) | 区块 | 内容 | | ----- | -------------------------------------------------------- | | 账号 | 昵称编辑、完整联系方式、退出登录 / 退出本地模式 | | 模型 | 平台模式与自有模型模式切换,主模型 / 记忆摘要 / 技能进化 / Embedding / ASR / 生图配置 | | Token | 平台赠送 Token 或 BYOK 用量统计、低余量提示、申请更多 | | 通用 | 简体中文 / English | | 窗口 | 默认启动模式(桌宠 / 完整 / 上次)、关闭行为、状态栏图标 | | 通知 | 更新通知、任务完成通知、声音 | | 隐私 | 记忆改进计划开关、数据协议 | | 开发者 | 日志级别、打开日志目录、导出脱敏诊断报告 | | 关于 | 版本、检查更新、服务条款 | 诊断报告不包含 secrets、tokens、账号标识、提示词或任务消息。 # 主工作台 (/docs/cn/desktop/workbench) `/main` 是完整的 Agent 工作台:左侧任务列表,中间消息流,底部输入框。 ## 输入与发送 [#输入与发送] * `Enter` 发送,`Shift + Enter` 换行;支持中文输入法组合态。 * `+` 按钮添加附件:最多 4 个,单文件 10MB,支持图片和 `.pdf`、`.docx`、`.xlsx`、`.pptx`、`.md`、`.csv`、`.json` 等常见格式。 * 麦克风按钮语音输入(需配置 ASR 模型),转写结果合并进输入框。 * 任务运行时发送按钮变为停止按钮。 ## Slash command [#slash-command] 输入 `/` 打开命令面板: | 命令 | 作用 | | ---------------- | ------------- | | `/new` | 开始新任务 | | `/stop` | 停止当前任务 | | `/restart` | 重新运行当前任务 | | `/status` | 查看 Agent 运行状态 | | `/model` | 查看当前模型配置 | | `/goal` | 查看或管理目标状态 | | `/dream` | 手动触发记忆整理 | | `/dream-log` | 查看整理记录 | | `/dream-restore` | 恢复整理前状态 | | `/help` | 帮助 | ## 任务列表 [#任务列表] 按置顶、今天、昨天、最近 7 天、更早、已归档分组。支持重命名、置顶、归档、恢复、删除;运行中任务显示旋转状态,完成未读任务显示未读点。`Cmd/Ctrl + K` 呼出任务搜索。 # 本地开发与打包 (/docs/cn/development/local-dev) ## 一键启动 [#一键启动] 三步即可跑起来: ```bash git clone https://github.com/MemTensor/memmy-agent.git && cd memmy-agent cp .env.example .env # 已预填云服务地址,开箱即用 bash scripts/dev-start.sh # 装依赖 → 构建 → 起全套服务 ``` `scripts/dev-start.sh` 一条命令完成全部:自动安装依赖、构建 Memory 与 memmy-agent、把 `memmy` / `memmy-memory` CLI 安装到 `~/.local/bin`,并同时拉起 Memory、Agent API、Gateway、前端和桌面后端。启动后在弹出的桌面应用里完成账号登录或 BYOK 配置,脚本会在模型配置写好后自动启动 agent 服务。 > `.env` 中 `MEMMY_CLOUD_SERVICE` 默认指向 `https://api.memmy.cn`(只填写域名,不要追加 `/api`,客户端会自动拼接接口路径),复制即连官方云服务——无需自建后端、无需自备 API Key。Windows 请在 Git Bash 中运行;脚本会把 `~/.local/bin` 加入 PATH。 ## 环境要求 [#环境要求] Node.js `>=22` + npm。根目录 workspace 包括 `Memory`、`App/backend/local-api-contracts`、`App/backend`、`App/frontend/*`、`App/shell/desktop/interface`、`App/shell/*`。 ## 常用命令 [#常用命令] ```bash npm install # 根目录安装依赖 npm run dev:desktop # 同时启动桌面前端 Vite 和 Electron 壳 npm run build # 构建 Memory 和所有 workspace npm run lint npm run typecheck npm run test npm run db:migrate # 后端数据库迁移 npm run package:mac # 打包 macOS DMG npm run package:win:x64 ``` ## Memory 单独开发 [#memory-单独开发] ```bash npm run memory:serve:dev -- \ --host 127.0.0.1 \ --port 18960 \ --db ~/.memmy/memory-service/memory.sqlite \ --config ~/.memmy/config.yaml ``` ## memmy-agent 源码态 [#memmy-agent-源码态] ```bash cd App/memmy-agent npm install && npm run build node dist/main.js onboard node dist/main.js agent --message "你好,介绍一下当前工作区" node dist/main.js serve ``` # 常见问题 (/docs/cn/help/faq) 普通聊天机器人只处理当前会话。Memmy 维护本地记忆、扫描外部 Agent 历史、安装 Agent Skill,并把桌面端、CLI、Memory 服务和工具连接放在同一个运行环境里。 不一定。桌面端支持账号模式和 API Key 模式;API Key 模式使用你自己的模型额度,数据仍以本地优先方式保存。 可以。它们只影响语音输入和 Agent 生图,是可选能力,不阻塞普通对话和记忆功能。 先运行 Memory 服务,再安装 CLI,然后 为 Codex、Cursor、Claude Code、Opencode、OpenClaw 或 Hermes 安装对应 Skill。 默认在 `~/.memmy` 下,包括配置、workspace、Memory SQLite 数据库和运行时文件。 扫描和入库都在本地完成,记忆写入本地 SQLite。是否参与「记忆改进计划」由隐私设置中的开关显式控制。 # memmy-memory CLI (/docs/cn/memory/memory-cli) 供外部 Agent 或脚本访问 Memory 服务: ```bash memmy-memory init memmy-memory health memmy-memory search "项目里的记忆策略" memmy-memory add "这是一条需要保存的知识" memmy-memory get memmy-memory delete ``` 默认连接 `http://127.0.0.1:18960`。可用 `--url`、`--token`、`--config`、`--source`、`--user-id` 指定目标服务、认证、调用来源和用户命名空间。 另支持 `reload-config`、`session open/close`、`turn start/complete` 和 `raw` 调用。 # 记忆是如何工作的 (/docs/cn/memory/overview) Memmy 的记忆由本地 Memory 服务承载。默认服务地址是 `http://127.0.0.1:18960`,数据保存在 `~/.memmy/memory-service/memory.sqlite`。Hook、插件、`memmy-memory` CLI 和桌面端最终都读写这一个服务,因此不同 Agent 可以共享同一套记忆。 ## 一次请求的完整链路 [#一次请求的完整链路] 链路可以拆成七步: 1. Hook 或插件在请求进入 Agent 前打开或复用 Memmy 会话,并调用 `turn.start`。 2. Memory 服务在新 episode 的第一轮判断请求意图,决定是否召回以及允许召回哪些层。 3. 查询被整理为语义查询、关键词、短词模式和结构化错误片段。 4. 各召回通道并行返回候选,再按记忆层、通道排名、质量和时间衰减融合。 5. 候选经过相对阈值、去重、MMR 多样性选择和可选的 LLM 过滤。 6. 命中项被渲染为“历史上下文”注入 Agent;当前用户请求始终优先。 7. 回合结束后,`turn.complete` 写入原始回合和 L1 轨迹,后台任务再继续摘要、反思、评分、向量化和高层记忆演化。 ## 四个记忆层 [#四个记忆层] | 记忆层 | 保存什么 | 如何产生 | | -------------- | ------------------------------------- | ------------------------------------ | | L1 Trace | 用户请求、Agent 回复、工具调用、结果、反思、错误签名与来源 | `turn.complete`、历史扫描或显式 `memory.add` | | L2 Policy | 从相似且有价值的 L1 中归纳出的触发条件、步骤、边界、验证方式和避坑经验 | reward 后的 L2 induction | | L3 World Model | 关于项目、环境和约束的稳定场域认知,不是操作步骤 | 从 L2 policy 集群抽象 | | Skill | 可调用的 SOP,包括名称、触发说明、执行步骤和验证条件 | 从满足条件的 L2 Policy 结晶并验证 | ## 写入、索引与演化 [#写入索引与演化] ### 自动回合采集 [#自动回合采集] `turn.complete` 会先保存 Raw Turn,然后按捕获到的步骤写入 L1。默认会保留: * 最多 4,000 字符的用户或 Agent 文本; * 每个工具输出最多 2,000 字符; * 最多 8 个派生标签; * 工具名、输入、结果、错误签名、回合状态和来源 Agent; * 启发式摘要,随后可由摘要模型异步改写; * `value`、`alpha` 和 `priority` 等质量信号。 当前默认开启反思合成和写入后向量化。L1 使用摘要文本生成 `vec_summary`;L2、L3 和 Skill 使用统一的 `vec`。索引失败会进入重试队列,不会阻塞当前 Agent 回合。 ### 显式写入和历史导入 [#显式写入和历史导入] `memory.add` 默认写入 L1,也可以显式指定其他层。普通手动写入会立即进入文本索引并异步生成向量。 从 Agent 历史扫描导入的 L1 会先进入 `summary_queued` 流程,完成摘要和向量索引后才参与召回,避免半成品记忆被提前注入。 ### Episode、反馈与高层记忆 [#episode反馈与高层记忆] * 连续 follow-up 默认合并到同一 episode,最大间隔为 2 小时。 * episode 因主题切换、会话关闭或空闲 2 小时而关闭后,会先生成/评分反思。 * 默认等待 30 秒反馈窗口,再计算任务奖励并向 episode 内的 L1 反向传播。 * 达到条件的 L1 进入候选池并归纳为 L2;新 L2 会继续触发 L3 抽象和 Skill 结晶。 * 用户明确反馈、工具连续失败和成功/失败分布还会修正价值、生成避坑经验或 decision repair。 关键演化默认值: | 配置 | 默认值 | 作用 | | ----------------------------------------- | ------: | ----------------------------------------------------- | | `capture.synthReflection` | `true` | episode 关闭后合成和评分反思 | | `capture.embedAfterCapture` | `true` | 写入或演化后异步生成向量 | | `capture.batchThreshold` | `12` | 长 episode 进入批量反思的步数阈值 | | `reward.gamma` | `0.9` | 按轨迹位置衰减较早步骤的奖励权重 | | `reward.lambda` | `0.5` | 在均匀权重与 gamma 位置衰减权重之间进行混合 | | `reward.delta` | `0.1` | 从无关步骤恢复到相关步骤时的额外权重系数 | | `reward.decayHalfLifeDays` | `30` | L1 priority 的时间衰减半衰期 | | `reward.feedbackWindowSec` | `30` | episode 关闭后等待显式反馈的时间 | | `l2Induction.minTraceValue` | `0.005` | L1 进入 L2 候选池的最低价值;同时必须已有向量 | | `l2Induction.minEpisodesForInduction` | `1` | 归纳 L2 所需的不同 episode 数 | | `l2Induction.minSimilarity` | `0.65` | L1 与已有 L2 的最低关联相似度 | | `l2Induction.candidateTtlDays` | `30` | L2 候选证据保留时间 | | `l2Induction.minGain` | `0.02` | 激活 L2 Policy 的最低收益 | | `l2Induction.archiveGain` | `-0.05` | 归档 L2 Policy 的收益阈值 | | `l3Abstraction.clusterMinSimilarity` | `0.3` | L2 聚成同一场域认知的最低相似度 | | `l3Abstraction.minConfidenceForRetrieval` | `0.2` | L3 可以参与召回的最低置信度 | | `skill.minEtaForRetrieval` | `0.1` | Skill 结晶时使用的 eta 阈值;实际召回还受 `retrieval.minSkillEta` 约束 | | `skill.minSupport` | `1` | Skill 结晶所需的最低证据数 | | `skill.minGain` | `0.02` | Skill 结晶所需的最低收益 | ## 召回在什么时候发生 [#召回在什么时候发生] 不同入口使用不同记忆层: | 检索模式 | 默认允许的层 | 用途 | | ---------------------------------- | -------------- | --------------------------- | | `turn_start` / `search` | Skill、L2、L1、L3 | 普通请求前自动召回或手动搜索 | | `tool_driven` / `sub_agent` | L2、L1、L3 | 工具决策或子 Agent 任务,不自动带入 Skill | | `skill_invoke` / `decision_repair` | Skill、L2、L1 | 调用指定 Skill 或失败后的决策修复 | | `world_model` | L3 | 只查询场域认知 | 新 episode 的第一轮还会做意图门控: | 意图 | 召回层 | | ------------- | ------------------ | | 任务或无法确定 | Skill、L2、L1、L3 | | 询问“以前是否记得” | Skill、L2、L1,不召回 L3 | | 闲聊或 Memmy 元命令 | 跳过召回 | `turn_start` 会排除当前 session 自己的 L1,防止刚发生的内容通过长期记忆路径回声式重复;L2、L3 和 Skill 不受这个排除规则影响。 `readOnlyInjectionProfile` 只在 `domain: research` 时缩小召回层:可选 `experience`(仅 L2)、`skill`、`skill_experience` 或 `all`。非 research 域始终按 `all` 处理。 ## 查询如何被准备 [#查询如何被准备] 1. 如果配置了 evolution 模型,服务先从完整请求中提取一个更适合向量化的语义查询和最多 5 个关键词。提取失败时使用原始请求和规则关键词,不会中断搜索。 2. 中文短语会补充二字模式;代码、路径和错误文本会提取结构化片段。 3. 只有数据库中存在可用向量时才生成查询向量;查询向量超时或失败时,全文、短词和结构通道仍可继续。 4. `enableQueryRewrite` 默认关闭。开启后,evolution 模型会生成 3 个互补查询,每个查询独立召回,再用独立的 RRF 合并结果。 ## 到底有几路召回 [#到底有几路召回] 从“检索方法”看有 **4 类**;从 ranker 的 channel 名称看有 **6 个**: `vec`、`vec_summary`、`vec_action`、`fts`、`pattern`、`structural`。 | 方法 | Channel | 使用范围 | 默认候选量与门槛 | | -------------- | ---------------------------------------------- | ---- | ----------------------------------------------------------- | | 语义向量 | L1 使用 `vec_summary` / `vec_action`;其他层使用 `vec` | 所有层 | Skill 12、L1 20、L2 20、L3 8;L1/L2/Skill 相似度至少 0.25,L3 至少 0.15 | | SQLite FTS5 全文 | `fts` | 所有层 | 每层最多 20;最多取 5 个全文词,词多于 2 个时按三词组合匹配 | | 短词/中文模式 | `pattern` | 所有层 | 每层最多 20;覆盖二字中文片段和两字符 ASCII 短词,使用字段包含匹配 | | 结构化片段 | `structural` | 仅 L1 | 最多 10;匹配错误签名、路径、错误码等高辨识度片段 | 候选量来自以下公式: * 向量池:`对应 tierTopK × candidatePoolFactor`; * 默认分别是 Tier 1:`3 × 4 = 12`,Tier 2:`5 × 4 = 20`,Tier 3:`2 × 4 = 8`; * FTS 和 pattern:`max(对应 tierTopK, keywordTopK)`,默认都是 20; * 所有通道合并后,再按 Tier 截断为 12 / 20 / 8。 本地 SQLite 向量检索会先从相应层和字段的最近 2,000 条向量记录中建立本次搜索窗口,再交给 sqlite-vec 取 Top K;这个 2,000 是当前固定常量,不在 `config.yaml` 中。 ## 候选如何过滤、融合与排序 [#候选如何过滤融合与排序] ### 进入 ranker 前 [#进入-ranker-前] * 只读取 `activated` 和 `resolving` 状态;`archived`、`deleted` 和未完成导入索引的记录不会进入召回。 * Skill 必须是 `active` 或 `candidate`,且 `eta >= minSkillEta`,默认 0.1。 * L3 的置信度必须达到 `l3Abstraction.minConfidenceForRetrieval`,默认 0.2。 * `tagFilter: auto` 只约束 L1 向量通道:先按查询推导出的标签检索;如果没有标签命中,会放宽为无标签的摘要向量检索。`on` 始终严格,`off` 不使用这个标签门控。 ### 相关度融合 [#相关度融合] 每个候选先取所有命中通道中的最高分,再叠加层级质量: ```text L1 bonus = min(weightPriority, 0.3) × max(value, 0) × 时间衰减 Skill bonus = skillEtaBlend × eta L2 bonus = 0.2 × clamp01(gain,或反馈经验的 salience / confidence) RRF bonus = 0.4 × Σ 1 / (rrfConstant + channelRank + 1) relevance = max(channelScore) + 层级 bonus + RRF bonus ``` ### 阈值、episode 聚合与 MMR [#阈值episode-聚合与-mmr] 1. 每个 Tier 的预排序候选池先按相关度、命中通道数和向量分排序。 2. 同一 episode 如果至少有 2 条高位 L1,且代表轨迹的向量相似度达到 0.45、value 不为负,会生成最多包含 6 步的 episode rollup。 3. 低于最高相关度 20% 的候选被丢弃;默认开启多通道豁免,命中至少 2 个通道的候选可以保留。 4. 对长标识符、错误码等高熵查询,L1/L2 还必须有 FTS、pattern 或 structural 的关键词确认;Skill 和 L3 例外。 5. MMR 以 `0.7 × relevance - 0.3 × redundancy` 选择结果。默认 smart seed 要求每个 Tier 的首个候选至少达到全局最高相关度的 70%。 6. 最后去重同一 episode 的单条 L1 与 rollup,并在 Skill 已覆盖同一 Policy 时抑制重复 L2。 `tier1TopK=3`、`tier2TopK=5`、`tier3TopK=2` 同时决定候选池大小和默认全局返回上限 `3 + 5 + 2 = 10`,但它们不是最终结果中每个 Tier 的硬配额。请求显式传入 `limit` 时,最终 MMR 使用请求值。 ### LLM 最终过滤 [#llm-最终过滤] 默认在机械排序后优先使用 evolution 模型做相关性过滤;未配置 evolution 模型时会尝试 summary 模型: | 配置 | 默认值 | 作用 | | ----------------------------- | -----: | --------------------- | | `llmFilterEnabled` | `true` | 是否启用最终语义过滤 | | `llmFilterMinCandidates` | `1` | 至少有多少条机械候选才调用 LLM | | `llmFilterMaxKeep` | `8` | LLM 成功时最多保留数量 | | `llmFilterFallbackMaxKeep` | `6` | 未配置 LLM、超时或返回异常时的保底上限 | | `llmFilterCandidateBodyChars` | `500` | 每条候选提供给过滤模型的正文字符数 | LLM 可以明确丢弃全部候选;如果输出格式无效或调用失败,则保留机械排序的前 6 条。 ## 如何注入 Agent 上下文 [#如何注入-agent-上下文] 命中项会按以下顺序渲染: 1. L1 Trace 和相似 episode; 2. L2 Policy; 3. L3 Environment Knowledge; 4. Skill; 5. 从经验中提炼出的 decision guidance。 普通片段最多 640 字符。Skill 默认使用 `summary` 模式,只注入名称和最多 200 字符的描述;可改为 `full`,但仍受单片段 640 字符上限约束。最终 Markdown 会明确说明这些内容只是历史记忆,需要与当前请求和当前仓库状态核对。 ## 在 config.yaml 中调整 [#在-configyaml-中调整] 主配置默认是 `~/.memmy/config.yaml`;设置 `MEMMY_CONFIG` 时使用该路径。下面是当前有效的核心参数及默认值,可以只保留你要覆盖的字段: ```yaml memmyMemory: version: 1 domain: "" algorithm: enableMemoryAdd: true enableMemorySearch: true enableQueryRewrite: false capture: maxTextChars: 4000 maxToolOutputChars: 2000 synthReflection: true embedAfterCapture: true batchThreshold: 12 reward: gamma: 0.9 lambda: 0.5 delta: 0.1 decayHalfLifeDays: 30 feedbackWindowSec: 30 l2Induction: minEpisodesForInduction: 1 minSimilarity: 0.65 candidateTtlDays: 30 minTraceValue: 0.005 minGain: 0.02 archiveGain: -0.05 l3Abstraction: minPolicies: 1 minPolicyGain: 0.02 minPolicySupport: 1 clusterMinSimilarity: 0.3 minConfidenceForRetrieval: 0.2 skill: minEtaForRetrieval: 0.1 minSupport: 1 minGain: 0.02 candidateTrials: 1 session: followUpMode: merge_follow_ups mergeMaxGapMs: 7200000 retrieval: tier1TopK: 3 tier2TopK: 5 tier3TopK: 2 candidatePoolFactor: 4 weightPriority: 0.4 mmrLambda: 0.7 rrfConstant: 60 relativeThresholdFloor: 0.2 minSkillEta: 0.1 minTraceSim: 0.25 episodeGoalMinSim: 0.45 tagFilter: auto keywordTopK: 20 skillEtaBlend: 0.15 smartSeed: true smartSeedRatio: 0.7 multiChannelBypass: true skillInjectionMode: summary skillSummaryChars: 200 llmFilterEnabled: true llmFilterMaxKeep: 8 llmFilterFallbackMaxKeep: 6 llmFilterMinCandidates: 1 llmFilterCandidateBodyChars: 500 readOnlyInjectionProfile: all ``` 保存后执行: ```bash memmy-memory reload-config ``` 召回、演化和模型配置可以热加载。修改 `storage` 后,reload 响应会返回 `requiresRestart: true`,此时需要重启 Memory 服务。算法参数集中在服务端,通常不需要重新安装 Agent Hook 或插件。 ### 常见调优方向 [#常见调优方向] * **提高召回率**:增大 `candidatePoolFactor` 或 `keywordTopK`,降低 `relativeThresholdFloor` 或 `minTraceSim`。 * **减少噪声**:提高 `minTraceSim`、`relativeThresholdFloor`、`minSkillEta`,或减小 `llmFilterMaxKeep`。 * **增加结果多样性**:降低 `mmrLambda`;提高它会更偏向最高相关度。 * **处理多事实或间接问题**:开启 `enableQueryRewrite`,代价是额外的 evolution 模型调用和延迟。 * **完全关闭记忆读或写**:分别设置 `enableMemorySearch: false` 或 `enableMemoryAdd: false`;二者互不强制绑定。 ## 如何检查某次召回 [#如何检查某次召回] ```bash memmy-memory search "你的查询" --verbose ``` 调试时重点看: * `candidateMemoryIds`:各底层通道汇总出的原始候选; * `hits`:融合、阈值和 MMR 后的候选; * `sourceMemoryIds`:实际渲染进上下文的记忆; * `status`:LLM 过滤是成功、关闭、跳过还是回退; * 记忆管理的日志页:查看 `memory.search` 的 candidates、filtered、droppedByLlm 和统计信息。 ## 记忆管理页 [#记忆管理页] `/memory` 的侧栏按用途分为三组: | 分组 | 子页 | 说明 | | -- | ----------------------------- | ---------------------------------- | | 工作 | 概览 / 记忆 / 任务 / 经验 / 场域认知 / 技能 | 查看总体统计和记忆详情,按任务、经验、场域认知与技能组织沉淀结果 | | 洞察 | 分析 / 日志 | 查看写入与演化分析图表,以及 Memory API 的搜索和写入日志 | | 系统 | 跨Agent接入 | 管理 Agent 来源、历史扫描以及 Hook/插件接入状态 | 日志页对 `memory.search` 和 `memory.add` 提供专门详情(搜索候选、写入字段、结果状态),可用来解释某条记忆为何被命中或写入。 # 给外部 Agent 安装记忆 Skill (/docs/cn/memory/skills) 除了被动扫描历史,Memmy 还能让外部 Agent **主动**读写记忆。 桌面端会自动启动;或使用 `npm run memory:serve:dev` 源码态启动。 桌面端「记忆来源」页提供一键安装到 `~/.local/bin`。 ### CLI 安装 [#cli-安装] ```bash memmy-memory init --agent ``` Memmy 会把记忆指令文件写入对应 Agent 的规则目录,之后该 Agent 就会主动调用 `memmy-memory` 检索和写入记忆。 # Agent 来源与扫描 (/docs/cn/memory/sources) 了解 Memmy 如何扫描九种内置 Agent 的本地历史,以及安装的 Hook、插件、Skill 和实时记忆效果。 Agent Source 是 Memmy 读取外部 Agent 本地历史的适配器。来源扫描负责导入已经存在的对话;支持实时接入的 Agent 由 Hook 或插件负责新对话中的自动召回和采集。
历史扫描和实时接入是两件事
“同步新增”读取 Agent 已写入本地的数据;Hook 或插件负责新对话中的自动召回、自动采集和任务接续。只扫描不会修改 Agent 配置;安装 Hook、插件或 Skill 才会写入下文列出的配置和文件。
## 内置来源 [#内置来源] | Agent | 默认历史来源 | 实时接入 | | ----------- | --------------------------------------------------------------------------------------------------------- | ------------------ | | Cursor | `~/Library/Application Support/Cursor/User/workspaceStorage/**/state.vscdb` 和 `globalStorage/state.vscdb` | Hook | | Claude Code | `~/.claude/projects/**/*.jsonl` | Hook | | Codex | `~/.codex/sessions///
/rollout-*.jsonl` | Hook | | OpenCode | `~/.local/share/opencode/opencode.db` | 原生插件 | | OpenClaw | `~/.openclaw` 下的 conversation / memory SQLite | Memory 插件 | | Hermes | `~/.hermes/sessions/**/*.jsonl` 和 `~/.hermes/state.db` | Memory Provider 插件 | | WorkBuddy | `~/.workbuddy/projects/**/*.jsonl` | Skill(按需调用记忆) | | Pi | `~/.pi/agent/sessions/**/*.jsonl` | Skill(按需调用记忆) | | qwenwork | `~/.qwenworkcn/projects/**/*.jsonl` | Skill(按需调用记忆) | 跨 Agent 接入页面只展示当前检测到本地配置或历史来源的内置 Agent;没有检测到的内置 Agent 不会占用列表位置。 ## 增量同步 [#增量同步] * **同步新增**扫描全部已发现来源;每个来源也可以单独同步。 * 扫描可以暂停、继续或停止;进度通过 SSE 实时推送。 * **深度扫描**使用 `full` 模式回扫旧历史,需要二次确认。 * 在 **高级操作 → 添加其他 Agent** 中,可以直接选择 `kimi code`、`zcode`、`minimax code`、`coder`,也可以输入其他 Agent 名称。 * 添加其他 Agent 时无需填写本地路径。Memmy 会启动一次发现任务,自动定位历史目录、识别消息格式、安装完整 `memmy-memory` Skill、导入最近 500 个完整对话回合,并保存后续同步使用的规则。此流程不会为未知 Agent 安装原生 Hook 或插件。 * 发现任务会先用可执行文件、`.app` 或已安装包的产品名称校验 Agent 身份。自动发现时,名称比较只忽略大小写、空格、连字符和下划线,不进行翻译、别名或语义猜测。如果找不到匹配的已安装产品,Memmy 会报告未找到并停止;用户可以继续提供安装产物、原生历史文件或目录以及 Skill 目录的绝对路径,让 Memmy 在这些限定路径内重新验证。Memmy 不会改用其他 Agent 或自己的历史。 * 自定义 Agent 在发现和验证期间只保存为内部草稿,不会显示在跨 Agent 列表中;验证出真实历史路径后才会显示。因而“未找到”的名称不会生成可见的 Agent 卡片,同时仍可在原任务中补充路径继续接入。 ### 为什么扫描消息数不等于新增记忆数 [#为什么扫描消息数不等于新增记忆数] 扫描和“添加中”的进度按**消息条数**计算,而记忆页按**记忆条数**计算,两者不是一一对应的。Memmy 先按来源和会话整理消息,再以完整对话回合为单位写入 L1 记忆: * 一条用户消息会开启一个回合,后续的工具消息、系统消息和 Assistant 消息会合并到同一回合;回合必须以非空用户消息开始,并以非空 Assistant 消息结束。 * 一个完整回合只生成一条 L1 记忆。例如,“1 条用户消息 + 2 条工具消息 + 1 条 Assistant 消息”会显示处理了 4 条消息,但只添加 1 条记忆。 * 边界处重读的消息或已导入消息会通过会话检查点、来源消息 ID 和稳定回合 ID 去重;重复同步会更新或返回同一条记忆,而不会新增副本。 * 只有用户消息、缺少最终 Assistant 回复或内容为空的不完整回合会被跳过,等待后续同步补全。 * 超过大小上限的回合会被跳过;Memory 服务写入失败的回合会计为失败。这两种情况都不会新增记忆。 因此,“本次扫描/处理消息数”“已采集的唯一消息数”和“新增记忆数”可能分别不同。内置来源还会在计数前忽略非消息记录、提取可用文本,并对常见密钥和大段 Base64 数据做脱敏。 ### 日期时间水位如何工作 [#日期时间水位如何工作] 每个来源单独维护日期时间水位,而不是只使用界面上显示的“上次扫描时间”: 1. 首次扫描开始时,Memmy 保存扫描开始时间作为基线,同时记录本次实际看到的最新消息时间;两者中较晚的时间成为下一次增量扫描的有效游标。 2. 后续点击 **同步新增** 时,内置来源会选择至少有一条消息时间**大于或等于**游标的会话。Memmy 会重读这些会话的完整消息,避免水位正好落在回合中间而丢失开头的用户请求。 3. `>=` 的包容边界会有意重读水位时刻的消息。导入前,会话检查点会比较最后消息的时间、消息 ID 和内容哈希;进入导入流程后,稳定的来源消息 ID 与回合 ID 再保证幂等。 4. 只有扫描和导入没有错误,且没有不完整或失败的会话时,水位才会推进到本次看到的最新时间。若扫描失败或回合尚未完成,水位保持不变,以便下次重试。界面上的“上次扫描时间”仍可能更新,它不等同于增量游标。 通过“添加其他 Agent”接入并由 Memmy 识别格式的 Agent 会保存首次导入的同步边界。后续同步只选择起始用户消息时间严格晚于该边界的完整回合,并继续依靠稳定消息 ID 和回合 ID 消除重复。 ### 图片、文件与超大回合 [#图片文件与超大回合] 图片或文件附件本身不会触发跳过。内置来源会从历史记录中提取可用文本,并在导入前将常见的内联 Base64 图片或文件内容替换为脱敏标记。 如果附件内容、文件正文、工具输出或其他长文本仍进入回合,Memmy 会按“用户请求 + 工具轨迹 + Assistant 回复 + 请求元数据”组成的完整记忆写入请求(`memory.add` JSON)计算 UTF-8 大小。请求超过 **2 MiB** 时,整个回合会被跳过,不会截断或拆成多条记忆;同一次同步中的其他回合会继续处理。该情况记为“已跳过”而不是同步失败,所以同步仍可能正常完成。大小限制针对完整回合请求,而不只是用户请求的字符数。 ## 扫描偏好 [#扫描偏好] | 开关 | 效果 | | --------------- | ---------------------------------------- | | 自动同步会话 | 自动从已接入的 Agent 采集新对话(启动时与定时),无需手动点「同步新增」 | | 发现新 Agent 时自动接入 | 为新发现的内置 Agent 自动安装接入组件;精简 Skill 会随接入一并安装 | 关闭自动安装后,已检测到的 Agent 仍会出现在列表中,你可以手动点击 **安装 Hook**、**安装插件**或 **安装 Skill**。 ## 数据处理与本地管理 [#数据处理与本地管理] * 每个成功写入的完整回合先成为一条 L1 原始记忆,再在后台生成摘要并建立索引。 * 可以查看本地数据路径(默认 `~/.memmy/memory-service`)、打开目录、导出 `memory.sqlite`,或在二次确认后清空本地记忆数据。 * 移除 Hook、插件或 Skill 不会删除已经导入的历史;清空本地数据是单独的显式操作。 ## Hook 与插件接入 [#hook-与插件接入] Memmy 通过 Agent 原生支持的 **Hook** 或**插件**接入实时对话。安装接入能力时,Memmy 还会为该 Agent 自动安装一份精简的 `memmy-memory` Skill,用于在自动注入的上下文不足时主动搜索和读取记忆。 ### 接入方式总览 [#接入方式总览] | Agent | 接入类型 | 使用的事件或接口 | 主要效果 | | ----------- | ------------------ | ------------------------------------------------ | ----------------------------------------- | | Cursor | Hook | `beforeSubmitPrompt`、`afterAgentResponse`、`stop` | 建立回合、记录回复、在回合结束时自动采集,并支持 `/memmy-resume` | | Claude Code | Hook | `UserPromptSubmit`、`Stop` | 请求前召回并注入相关记忆,结束时自动采集,支持 `/memmy-resume` | | Codex | Hook | `UserPromptSubmit`、`Stop` | 请求前召回并注入相关记忆,结束时自动采集,支持 `/memmy-resume` | | OpenCode | 原生插件 | 消息、工具、文本完成和会话事件 | 自动召回、采集回复与工具轨迹,并提供原生记忆工具和 `/memmy-resume` | | OpenClaw | Memory 插件 | `before_prompt_build`、`agent_end` | 构建提示词前注入记忆,Agent 结束时采集完整回合,并提供原生记忆工具 | | Hermes | Memory Provider 插件 | `prefetch`、`sync_turn` 等 Provider 生命周期 | 自动召回和采集,镜像 Hermes 的显式记忆写入,并提供原生记忆工具 | | WorkBuddy | Skill | Agent 主动调用 `memmy-memory` | 按需搜索、读取和写入共享记忆 | | Pi | Skill | Agent 主动调用 `memmy-memory` | 按需搜索、读取和写入共享记忆 | | qwenwork | Skill | Agent 主动调用 `memmy-memory` | 按需搜索、读取和写入共享记忆 | ### 一次对话中会发生什么 [#一次对话中会发生什么] ```mermaid flowchart LR Request["用户请求"] --> Entry["Hook / 插件"] Entry --> Start["打开会话并开始回合"] Start --> Recall["检索相关 Memmy 记忆"] Recall --> Context["作为历史上下文注入"] Context --> Agent["Agent 执行任务"] Agent --> Complete["采集回答、状态和可用的工具轨迹"] Complete --> Memory["完成回合并写入本地 Memory 服务"] ``` 安装后的共同效果: * **自动召回**:Claude Code、Codex、OpenCode、OpenClaw 和 Hermes 会在正常请求执行前检索相关记忆并注入上下文。 * **自动采集**:Hook 或插件会在回合结束时提交用户请求、Agent 回答和成功/失败状态,不需要 Agent 手动执行 `memmy-memory add`。 * **任务接续**:输入 `/memmy-resume ` 会搜索最多 5 个候选 L1 episode;继续输入 `1`–`5` 可读取完整 episode 并注入接续上下文。Claude Code、OpenCode、OpenClaw 和 Hermes 使用原生命令入口;Cursor、Codex 及 Skill 型接入会安装显式 `memmy-resume` Skill。 * **按需查询**:随接入安装的 Skill 保留 `memmy-memory search` 和 `memmy-memory get`,只在自动上下文不足时使用。 * **来源标记**:采集结果会记录 `cursor`、`claude_code`、`codex`、`opencode`、`openclaw` 或 `hermes`,便于过滤和追踪来源。
Cursor 当前的 Hook 重点负责自动采集和 /memmy-resume
普通请求需要额外记忆时,由随 Hook 安装的 Skill 执行按需搜索;其他五个接入会在普通请求前自动注入召回结果。
### Cursor:三个 Hook [#cursor三个-hook] Memmy 会在 `~/.cursor/hooks.json` 中追加自己的 Hook 条目,不会覆盖其他 Hook。 | Hook | 触发时机 | Memmy 的处理 | | -------------------- | ----------- | ----------------------------------------------------- | | `beforeSubmitPrompt` | 用户请求提交前 | 打开或复用 Memmy 会话、开始回合并保存请求;同时拦截 `/memmy-resume` 搜索和候选选择 | | `afterAgentResponse` | Agent 生成回复后 | 将最终回复暂存在本回合状态中,供结束 Hook 采集 | | `stop` | Agent 回合停止时 | 汇总请求和回复,调用 turn-complete 接口自动保存回合;失败时放行,不阻塞 Cursor | 默认写入或更新: * `~/.cursor/hooks.json` * `~/.cursor/hooks/memmy-resume-hook.mjs` * `~/.cursor/hooks/memmy-memory-config.json` * `~/.cursor/skills/memmy-memory/SKILL.md` * `~/.cursor/skills/memmy-resume/SKILL.md` ### Claude Code:`UserPromptSubmit` 与 `Stop` [#claude-codeuserpromptsubmit-与-stop] | Hook | 触发时机 | Memmy 的处理 | | ------------------ | -------------------- | ----------------------------------------------------------------------------- | | `UserPromptSubmit` | 用户请求进入模型前 | 开始 Memmy 回合,把召回结果放入 `additionalContext`;处理 `/memmy-resume` | | `Stop` | Claude Code 完成或终止回合时 | 从 Hook payload 或 transcript 读取请求与回答,按 `succeeded`、`failed` 或 `cancelled` 完成回合 | 默认写入或更新: * `~/.claude/settings.json` * `~/.claude/hooks/memmy-resume-hook.mjs` * `~/.claude/hooks/memmy-memory-config.json` * `~/.claude/commands/memmy-resume.md` * `~/.claude/CLAUDE.md` * `~/.claude/skills/memmy-memory/SKILL.md` ### Codex:`UserPromptSubmit` 与 `Stop` [#codexuserpromptsubmit-与-stop] | Hook | 触发时机 | Memmy 的处理 | | ------------------ | ----------- | ------------------------------------------------------------ | | `UserPromptSubmit` | 用户请求提交前 | 开始回合并通过 Hook 的 `additionalContext` 注入相关记忆;处理 `/memmy-resume` | | `Stop` | Codex 回合停止时 | 从 transcript 或最后一条 Assistant 消息提取回答并完成回合,保留失败和取消状态 | 默认写入或更新: * `~/.codex/hooks.json` * `~/.codex/hooks/memmy-resume-hook.mjs` * `~/.codex/hooks/memmy-memory-config.json` * `~/.codex/AGENTS.md` * `~/.codex/skills/memmy-memory/SKILL.md` * `~/.codex/skills/memmy-resume/SKILL.md` ### OpenCode:原生插件 [#opencode原生插件] | 回调 | 效果 | | ----------------------------------------------------- | --------------------------------- | | `chat.message` | 开始回合、自动注入召回结果,并处理 `/memmy-resume` | | `tool.execute.before` / `tool.execute.after` | 记录非 Memmy 工具的调用参数与结果,作为回合轨迹的一部分 | | `experimental.text.complete` / `message.part.updated` | 收集 Assistant 的完整文本输出 | | `session.error` | 把当前回合标记为失败并记录错误 | | `session.idle` | 异步完成并采集当前回合 | | `dispose` | 插件卸载或进程退出前刷新尚未提交的回合 | 插件还注册 `memmy_memory_search`、`memmy_memory_get`、`memmy_memory_add` 三个原生工具。 默认在 `~/.config/opencode` 中写入或更新: * `plugins/memmy-memory.js` * `plugins/memmy-memory-config.json` * `commands/memmy-resume.md` * `../../../AGENTS.md` * `skills/memmy-memory/SKILL.md` 如果设置了 `OPENCODE_CONFIG_DIR` 或 `XDG_CONFIG_HOME`,文件会写入对应配置目录。 ### OpenClaw:Memory 插件 [#openclawmemory-插件] | 接口 | 效果 | | -------------------------- | -------------------------------------------------------------- | | `registerMemoryCapability` | 告诉 OpenClaw 当前启用了 Memmy,并声明注入内容属于历史上下文 | | `before_prompt_build` | 在构建提示词前开始回合,通过 `prependContext` 注入召回结果或选中的 episode | | `agent_end` | 提取本轮请求、回答和工具轨迹,同步完成回合,避免进程结束时丢失采集结果 | | `registerCommand` | 注册 `/memmy-resume` | | `registerTool` | 注册 `memmy_memory_search`、`memmy_memory_get`、`memmy_memory_add` | 安装时会把 `plugins.slots.memory` 指向 `memmy-memory`,并启用 `allowPromptInjection` 与 `allowConversationAccess`。 默认写入或更新: * `~/.openclaw/extensions/memmy-memory/` * `~/.openclaw/openclaw.json` * `~/.openclaw/skills/memmy-memory/SKILL.md` * OpenClaw workspace 下的 `../../../AGENTS.md`(默认 `~/.openclaw/workspace/AGENTS.md`) OpenClaw 的 memory slot 只能有一个提供者。如果已安装其他记忆插件,Memmy 会在安装前提示:替换现有插件,或保留现有插件并只安装 Skill。 ### Hermes:Memory Provider 插件 [#hermesmemory-provider-插件] | Provider 接口 / Hook | 效果 | | --------------------------------------- | -------------------------------------------------------------- | | `system_prompt_block` | 声明 Memmy 已启用,并约束注入记忆只作为历史上下文 | | `prefetch` | 用户请求前开始回合并返回相关记忆上下文 | | `sync_turn` | 在后台线程完成回合,自动采集用户请求和 Assistant 回复 | | `on_memory_write` | 将 Hermes 发出的显式记忆写入同步到 Memmy | | `on_session_switch` | 让 Memmy 会话跟随 Hermes 会话切换 | | `get_tool_schemas` / `handle_tool_call` | 提供 `memmy_memory_search`、`memmy_memory_get`、`memmy_memory_add` | | `pre_llm_call` / `pre_gateway_dispatch` | 识别 `/memmy-resume` 的候选编号并注入或重写为完整 episode 上下文 | 安装时会把 `memory.provider` 设为 `memmy-memory`,启用 `memory` toolset 和独立的 `memmy-resume` command plugin。 默认写入或更新: * `~/.hermes/plugins/memmy-memory/` * `~/.hermes/plugins/memmy-resume/` * `~/.hermes/config.yaml` * `~/.hermes/SOUL.md` * `~/.hermes/skills/memmy-memory/SKILL.md` Hermes 同样只允许一个活动的 Memory Provider;检测到其他 Provider 时,Memmy 会先请求确认。 ### 安装、验证与移除 [#安装验证与移除] 1. 打开 **记忆管理 → 跨Agent接入**。 2. Cursor、Claude Code、Codex 点击 **安装 Hook**;OpenCode、OpenClaw、Hermes 点击 **安装插件**;WorkBuddy、Pi、qwenwork 点击 **安装 Skill**。 3. 对于其他 Agent,展开 **高级操作 → 添加其他 Agent**,从预设列表选择或输入名称,然后让 Memmy 完成发现与首次导入。 4. 如果 Agent 正在运行,重启 Agent 或新建会话,让它重新加载配置。 5. 完成一轮普通对话,再到 Memmy 的记忆或日志页面确认对应来源出现新记录。 6. 输入 `/memmy-resume <关键词>`,确认能看到候选并用 `1`–`5` 选择一个 episode。 点击 **移除 Hook**、**移除插件** 或 **移除 Skill** 时,Memmy 会清理自己管理的接入内容;其他配置会保留,已经进入 Memmy 的历史记忆不会被删除。 ### 本地访问与失败行为 [#本地访问与失败行为] * Hook 和插件从 `~/.memmy/config.yaml` 读取 Memory 服务地址与 token,并把运行所需配置保存在对应 Agent 的本地配置目录。请不要公开这些配置文件。 * Memmy 注入的内容使用 `` 标记为历史记忆,并用 `` 明确当前请求,降低旧记忆被误当成新指令的风险。 * 召回或采集失败时采用 **fail-open**:记录错误并继续 Agent 的当前任务,不会因为 Memory 服务暂时不可用而中断正常对话。 * Hook 命令的宿主超时为 60 秒,单次 Memory 请求超时为 45 秒。 # API Key 模式(BYOK) (/docs/cn/models/byok) 使用自己的模型额度,分三步配置,每步都有真实连接测试。 1. 选择 Provider(OpenAI、Anthropic、Gemini、DeepSeek、智谱、通义千问、Kimi、MiniMax、百度千帆、豆包),填模型 ID、Endpoint、API Key;Embedding 可选本地模式或自定义模式。 2. 记忆摘要模型(总结对话和经验)与技能进化模型(把经验沉淀为技能),均可直接复用主模型。 3. ASR(语音输入,当前固定 Qwen ASR)与图像生成模型,可跳过,不阻塞普通对话与记忆功能。 ## Provider 默认值 [#provider-默认值] | Provider | 默认 Endpoint | 默认模型占位 | | --------- | --------------------------------------------------- | ------------------ | | OpenAI | `https://api.openai.com/v1` | `gpt-4o` | | Anthropic | `https://api.anthropic.com` | `claude-sonnet-4` | | Gemini | `https://generativelanguage.googleapis.com` | `gemini-2.5-pro` | | DeepSeek | `https://api.deepseek.com/v1` | `deepseek-chat` | | 智谱 | `https://open.bigmodel.cn/api/paas/v4` | `glm-4` | | 通义千问 | `https://dashscope.aliyuncs.com/compatible-mode/v1` | `qwen-max` | | Kimi | `https://api.moonshot.ai/v1` | `moonshot-v1-128k` | | MiniMax | `https://api.minimax.chat/v1` | `MiniMax-Text-01` | | 百度千帆 | `https://qianfan.baidubce.com/v2` | `ernie-4.0-8k` | | 豆包 | `https://ark.cn-beijing.volces.com/api/v3` | `doubao-pro-256k` | # 支持的 Provider (/docs/cn/models/providers) Agent Runtime 当前支持: OpenAI 兼容接口、Anthropic、Azure OpenAI、AWS Bedrock、OpenRouter、DeepSeek、Gemini、智谱、DashScope、Kimi、MiniMax、Ollama、LM Studio、GitHub Copilot、OpenAI Codex OAuth 等。 OAuth 类 Provider 可通过 CLI 登录: ```bash memmy provider login ``` # 桌面本地 API (/docs/cn/reference/local-api) 桌面本地 API 基于 Fastify,绑定 `127.0.0.1` 随机端口,除 `/api/health` 外通过 `x-memmy-local-token` 认证;SSE 因 EventSource 限制用 `?token=` 传递同一 token。 ## 主要接口分组 [#主要接口分组] | 分组 | 代表接口 | | ------------ | ------------------------------------------------------------------------------------------------- | | 应用配置 | `PATCH /api/app/settings`、`GET/PUT /api/app/model-config`、`POST /api/app/model-config/test` | | 账号 | `POST /api/account/send-code`、`POST /api/account/verify-code`、`POST /api/account/logout` | | 集成与渠道 | `GET /api/v1/integrations/capabilities`、`POST /api/v1/channels/:provider/connect` | | Agent Source | `GET /api/agent-sources`、`POST /api/agent-sources/scan`、`POST /api/agent-sources/:sourceId/skill` | | 本地数据 | `POST /api/local-data/reveal`、`POST /api/local-data/export`、`DELETE /api/local-data` | | Memory 代理 | `/api/v1/memory/*`、`/api/v1/panel/*`(代理到 Memory Runtime) | | MCP bridge | `GET/POST/DELETE /mcp/composio`(独立 `x-memmy-mcp-token`) | ## SSE 事件 [#sse-事件] `/api/events` 推送:`app.connected`、`app.heartbeat`、`agent_source.scan_progress`、`agent_source.scan_completed`。 # Memory Runtime API (/docs/cn/reference/memory-api) 默认地址 `http://127.0.0.1:18960`。设置 `storage.token`、`MEMMY_MEMORY_TOKEN` 或 `MEMORY_SERVICE_TOKEN` 后,除健康检查外的接口需要携带 bearer token。 | Method | Path | 说明 | | -------- | ----------------------------------- | ----------- | | `GET` | `/api/v1/health` | 健康检查 | | `POST` | `/api/v1/sessions/open` | 打开 Agent 会话 | | `POST` | `/api/v1/sessions/:sessionId/close` | 关闭会话 | | `POST` | `/api/v1/turns/start` | 记录回合开始 | | `POST` | `/api/v1/turns/:turnId/complete` | 记录回合完成 | | `POST` | `/api/v1/memory/search` | 检索记忆 | | `POST` | `/api/v1/memory/add` | 写入记忆 | | `GET` | `/api/v1/memory/:id` | 记忆详情 | | `DELETE` | `/api/v1/memory/:id` | 删除记忆 | | `GET` | `/api/v1/panel/overview` | 面板概览 | | `GET` | `/api/v1/panel/analysis` | 记忆分析 | | `GET` | `/api/v1/panel/items` | 条目列表 | ## 本地存储配置 [#本地存储配置] ```yaml memmyMemory: version: 1 activeProfile: byok storage: mode: local backend: sqlite sqlitePath: ~/.memmy/memory-service/memory.sqlite endpoint: http://127.0.0.1:18960 token: local-token profiles: byok: embedding: provider: local ``` # OpenAI 兼容 API (/docs/cn/reference/openai-api) `memmy serve` 默认监听 `http://127.0.0.1:18990`: | Method | Path | | ------ | ---------------------- | | `GET` | `/health` | | `GET` | `/v1/models` | | `POST` | `/v1/chat/completions` | 任何支持 OpenAI Chat Completions 协议的工具或脚本都可以直接复用 Memmy。 # 默认端口 (/docs/cn/reference/ports) | 服务 | 默认端口 | | ------------------------------ | ------------- | | Memory HTTP / 记忆底座 | `18960` | | Gateway health | `18970` | | WebUI / WebSocket / admin HTTP | `18980` | | OpenAI 兼容 API(`memmy serve`) | `18990` | | 桌面前端 Vite dev server | `19000` | | Vite HMR | `19010` | | 桌面本地 API | 随机端口 | | Composio MCP bridge | 复用桌面本地 API 端口 | # 安全与隐私 (/docs/cn/security/security) Memmy 的安全边界以**本地运行**和**显式认证**为基础: * 桌面本地 API 默认只允许本机、`file://` 或受控来源访问,使用 `x-memmy-local-token` 校验。 * SSE 因 EventSource 限制使用查询参数传递同一运行时 token。 * Composio MCP bridge 使用独立的 `x-memmy-mcp-token`。 * Memory HTTP 可通过 bearer token 保护(`MEMMY_MEMORY_TOKEN` / `MEMORY_SERVICE_TOKEN`)。 * 配置支持 `${ENV_NAME}` 环境变量引用,避免把 API Key 写进配置文件。 * Memory client 必须连接真实 Memory Layer 或发现本地 SQLite 来源,否则启动失败,不静默展示假数据。 ## 数据存在哪里 [#数据存在哪里] 默认全部在 `~/.memmy` 下:配置、workspace、Memory SQLite 数据库和运行时文件。桌面 app state 由本地后端维护在本机 SQLite 中。 扫描和入库都在本地完成,记忆写入本地 SQLite。是否参与「记忆改进计划」由隐私设置中的开关显式控制。 # 入门指南 (/docs/cn/start/getting-started) 本页带你从零完成 Memmy 的安装、首次配置和第一轮对话。 ## 你需要准备 [#你需要准备] * macOS 或 Windows 桌面环境(桌面端路径)。 * 或 Node.js `>=22` + npm(CLI / 源码路径)。 * API Key 模式需要至少一个模型 Provider 的 API Key。 不确定选哪种模式?账号模式开箱即用并附带平台体验 Token;API Key 模式的数据与额度完全由你掌控。两种模式的数据都以本地优先方式保存。 ## 快速设置 [#快速设置] Linux x64 或 arm64 的纯终端用户需先安装 Node.js 22 或更高版本,并确认 systemd 用户会话可用,然后执行: ```bash curl -fsSL https://raw.githubusercontent.com/MemTensor/memmy-agent/main/scripts/install.sh | bash memmy ``` 安装器会以 `memmy-memory.service` 启动本地 Memory Service。如果尚未配置可用模型,首次裸执行 `memmy` 会打开现有配置向导;保存后启用 `memmy-gateway.service`,等待就绪并进入 TUI。两个 `systemd --user` 服务都不会因退出 TUI 或关闭终端而停止,并会在以后登录时自动启动;安装器不启用 linger。安装器 launcher 还会刷新权限为 `0600` 的私有文件 `~/.memmy/systemd/gateway.env`,确保配置引用的凭据和终端 `PATH` 对常驻 Gateway 可用。 可用 `systemctl --user status memmy-memory.service` 和 `systemctl --user status memmy-gateway.service` 查看状态。安装器不会修改外部 Agent;只有用户明确执行 `memmy-memory init` 或 `memmy-memory init --agent ` 时,才安装对应的 Memory 集成。 下载并安装 Memmy 桌面应用。首次启动会自动完成: 1. 设置 `MEMMY_HOME` 和 `MEMMY_CONFIG`。 2. 安装内置 CLI,并为已授权的 Agent 准备 Hook、插件和配套 Skill。 3. 准备 `~/.memmy/config.yaml`、workspace 和 Memory SQLite。 4. 启动 Memory 服务和 Agent gateway。 ```bash cd App/memmy-agent npm install npm run build node dist/main.js --help ``` 在欢迎页选择: * **账号模式**:手机号或邮箱验证码登录,使用平台体验 Token。 * **API Key 模式**:分三步配置主模型 + Embedding、记忆相关模型、可选的 ASR 与图像生成模型,每一步都提供真实连接测试。 ```bash memmy onboard # 终端菜单式配置模型、Provider、工具 memmy onboard --defaults # 非交互式初始化配置和 workspace memmy status # 检查配置与运行状态 ``` 进入主工作台,在输入框发送第一条消息。`Enter` 发送,`Shift + Enter` 换行,输入 `/` 可打开 Slash command 面板。 ```bash memmy agent --message "你好,介绍一下当前工作区" # 或直接进入交互式聊天 memmy ``` 打开「记忆管理 → 跨Agent接入」,扫描 Cursor、Claude Code、Codex、OpenCode、OpenClaw、Hermes、WorkBuddy、Pi 和 qwenwork 的历史对话并入库。首次引导会让你选择是否只扫描,或同时为检测到的 Agent 安装对应的 Hook、插件或 Skill。 接入后,Hook 或插件会在新对话中自动采集完整回合并注入相关记忆;WorkBuddy、Pi 和 qwenwork 则通过 Skill 按需读写记忆。详见 [Agent 来源与扫描](/docs/memory/sources)。 内置列表之外的 Agent 可以在 **高级操作 → 添加其他 Agent** 中接入。你可以选择 `kimi code`、`zcode`、`minimax code`、`coder`,或输入其他名称;Memmy 会自动发现历史位置与格式、安装 Skill 并完成首次导入。 打开「工具」页: * 消息渠道:Telegram、Discord、iMessage、WeChat、Feishu、DingTalk。 * 托管集成:GitHub、Gmail、Notion、Slack、Linear、Jira 等,走 OAuth 授权。 ## 高级:把 Memmy 当本地 API 用 [#高级把-memmy-当本地-api-用] ```bash memmy serve ``` 默认监听 `http://127.0.0.1:18990`,提供 `GET /health`、`GET /v1/models`、`POST /v1/chat/completions`,可被任何支持 OpenAI Chat Completions 协议的工具复用。 ## 高级:环境变量 [#高级环境变量] | 变量 | 作用 | | --------------------------------------------- | ---------------------------------- | | `MEMMY_HOME` | Memmy 数据主目录(默认 `~/.memmy`) | | `MEMMY_CONFIG` | 主配置文件路径(默认 `~/.memmy/config.yaml`) | | `MEMMY_MEMORY_TOKEN` / `MEMORY_SERVICE_TOKEN` | Memory HTTP 服务的 bearer token | 配置文件中的 `${ENV_NAME}` 会被自动解析,避免把 API Key 写死在配置里。 ## 接下来做什么 [#接下来做什么] 会话、附件、语音与 Slash command · Agent 扫描与 Hook/插件接入 · 三步配置详解 · 常驻桌面的轻量入口 ## 相关内容 [#相关内容] * [默认端口](/docs/reference/ports) * [安全与隐私](/docs/security/security) * [常见问题](/docs/help/faq) # CLI 命令参考 (/docs/cn/terminal/cli) | 命令 | 说明 | | --------------------------------- | ------------------------------ | | `memmy` | 进入交互式聊天 | | `memmy onboard` | 终端菜单式配置 | | `memmy onboard --defaults` | 非交互式初始化配置和 workspace | | `memmy status` | 查看配置、workspace、模型和 Provider 状态 | | `memmy agent --message "..."` | 发送单轮消息 | | `memmy serve` | 启动 OpenAI 兼容 API | | `memmy provider login ` | Provider OAuth 登录 | # TUI 使用指南 (/docs/cn/terminal/tui) Memmy TUI 是 Memmy 的全屏终端界面。安装桌面端,或只安装 CLI,都可以在终端执行 `memmy` 使用它。 image.png ## 一、安装 Memmy TUI [#一安装-memmy-tui] ### 方式一:安装 Memmy 桌面端 [#方式一安装-memmy-桌面端] 适用于 macOS 和 Windows。桌面端会提供 `memmy` 命令,并负责启动本地 Memory 和 Agent Gateway。 1. 从 [Memmy 官网](https://memmy.cn/) 或 [GitHub Releases](https://github.com/MemTensor/memmy-agent/releases) 下载并安装桌面端。 2. 启动 Memmy,完成账号模式或 API Key 模式配置。 3. 打开一个新的终端,检查命令是否可用: ```plaintext memmy --help memmy --version ``` * macOS 用户需要先把应用拖入 `/Applications`,并至少启动一次。若终端提示找不到 `memmy`,打开新终端或执行: ```plaintext source ~/.zshrc ``` * Windows 用户安装完成后,请打开新的 PowerShell 或 Windows Terminal。 使用桌面端提供的 TUI 时,请保持 Memmy 桌面端运行。关闭桌面端后,它管理的 Gateway 也会停止。 ### 方式二:只安装 Memmy CLI [#方式二只安装-memmy-cli] 适用于不需要桌面端的 Linux x64 或 arm64 环境。需要 Node.js `22` 或更高版本,并且系统支持 `systemd --user`。 ```plaintext curl -fsSL https://raw.githubusercontent.com/MemTensor/memmy-agent/main/scripts/install.sh | bash ``` 安装完成后执行: ```plaintext memmy ``` 首次运行如果还没有可用模型,Memmy 会打开配置向导。CLI 安装器会管理 Memory 和 Gateway 服务;退出 TUI 或关闭终端后,服务仍会运行。 查看服务状态: ```plaintext systemctl --user status memmy-memory.service systemctl --user status memmy-gateway.service ``` ## 二、首次配置 [#二首次配置] 如果桌面端已经完成首次引导,可以跳过本节。CLI 用户建议执行: ```plaintext memmy onboard --defaults memmy onboard memmy status ``` * `memmy onboard --defaults`:创建或刷新配置文件和 workspace,非交互式配置。 * `memmy onboard`:配置模型、Provider、Gateway、Memory 和工具,交互式配置。 * `memmy status`:检查当前配置、workspace、模型和 Provider。 默认位置: * 配置文件:`~/.memmy/config.yaml` * workspace:`~/.memmy/workspace` ## 三、打开 TUI [#三打开-tui] 直接执行: ```plaintext memmy ``` 这会打开默认的 `cli:direct` 会话。输入消息后按 `Enter` 发送。 ### 恢复或创建会话 [#恢复或创建会话] ```plaintext # 恢复已有会话 memmy --session cli:work # 创建新的独立会话 memmy --standalone # 创建绑定到项目目录的会话 memmy --project /path/to/project ``` `--session`、`--standalone` 和 `--project` 只能选择一个。 查看已有会话: ```plaintext memmy sessions list ``` ### `memmy` 与 `memmy agent` [#memmy-与-memmy-agent] 要打开本教程介绍的全屏 TUI,请使用裸 `memmy`。 `memmy agent` 适合单轮任务或传统终端交互: ```plaintext # 单轮任务 memmy agent --message "介绍一下当前工作区" # 从标准输入发送一轮任务 echo "总结这个项目" | memmy agent ``` ## 四、发送任务 [#四发送任务] 在 `❯` 后面输入内容,按 `Enter` 发送。TUI 当前没有桌面端工作台的 `Shift + Enter` 换行操作,`Enter` 始终表示提交。 长文本可以在终端中自动视觉换行,但不会插入多行内容。需要发送多行文本时,请使用: ```plaintext memmy agent --message $'第一行\n第二行' ``` 或: ```plaintext printf '第一行\n第二行\n' | memmy agent ``` ### 任务运行时继续输入 [#任务运行时继续输入] * `Enter`:排队发送下一轮任务。 * `Tab`:当当前回合由这个 TUI 执行时,把内容追加到当前回合。 如果当前回合来自桌面端或其他 IM 渠道,TUI 不会接管它;请使用 `Enter` 排队。 队列中有任务时,界面会显示排队数量、消息预览和消息来源。 ## 五、键盘操作 [#五键盘操作] 基础操作在 macOS、Windows 和 Linux 上一致;行编辑组合键的主修饰键不同: | **操作** | **macOS** | **Windows** | **Linux** | | ---------------- | --------------------------------------------------- | ------------------------------- | ------------------------------- | | 发送;运行中排队下一轮 | `Enter` | `Enter` | `Enter` | | 追加到当前由 TUI 执行的回合 | `Tab` | `Tab` | `Tab` | | 移动一个字符 | `←` / `→` | `←` / `→` | `←` / `→` | | 按单词移动 | `⌘ + ←` / `⌘ + →` | `Ctrl + ←` / `Ctrl + →` | `Ctrl + ←` / `Ctrl + →` | | 移到输入开头 | `Home` 或 `Ctrl + A` | `Home` 或 `Ctrl + A` | `Home` 或 `Ctrl + A` | | 移到输入末尾 | `End`、`Ctrl + E` 或 `⌘ + E` | `End` 或 `Ctrl + E` | `End` 或 `Ctrl + E` | | 删除光标前内容至行首 | `Ctrl + U` 或 `⌘ + U`;`⌘ + Backspace` / `⌘ + Delete` | `Ctrl + U` | `Ctrl + U` | | 删除光标后内容至行尾 | `Ctrl + K` 或 `⌘ + K` | `Ctrl + K` | `Ctrl + K` | | 删除前一个单词 | `Ctrl + W` 或 `⌘ + W` | `Ctrl + W` / `Ctrl + Backspace` | `Ctrl + W` / `Ctrl + Backspace` | | 删除字符 | `Backspace` / `Delete` | `Backspace` / `Delete` | `Backspace` / `Delete` | | 停止自己执行的回合并退出 | `Ctrl + C` | `Ctrl + C` | `Ctrl + C` | 在 macOS 上,`⌘` 是 Command 键;Windows/Linux 使用 `Ctrl` 作为主要组合键。`Shift + Enter` 在所有平台上都不会插入换行,而是提交当前消息。 也可以输入以下任意命令退出: ```plaintext exit quit /exit /quit :q ``` 如果任务由其他渠道执行,`Ctrl + C` 只会退出当前 TUI,不会停止其他渠道的任务。 ## 六、Slash 命令 [#六slash-命令] Slash 命令菜单 TUI 支持 Slash 命令候选菜单。在输入区输入 `/` 即可打开菜单,继续输入命令名称(例如 `/go`)会筛选候选命令。输入空格进入参数或子命令后,候选菜单会关闭。 * `↑` / `↓`:切换候选命令。 * `Tab`:补全当前选中的命令入口,不会补全子命令或参数。 * `Enter`:如果当前输入是命令前缀,先确认补全;命令入口已经完整时执行命令。 * `Esc`:关闭候选菜单。 如果 `Enter` 只是完成了命令补全,再按一次 `Enter` 即可执行。 * 候选菜单显示当前可用的命令,以及该命令提供的参数或子命令提示。 * 参数和子命令不会分别生成候选项,例如 `/model list` 可以先补全 `/model`,再手动输入 `list`。 * `/stop` 只有在当前回合由该 TUI 执行时才显示。 * `/restart` 不显示,也不能在 TUI 中执行。 * `exit`、`quit`、`/exit`、`/quit`、`:q` 可以退出,但只有 `/quit` 出现在菜单中。 * `/history-dag` 是否出现取决于对应功能是否启用。 * 初始最多显示 8 个候选项,可继续输入命令前缀筛选其他命令。 | **命令** | **参数** | **作用** | | --------------------------- | ---------- | ----------------------------- | | `/help` | 无 | 查看当前命令帮助 | | `/status` | 无 | 查看运行状态、Provider 和渠道状态 | | `/model` | 无 | 查看当前模型配置 | | `/model list` | 无 | 列出模型预设 | | `/model ` | 模型预设名 | 切换模型预设,例如 `/model fast` | | `/history` | 无 | 查看会话历史 | | `/history ` | 消息数量 | 查看最近 `n` 条历史消息 | | `/history-dag` | 无 | 查看会话历史 DAG | | `/new` | 无 | 停止当前任务并开始新对话 | | `/stop` | 无 | 停止当前由这个 TUI 执行的回合;不会停止其他渠道的任务 | | `/restart` | 无 | TUI 不接受此控制命令;请退出后重启 Gateway | | `/last-compaction` | 无 | 查看当前会话最近一次上下文压缩摘要 | | `/quit` | 无 | 退出 TUI,不停止其他渠道正在执行的回合 | | `/goal` | 无 | 查看当前持久目标 | | `/goal status` | 无 | 查看持久目标状态 | | `/goal help` | 无 | 查看 Goal 子命令帮助 | | `/goal ` | 目标内容 | 创建持久目标的简写形式 | | `/goal create ` | 目标内容 | 创建持久目标 | | `/goal pause` | 无 | 暂停目标 | | `/goal resume` | 无 | 恢复目标 | | `/goal edit ` | 新目标内容 | 修改目标 | | `/goal budget ` | 数字或 `none` | 设置或清除目标预算 | | `/goal clear` | 无 | 清除目标 | | `/pairing` | 无 | 查看或管理渠道配对 | | `/pairing list` | 无 | 查看渠道配对请求 | | `/pairing approve ` | 配对码 | 批准配对请求 | | `/pairing deny ` | 配对码 | 拒绝配对请求 | | `/pairing revoke ` | 用户 ID | 撤销用户配对 | `/history-dag` 是否可用,取决于对应功能是否在配置中启用。 ## 七、常见问题 [#七常见问题] ### `memmy: command not found` [#memmy-command-not-found] * macOS:确认 Memmy 已拖入 `/Applications` 并启动过一次,然后打开新终端或执行 `source ~/.zshrc`。 * Windows:打开新的 PowerShell 或 Windows Terminal。 * Linux:确认安装器执行成功,并检查 `~/.local/bin` 是否在 PATH 中。 ### 没有可用模型 [#没有可用模型] ```plaintext memmy onboard memmy status ``` 确认模型、Provider 和凭据已保存后,再执行 `memmy`。 ### Gateway 不可用 [#gateway-不可用] * 使用桌面端:确认 Memmy 桌面端正在运行。 * 使用 Linux CLI:检查 `memmy-gateway.service`。 * 使用源码或手动运行的 CLI:在另一个终端执行 `memmy gateway`。 默认 Gateway WebSocket 端口是 `18980`。Linux 用户可以查看日志: ```plaintext journalctl --user -u memmy-gateway.service ``` ### 为什么 `memmy agent` 没有打开全屏界面 [#为什么-memmy-agent-没有打开全屏界面] 这是正常的。`memmy agent` 是单轮或传统终端入口;需要全屏 TUI 时执行: ```plaintext memmy ``` # 托管工具集成 (/docs/cn/tools/integrations) 工具页的普通集成来自托管目录(Composio),包括 GitHub、GitLab、Gmail、Google Calendar/Docs/Drive/Sheets/Slides、Notion、Slack、Linear、Jira、Confluence、Figma、Dropbox、Airtable、Trello、Salesforce、HubSpot、Stripe、Zoom 等。 ## 授权流程 [#授权流程] 1. 点击工具卡片,查看权限范围后点击连接,获取授权 URL。 2. 在外部浏览器完成 OAuth;弹窗每 4 秒轮询,最长等待 5 分钟。 3. 连接成功后,工具通过 Composio MCP bridge 暴露给 Agent Runtime,桌面后端自动写入 `tools.mcpServers.composio`。 # 自定义 MCP Server (/docs/cn/tools/mcp) Memmy 支持 `stdio`、`sse`、`streamableHttp` 三种 MCP server: ```yaml tools: mcpServers: example: type: stdio command: npx args: - "-y" - "your-mcp-server" toolTimeout: 30 enabledTools: - "*" ``` ## 内置工具开关 [#内置工具开关] ```yaml tools: web: enabled: true search: provider: duckduckgo maxResults: 5 fetch: timeoutS: 30 maxChars: 60000 exec: enabled: true timeout: 60 imageGeneration: enabled: false ``` 内置工具覆盖文件系统、shell、Web 搜索与抓取、MCP、定时任务、消息发送、图像生成、长任务、自省、运行时状态和上下文管理。 # Memmy changelog (/docs/changelog) The latest updates to Memmy Desktop, Agent, Memory, and CLI [View all GitHub releases](https://github.com/MemTensor/memmy-agent/releases) ## Knowledge Base v1.1.7 2026-09-21 ### New features - Added Knowledge Base support: once recall is enabled, Agent tasks can use the knowledge base, which can also be shared with multiple people. ### Improvements and bug fixes - Filtered Codex noise data to keep conversation turns clean. - Task pages now generate titles and summaries automatically instead of displaying raw messages. ## Computer History and Computer Use v1.1.6 2026-09-21 ### New features - Added Computer History for macOS: it continuously records desktop activity, generates summaries, and lets Agent retrieve those records as conversation context. - Added Computer Use, allowing Memmy to control the computer. - Local mode now supports the StepFun and Xiaomi MiMo protocols. ### Improvements and bug fixes - Agent Skills are deduplicated by content, preventing the same Skill from being imported repeatedly across Agents. - Fixed local tasks disappearing after sign-in. - Fixed duplicate Cursor hooks. - Fixed truncated model reasoning being incorrectly replaced with an empty reply. ## Bug fixes v1.1.5 2026-09-15 ### Improvements and bug fixes - Removed the previous limits on the number and size of uploaded files. ## Independent Background Memory Service and Fixes v1.1.2–v1.1.4 2026-09-09 ### New features - Memory is now separated from Memmy and can run independently in the background. You can change this behavior under Settings > Preferences. ### Fixes - Fixed a v1.1.2 upgrade issue that could prevent the Memory service from starting. - Fixed an issue in v1.1.3 that could automatically trigger a full scan of all conversations. - Note 1: If you are currently using v1.1.2 or v1.1.3, please upgrade to the stable v1.1.4 release as soon as possible. - Note 2: If you are using v1.1.3 and a full memory scan created too many memories, causing repeated service restarts, clear all local memories under Cross-Agent Access > Data Management and upgrade to v1.1.4. This will not affect your original local conversation records. We sincerely apologize for the inconvenience and appreciate your understanding. If you have any questions, please contact memmy_bot@outlook.com. ## Linux support, CLI Goal commands, and model configuration fixes v1.1.1 2026-08-26 ### New features - Added a one-line Linux installation script and updated the accompanying documentation. - Added the memmy goal CLI command, enabling Goal tasks to be started and resumed from scripts or CI without an interactive terminal. ### Improvements and bug fixes - Fixed an issue where the selected embedding model could be lost when configuring local mode; the selection now stays synchronized when switching account modes. - Deleting a model now automatically cleans up leftover workspace bindings and runtime configuration. - Memory retrieval can now target a specific memory layer through explicit configuration. - Fixed Unicode path handling in the Windows update installer. ## Project-isolated field cognition memory and User Memory v1.1.0 2026-08-24 ### New features - L3 field cognition memory can now be isolated by project. It automatically learns each workspace's environment, working conventions, and domain knowledge, then injects relevant memories into conversations. - Added User Memory to record user facts, personal preferences, and stable work preferences. ### Improvements and bug fixes - During long-running Agent tasks, older context can now be compacted while preserving the current turn's results and a complete archive, preventing interruptions caused by context overflow. - File editing now uses a validated patch format, with all changes rolled back if a multi-file operation fails. - Improved Windows upgrades so configurations are no longer lost. - Fixed DeepSeek Harness scanning failures on Windows. - Memory service startup now runs in the background to prevent startup failures. Connection and tool-connection failures were also fixed, with hot loading supported after the backend starts. ## Git workspaces, Skill scanning and recall, and in-app updates v1.0.9 2026-08-20 ### New features - Conversation pages now show Git information, including file changes and rendered diffs, with controls to switch or create local branches. - In addition to automatically capturing Skills, Memmy can now scan Skills installed across different Agents, save them to Memory, and recall them across Agents during conversations, so users no longer need to install the same Skill repeatedly. - The desktop app now provides in-app update notifications. ### Improvements and bug fixes - TUI follow-up messages can now steer an active Goal without waiting for the current turn to finish. - Agent conversation-history scanning now runs in a separate process, improving import stability. - Lowered the minimum Memory recall score to reduce cases where relevant Memories are filtered out. - Fixed sign-in state leaking between the domestic and international editions. ## Improvements and bug fixes v1.0.8 2026-08-18 ### Improvements and bug fixes - The “Add more Agents” flow is now simpler: you can manually specify a conversation-history file or directory path, or let Memmy discover it automatically. - Agent turn routing and memory retrieval now run in parallel, reducing the wait at the start of each conversation turn while preserving the basis for routing decisions. - The memory service now handles locks more reliably during shutdown and startup, reducing startup failures after abnormal exits. - Hardened Windows and macOS packaging. ## DeepSeek Harness, Goal mode, and multiple custom model APIs v1.0.7 2026-08-17 ### New features - DeepSeek Harness is now supported with access to long-term and historical Memory. - Added Goal mode for retaining goals and progress during long-running tasks and continuing them in other conversations; type “/” to open it. - You can now add multiple custom API model configurations and switch the task model at any time within a conversation. - All historical messages from IM channels can now be displayed in the task list. ### Improvements and bug fixes - Improved the settings page layout and model configuration flow. - Improved task routing, recall queries, and episode processing to reduce inconsistent Memory capture and retrieval state. - The terminal now connects to the Gateway after configuration migration, with improved startup, restart, and session recovery. - Improved Memory processing—including session admission, cancellation, transcript synchronization, and tool-result handling—to reduce duplicate or incomplete message state. ## More Agent support and bug fixes v1.0.6 2026-08-12 This release adds more Agent support, introduces a Windows cleanup tool, and fixes local tool integration, Claude Code tool results, error messages, API usage reporting, and time offsets. ### New features - This release adds support for Pi and QwenWork; - Added a Windows cleanup tool that removes Memmy installation, runtime data, updater state, and CLI artifacts within the confirmed scope. ### Improvements and bug fixes - Fixed Windows Hook command path quoting in cmd.exe and PowerShell, reducing local tool integration failures; - Fixed Claude Code tool results being mistaken for user questions; - Improved Agent task and memory processing errors with clearer prompts; - The OpenAI-compatible Chat Completions API now returns real token usage; - UTC offsets are now consistent across Agent settings, Memory capture and recall, date filters, and dashboards, reducing time display drift across time zones. ## Time-aware Memory and easier Feishu setup v1.0.5 2026-08-06 This release improves time-aware Memory recall, Feishu bot setup, related-content navigation, Memory write reliability, clearer errors, and desktop installer reliability. ### New features - Memory recall now supports time awareness, making L1 recall more accurate for questions with a clear time range. - Tools and connections: Feishu bot setup now supports QR-code configuration for easier connection. - Memory, task, experience, context-awareness, and skill pages now include related-content jumps for faster navigation. ### Improvements and bug fixes - Cancelled, interrupted, or incomplete sessions no longer reserve an episode or generate L1 memories, improving Memory write reliability. - Improved first-report and local AI tool handoff by saving generated reports as real conversations and handoff Memories, avoiding repeated Agent runs after the first experience. - Error messages are clearer for insufficient quota, invalid Agent configuration, and unavailable Memory services, reducing silent fallbacks. - Improved desktop installer reliability by removing unrelated files and bundling the default local embedding model resource. ## Project workspaces, browser automation, and long-term Memory v1.0.4 2026-07-30 This release organizes Memmy work around projects and improves Agent browser tasks, long-term Memory, and local data safety. ### New features - Added project-scoped desktop workspaces that keep conversations, working directories, and file access bound to the selected project. - Added built-in browser automation and the ui-craft Skill for web interaction, debugging, local previews, and visual UI validation. - Added on-demand Agent Memory onboarding to import history from selected local AI tools and keep it synchronized incrementally. ### Improvements and bug fixes - Cancelled or timed-out commands now terminate descendant processes to prevent leftover work and output streams. - Improved long-term Memory for reusable subgoals and failure-avoidance lessons, with faster retrieval of completed turns and clearer diagnostics. - Compatibility note: first launch migrates existing workspaces while preserving messages, titles, pins, and archives. - Memory database exports now include committed WAL data to avoid incomplete SQLite snapshots. ## More reliable Agent and Memory workflows v1.0.3 2026-07-24 This release focuses on Agent recovery, file-memory controls, and more reliable and diagnosable Memory processing. ### New features - Added the fileMemory.enabled switch for independently controlling local file memory, Recent History, and Dream capabilities. - Added targeted format and syntax validation after the Agent modifies supported files. ### Improvements and bug fixes - Upgrades now preserve sign-in and local BYOK settings, with clearer token-quota status, more reliable task switching, and improved Markdown rendering. - Improved Agent Gateway recovery and longer responses; history import now skips malformed JSONL records instead of stopping the entire sync. - Improved retries, fallbacks, model routing, and diagnostics across Memory import, embedding, retrieval, summarization, and evolution. - Compatibility note: file memory is off by default and requires fileMemory.enabled; the legacy built-in my tool and related settings were removed. ## Resumable Memory sync and clearer updates v1.0.2 2026-07-21 This release makes history and Memory processing resumable and improves desktop updates, error reporting, and data migration. ### New features - Added a jump-to-latest control for quickly returning to the newest conversation activity. ### Improvements and bug fixes - Agent history sync now uses persistent checkpoints and incremental scans so interrupted or failed work can resume. - Memory processing now reports the failed stage, provider reason, and retry state, with clearer distinctions between invalid model-endpoint responses. - Desktop updates now show download progress and wait for Memory health checks, and macOS reopening after privacy-setting changes is more reliable. - Compatibility note: schema-v3 databases are backed up before migration to v4, and memmy-memory --version now prints only the version number. ## First public desktop release v1.0.1 2026-07-17 Memmy is now publicly available as a desktop installer for macOS Apple Silicon and Windows x64. ### New features - Published the first Memmy desktop installers for macOS Apple Silicon and Windows x64. ### Improvements and bug fixes - Added first-install guidance for allowing Memmy through macOS Privacy & Security settings or Windows SmartScreen. # Memmy (/docs) Let every AI remember the same you. Memmy is your **personal memory hub** and a dedicated Agent that truly knows you — it lets **every AI connect to the same memory and evolve together through collaboration**. It distills your knowledge, preferences, and project experience into personal memory, and lets different Agents — Cursor, Claude Code, Codex, OpenClaw, and more — share the same context. Memmy ships as a desktop app, a CLI, and an API, so you can use the same long-term memory in different ways. Accumulate once, use everywhere. * Download the Memmy desktop app and finish onboarding in minutes * BYOK mode — plug in the model quota you already have * Turn your Cursor, Claude Code, and Codex history into memory ## What Is Memmy [#what-is-memmy] Memmy is not just an app with a chat window — it is a complete local Agent Runtime: * The **Desktop app** provides the task workbench, desktop pet, memory panel, tool connections, and settings pages. * The **Agent Runtime** handles conversations, tool calls, MCP, scheduled tasks, long-running tasks, sessions, and skills. * The **Memory service** handles memory writing, retrieval, archiving, and analytics, using local SQLite by default. * The **Local backend** handles accounts, configuration, integrations, Agent source scanning, Skill installation, and the local machine API. * The **CLI and HTTP API** let external Agents, scripts, or other products plug into Memmy too. ### Who It's For [#who-its-for] * People who use multiple AI coding/chat tools at once (Cursor, Claude Code, Codex, Opencode, OpenClaw, Hermes) and want them to share one set of memory. * Developers who want local-first data and bring-your-own API Keys. * Everyday users who want an always-on-desktop, on-call Agent entry point (the desktop pet). ## What You Need [#what-you-need] * A macOS or Windows device (desktop app), or a Node.js `>=22` environment (CLI / from source). * Account mode: a Memmy account (includes platform trial tokens). * Or API Key mode: an API Key from any supported model provider. ## How It Works [#how-it-works] Memmy System Architecture ## Core Capabilities [#core-capabilities] * Scan conversation history from Cursor, Claude Code, Codex, and more; dedupe, ingest, and search it in one place. * Config lives in `~/.memmy/config.yaml`, memory in local SQLite, and every endpoint is token-protected. * Multi-session tasks, streaming output, attachments, voice input, and slash commands. * A transparent always-on-top mini window that takes text or voice tasks anytime and syncs with the main workbench. * Channels like Telegram, WeChat, Feishu, and DingTalk, plus managed integrations such as GitHub, Notion, and Slack. * Many providers including OpenAI-compatible, Anthropic, Gemini, DeepSeek, and Ollama. ## Quick Start [#quick-start] 1. Download and launch the Memmy desktop app, or build `App/memmy-agent` and use the CLI. 2. Choose account mode or API Key mode, configure your primary model, and pass a connection test. CLI users run: ```bash memmy onboard ``` 3. Send your first task from the main workbench, or in the terminal: ```bash memmy agent --message "Hi, introduce the current workspace" ``` Keep your first milestone small: get one normal reply working in the desktop app or CLI first, then move on to tools, channels, MCP, memory scanning, and the desktop pet. ## Configuration [#configuration] The main config defaults to `~/.memmy/config.yaml` and supports `${ENV_NAME}` environment variable references: ```yaml agents: defaults: model: openai/gpt-4.1 provider: openai timezone: "+08:00" providers: openai: apiKey: ${OPENAI_API_KEY} ``` ## Next Steps [#next-steps] Full installation and first-run setup · Overview, entries, policies, world model, and logs · Connect Memmy to your IM · memmy and memmy-memory commands · Processes, ports, and data flow · FAQ and troubleshooting entry points # Messaging Channels (/docs/channels) Memmy plugs into the IMs you already use, so you can command your Agent right from your chat apps. Currently supported: **Telegram · Discord · iMessage · WeChat · Feishu · DingTalk** ## How to Connect [#how-to-connect] | Channel | Method | | ----------------------------- | --------------------------------------------------------------------------------------------------------------- | | WeChat | QR code sign-in; the dialog polls for the scan result | | Feishu | `appId` + `appSecret` form; on insufficient permissions, missing scopes are parsed out with an application link | | DingTalk | `clientId` + `clientSecret` form | | Telegram / Discord / iMessage | Follow the dialog instructions on the Tools page | Connection status refreshes every 5 seconds; connected channels can be disconnected anytime. Channel configuration is written into the runtime by the local backend via the memmy-agent admin client. # Local Architecture (/docs/concepts/architecture) Memmy System Architecture ## Core Concepts [#core-concepts] | Concept | Description | | -------------- | -------------------------------------------------------------------------------------------------------------------------------------- | | Workspace | The Agent's working directory, default `~/.memmy/workspace`; the runtime syncs templates, built-in skills, and memory files here | | Config | `~/.memmy/config.yaml`, overridable via `MEMMY_CONFIG` or `--config` | | Agent Runtime | Model calls, message loop, tool registration, MCP, sessions, long tasks, skills, auto-compaction, memory hooks | | Memory Service | The local-first memory foundation; entry point `Memory/src/server/index.ts`, default `:18960` | | Local Backend | Backend for the desktop local API: SQLite app state, permissions, Cloud/Memory clients, source scanning, Skill writing, Fastify routes | | Agent Source | Read adapter for external Agent history + optional Skill install target | | Dream | Memory consolidation mechanism, triggered manually or on a schedule | # Full Feature List (/docs/concepts/features) ## Highlights [#highlights] * Nine external Agent sources — scanned, deduped, ingested * Multi-session, attachments, voice, slash commands * A transparent always-on-top mini window, on call anytime * 20+ managed integrations + custom MCP * 6 IM channels * 15+ providers with your own quota ## Full List [#full-list] ### Memory [#memory] * External source scanning: Cursor, Claude Code, Codex, OpenCode, OpenClaw, Hermes, WorkBuddy, Pi, qwenwork * Memory panel: overview, entries, tasks, policies, world model, skills, analytics, logs * Dream consolidation: manual / scheduled, with logs and rollback * memmy-memory CLI and the Memory Runtime HTTP API * External Agent Skill installation (active memory read/write) ### Desktop [#desktop] * Multi-session task list: grouping, pinning, archiving, search, unread indicators * Streaming output, stop / restart, Agent status panel * Attachments (images + common office documents), voice input (ASR) * Slash commands, Agent artifact preview * Pet mode: input bubble, multi-task badge, answer preview, session continuation ### Models & Auth [#models--auth] * Account mode (platform tokens) and API Key mode (BYOK) * Six independently configurable model slots: primary, Embedding, memory summary, skill evolution, ASR, image generation * 15+ providers, including OAuth sign-in ### Tools & Automation [#tools--automation] * Built-in tools: files, shell, web search and fetching, scheduled tasks, long tasks, image generation, and more * Composio managed integrations + custom MCP servers (stdio / sse / streamableHttp) * 6 messaging channels ### APIs [#apis] * OpenAI-compatible API (`memmy serve`) * Memory Runtime API, desktop local API, SSE event stream # Desktop Pet Mode (/docs/desktop/pet) The desktop pet is a transparent, always-on-top mini window — perfect for firing off tasks without interrupting your current work. ## Interactions [#interactions] * Single-click to expand the input bubble; `Enter` to send; voice recording with transcription is supported. * Double-click to leave pet mode and open the full workbench. * Drag with the left mouse button to move the window; the right-click menu can open full mode. * When tasks are running or there are unread completions, a numeric badge appears; click it to expand a mini task list (up to 6). ## Session Continuation [#session-continuation] * If a task is running, new messages continue the same session; tasks completed within the last 5 minutes also continue their session. * After clicking "New session", the next message creates a new session. * The pet and full mode share the WebUI thread, so context survives switching. # Settings (/docs/desktop/settings) | Section | Contents | | ------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | | Account | Nickname editing, full contact info, sign out / exit local mode | | Models | Switch between platform mode and own-model mode; configure primary / memory summary / skill evolution / Embedding / ASR / image generation models | | Tokens | Platform-granted token or BYOK usage stats, low-balance alerts, request more | | General | Simplified Chinese / English | | Window | Default launch mode (pet / full / last used), close behavior, menu bar icon | | Notifications | Update notifications, task completion notifications, sounds | | Privacy | Memory improvement program toggle, data agreement | | Developer | Log level, open log directory, export redacted diagnostic report | | About | Version, check for updates, terms of service | Diagnostic reports contain no secrets, tokens, account identifiers, prompts, or task messages. # Main Workbench (/docs/desktop/workbench) `/main` is the full Agent workbench: task list on the left, message stream in the middle, input box at the bottom. ## Input & Sending [#input--sending] * `Enter` to send, `Shift + Enter` for a new line; IME composition (e.g. Chinese input) is handled correctly. * The `+` button adds attachments: up to 4, 10MB each, supporting images and common formats like `.pdf`, `.docx`, `.xlsx`, `.pptx`, `.md`, `.csv`, `.json`. * The microphone button enables voice input (requires an ASR model); transcriptions merge into the input box. * While a task is running, the send button becomes a stop button. ## Slash Commands [#slash-commands] Type `/` to open the command panel: | Command | Purpose | | ---------------- | ------------------------------------- | | `/new` | Start a new task | | `/stop` | Stop the current task | | `/restart` | Re-run the current task | | `/status` | Check the Agent's runtime status | | `/model` | View the current model configuration | | `/goal` | View or manage goal state | | `/dream` | Manually trigger memory consolidation | | `/dream-log` | View consolidation records | | `/dream-restore` | Restore the pre-consolidation state | | `/help` | Help | ## Task List [#task-list] Grouped by Pinned, Today, Yesterday, Last 7 Days, Older, and Archived. Supports rename, pin, archive, restore, and delete; running tasks show a spinner, and completed-but-unread tasks show an unread dot. `Cmd/Ctrl + K` opens task search. # Local Development & Packaging (/docs/development/local-dev) ## One-Command Start [#one-command-start] Get running in three steps: ```bash git clone https://github.com/MemTensor/memmy-agent.git && cd memmy-agent cp .env.example .env # Cloud address is pre-filled — works out of the box bash scripts/dev-start.sh # Install deps → build → start the full stack ``` `scripts/dev-start.sh` does everything in one command: it installs dependencies, builds Memory and memmy-agent, installs the `memmy` / `memmy-memory` CLIs into `~/.local/bin`, and starts the full stack (Memory, Agent API, Gateway, frontend, and desktop backend). Once the desktop app opens, finish account sign-in or BYOK setup — the script waits for the model config and then starts the agent services automatically. > `MEMMY_CLOUD_SERVICE` in `.env` defaults to `https://api.memmy.cn (use the origin only; clients append /api/... paths)`, so copying it connects you to the official cloud — no self-hosted backend or API key required. On Windows, run it in Git Bash; the script adds `~/.local/bin` to your PATH. ## Requirements [#requirements] Node.js `>=22` + npm. Root workspaces include `Memory`, `App/backend/local-api-contracts`, `App/backend`, `App/frontend/*`, `App/shell/desktop/interface`, and `App/shell/*`. ## Common Commands [#common-commands] ```bash npm install # Install dependencies at the repo root npm run dev:desktop # Start the desktop frontend Vite server and Electron shell together npm run build # Build Memory and all workspaces npm run lint npm run typecheck npm run test npm run db:migrate # Run backend database migrations npm run package:mac # Package the macOS DMG npm run package:win:x64 ``` ## Developing Memory Standalone [#developing-memory-standalone] ```bash npm run memory:serve:dev -- \ --host 127.0.0.1 \ --port 18960 \ --db ~/.memmy/memory-service/memory.sqlite \ --config ~/.memmy/config.yaml ``` ## memmy-agent from Source [#memmy-agent-from-source] ```bash cd App/memmy-agent npm install && npm run build node dist/main.js onboard node dist/main.js agent --message "Hi, introduce the current workspace" node dist/main.js serve ``` # FAQ (/docs/help/faq) **How is Memmy different from a regular chatbot?** A regular chatbot only handles the current conversation. Memmy maintains local memory, scans external Agent history, installs Agent Skills, and puts the desktop app, CLI, Memory service, and tool connections in one runtime environment. **Do I have to register an account?** Not necessarily. The desktop app supports both account mode and API Key mode; API Key mode uses your own model quota, and data is still stored local-first. **Can I use Memmy without configuring ASR or an image generation model?** Yes. They only affect voice input and Agent image generation — both optional capabilities that never block normal chat or memory features. **How do external Agents use Memmy's memory?** First run the Memory service, then install the CLI, and finally install the corresponding Skill for Codex, Cursor, Claude Code, Opencode, OpenClaw, or Hermes. **Where is my data stored? Does scanning upload it?** Everything defaults to `~/.memmy`, including config, workspace, the Memory SQLite database, and runtime files. Scanning and ingestion happen entirely locally, with memories written to local SQLite. Participation in the "memory improvement program" is explicitly controlled by a toggle in privacy settings. # memmy-memory CLI (/docs/memory/memory-cli) Gives external Agents or scripts access to the Memory service: ```bash memmy-memory init memmy-memory health memmy-memory search "memory policies in this project" memmy-memory add "a piece of knowledge worth saving" memmy-memory get memmy-memory delete ``` Connects to `http://127.0.0.1:18960` by default. Use `--url`, `--token`, `--config`, `--source`, and `--user-id` to specify the target service, authentication, calling source, and user namespace. Also supports reload-config, session open/close, turn start/complete, and raw calls. # How Memory Works (/docs/memory/overview) Memmy memory is hosted by the local Memory service. The default endpoint is `http://127.0.0.1:18960`, and data is stored in `~/.memmy/memory-service/memory.sqlite`. Hooks, plugins, the `memmy-memory` CLI, and the desktop app all read and write this service, so different Agents share the same memory store. ## The Complete Path of One Request [#the-complete-path-of-one-request] The path has seven stages: 1. Before a request reaches the Agent, a Hook or plugin opens or reuses a Memmy session and calls `turn.start`. 2. On the first turn of a new episode, the Memory service classifies intent and decides whether to recall memory and which layers are allowed. 3. The request is converted into a semantic query, keywords, short-pattern terms, and structural error fragments. 4. Recall channels run in parallel, then candidates are fused using memory layer, channel rank, quality, and time decay. 5. Candidates pass a relative threshold, deduplication, MMR diversity selection, and an optional LLM filter. 6. Hits are rendered as historical context and injected into the Agent. The current user request always remains authoritative. 7. At the end of the turn, `turn.complete` stores the raw turn and L1 traces. Background jobs then summarize, reflect, score, embed, and evolve higher-level memory. ## Four Memory Layers [#four-memory-layers] | Memory layer | What it stores | How it is produced | | -------------- | ---------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------- | | L1 Trace | User request, Agent response, tool calls, results, reflections, error signatures, and source | `turn.complete`, history scanning, or explicit `memory.add` | | L2 Policy | Triggers, procedures, boundaries, verification, and failure-avoidance guidance induced from similar valuable L1 traces | L2 induction after reward | | L3 World Model | Stable knowledge about a project, environment, and constraints rather than a procedure | Abstraction from clusters of L2 policies | | Skill | A callable SOP with a name, invocation guide, steps, and verification conditions | Crystallized and verified from eligible L2 Policies | ## Capture, Indexing, and Evolution [#capture-indexing-and-evolution] ### Automatic turn capture [#automatic-turn-capture] `turn.complete` first stores a Raw Turn and then writes one L1 item for each captured step. By default it retains: * up to 4,000 characters of user or Agent text; * up to 2,000 characters from each tool output; * up to 8 derived tags; * tool name, input, result, error signatures, turn status, and source Agent; * a heuristic summary that can later be rewritten asynchronously by the summary model; * quality signals such as `value`, `alpha`, and `priority`. Reflection synthesis and embedding after capture are enabled by default. L1 uses the summary text to create `vec_summary`; L2, L3, and Skill use `vec`. An embedding failure enters a retry queue and does not block the active Agent turn. ### Explicit writes and history imports [#explicit-writes-and-history-imports] `memory.add` writes L1 by default, although callers can select another layer. A normal manual write enters the text index immediately and receives an embedding asynchronously. An L1 imported by an Agent history scan enters the `summary_queued` pipeline first. It becomes recallable only after summary and vector indexing complete, preventing partially processed history from being injected. ### Episodes, feedback, and higher-level memory [#episodes-feedback-and-higher-level-memory] * Consecutive follow-ups are merged into one episode by default, with a maximum gap of 2 hours. * When an episode closes because of a topic boundary, session close, or 2 hours of inactivity, Memmy generates and scores reflections first. * It waits through a default 30-second feedback window, then computes task reward and propagates it back through the episode's L1 traces. * Eligible L1 traces enter a candidate pool and are induced into L2. A new L2 triggers L3 abstraction and Skill crystallization. * Explicit user feedback, repeated tool failures, and divergent success/failure distributions can also adjust value and create failure-avoidance experience or decision repair. Key evolution defaults: | Setting | Default | Effect | | ----------------------------------------- | ------: | ------------------------------------------------------------------------------------------- | | `capture.synthReflection` | `true` | Synthesizes and scores reflection after an episode closes | | `capture.embedAfterCapture` | `true` | Creates embeddings asynchronously after capture or evolution | | `capture.batchThreshold` | `12` | Step threshold for batched reflection on long episodes | | `reward.gamma` | `0.9` | Positional discount applied to earlier steps in the trace | | `reward.lambda` | `0.5` | Blends uniform weighting with gamma-based positional weighting | | `reward.delta` | `0.1` | Extra weight for a step that recovers from an irrelevant previous step | | `reward.decayHalfLifeDays` | `30` | Time-decay half-life for L1 priority | | `reward.feedbackWindowSec` | `30` | Time to wait for explicit feedback after episode close | | `l2Induction.minTraceValue` | `0.005` | Minimum value for the L2 pool; the L1 trace must also have a vector | | `l2Induction.minEpisodesForInduction` | `1` | Distinct episodes required to induce L2 | | `l2Induction.minSimilarity` | `0.65` | Minimum similarity for associating L1 with an existing L2 | | `l2Induction.candidateTtlDays` | `30` | Retention period for L2 candidate evidence | | `l2Induction.minGain` | `0.02` | Minimum gain for activating an L2 Policy | | `l2Induction.archiveGain` | `-0.05` | Gain threshold for archiving an L2 Policy | | `l3Abstraction.clusterMinSimilarity` | `0.3` | Minimum similarity for clustering L2 into one world model | | `l3Abstraction.minConfidenceForRetrieval` | `0.2` | Minimum L3 confidence for recall | | `skill.minEtaForRetrieval` | `0.1` | Eta threshold used during Skill crystallization; recall also checks `retrieval.minSkillEta` | | `skill.minSupport` | `1` | Minimum evidence count for Skill crystallization | | `skill.minGain` | `0.02` | Minimum gain for Skill crystallization | ## When Recall Runs [#when-recall-runs] Each retrieval entry point allows different layers: | Retrieval mode | Layers allowed by default | Purpose | | ---------------------------------- | ------------------------- | ------------------------------------------------------------------- | | `turn_start` / `search` | Skill, L2, L1, L3 | Automatic recall before a normal request or manual search | | `tool_driven` / `sub_agent` | L2, L1, L3 | Tool decisions or sub-Agent missions without automatic Skill recall | | `skill_invoke` / `decision_repair` | Skill, L2, L1 | Invoking a target Skill or repairing a failed decision | | `world_model` | L3 | World-model-only lookup | The first turn of a new episode also passes an intent gate: | Intent | Layers recalled | | --------------------------------------- | -------------------- | | Task or unknown | Skill, L2, L1, L3 | | Asking what Memmy remembers from before | Skill, L2, L1; no L3 | | Chitchat or a Memmy meta-command | Recall is skipped | `turn_start` excludes L1 from the current session to prevent a just-observed turn from echoing back through the long-term-memory path. L2, L3, and Skill are not excluded by this rule. `readOnlyInjectionProfile` narrows layers only when `domain: research`. It can be `experience` (L2 only), `skill`, `skill_experience`, or `all`. Outside the research domain, the effective profile is always `all`. ## How the Query Is Prepared [#how-the-query-is-prepared] 1. When an evolution model is configured, the service extracts one embedding-oriented semantic query and up to 5 keywords from the full request. If extraction fails, it falls back to the original request and rule-based keywords. 2. Chinese phrases produce additional two-character patterns, while code, paths, and error text produce structural fragments. 3. A query vector is created only when the database contains eligible vectors. If vectorization times out or fails, full-text, short-pattern, and structural channels continue. 4. `enableQueryRewrite` is off by default. When enabled, the evolution model generates 3 complementary queries, each recalls independently, and a separate RRF merge combines their results. ## How Many Recall Paths Are There? [#how-many-recall-paths-are-there] There are **4 retrieval families**, represented by **6 ranker channel names**: `vec`, `vec_summary`, `vec_action`, `fts`, `pattern`, and `structural`. | Family | Channel | Scope | Default pool and threshold | | ------------------- | ------------------------------------------------------------ | ---------- | ------------------------------------------------------------------------------------------------------------------- | | Semantic vector | L1 uses `vec_summary` / `vec_action`; other layers use `vec` | All layers | Skill 12, L1 20, L2 20, L3 8; minimum similarity is 0.25 for L1/L2/Skill and 0.15 for L3 | | SQLite FTS5 | `fts` | All layers | Up to 20 per layer; up to 5 full-text terms, combined in groups of three when more than two terms exist | | Short/CJK pattern | `pattern` | All layers | Up to 20 per layer; covers two-character CJK fragments and two-character ASCII terms using field substring matching | | Structural fragment | `structural` | L1 only | Up to 10; matches distinctive error signatures, paths, and error codes | Pool sizes follow these formulas: * vector pool: `tierTopK × candidatePoolFactor`; * the defaults are Tier 1 `3 × 4 = 12`, Tier 2 `5 × 4 = 20`, and Tier 3 `2 × 4 = 8`; * FTS and pattern: `max(tierTopK, keywordTopK)`, which is 20 by default; * after all channels are merged, each Tier is capped again at 12 / 20 / 8. For local SQLite retrieval, the service first builds a search window from the latest 2,000 vector rows matching the layer and vector field, then asks sqlite-vec for Top K. The 2,000-row window is currently a fixed constant, not a `config.yaml` option. ## Candidate Filtering, Fusion, and Ranking [#candidate-filtering-fusion-and-ranking] ### Before the ranker [#before-the-ranker] * Only `activated` and `resolving` records are read. `archived`, `deleted`, and unfinished history imports are excluded. * A Skill must be `active` or `candidate` and have `eta >= minSkillEta`, which defaults to 0.1. * L3 confidence must reach `l3Abstraction.minConfidenceForRetrieval`, which defaults to 0.2. * `tagFilter: auto` applies only to the L1 vector route. It first uses tags inferred from the query; if no tagged vector matches, it relaxes to an untagged summary-vector search. `on` stays strict, while `off` disables this tag gate. ### Relevance fusion [#relevance-fusion] Each candidate starts with its best channel score, then receives a layer-quality bonus: ```text L1 bonus = min(weightPriority, 0.3) × max(value, 0) × time decay Skill bonus = skillEtaBlend × eta L2 bonus = 0.2 × clamp01(gain, or feedback salience / confidence) RRF bonus = 0.4 × Σ 1 / (rrfConstant + channelRank + 1) relevance = max(channelScore) + layer bonus + RRF bonus ``` ### Thresholds, episode rollups, and MMR [#thresholds-episode-rollups-and-mmr] 1. Each Tier's pre-pool is ordered by relevance, channel count, and vector score. 2. When at least 2 high-ranking L1 traces share an episode, the representative vector similarity reaches 0.45, and its value is not negative, Memmy creates an episode rollup containing up to 6 steps. 3. Candidates below 20% of the highest relevance are dropped. Multi-channel bypass is on by default, so a candidate that hits at least 2 channels can survive. 4. Queries containing long identifiers or error-code-like tokens require keyword confirmation from FTS, pattern, or structural channels for L1/L2. Skill and L3 are exempt. 5. MMR selects using `0.7 × relevance - 0.3 × redundancy`. Smart seed requires the first candidate from a Tier to reach at least 70% of the global top relevance. 6. The final pass deduplicates individual L1 traces against an episode rollup and suppresses duplicate L2 Policies already covered by a Skill. `tier1TopK=3`, `tier2TopK=5`, and `tier3TopK=2` size candidate pools and also produce the default global result limit of `3 + 5 + 2 = 10`. They are not hard per-Tier quotas in the final result. When a request supplies `limit`, final MMR selection uses that request value. ### Final LLM filter [#final-llm-filter] After mechanical ranking, Memmy prefers the evolution model for relevance filtering and falls back to the summary model when evolution is not configured: | Setting | Default | Effect | | ----------------------------- | ------: | ------------------------------------------------------------------------------ | | `llmFilterEnabled` | `true` | Enables final semantic filtering | | `llmFilterMinCandidates` | `1` | Minimum mechanical candidates required before calling the LLM | | `llmFilterMaxKeep` | `8` | Maximum kept after a successful LLM call | | `llmFilterFallbackMaxKeep` | `6` | Fallback cap when no LLM is configured, the call fails, or output is malformed | | `llmFilterCandidateBodyChars` | `500` | Candidate body characters shown to the filter model | The LLM may intentionally drop every candidate. If its output is invalid or the call fails, the top 6 mechanically ranked candidates are retained. ## How Context Is Injected [#how-context-is-injected] Hits are rendered in this order: 1. L1 traces and similar episodes; 2. L2 Policy; 3. L3 Environment Knowledge; 4. Skills; 5. decision guidance distilled from experience. A normal snippet is capped at 640 characters. Skills use `summary` mode by default, injecting the name and up to 200 characters of description. `full` mode injects the guide but still obeys the 640-character per-snippet cap. The final Markdown explicitly labels the content as historical memory that must be checked against the current request and current repository state. ## Tuning config.yaml [#tuning-configyaml] The main configuration file is `~/.memmy/config.yaml` unless `MEMMY_CONFIG` points elsewhere. The following block lists the effective core settings and their defaults. You only need to keep fields you want to override: ```yaml memmyMemory: version: 1 domain: "" algorithm: enableMemoryAdd: true enableMemorySearch: true enableQueryRewrite: false capture: maxTextChars: 4000 maxToolOutputChars: 2000 synthReflection: true embedAfterCapture: true batchThreshold: 12 reward: gamma: 0.9 lambda: 0.5 delta: 0.1 decayHalfLifeDays: 30 feedbackWindowSec: 30 l2Induction: minEpisodesForInduction: 1 minSimilarity: 0.65 candidateTtlDays: 30 minTraceValue: 0.005 minGain: 0.02 archiveGain: -0.05 l3Abstraction: minPolicies: 1 minPolicyGain: 0.02 minPolicySupport: 1 clusterMinSimilarity: 0.3 minConfidenceForRetrieval: 0.2 skill: minEtaForRetrieval: 0.1 minSupport: 1 minGain: 0.02 candidateTrials: 1 session: followUpMode: merge_follow_ups mergeMaxGapMs: 7200000 retrieval: tier1TopK: 3 tier2TopK: 5 tier3TopK: 2 candidatePoolFactor: 4 weightPriority: 0.4 mmrLambda: 0.7 rrfConstant: 60 relativeThresholdFloor: 0.2 minSkillEta: 0.1 minTraceSim: 0.25 episodeGoalMinSim: 0.45 tagFilter: auto keywordTopK: 20 skillEtaBlend: 0.15 smartSeed: true smartSeedRatio: 0.7 multiChannelBypass: true skillInjectionMode: summary skillSummaryChars: 200 llmFilterEnabled: true llmFilterMaxKeep: 8 llmFilterFallbackMaxKeep: 6 llmFilterMinCandidates: 1 llmFilterCandidateBodyChars: 500 readOnlyInjectionProfile: all ``` After saving the file, run: ```bash memmy-memory reload-config ``` Retrieval, evolution, and model settings can be hot-reloaded. A `storage` change makes the reload response return `requiresRestart: true`, in which case the Memory service must be restarted. Algorithm settings are centralized in the service, so Agent Hooks and plugins usually do not need to be reinstalled. ### Common tuning directions [#common-tuning-directions] * **Increase recall:** raise `candidatePoolFactor` or `keywordTopK`, or lower `relativeThresholdFloor` or `minTraceSim`. * **Reduce noise:** raise `minTraceSim`, `relativeThresholdFloor`, or `minSkillEta`, or lower `llmFilterMaxKeep`. * **Increase diversity:** lower `mmrLambda`. Raising it favors the highest relevance more strongly. * **Handle multi-fact or indirect questions:** enable `enableQueryRewrite`, at the cost of extra evolution-model calls and latency. * **Disable memory reads or writes independently:** set `enableMemorySearch: false` or `enableMemoryAdd: false`. ## Inspecting a Recall [#inspecting-a-recall] ```bash memmy-memory search "your query" --verbose ``` For debugging, inspect: * `candidateMemoryIds`: raw candidates merged from the underlying channels; * `hits`: candidates after fusion, thresholding, and MMR; * `sourceMemoryIds`: memories actually rendered into context; * `status`: whether LLM filtering succeeded, was disabled, was skipped, or fell back; * the Memory Logs page: `memory.search` candidates, filtered results, droppedByLlm entries, and statistics. ## The Memory Management Page [#the-memory-management-page] The `/memory` sidebar is organized into three groups by purpose: | Group | Sub-pages | Description | | -------- | ----------------------------------------------------------------- | ------------------------------------------------------------------------------------------------- | | Work | Overview / Memories / Tasks / Experiences / World models / Skills | View summary statistics and memory details, organized by task, experience, world model, and skill | | Insights | Analytics / Logs | Review write and evolution analytics, plus Memory API search and write logs | | System | Cross-Agent access | Manage Agent sources, history scanning, and Hook/plugin connection status | The Logs page provides dedicated detail views for `memory.search` and `memory.add` (search candidates, written fields, result status), useful for explaining why a memory was matched or written. # Install Memory Skills for External Agents (/docs/memory/skills) Beyond passively scanning history, Memmy lets external Agents actively read and write memory. The desktop app starts it automatically; or launch from source with `npm run memory:serve:dev`. The desktop "Memory Sources" page offers one-click installation to `~/.local/bin`. `bash memmy-memory init --agent ` Memmy writes the memory instruction file into the target Agent's rules directory, after which that Agent will actively call `memmy-memory` to retrieve and write memories. # Agent Sources & Scanning (/docs/memory/sources) Learn how Memmy scans local history from nine built-in Agents and which Hooks, plugins, Skills, and live-memory behaviors it installs. An Agent Source is Memmy's adapter for reading local history from an external Agent. Source scanning imports conversations that already exist; supported live integrations use Hooks and plugins for automatic recall and capture in new conversations.
History scanning and live integration are separate
“Sync new” reads data the Agent has already written locally. A Hook or plugin handles automatic recall, automatic turn capture, and task resumption in new conversations. Scanning alone does not modify Agent configuration; installing a Hook, plugin, or Skill writes the files listed below.
## Built-in sources [#built-in-sources] | Agent | Default history source | Live integration | | ----------- | ----------------------------------------------------------------------------------------------------------- | ------------------------------- | | Cursor | `~/Library/Application Support/Cursor/User/workspaceStorage/**/state.vscdb` and `globalStorage/state.vscdb` | Hook | | Claude Code | `~/.claude/projects/**/*.jsonl` | Hook | | Codex | `~/.codex/sessions///
/rollout-*.jsonl` | Hook | | OpenCode | `~/.local/share/opencode/opencode.db` | Native plugin | | OpenClaw | Conversation and memory SQLite databases under `~/.openclaw` | Memory plugin | | Hermes | `~/.hermes/sessions/**/*.jsonl` and `~/.hermes/state.db` | Memory Provider plugin | | WorkBuddy | `~/.workbuddy/projects/**/*.jsonl` | Skill (on-demand memory access) | | Pi | `~/.pi/agent/sessions/**/*.jsonl` | Skill (on-demand memory access) | | qwenwork | `~/.qwenworkcn/projects/**/*.jsonl` | Skill (on-demand memory access) | Cross-Agent access only shows built-in Agents whose local configuration or history source is currently detected. Undetected built-in Agents do not occupy space in the list. ## Incremental sync [#incremental-sync] * **Sync new** scans every detected source; each source can also be synced individually. * Scans can be paused, resumed, or stopped; progress streams in real time over SSE. * **Deep scan** uses `full` mode to backfill older history and requires a second confirmation. * Under **Advanced actions → Add another Agent**, you can select `kimi code`, `zcode`, `minimax code`, or `coder`, or enter another Agent name. * Adding another Agent does not require a local path. Memmy starts a discovery task that locates the history directory, identifies the message format, installs the full `memmy-memory` Skill, imports the latest 500 complete conversation turns, and saves a rule for later syncs. This flow does not install a native Hook or plugin for an unknown Agent. * The discovery task first verifies the Agent identity against an executable, `.app`, or installed package product name. During automatic discovery, matching only ignores case, spaces, hyphens, and underscores; it does not translate, infer aliases, or match semantically. If no installed product matches, Memmy reports that the Agent was not found and stops. The user can continue by supplying absolute paths to the installation artifact, native history file or directory, and optional Skill directory so Memmy can validate only those scoped paths. Memmy does not substitute another Agent or its own history. * During discovery and validation, a custom Agent remains an internal draft and is not shown in the Cross-Agent list. It appears only after Memmy records a verified native history path. A name reported as not found therefore does not create a visible Agent card, while the original task can still accept paths and continue onboarding. ### Why scanned-message and added-memory counts differ [#why-scanned-message-and-added-memory-counts-differ] The scan and “Adding” progress indicators count **messages**, while the memory pages count **memory records**. These values are not one-to-one. Memmy groups messages by source and conversation, then writes one L1 memory for each complete conversation turn: * A user message starts a turn. Following tool, system, and Assistant messages are merged into that turn, which must start with non-empty user content and end with a non-empty Assistant message. * One complete turn creates one L1 memory. For example, one user message, two tool messages, and one Assistant message are four processed messages but only one added memory. * Messages reread at the watermark boundary and messages imported previously are deduplicated with conversation checkpoints, source message IDs, and stable turn IDs. A repeat sync updates or returns the same memory instead of creating a copy. * A user-only turn, a turn without a final Assistant response, or a turn with empty boundary content is skipped until a later sync can complete it. * An oversized turn is skipped, while a Memory service write error is counted as failed. Neither case adds a memory. As a result, the current scan/processed-message count, the unique imported-message count, and the new-memory count can all differ. Before counting, built-in adapters also ignore non-message records, extract usable text, and redact common secrets and large Base64 payloads. ### How the date-time watermark works [#how-the-date-time-watermark-works] Memmy maintains a separate date-time watermark for each source. This is not simply the “last scanned” time shown in the UI: 1. When the initial scan starts, Memmy stores its start time as a baseline and also records the newest message timestamp actually observed. The later of those values becomes the effective cursor for the next incremental scan. 2. On later **Sync new** runs, a built-in source selects a conversation when at least one of its messages has a timestamp **greater than or equal to** the cursor. Memmy rereads the entire selected conversation so a watermark cannot cut off the user request at the start of a turn. 3. The inclusive `>=` boundary intentionally allows the boundary message to be read again. Before import, a conversation checkpoint compares the last message timestamp, message ID, and content hash. Stable source message IDs and turn IDs then make the import itself idempotent. 4. The watermark advances to the newest observed timestamp only when scanning and import finish without errors and there are no incomplete or failed conversations. After a scan error or an unfinished turn, the watermark stays in place so the next run can retry. The displayed “last scanned” time may still change and is not the incremental cursor. For an Agent connected through “Add another Agent” whose format Memmy discovers, the first import stores a sync boundary. Later syncs select complete turns whose starting user message is strictly later than that boundary, then use stable message and turn IDs to remove repeats. ### Images, files, and oversized turns [#images-files-and-oversized-turns] An image or file attachment does not cause a turn to be skipped by itself. Built-in sources extract usable text from history and replace common inline Base64 image or file payloads with a redaction marker before import. Attachment contents, file text, tool output, or other long text may still become part of a turn. Memmy measures the UTF-8 size of the complete memory-write request (`memory.add` JSON), including the user request, tool trace, Assistant response, and request metadata. If it exceeds **2 MiB**, Memmy skips the entire turn rather than truncating it or splitting it across memories, then continues with other turns in the same sync. This is recorded as skipped rather than as a sync failure, so the sync may still complete successfully. The size limit applies to the complete turn request, not only to the user request's character count. ## Scan preferences [#scan-preferences] | Toggle | Effect | | ------------------------------- | ---------------------------------------------------------------------------------------------------------------------- | | Auto-sync conversations | Automatically collect new conversations from connected Agents (on startup and on a schedule)—no need to click Sync new | | Auto-connect newly found Agents | Installs the integration for a newly detected built-in Agent; the compact Skill is installed with it | When auto-install is disabled, a detected Agent still appears in the list and you can click **Install Hook**, **Install plugin**, or **Install Skill** manually. ## Data processing and local management [#data-processing-and-local-management] * Each successfully written complete turn first becomes one raw L1 memory, then receives its summary and search index in the background. * You can view the local data path (default `~/.memmy/memory-service`), open the directory, export `memory.sqlite`, or wipe local memory data after a second confirmation. * Removing a Hook, plugin, or Skill does not delete imported history. Clearing local data is a separate explicit action. ## Hook and plugin integrations [#hook-and-plugin-integrations] Memmy connects to live Agent conversations through each host's native **Hooks** or **plugin** system. Installing an integration also installs a compact `memmy-memory` Skill for on-demand search and retrieval when the automatically injected context is not enough. ### Integration overview [#integration-overview] | Agent | Integration | Events or interfaces used | Main effect | | ----------- | ---------------------- | ------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------- | | Cursor | Hook | `beforeSubmitPrompt`, `afterAgentResponse`, `stop` | Starts turns, records responses, captures completed turns, and supports `/memmy-resume` | | Claude Code | Hook | `UserPromptSubmit`, `Stop` | Recalls and injects memory before a request, captures the completed turn, and supports `/memmy-resume` | | Codex | Hook | `UserPromptSubmit`, `Stop` | Recalls and injects memory before a request, captures the completed turn, and supports `/memmy-resume` | | OpenCode | Native plugin | Message, tool, text-completion, and session events | Recalls memory, captures responses and tool traces, and exposes native memory tools and `/memmy-resume` | | OpenClaw | Memory plugin | `before_prompt_build`, `agent_end` | Injects memory while building the prompt, captures the completed turn, and exposes native memory tools | | Hermes | Memory Provider plugin | Provider lifecycle methods such as `prefetch` and `sync_turn` | Recalls and captures automatically, mirrors explicit Hermes memory writes, and exposes native memory tools | | WorkBuddy | Skill | Agent invokes `memmy-memory` | Searches, reads, and writes shared memory on demand | | Pi | Skill | Agent invokes `memmy-memory` | Searches, reads, and writes shared memory on demand | | qwenwork | Skill | Agent invokes `memmy-memory` | Searches, reads, and writes shared memory on demand | ### What happens during a turn [#what-happens-during-a-turn] ```mermaid flowchart LR Request["User request"] --> Entry["Hook / plugin"] Entry --> Start["Open session and start turn"] Start --> Recall["Retrieve relevant Memmy memory"] Recall --> Context["Inject it as historical context"] Context --> Agent["Agent performs the task"] Agent --> Complete["Capture answer, status, and available tool traces"] Complete --> Memory["Complete the turn in the local Memory service"] ``` Common results after installation: * **Automatic recall:** Claude Code, Codex, OpenCode, OpenClaw, and Hermes retrieve and inject relevant memory before normal requests run. * **Automatic capture:** the Hook or plugin submits the user request, Agent answer, and success/failure status at the end of a turn. The Agent does not need to run `memmy-memory add` manually. * **Task resumption:** `/memmy-resume ` returns up to five L1 episode candidates. Enter `1`–`5` to load the complete episode and inject continuation context. Claude Code, OpenCode, OpenClaw, and Hermes use native command entry points; Cursor, Codex, and Skill-only integrations install an explicit `memmy-resume` Skill. * **On-demand lookup:** the bundled Skill keeps `memmy-memory search` and `memmy-memory get` for cases where automatic context is insufficient. * **Source attribution:** captured turns carry `cursor`, `claude_code`, `codex`, `opencode`, `openclaw`, or `hermes`, so you can filter and trace their origin.
Cursor's current Hook focuses on automatic capture and /memmy-resume
When a normal Cursor request needs additional memory, the bundled Skill performs an on-demand lookup. The other five integrations inject recalled context before normal requests.
### Cursor: three Hooks [#cursor-three-hooks] Memmy appends its own entries to `~/.cursor/hooks.json` without replacing other Hooks. | Hook | When it runs | What Memmy does | | -------------------- | ------------------------------------ | -------------------------------------------------------------------------------------------------------------------- | | `beforeSubmitPrompt` | Before the user request is submitted | Opens or reuses a Memmy session, starts a turn, stores the request, and handles `/memmy-resume` search and selection | | `afterAgentResponse` | After the Agent produces a response | Stores the final response in the current turn state for the completion Hook | | `stop` | When the Agent turn stops | Combines the request and response and calls turn-complete; failures are allowed through and do not block Cursor | Written or updated by default: * `~/.cursor/hooks.json` * `~/.cursor/hooks/memmy-resume-hook.mjs` * `~/.cursor/hooks/memmy-memory-config.json` * `~/.cursor/skills/memmy-memory/SKILL.md` * `~/.cursor/skills/memmy-resume/SKILL.md` ### Claude Code: `UserPromptSubmit` and `Stop` [#claude-code-userpromptsubmit-and-stop] | Hook | When it runs | What Memmy does | | ------------------ | ----------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------- | | `UserPromptSubmit` | Before the user request reaches the model | Starts a Memmy turn, puts recalled memory into `additionalContext`, and handles `/memmy-resume` | | `Stop` | When Claude Code completes or terminates a turn | Reads the request and answer from the Hook payload or transcript, then completes the turn as `succeeded`, `failed`, or `cancelled` | Written or updated by default: * `~/.claude/settings.json` * `~/.claude/hooks/memmy-resume-hook.mjs` * `~/.claude/hooks/memmy-memory-config.json` * `~/.claude/commands/memmy-resume.md` * `~/.claude/CLAUDE.md` * `~/.claude/skills/memmy-memory/SKILL.md` ### Codex: `UserPromptSubmit` and `Stop` [#codex-userpromptsubmit-and-stop] | Hook | When it runs | What Memmy does | | ------------------ | ------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------- | | `UserPromptSubmit` | Before the user request is submitted | Starts a turn, injects recalled memory through Hook `additionalContext`, and handles `/memmy-resume` | | `Stop` | When the Codex turn stops | Extracts the answer from the transcript or last Assistant message, completes the turn, and preserves failed or cancelled status | Written or updated by default: * `~/.codex/hooks.json` * `~/.codex/hooks/memmy-resume-hook.mjs` * `~/.codex/hooks/memmy-memory-config.json` * `~/.codex/AGENTS.md` * `~/.codex/skills/memmy-memory/SKILL.md` * `~/.codex/skills/memmy-resume/SKILL.md` ### OpenCode: native plugin [#opencode-native-plugin] | Callback | Effect | | ----------------------------------------------------- | --------------------------------------------------------------------------------------------- | | `chat.message` | Starts a turn, injects recalled memory automatically, and handles `/memmy-resume` | | `tool.execute.before` / `tool.execute.after` | Captures non-Memmy tool arguments and results as part of the turn trace | | `experimental.text.complete` / `message.part.updated` | Collects the complete Assistant text output | | `session.error` | Marks the current turn failed and stores the error | | `session.idle` | Completes and captures the current turn asynchronously | | `dispose` | Flushes turns that have not yet been submitted before the plugin unloads or the process exits | The plugin also registers the native `memmy_memory_search`, `memmy_memory_get`, and `memmy_memory_add` tools. Written or updated under `~/.config/opencode` by default: * `plugins/memmy-memory.js` * `plugins/memmy-memory-config.json` * `commands/memmy-resume.md` * `../../../AGENTS.md` * `skills/memmy-memory/SKILL.md` If `OPENCODE_CONFIG_DIR` or `XDG_CONFIG_HOME` is set, Memmy writes to the corresponding configuration directory instead. ### OpenClaw: Memory plugin [#openclaw-memory-plugin] | Interface | Effect | | -------------------------- | ------------------------------------------------------------------------------------------------------------------------ | | `registerMemoryCapability` | Tells OpenClaw that Memmy is active and that injected content is historical context | | `before_prompt_build` | Starts a turn before prompt construction and injects recalled memory or a selected episode through `prependContext` | | `agent_end` | Extracts the request, answer, and tool trace and completes the turn synchronously so capture is not lost on process exit | | `registerCommand` | Registers `/memmy-resume` | | `registerTool` | Registers `memmy_memory_search`, `memmy_memory_get`, and `memmy_memory_add` | Installation points `plugins.slots.memory` to `memmy-memory` and enables `allowPromptInjection` and `allowConversationAccess`. Written or updated by default: * `~/.openclaw/extensions/memmy-memory/` * `~/.openclaw/openclaw.json` * `~/.openclaw/skills/memmy-memory/SKILL.md` * `../../../AGENTS.md` in the OpenClaw workspace (default `~/.openclaw/workspace/AGENTS.md`) OpenClaw has one memory-provider slot. If another memory plugin is already active, Memmy asks whether to replace it or keep it and install only the Skill. ### Hermes: Memory Provider plugin [#hermes-memory-provider-plugin] | Provider interface / Hook | Effect | | --------------------------------------- | ------------------------------------------------------------------------------------------------ | | `system_prompt_block` | Declares that Memmy is active and that injected memory is historical context only | | `prefetch` | Starts a turn before the user request and returns relevant memory context | | `sync_turn` | Completes the turn in a background thread and captures the user request and Assistant answer | | `on_memory_write` | Mirrors explicit memory writes from Hermes into Memmy | | `on_session_switch` | Keeps the Memmy session aligned with the active Hermes session | | `get_tool_schemas` / `handle_tool_call` | Exposes `memmy_memory_search`, `memmy_memory_get`, and `memmy_memory_add` | | `pre_llm_call` / `pre_gateway_dispatch` | Recognizes a `/memmy-resume` candidate number and injects or rewrites it as full episode context | Installation sets `memory.provider` to `memmy-memory`, enables the `memory` toolset, and enables the standalone `memmy-resume` command plugin. Written or updated by default: * `~/.hermes/plugins/memmy-memory/` * `~/.hermes/plugins/memmy-resume/` * `~/.hermes/config.yaml` * `~/.hermes/SOUL.md` * `~/.hermes/skills/memmy-memory/SKILL.md` Hermes likewise allows one active Memory Provider. Memmy asks for confirmation before replacing another provider. ### Install, verify, and remove [#install-verify-and-remove] 1. Open **Memory → Cross-Agent access**. 2. For Cursor, Claude Code, and Codex, click **Install Hook**. For OpenCode, OpenClaw, and Hermes, click **Install plugin**. For WorkBuddy, Pi, and qwenwork, click **Install Skill**. 3. For another Agent, expand **Advanced actions → Add another Agent**, select a preset or enter its name, and let Memmy complete discovery and the first import. 4. If the Agent is already running, restart it or open a new session so it reloads its configuration. 5. Complete a normal turn, then confirm that the corresponding source appears in Memmy's memory or log views. 6. Enter `/memmy-resume `, confirm that candidates appear, and select an episode with `1`–`5`. When you click **Remove Hook**, **Remove plugin**, or **Remove Skill**, Memmy cleans up the integration content it manages. Other configuration is preserved, and memories already stored in Memmy are not deleted. ### Local access and failure behavior [#local-access-and-failure-behavior] * Hooks and plugins read the Memory service endpoint and token from `~/.memmy/config.yaml` and keep the runtime configuration they need in the Agent's local config directory. Do not publish these config files. * Injected content is wrapped in `` as historical memory, while `` identifies the authoritative current request. This reduces the risk of treating old memory as a new instruction. * Recall and capture are **fail-open**: errors are logged and the Agent continues its current task instead of being interrupted when the Memory service is temporarily unavailable. * Host Hook commands have a 60-second timeout; individual Memory requests have a 45-second timeout. # API Key Mode (BYOK) (/docs/models/byok) Use your own model quota. Setup takes three steps, each with a real connection test. 1. Choose a provider (OpenAI, Anthropic, Gemini, DeepSeek, Zhipu, Tongyi Qianwen, Kimi, MiniMax, Baidu Qianfan, Doubao), then fill in the model ID, endpoint, and API Key; Embedding can run in local mode or custom mode. 2. The memory summary model (summarizes conversations and experience) and the skill evolution model (distills experience into skills) can both simply reuse the primary model. 3. ASR (voice input, currently fixed to Qwen ASR) and the image generation model are skippable — they never block normal chat or memory features. ## Provider Defaults [#provider-defaults] | Provider | Default Endpoint | Default Model Placeholder | | -------------- | --------------------------------------------------- | ------------------------- | | OpenAI | `https://api.openai.com/v1` | `gpt-4o` | | Anthropic | `https://api.anthropic.com` | `claude-sonnet-4` | | Gemini | `https://generativelanguage.googleapis.com` | `gemini-2.5-pro` | | DeepSeek | `https://api.deepseek.com/v1` | `deepseek-chat` | | Zhipu | `https://open.bigmodel.cn/api/paas/v4` | `glm-4` | | Tongyi Qianwen | `https://dashscope.aliyuncs.com/compatible-mode/v1` | `qwen-max` | | Kimi | `https://api.moonshot.ai/v1` | `moonshot-v1-128k` | | MiniMax | `https://api.minimax.chat/v1` | `MiniMax-Text-01` | | Baidu Qianfan | `https://qianfan.baidubce.com/v2` | `ernie-4.0-8k` | | Doubao | `https://ark.cn-beijing.volces.com/api/v3` | `doubao-pro-256k` | # Supported Providers (/docs/models/providers) The Agent Runtime currently supports: OpenAI-compatible APIs, Anthropic, Azure OpenAI, AWS Bedrock, OpenRouter, DeepSeek, Gemini, Zhipu, DashScope, Kimi, MiniMax, Ollama, LM Studio, GitHub Copilot, OpenAI Codex OAuth, and more. OAuth-based providers can sign in via the CLI: ```bash memmy provider login ``` # Desktop Local API (/docs/reference/local-api) The desktop local API is built on Fastify and binds to a random port on `127.0.0.1`. Everything except `/api/health` is authenticated with `x-memmy-local-token`; due to EventSource limitations, SSE passes the same token via `?token=`. ## Main Endpoint Groups [#main-endpoint-groups] | Group | Representative Endpoints | | ----------------------- | --------------------------------------------------------------------------------------------------- | | App configuration | `PATCH /api/app/settings`, `GET/PUT /api/app/model-config`, `POST /api/app/model-config/test` | | Account | `POST /api/account/send-code`, `POST /api/account/verify-code`, `POST /api/account/logout` | | Integrations & channels | `GET /api/v1/integrations/capabilities`, `POST /api/v1/channels/:provider/connect` | | Agent Source | `GET /api/agent-sources`, `POST /api/agent-sources/scan`, `POST /api/agent-sources/:sourceId/skill` | | Local data | `POST /api/local-data/reveal`, `POST /api/local-data/export`, `DELETE /api/local-data` | | Memory proxy | `/api/v1/memory/*`, `/api/v1/panel/*` (proxied to the Memory Runtime) | | MCP bridge | `GET/POST/DELETE /mcp/composio` (separate `x-memmy-mcp-token`) | ## SSE Events [#sse-events] `/api/events` pushes: `app.connected`, `app.heartbeat`, `agent_source.scan_progress`, `agent_source.scan_completed`. # Memory Runtime API (/docs/reference/memory-api) Default address `http://127.0.0.1:18960`. Once `storage.token`, `MEMMY_MEMORY_TOKEN`, or `MEMORY_SERVICE_TOKEN` is set, all endpoints except the health check require a bearer token. | Method | Path | Description | | -------- | ----------------------------------- | ------------------------ | | `GET` | `/api/v1/health` | Health check | | `POST` | `/api/v1/sessions/open` | Open an Agent session | | `POST` | `/api/v1/sessions/:sessionId/close` | Close a session | | `POST` | `/api/v1/turns/start` | Record a turn start | | `POST` | `/api/v1/turns/:turnId/complete` | Record a turn completion | | `POST` | `/api/v1/memory/search` | Search memories | | `POST` | `/api/v1/memory/add` | Write a memory | | `GET` | `/api/v1/memory/:id` | Memory details | | `DELETE` | `/api/v1/memory/:id` | Delete a memory | | `GET` | `/api/v1/panel/overview` | Panel overview | | `GET` | `/api/v1/panel/analysis` | Memory analytics | | `GET` | `/api/v1/panel/items` | Entry list | ## Local Storage Configuration [#local-storage-configuration] ```yaml memmyMemory: version: 1 activeProfile: byok storage: mode: local backend: sqlite sqlitePath: ~/.memmy/memory-service/memory.sqlite endpoint: http://127.0.0.1:18960 token: local-token profiles: byok: embedding: provider: local ``` # OpenAI-Compatible API (/docs/reference/openai-api) `memmy serve` listens on `http://127.0.0.1:18990` by default: | Method | Path | | ------ | ---------------------- | | `GET` | `/health` | | `GET` | `/v1/models` | | `POST` | `/v1/chat/completions` | Any tool or script that speaks the OpenAI Chat Completions protocol can reuse Memmy directly. # Default Ports (/docs/reference/ports) | Service | Default Port | | ------------------------------------- | --------------------------------- | | Memory HTTP / memory foundation | `18960` | | Gateway health | `18970` | | WebUI / WebSocket / admin HTTP | `18980` | | OpenAI-compatible API (`memmy serve`) | `18990` | | Desktop frontend Vite dev server | `19000` | | Vite HMR | `19010` | | Desktop local API | Random port | | Composio MCP bridge | Reuses the desktop local API port | # Security & Privacy (/docs/security/security) Memmy's security boundary is built on **local execution** and **explicit authentication**: * The desktop local API only accepts requests from the local machine, `file://`, or controlled origins by default, verified with `x-memmy-local-token`. * Due to EventSource limitations, SSE passes the same runtime token via a query parameter. * The Composio MCP bridge uses a separate `x-memmy-mcp-token`. * Memory HTTP can be protected with a bearer token (`MEMMY_MEMORY_TOKEN` / `MEMORY_SERVICE_TOKEN`). * Config supports `${ENV_NAME}` environment variable references, keeping API Keys out of config files. * The Memory client must connect to a real Memory Layer or discover a local SQLite source — otherwise startup fails rather than silently showing fake data. ## Where Your Data Lives [#where-your-data-lives] Everything defaults to `~/.memmy`: config, workspace, the Memory SQLite database, and runtime files. Desktop app state is maintained by the local backend in a local SQLite database. Scanning and ingestion happen entirely locally, with memories written to local SQLite. Participation in the "memory improvement program" is explicitly controlled by a toggle in privacy settings. # Getting Started (/docs/start/getting-started) This page walks you through installing Memmy, completing first-run setup, and having your first conversation — from zero. ## What You Need [#what-you-need] * A macOS or Windows desktop environment (desktop path). * Or Node.js `>=22` + npm (CLI / source path). * API Key mode requires at least one model provider's API Key. Not sure which mode to pick? Account mode works out of the box and comes with platform trial tokens; in API Key mode your data and quota stay fully under your control. Both modes store data local-first. ## Quick Setup [#quick-setup] For a terminal-only installation on Linux x64 or arm64, install Node.js 22 or newer and make sure a systemd user session is available, then run: ```bash curl -fsSL https://raw.githubusercontent.com/MemTensor/memmy-agent/main/scripts/install.sh | bash memmy ``` The installer starts the local Memory Service as `memmy-memory.service`. If no usable model is configured, the first bare `memmy` command opens the existing wizard. After saving, it enables `memmy-gateway.service`, waits for readiness, and continues into the TUI. Both `systemd --user` services stay running when the TUI or terminal exits and start again on later logins; linger is not enabled. The installer launcher also refreshes a private `~/.memmy/systemd/gateway.env` file (mode `0600`) so configuration-referenced credentials and the terminal `PATH` remain available to the persistent Gateway. Use `systemctl --user status memmy-memory.service` and `systemctl --user status memmy-gateway.service` to inspect them. The installer does not modify external agents. Run `memmy-memory init` or `memmy-memory init --agent ` explicitly to install Memory integration for an agent. Download and install the Memmy desktop app. On first launch it automatically: 1. Sets `MEMMY_HOME` and `MEMMY_CONFIG`. 2. Installs the bundled CLI and prepares Hooks, plugins, and companion Skills for authorized Agents. 3. Prepares `~/.memmy/config.yaml`, the workspace, and the Memory SQLite database. 4. Starts the Memory service and the Agent gateway. ```bash cd App/memmy-agent npm install npm run build node dist/main.js --help ``` On the welcome page, choose: * **Account mode**: sign in with a phone number or email verification code, using platform trial tokens. * **API Key mode**: a three-step setup — primary model + Embedding, memory-related models, and optional ASR and image generation models — each step with a real connection test. ```bash memmy onboard # Terminal menu for configuring models, providers, and tools memmy onboard --defaults # Initialize config and workspace non-interactively memmy status # Check configuration and runtime status ``` Enter the main workbench and send your first message from the input box. `Enter` to send, `Shift + Enter` for a new line, and type `/` to open the slash command panel. ```bash memmy agent --message "Hi, introduce the current workspace" # Or start an interactive chat directly memmy ``` Open "Memory → Cross-Agent access" and scan conversation history from Cursor, Claude Code, Codex, OpenCode, OpenClaw, Hermes, WorkBuddy, Pi, and qwenwork into the memory store. First-run onboarding lets you scan only or also install the matching Hook, plugin, or Skill for detected Agents. After connection, Hooks and plugins capture completed turns and inject relevant memory automatically; WorkBuddy, Pi, and qwenwork use the Skill for on-demand memory access. See [Agent Sources & Scanning](/docs/memory/sources) for details. To connect an Agent outside the built-in list, open **Advanced actions → Add another Agent**. Select `kimi code`, `zcode`, `minimax code`, or `coder`, or enter another name; Memmy discovers its history location and format, installs the Skill, and completes the first import. Open the "Tools" page: * Messaging channels: Telegram, Discord, iMessage, WeChat, Feishu, DingTalk. * Managed integrations: GitHub, Gmail, Notion, Slack, Linear, Jira, and more, via OAuth. ## Advanced: Use Memmy as a Local API [#advanced-use-memmy-as-a-local-api] ```bash memmy serve ``` Listens on `http://127.0.0.1:18990` by default, exposing `GET /health`, `GET /v1/models`, and `POST /v1/chat/completions` — reusable by any tool that speaks the OpenAI Chat Completions protocol. ## Advanced: Environment Variables [#advanced-environment-variables] | Variable | Purpose | | --------------------------------------------- | ------------------------------------------------------ | | `MEMMY_HOME` | Memmy data home directory (default `~/.memmy`) | | `MEMMY_CONFIG` | Main config file path (default `~/.memmy/config.yaml`) | | `MEMMY_MEMORY_TOKEN` / `MEMORY_SERVICE_TOKEN` | Bearer token for the Memory HTTP service | `${ENV_NAME}` references in the config file are resolved automatically, so you never hard-code API Keys in config. ## What's Next [#whats-next] Sessions, attachments, voice, and slash commands · Agent scanning and Hook/plugin integrations · The three-step setup in detail · The lightweight always-on-desktop entry point ## Related [#related] * [Default Ports](/docs/reference/ports) * [Security & Privacy](/docs/security/security) * [FAQ](/docs/help/faq) # CLI Command Reference (/docs/terminal/cli) | Command | Description | | --------------------------------- | --------------------------------------------------- | | `memmy` | Start an interactive chat | | `memmy onboard` | Terminal menu-driven setup | | `memmy onboard --defaults` | Initialize config and workspace non-interactively | | `memmy status` | Check config, workspace, model, and provider status | | `memmy agent --message "..."` | Send a single-turn message | | `memmy serve` | Start the OpenAI-compatible API | | `memmy provider login ` | Provider OAuth sign-in | # TUI User Guide (/docs/terminal/tui) Memmy TUI is Memmy's full-screen terminal interface. Whether you install the desktop app or just the CLI, you can run `memmy` in your terminal to use it. image.png ## Installing Memmy TUI [#installing-memmy-tui] ### Option 1: Install the Memmy desktop app [#option-1-install-the-memmy-desktop-app] For macOS and Windows. The desktop app provides the `memmy` command and takes care of starting the local Memory and Agent Gateway services. 1. Download and install the desktop app from the [Memmy official website](https://memmy.cn/en/) or [GitHub Releases](https://github.com/MemTensor/memmy-agent/releases). 2. Launch Memmy and complete setup in either account mode or API key mode. 3. Open a new terminal and check that the command is available: ```bash memmy --help memmy --version ``` * **macOS:** drag the app into `/Applications` and launch it at least once. If your terminal reports that `memmy` cannot be found, open a new terminal or run: ```bash source ~/.zshrc ``` * **Windows**: after installation, open a new PowerShell or Windows Terminal window. When using the TUI provided by the desktop app, keep the Memmy desktop app running. Closing it also stops the Gateway it manages. ### Option 2: Install only the Memmy CLI [#option-2-install-only-the-memmy-cli] For Linux x64 or arm64 environments that don't need the desktop app. Requires **Node.js 22** or later and a system with `systemd --user` support. ```bash curl -fsSL https://raw.githubusercontent.com/MemTensor/memmy-agent/main/scripts/install.sh | bash ``` Once installation finishes, run: ```bash memmy ``` On first run, if no model is available yet, Memmy opens the setup wizard. The CLI installer manages the Memory and Gateway services; they keep running after you exit the TUI or close the terminal. Check service status: ```bash systemctl --user status memmy-memory.service systemctl --user status memmy-gateway.service ``` ## First Time Setup [#first-time-setup] If you already completed onboarding in the desktop app, you can skip this section. CLI users should run: ```bash memmy onboard --defaults memmy onboard memmy status ``` * `memmy onboard --defaults` — creates or refreshes the config file and workspace, non-interactively. * `memmy onboard` — configures models, providers, Gateway, Memory, and tools interactively. * `memmy status` — checks the current configuration, workspace, model, and provider. Default locations: * Config file: `~/.memmy/config.yaml` * Workspace: `~/.memmy/workspace` ## Opening the TUI [#opening-the-tui] Run: ```bash memmy ``` This opens the default `cli:direct` session. Type a message and press `Enter` to send it. **Resuming or creating sessions:** ```bash # Resume an existing session memmy --session cli:work # Create a new standalone session memmy --standalone # Create a session bound to a project directory memmy --project /path/to/project ``` `--session`, `--standalone`, and `--project` are mutually exclusive — pick one. List existing sessions: ```bash memmy sessions list ``` ### `memmy` vs. `memmy agent` [#memmy-vs-memmy-agent] To open the full-screen TUI covered in this guide, use bare `memmy`. `memmy agent` is for single-turn tasks or conventional terminal interaction: ```bash # Single-turn task memmy agent --message "Give me an overview of the current workspace" # Send a single turn from stdin echo "Summarize this project" | memmy agent ``` ## Sending Tasks [#sending-tasks] Type after the `❯` prompt and press `Enter` to send. The TUI does not currently support the desktop workbench's `Shift + Enter` newline; `Enter` always submits. Long text wraps visually in the terminal, but you cannot insert multiple lines. To send multi-line text, use: ```bash memmy agent --message $'first line\nsecond line' ``` or: ```bash printf 'first line\nsecond line\n' | memmy agent ``` ### Typing while a task is running [#typing-while-a-task-is-running] * `Enter` — queue the next turn. * `Tab` — append your input to the current turn, when that turn is being executed by this TUI. If the current turn came from the desktop app or another IM channel, the TUI will not take it over; use `Enter` to queue instead. When there are queued tasks, the interface shows the queue count, a message preview, and the message source. ## Keyboard Controls [#keyboard-controls] Basic controls are the same on macOS, Windows, and Linux; the primary modifier for line-editing combinations differs: | **Action** | **macOS** | **Windows** | **Linux** | | --------------------------------------- | ----------------------------------------------------- | ------------------------------- | ------------------------------- | | Send; queue next turn while running | `Enter` | `Enter` | `Enter` | | Append to the current TUI executed turn | `Tab` | `Tab` | `Tab` | | Move one character | `←` / `→` | `←` / `→` | `←` / `→` | | Move by word | `⌘ + ←` / `⌘ + →` | `Ctrl + ←` / `Ctrl + →` | `Ctrl + ←` / `Ctrl + →` | | Move to start of input | `Home` / `Ctrl + A` | `Home` / `Ctrl + A` | `Home` / `Ctrl + A` | | Move to end of input | `End` / `Ctrl + E` / `⌘ + E` | `End` / `Ctrl + E` | `End` / `Ctrl + E` | | Delete from cursor to start of line | `Ctrl + U` / `⌘ + U` / `⌘ + Backspace` / `⌘ + Delete` | `Ctrl + U` | `Ctrl + U` | | Delete from cursor to end of line | `Ctrl + K` / `⌘ + K` | `Ctrl + K` | `Ctrl + K` | | Delete previous word | `Ctrl + W` / `⌘ + W` | `Ctrl + W` / `Ctrl + Backspace` | `Ctrl + W` / `Ctrl + Backspace` | | Delete a character | `Backspace` / `Delete` | `Backspace` / `Delete` | `Backspace` / `Delete` | | Stop your own running turn and exit | `Ctrl + C` | `Ctrl + C` | `Ctrl + C` | On macOS, `⌘` is the Command key; Windows and Linux use `Ctrl` as the primary modifier. `Shift + Enter` never inserts a newline on any platform — it submits the current message. You can also exit by typing any of the following: ```bash exit quit /exit /quit :q ``` If the task is being executed by another channel, `Ctrl + C` only exits the current TUI; it does not stop the task on that channel. ## Slash Commands [#slash-commands] Slash command menu The TUI has a slash-command suggestion menu. Type `/` in the input area to open it, and keep typing a command name (for example `/go`) to filter the suggestions. The menu closes once you type a space to enter an argument or subcommand. * `↑` / `↓` — move between suggestions. * `Tab` — complete the selected command entry; it does not complete subcommands or arguments. * `Enter` — if the current input is a command prefix, completes it first; if the command entry is already complete, runs the command. * `Esc` — close the suggestion menu. If `Enter` only completed the command, press `Enter` again to run it. * The menu shows the commands currently available, along with hints for that command's arguments or subcommands. * Arguments and subcommands do not get their own suggestions — for example, with `/model list` you complete `/model` first and then type `list` manually. * `/stop` appears only when the current turn is being executed by this TUI. * `/restart` is not shown and cannot be run from the TUI. * `exit`, `quit`, `/exit`, `/quit`, and `:q` all exit, but only `/quit` appears in the menu. * Whether `/history-dag` appears depends on whether the corresponding feature is enabled. * Up to 8 suggestions are shown initially; keep typing a command prefix to filter down to others. | **Command** | **Arguments** | **Purpose** | | --------------------------- | ------------------ | ----------------------------------------------------------------------------------- | | `/help` | none | Show help for the available commands | | `/status` | none | Show runtime status, provider, and channel status | | `/model` | none | Show the current model configuration | | `/model list` | none | List model presets | | `/model ` | model preset name | Switch model preset, e.g. `/model fast` | | `/history` | none | Show session history | | `/history ` | number of messages | Show the last `n` history messages | | `/history-dag` | none | Show the session history DAG | | `/new` | none | Stop the current task and start a new conversation | | `/stop` | none | Stop the turn currently executed by this TUI; does not stop tasks on other channels | | `/restart` | none | Not accepted by the TUI; exit and restart the Gateway instead | | `/last-compaction` | none | Show the most recent context-compaction summary for this session | | `/quit` | none | Exit the TUI without stopping turns running on other channels | | `/goal` | none | Show the current persistent goal | | `/goal status` | none | Show persistent goal status | | `/goal help` | none | Show help for the goal subcommands | | `/goal ` | goal text | Shorthand for creating a persistent goal | | `/goal create ` | goal text | Create a persistent goal | | `/goal pause` | none | Pause the goal | | `/goal resume` | none | Resume the goal | | `/goal edit ` | new goal text | Edit the goal | | `/goal budget ` | a number or `none` | Set or clear the goal budget | | `/goal clear` | none | Clear the goal | | `/pairing` | none | View or manage channel pairings | | `/pairing list` | none | List channel pairing requests | | `/pairing approve ` | pairing code | Approve a pairing request | | `/pairing deny ` | pairing code | Deny a pairing request | | `/pairing revoke ` | user ID | Revoke a user's pairing | Whether `/history-dag` is available depends on whether the corresponding feature is enabled in your configuration. ## FAQ [#faq] ### `memmy: command not found` [#memmy-command-not-found] * **macOS**: make sure Memmy has been moved into `/Applications` and launched at least once, then open a new terminal or run `source ~/.zshrc`. * **Windows**: open a new PowerShell or Windows Terminal window. * **Linux**: confirm the installer completed successfully, and check that `~/.local/bin` is on your `PATH`. ### No model available [#no-model-available] ```bash memmy onboard memmy status ``` Confirm that the model, provider, and credentials have been saved, then run `memmy`. ### Gateway unavailable [#gateway-unavailable] * **Desktop app**: make sure the Memmy desktop app is running. * **Linux CLI**: check `memmy-gateway.service`. * **Running the CLI from source or manually**: run `memmy gateway` in another terminal. The default Gateway WebSocket port is `18980`. On Linux you can check the logs: ```bash journalctl --user -u memmy-gateway.service ``` ### Why doesn't `memmy agent` open the full-screen interface? [#why-doesnt-memmy-agent-open-the-full-screen-interface] That's expected. `memmy agent` is the single-turn / conventional terminal entry point. For the full-screen TUI, run: ```bash memmy ``` # Managed Tool Integrations (/docs/tools/integrations) The standard integrations on the Tools page come from a managed catalog (Composio), including GitHub, GitLab, Gmail, Google Calendar/Docs/Drive/Sheets/Slides, Notion, Slack, Linear, Jira, Confluence, Figma, Dropbox, Airtable, Trello, Salesforce, HubSpot, Stripe, Zoom, and more. ## Authorization Flow [#authorization-flow] 1. Click a tool card, review the permission scopes, then click Connect to get an authorization URL. 2. Complete OAuth in your external browser; the dialog polls every 4 seconds for up to 5 minutes. 3. Once connected, the tool is exposed to the Agent Runtime through the Composio MCP bridge, and the desktop backend automatically writes `tools.mcpServers.composio`. # Custom MCP Servers (/docs/tools/mcp) Memmy supports three kinds of MCP servers: `stdio`, `sse`, and `streamableHttp`: ```yaml tools: mcpServers: example: type: stdio command: npx args: - "-y" - "your-mcp-server" toolTimeout: 30 enabledTools: - "*" ``` ## Built-in Tool Toggles [#built-in-tool-toggles] ```yaml tools: web: enabled: true search: provider: duckduckgo maxResults: 5 fetch: timeoutS: 30 maxChars: 60000 exec: enabled: true timeout: 60 imageGeneration: enabled: false ``` Built-in tools cover the filesystem, shell, web search and fetching, MCP, scheduled tasks, message sending, image generation, long-running tasks, introspection, runtime status, and context management.