sync-docs

sync-docs is a command for Claude Code from franciszhangkk/claude-obsidian-multi-repo-tracker. It costs 34 tokens per session (1,714 once invoked), scanned B, original, MIT.

A command that copies recent Git commit information into the matching project notes in Obsidian, a markdown-based note-taking app.

In plain words
What is it for?
Use it after commits, or through the related commit and pull workflows, to update a project's active context and activity status in an Obsidian vault.
Why use it?
It keeps project documentation aligned with code changes and highlights changes that may affect the system's structure.

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 after commits, or through the related commit and pull workflows, to update a project's active context and activity status in an Obsidian vault.

Compare 6 commands from other repositories ↓
Install with agentmods
npx agentmods add commands/franciszhangkk/claude-obsidian-multi-repo-tracker/sync-docs
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 sync-docs

README.md
[![agentmods](https://agentmods.dev/badge/commands/franciszhangkk/claude-obsidian-multi-repo-tracker/sync-docs/github.svg)](https://agentmods.dev/commands/franciszhangkk/claude-obsidian-multi-repo-tracker/sync-docs)
Your own site
<a href="https://agentmods.dev/commands/franciszhangkk/claude-obsidian-multi-repo-tracker/sync-docs"><img src="https://agentmods.dev/badge/commands/franciszhangkk/claude-obsidian-multi-repo-tracker/sync-docs/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 sync-docs

Your own site · 80×15
<a href="https://agentmods.dev/commands/franciszhangkk/claude-obsidian-multi-repo-tracker/sync-docs"><img src="https://agentmods.dev/badge/commands/franciszhangkk/claude-obsidian-multi-repo-tracker/sync-docs.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 34 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 1,714 The whole file, excluding the scripts and references it only reads on demand.
Security scan B 1 finding. 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.00034 $0.01714
Opus 5 $0.00017 $0.00857
Sonnet 5 $0.00007 $0.00343
Haiku 4.5 $0.00003 $0.00171

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

Security

Grade B, and why

sync-docs scanned grade B with 1 finding 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 12d 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.

Reads agent configuration directoriesmediumAgent snooping

.claude/, .codex/, .gemini/ hold keys, settings and other credentials a mod has no legitimate need for.

- 在 ~/.claude/settings.json 的 env 里设置 OBSIDIAN_VAULT_PATH,或
commands/sync-docs.md · 134 lines

How it starts

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

/sync-docs — 项目文档同步

把当前 git 仓库的最近变更同步到对应 Obsidian 项目的 activeContext.md,并刷新 首页.md 的项目活跃状态。

执行流程

1. 解析 vault 路径

按优先级取:

  1. 命令参数 $ARGUMENTS(如 /sync-docs ~/Documents/MyVault

  2. 环境变量 $OBSIDIAN_VAULT_PATH

  3. 都没有 → 报错并提示用户配置:

    未找到 Obsidian vault。请:
    - 在 ~/.claude/settings.json 的 env 里设置 OBSIDIAN_VAULT_PATH,或
    - 直接传参:/sync-docs <vault 路径>
    

    不要随便猜默认路径

2. 匹配当前项目

git rev-parse --show-toplevel    # CODE_ROOT

读取 $VAULT_PATH/CLAUDE.md,解析"项目 ↔ 代码仓库映射"表(markdown 表格),找到 代码路径 列等于 CODE_ROOT(或 CODE_ROOT 是其前缀展开)的那一行,取出 Obsidian 路径(形如 项目/<name>/)。

匹配不到就用 AskUserQuestion 让用户从已存在的项目列表里选,或者提示用 /add-project 先注册。

3. 收集最近一次提交

git log -1 --format="%h|%s|%ai|%an"
git diff HEAD~1 --name-only

如果是首次提交(没有 HEAD~1),用 git show --name-only HEAD 取文件列表。

4. 检测架构变更

把变更文件名跟以下模式做匹配(语言无关,覆盖大多数项目):

  • *.proto *_proto.*
  • **/architecture/* **/arch/*
  • **/middleware/*
  • 项目根的 Makefile Dockerfile go.mod package.json pyproject.toml Cargo.toml pom.xml
  • **/SKILL.md .claude/skills/**
  • config*.yaml config*.yml

命中任何一个就标记 arch_changed=true

5. 更新 Obsidian activeContext.md

打开 $VAULT_PATH/<obsidian_project_path>/activeContext.md,在 ## 最近改了什么(最近 1-2 次会话) 区域顶部插入一行:

- <YYYY-MM-DD> `<short_sha>` <commit_message>

规则

  • 该区域只保留最新 5 条,更早的删掉
  • 如果最新 sha 已存在,跳过(防重复)
  • 如果区域不存在,提示用户文件结构异常,让其检查模板

6. 更新首页项目活跃状态

打开 $VAULT_PATH/首页.md,找到"项目列表"表格里 obsidian 路径匹配当前项目的那一行,把"状态"列更新为:

进行中(YYYY-MM-DD)

只动这一个 cell,不要改其他列。如果该列原本是「维护中」「已暂停」等用户手填状态,跳过更新(人工设置优先)—— 仅当原值是「进行中」或为空时才覆盖。

7. 检查 CLAUDE.md 是否有需要迁移的旧结构

v0.5 以后,"最近变更"由 activeContext.md 承载,CLAUDE.md 不再有此段。

  • 如果 $CODE_ROOT/CLAUDE.md 仍包含 ## 最近变更 段 → 输出提醒:
    ⚠️ 检测到旧版 CLAUDE.md 结构(含"最近变更"段)。
       建议用 /update-memory 迁移到 v0.5 新骨架,将"最近变更"移到 activeContext.md。
       本次 /sync-docs 仍会更新该段,但后续请迁移。
    
    并继续向旧 ## 最近变更 写入(向下兼容,防已有文件断更)
  • 如果没有 ## 最近变更 段(已是 v0.5 结构)→ 跳过,什么都不写

8. 刷新 CLAUDE.md 的"Obsidian 文档地图"段

Read the full file on GitHub · 134 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. 12d ago First seen · 134 lines · 34 tokens per session scan B 64e92dd59147

Subscribe to this mod's changes

sync-docs is a command published in the GitHub repository franciszhangkk/claude-obsidian-multi-repo-tracker (2 stars, last pushed 4mo ago), licensed MIT. It adds 34 tokens to every session and 1,714 once invoked, about $0.0002 per session on Opus 5. A static security scan graded it B with 1 finding (reads agent configuration directories). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.