update-memory

update-memory is a command for Claude Code from franciszhangkk/claude-obsidian-multi-repo-tracker. It costs 40 tokens per session (2,348 once invoked), scanned A, original, MIT.

A command for comparing the code repository, Obsidian project notes, and automatic memory to find information that has drifted apart. Obsidian is a note-taking system that stores linked Markdown files.

In plain words
What is it for?
Use it for a regular project audit, after a large feature, when taking over an old project, or when the agent's behavior seems inconsistent.
Why use it?
It helps reveal outdated file references, missing documentation, and differences between the code and the notes used to describe it.

Command for Claude Code

Written for Claude Code: allowed-tools in frontmatter. Also seen: reads .claude/ paths; mentions CLAUDE.md; names the AskUserQuestion tool.

Good fit Use it for a regular project audit, after a large feature, when taking over an old project, or when the agent's behavior seems inconsistent.

Compare 6 commands from other repositories ↓
Install with agentmods
npx agentmods add commands/franciszhangkk/claude-obsidian-multi-repo-tracker/update-memory
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Clone the repo
git clone --depth 1 https://github.com/franciszhangkk/claude-obsidian-multi-repo-tracker

Made for: Claude Code.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for update-memory

README.md
[![agentmods](https://agentmods.dev/badge/commands/franciszhangkk/claude-obsidian-multi-repo-tracker/update-memory/github.svg)](https://agentmods.dev/commands/franciszhangkk/claude-obsidian-multi-repo-tracker/update-memory)
Your own site
<a href="https://agentmods.dev/commands/franciszhangkk/claude-obsidian-multi-repo-tracker/update-memory"><img src="https://agentmods.dev/badge/commands/franciszhangkk/claude-obsidian-multi-repo-tracker/update-memory/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for update-memory

Your own site · 80×15
<a href="https://agentmods.dev/commands/franciszhangkk/claude-obsidian-multi-repo-tracker/update-memory"><img src="https://agentmods.dev/badge/commands/franciszhangkk/claude-obsidian-multi-repo-tracker/update-memory.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 40 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 2,348 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00040 $0.02348
Opus 5 $0.00020 $0.01174
Sonnet 5 $0.00008 $0.00470
Haiku 4.5 $0.00004 $0.00235

Measured 11d ago against content hash 1472ec29539e, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-11, from the pricing page.

Security

Grade A, and why

update-memory scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 11d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

commands/update-memory.md · 200 lines

How it starts

The opening of the file, as written. The whole thing — 200 lines — stays where its author put it; the contents beside it link to each section on GitHub.

/update-memory — 漂移对账 + 文档地图刷新

/sync-docs 是流水账(只看最新 commit,无判断),/update-memory 是年度审计(全量扫描,找漂移)。

何时用:每周一次 / 大功能完成后 / 接手老项目第一天 / 发现 Claude 行为奇怪时。

不要用 / 不能替代的:日常 commit 后的同步(用 /commit 即可)。

执行流程

1. 解析参数和定位项目

# 当前 git 仓库根
CODE_ROOT=$(git rev-parse --show-toplevel)

# 从 vault CLAUDE.md 找映射
VAULT_PATH="${OBSIDIAN_VAULT_PATH:-}"
[ -z "$VAULT_PATH" ] && echo "未配置 OBSIDIAN_VAULT_PATH,退出" && exit 1

支持参数:

  • /update-memory → 当前仓库
  • /update-memory <项目名> → 指定项目
  • /update-memory --all → 扫所有项目(耗时较长,会提示)

2. 收集对账输入

并发读取:

  • Obsidian 项目目录所有 .mdfind $VAULT_PATH/项目/<name>/ -name "*.md" -type f
  • 概览.md frontmatter:解析 docs: 字段(人工维护的真相源)和"关键模块"段
  • 最近 30 天 git loggit log --since="30 days ago" --name-only --pretty=format:"%h|%ai|%s"
  • auto-memory 对应文件~/.claude/projects/<encoded-cwd>/memory/project_*.md(如有)
  • 代码仓库 CLAUDE.md 的"Obsidian 文档地图"段

3. 执行 4 类对账检查

检查 A:Obsidian 引用的代码文件是否存在

扫所有 Obsidian .md 中的代码路径引用(形如 `biz/agent/...`pkg/llm/...、行内 code 含 /.go/.py/.proto):

grep -rEho '`[a-zA-Z_/][a-zA-Z0-9_/.-]+\.(go|py|proto|ts|tsx|java)`' "$VAULT_PATH/项目/<name>/"

对每个引用:检查 $CODE_ROOT/<path> 是否存在。

不存在 → 标记 "幽灵引用"(Obsidian 提到的代码已删/重命名)。

检查 B:概览.md 的"关键模块"是否还在

读概览.md 的"关键模块"或"主要模块"表格,对每个模块路径检查 $CODE_ROOT/<path> 是否存在。

不存在 → 标记 "模块漂移"

检查 C:30 天内代码改了但 Obsidian 没改

对每个 02-功能/ 子文档:

  1. 找文档中提到的代码路径(同检查 A)
  2. 看这些代码文件 30 天内是否有修改(git log --since=30d -- <path>
  3. 看对应 02-功能/.md 的修改时间(文件 mtime 或 git log)
  4. 代码改了 + 文档至少 7 天没动 → 标记 "可能漂移"
检查 D:auto-memory 与 Obsidian 概览不一致

对照 ~/.claude/projects/<encoded-cwd>/memory/project_*.md 内容 vs Obsidian 概览.md 的关键事实(技术栈、Agent 列表、关键模块):

  • 字段值不同 → 标记 "memory 漂移"

4. 生成对账报告

按严重度排序输出:

📊 漂移对账报告 — <项目名>
   扫描时间:<YYYY-MM-DD HH:MM>
   覆盖:Obsidian 24 文档 / 代码 30 天 47 提交 / auto-memory 2 文件

🔴 幽灵引用(3 处)
   1. 项目/<name>/02-功能/Skill架构/query-ad-data-skill迁移设计.md:42
      引用 `biz/agent/ad/skills/query-ad-data-xd/` — 代码已不存在
      [a] 改 Obsidian 删除/更新引用
      [b] 跳过(这是历史记录)

🟡 模块漂移(1 处)
   2. 概览.md "关键模块" 表格列出 `pkg/embedding/` — 代码里没有
      [a] 改 Obsidian 概览
      [b] 跳过

🟡 可能漂移(2 处)
   3. biz/agent/ad/skills/query-ad-data/ 30 天内 5 commits(最新 2026-04-21)
      但 02-功能/Skill架构/query-ad-data-skill迁移设计.md 上次修改 2026-03-15
      [a] 标 TODO 让用户人工确认
      [b] 自动总结代码变更追加到文档"近期更新"段
      [c] 跳过

🟢 memory 漂移(0 处)

✨ 文档地图刷新(5 处变化)
   - 新增:02-功能/<新加的文件>.md(追加到地图,desc 留 TODO)
   - 删除:05-测试与调试/<已删除的文件>.md(从地图移除)
   - 更新 desc:3 处(按 概览.md 的 docs: frontmatter)

Read the full file on GitHub · 200 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 11d ago First seen · 200 lines · 40 tokens per session scan A 1472ec29539e

Subscribe to this mod's changes

update-memory is a command published in the GitHub repository franciszhangkk/claude-obsidian-multi-repo-tracker (2 stars, last pushed 4mo ago), licensed MIT. It adds 40 tokens to every session and 2,348 once invoked, about $0.0002 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.