commit

commit is a command for Claude Code from franciszhangkk/claude-obsidian-multi-repo-tracker. It costs 26 tokens per session (1,132 once invoked), scanned A, original, MIT.

A Git commit command that selects files, avoids common secret and generated-file patterns, creates a commit message, commits the changes, and updates related notes in an Obsidian vault.

In plain words
What is it for?
Use it to commit a working tree safely, generate a Chinese commit message when none is supplied, and record the change in project notes.
Why use it?
It reduces repetitive commit preparation and keeps project documentation connected to submitted code changes.

Command for Claude Code

Written for Claude Code: allowed-tools in frontmatter. Also seen: names the AskUserQuestion tool.

Good fit Use it to commit a working tree safely, generate a Chinese commit message when none is supplied, and record the change in project notes.

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

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

Your own site · 80×15
<a href="https://agentmods.dev/commands/franciszhangkk/claude-obsidian-multi-repo-tracker/commit"><img src="https://agentmods.dev/badge/commands/franciszhangkk/claude-obsidian-multi-repo-tracker/commit.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 26 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,132 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.00026 $0.01132
Opus 5 $0.00013 $0.00566
Sonnet 5 $0.00005 $0.00226
Haiku 4.5 $0.00003 $0.00113

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

Security

Grade A, and why

commit 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 9d 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/commit.md · 121 lines

How it starts

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

/commit — 智能提交 + 文档同步

封装 git add + git commit,提交完成后自动调用 sync-docs 把变更同步到 Obsidian。

执行流程

1. 检查工作区状态

git status --short
git diff --stat
git diff --cached --stat

如果工作区干净(无暂存、无未暂存改动),输出"没有改动需要提交"并退出。

2. 选择并暂存文件

读取改动列表,按以下规则筛选要暂存的文件:

  • 必须排除.env**.key*.pem*credentials**secret**.p12*.pfx
  • 默认排除(除非用户明确指定):node_modules/__pycache__/*.pyc.DS_Store*.log
  • 可疑文件警告:文件名含 passwordtokenapi_key 时停下来用 AskUserQuestion 让用户确认

git add <具体文件> 一个个加,不要用 git add .git add -A

3. 生成 commit message

用户传了消息($ARGUMENTS 非空)

直接使用 $ARGUMENTS 作为 commit message,跳到第 4 步。

自动生成

参考最近 5 条提交的风格:

git log --oneline -5

按以下规则生成中文 message:

  • 格式:<type>: <描述>
  • type 选一个:feat(新功能)/ fix(bug 修复)/ refactor(重构)/ docs(文档)/ chore(杂项)/ test(测试)/ style(格式)
  • 描述用中文,陈述句,不超过 50 字
  • 不要写"修改了 X 文件"这种废话,要写为什么做了什么决策

如果改动横跨多个不相关的功能块,用 AskUserQuestion 问用户是否要拆分提交。

4. 执行提交

git commit -m "$(cat <<'EOF'
<message>

Co-Authored-By: Claude <[email protected]>
EOF
)"

如果 pre-commit hook 失败:报告错误并停止,不要用 --no-verify 绕过

5. 调用 sync-docs

提交成功后,直接执行 sync-docs 的全部流程(不要重新解析 vault 路径,复用同一份逻辑)。

如果 sync-docs 失败(vault 不存在、项目未注册等),不要让 commit 一起回滚 —— commit 已经在 git 里了。报告"提交成功,文档同步失败:<原因>"并提示用户后续手动 /sync-docs

6. 更新当前焦点(精简版 update-active)

额外 token 成本约 200,复用已有的 commit message,不再重新读 git。

从 commit message 推断焦点草稿(和 /update-active 第 3 步相同规则,但输入只用 commit message)。

然后用 AskUserQuestion 展示:

当前焦点是否需要更新?

  推测:"<从 commit message 提取的一句话>"

→ 确认 / 自定义 / s 跳过
  • 用户确认 → 写入 activeContext.md "当前焦点"段
  • 用户跳过 → 不动 activeContext,继续
  • 用户自定义 → 写入用户输入的内容

什么时候建议跳过:commit type 是 chore / docs / style / test 时,推测草稿后主动提示"这次提交不涉及功能进展,建议跳过焦点更新"。

7. 输出报告

✅ 提交完成
   <short_sha> <message>
   涉及文件: <count> 个
   
✅ 文档已同步(参见 sync-docs 的输出)

或:

✅ 提交完成
   <short_sha> <message>
   
⚠️ 文档同步失败:<reason>
   稍后可手动运行 /sync-docs 补同步

Read the full file on GitHub · 121 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. 9d ago First seen · 121 lines · 26 tokens per session scan A 2d4c8fbbf881

Subscribe to this mod's changes

commit is a command published in the GitHub repository franciszhangkk/claude-obsidian-multi-repo-tracker (2 stars, last pushed 4mo ago), licensed MIT. It adds 26 tokens to every session and 1,132 once invoked, about $0.0001 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.