Skip to main content

novelmemo

面向 AI Agent 的长期记忆 MCP 服务:将记忆持久化为 Obsidian 兼容的 Markdown vault,供 Agent 读写、供 Obsidian 只读可视化记忆图谱。

快速开始

安装与运行(推荐 uvx)

uvx novelmemo init ~/my-vault
uvx novelmemo mcp --vault ~/my-vault

本地开发:

uv sync
uv run novelmemo init ./my-vault
uv run novelmemo mcp --vault ./my-vault

Cursor / MCP 配置示例

在 mcp.json 中添加:

{
  "mcpServers": {
    "novelmemo": {
      "command": "uvx",
      "args": ["novelmemo", "mcp", "--vault", "/path/to/my-vault"]
    }
  }
}

工作流约定

  • MCP 是唯一写入方:记忆的创建、更新、删除以及 ## Related memories 自动链接段均由 MCP 维护。
  • Obsidian 只读使用:在 Obsidian 中打开 vault 浏览图谱与正文,请勿手改记忆文件;.memory/ 目录(sidecar 索引与配置)可加入 Obsidian ignore。
  • 会话起始:在新 Agent 会话中调用 read_memory("system://boot") 加载 memory.yaml 中配置的 boot 记忆;boot 视图末尾会附加最近修改的 5 条记忆。novelmemo 通过 MCP 提供工具但不推送使用说明,boot 加载与读写时机等主动行为需由 Agent 系统提示驱动——可直接采用 docs/system-prompt.md,粘进 Cursor Rules 或 Agent 系统提示即可。

CLI

命令 说明
novelmemo init <vault-path> 将 starter vault 模板拷贝到目标目录
novelmemo mcp --vault <path> 启动 MCP stdio 服务

业务配置位于 {vault}/.memory/memory.yaml(valid_domains、boot_uris、locale 等)。优先级:CLI > 环境变量 > memory.yaml > 默认值。

环境变量(v1):MEMORY_BOOT_URIS、MEMORY_VALID_DOMAINS、MEMORY_LOCALE。

MCP 工具(6 个)

工具 说明
read_memory(uri) 读取记忆或 system 视图(boot / index / recent / glossary)
create_memory(parent_uri, content, disclosure, title?) 创建子记忆;disclosure 必填,title 可选(支持中文)
update_memory(uri, ...) patch、append 或更新 disclosure
delete_memory(uri) 删除记忆并同步邻居 Related 段
manage_triggers(uri, add?, remove?) 管理 frontmatter triggers
search_memory(query, domain?, limit?) FTS + jieba 全文检索

目录结构

my-vault/
  core/agent/_index.md      → core://agent
  core/my_user.md           → core://my_user
  writer/characters/爱丽丝.md → writer://characters/爱丽丝
  .memory/
    memory.yaml             # 业务配置
    index.db                # sidecar FTS 索引(内部使用)

外部变更同步

当 vault 中的 .md 文件被 MCP 以外的途径修改(例如 git pull)时,后台 watcher 会自动 resync Related 段与 sidecar 全文索引。正常运行时仍以 MCP 写入为主路径。

许可

MIT License。自 Nocturne Memory 改编的组件见 NOTICE。

Release files for novelmemo 0.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for novelmemo 0.2.0
File Size Uploaded
novelmemo-0.2.0.tar.gz 295.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for novelmemo 0.2.0
File Interpreter ABI Platform
novelmemo-0.2.0-py3-none-any.whl Python 3 none any Details

Total release size: 339.9 kB

Release files / novelmemo-0.2.0.tar.gz

Download URL novelmemo-0.2.0.tar.gz
Size 295.8 kB
Tags Source
SHA-256 checksum
How to use checksums
09ce284c2774a0e9dbd25947be90e5d7d3d017e9e022a247881b0d8379425b2d
BLAKE2b-256 checksum
How to use checksums
3905dc5ed65f4312df7b43c94d1684e06b59c727289ec90fd34fb04f1589a502
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 7, 2026.

Transparency log

Release files / novelmemo-0.2.0-py3-none-any.whl

Download URL novelmemo-0.2.0-py3-none-any.whl
Size 44.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
c06611df3cd56904b6ded6a5b033e1009ad46a90bfc0e6f13cbd7f96af95f4c3
BLAKE2b-256 checksum
How to use checksums
f015d98769c742fefc703811701417b2da327e0a175601d672d94ea38ea591e8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 7, 2026.

Transparency log

Release history Release notifications | RSS feed

0.2.1

2 release files

This release

0.2.0 This release

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page