mcpField
M
memory-bridge

memory-bridge

github.com/ar9av生产力3.6k2.4k 次安装1 天前更新
代码仓库

关于 memory-bridge

memory-bridge 是用于按来源工具浏览和比较 Obsidian wiki 页面的技能。它利用来源记录展示页面归属、工具间重叠和内容缺口。

主要功能

  1. 01按来源工具浏览页面
  2. 02搜索指定来源的页面
  3. 03比较各工具的 wiki 覆盖
  4. 04映射页面的工具来源

适用场景

  1. 01查找特定 AI 工具创建的页面
  2. 02比较两个工具贡献的知识
  3. 03识别多个工具共有的主题
  4. 04查看 wiki 页面的来源

安装

复制下面的命令,在终端中运行。

$npx skills add https://github.com/ar9av/obsidian-wiki --skill memory-bridge

安装后在 Claude Code 中输入/memory-bridge确认已加载。

详细介绍

Memory Bridge — 跨工具知识浏览器

你将帮助用户浏览和比较 Obsidian 知识库中的内容,并按最初生成内容的 AI 工具筛选。知识库会在 .manifest.json 和页面 sources: frontmatter 中记录来源信息;此技能会将这些元数据呈现为可浏览的视图。

开始之前

  1. 解析配置 — 遵循 llm-wiki/SKILL.md 中的 Config Resolution Protocol(内联 @name 覆盖 → 从当前工作目录向上查找 .env → 全局配置 → 提示用户设置)。这样可以获取 OBSIDIAN_VAULT_PATH。
  2. 读取 $OBSIDIAN_VAULT_PATH/.manifest.json — 这是确认每项内容由什么工具生成的权威来源。
  3. 读取 $OBSIDIAN_VAULT_PATH/index.md,获取页面标题和单行说明。

命令

解析用户的调用,确定模式:

调用模式
/memory-bridge <tool>浏览 — 列出来源为 <tool> 的所有知识库页面
/memory-bridge <tool> "<topic>"搜索 — 列出来源为 <tool> 且提及 <topic> 的页面
/memory-bridge diff差异比较 — 找出各工具独有的页面、重叠内容和盲区
/memory-bridge diff <tool-a> <tool-b>差异比较 — 比较两个指定工具
/memory-bridge map映射 — 完整来源矩阵:每个页面 × 所有参与过该页面的工具

可识别的工具名称:claude、codex、hermes、openclaw、copilot、pi、manual(手写)、ingest(wiki-ingest 文档)。

步骤 1:构建来源映射

读取 .manifest.json。对每个来源条目,提取:

  • source_type — 映射到工具名称:
    • claude_conversation、claude_memory、claude_audit_log、claude_desktop_session → claude
    • codex_rollout、codex_index、codex_history → codex
    • hermes_memory、hermes_session → hermes
    • openclaw_memory、openclaw_daily_note、openclaw_session、openclaw_dreams → openclaw
    • copilot_session、copilot_checkpoint、copilot_transcript、copilot_memory_artifact → copilot
    • pi_session → pi
    • document → ingest
    • 其他任何值 → manual
  • pages_created 和 pages_updated — 此来源生成的知识库页面

构建映射:

tool_pages = {
  "claude": set(pages created/updated by claude sources),
  "codex":  set(pages created/updated by codex sources),
  ...
}

如果多个工具都参与了某个页面,该页面可以出现在多个工具的集合中。

步骤 2:执行模式

浏览模式

筛选 tool_pages[<tool>] 并按分组列表呈现:

## Knowledge from <tool> (<N> pages)

### By category
- concepts/ — N pages
- entities/ — N pages
- skills/   — N pages
...

### Pages
| Page | Category | Tags | Last updated |
|------|----------|------|--------------|
| [[page-name]] | concept | tag1, tag2 | 2026-04-10 |
...

读取所列页面的 frontmatter(grep 匹配 ^(title|category|tags|updated):)——除非用户要求,否则不要读取完整页面正文。

搜索模式

在筛选后的页面集合中运行:

rg -l "<topic>" <pages in tool set>

然后 grep 匹配项附近的章节标题(^##),以提供上下文,而无需完整读取页面。将结果按相关度排序,以列表形式呈现,并附上匹配摘录。

差异比较模式

计算:

  • only_in_a = tool_pages[a] − tool_pages[b]
  • only_in_b = tool_pages[b] − tool_pages[a]
  • shared = tool_pages[a] ∩ tool_pages[b]

如果未指定工具,则对所有工具进行两两比较(仅保留重叠页面或独有页面数量大于 0 的组合,以保持输出简洁)。

呈现:

## Memory Bridge Diff — <tool-a> vs <tool-b>

### Only in <tool-a> (<N> pages)
These concepts exist in your wiki from <tool-a> sessions but <tool-b> has never touched them.
<list with one-line descriptions from index.md>

### Only in <tool-b> (<N> pages)
<list>

### Shared (<N> pages)
Both tools have contributed to these pages.
<list — only show if ≤15; otherwise just the count>

### Notable gaps
<highlight the most interesting asymmetries — e.g. "codex has 12 pages on build tooling that claude has never seen">
映射模式

构建矩阵,显示每个页面及参与过该页面的工具。最多显示 50 行;按参与工具数量降序排序(跨工具页面最多的排在前面——这些是信息最丰富的节点)。

| Page | claude | codex | hermes | copilot | pi |
|------|--------|-------|--------|---------|----|
| [[react-patterns]] | ✓ | ✓ | — | ✓ | — |
| [[rust-ownership]] | — | ✓ | — | — | ✓ |

步骤 3:启动 impl-validator(如果可用)

生成输出后,如果当前环境中有 impl-validator 技能,则将其作为子 Agent 启动:

impl-validator check:
  goal: "Browse/diff wiki knowledge by source tool and surface cross-tool blind spots"
  artifacts: [the output you just generated]
  checks:
    - Did you correctly parse source_type from .manifest.json?
    - Are page counts plausible (not 0 unless vault is empty)?
    - Is the diff symmetric (a−b and b−a are disjoint)?
    - Did you avoid reading full page bodies when not needed?

在向用户呈现输出之前,先处理其指出的所有问题。

步骤 4:记录

追加到 $OBSIDIAN_VAULT_PATH/log.md:

- [TIMESTAMP] MEMORY-BRIDGE mode=<browse|search|diff|map> tool=<tool> pages_shown=N

输出规范

  • 始终显示页面数量,以便用户了解每个工具各自知识库中的内容规模。
  • 页面引用使用 [[wikilinks]](如果设置了 OBSIDIAN_LINK_FORMAT=markdown,则使用标准 Markdown 链接)。
  • 在差异比较模式下,明确指出最令人意外的不对称之处——这是用户想要了解的洞察。
  • 如果 .manifest.json 为空或缺失,请明确说明,并建议先运行 /wiki-history-ingest。

评论

支持 Markdown