fit-commit

A Git commit workflow command that guides an agent through reviewing changes, checking copyright years, writing a commit message, and creating the commit.

In plain words
What is it for?
Use it before committing code to inspect modified files, review their differences, check copyright headers, prepare a compliant commit, and update task status when relevant.
Why use it?
It reduces the risk of overwriting local work, committing sensitive files, using unclear messages, or missing required copyright updates.

Command for Codex

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.

agentmods
npx agentmods add commands/modelengine-group/fit-framework/fit-commit
Clone the repo
git clone --depth 1 https://github.com/ModelEngine-Group/fit-framework

Made for: Codex.

Per session 12 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 3,308 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
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 $0.00012 $0.03308
Opus 5 $0.00006 $0.01654
Sonnet 5 $0.00002 $0.00662
Haiku 4.5 $0.00001 $0.00331

Measured yesterday against content hash 85ef66e3fc58, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

fit-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 yesterday.

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.

.codex/commands/fit-commit.md · 476 lines

How it starts

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

Commit Command

提交当前变更到 Git。

此命令提供 Git 提交的最佳实践指南。

用法:

  • /prompts:fit-commit - 查看提交指南

功能说明:

本命令会引导你完成以下步骤:

  1. 检查并更新版权头年份(CRITICAL)
  2. 分析变更内容并生成提交信息
  3. 执行 Git 提交操作
  4. 更新任务状态(如适用)

注意事项:

  • 不要提交包含敏感信息的文件(.env, credentials 等)
  • 确保提交消息清晰描述了变更内容
  • 遵循项目的 commit message 规范
  • 提交前必须检查版权头年份(见下文)

⚠️ 提交前确认用户本地修改(CRITICAL)

强制要求:在执行任何编辑操作之前,必须先检查用户的本地修改,避免覆盖用户的工作。

检查流程

步骤 0:检查用户本地修改

# 查看所有已修改的文件
git status --short

# 查看每个文件的具体修改内容
git diff

处理规则

  1. 仔细阅读 git diff 的输出,理解用户已经做了哪些修改
  2. 在用户修改的基础上进行增量编辑,不要覆盖用户的实现
  3. 如果你计划的修改与用户的修改有冲突,必须先询问用户:
    我发现该文件已有本地修改:
    - 你的修改:[描述用户的修改]
    - 我计划的修改:[描述你计划的修改]
    请确认如何处理。
    
  4. 禁止按自己的想法重写用户已经实现的代码
  5. 禁止添加用户没有要求的"改进"

⚠️ 提交前的版权头年份检查(CRITICAL)

强制要求:在执行提交之前,必须检查并更新所有修改文件的版权头年份。参见项目规则第 5 条。

检查流程

步骤 1:自动获取当前年份

# 动态获取当前年份(绝对不要硬编码)

## 使用前:自动识别仓库

命令会默认使用当前工作目录所在的 Git 仓库作为目标,无需传入仓库参数。若当前目录不在 Git 仓库内,请先 `cd` 到目标仓库根目录后再执行。

文中所有路径示例默认以仓库根目录为基准。

current_year=$(date +%Y)
echo "当前年份: $current_year"

步骤 2:检查修改的文件

# 查看即将提交的文件
git status --short

# 或查看已暂存的文件
git diff --cached --name-only

步骤 3:检查版权头

对于每个修改的文件:

# 检查文件是否包含版权头
grep -l "Copyright" <modified_file>

# 查看版权年份
grep "Copyright.*[0-9]\{4\}" <modified_file>

步骤 4:更新版权年份

如果文件包含版权头且年份不是当前年份,使用 Edit 工具更新:

常见格式:

  • Copyright (C) 2024-2025Copyright (C) 2024-<current_year>
  • Copyright (C) 2024Copyright (C) 2024-<current_year>
  • Copyright (C) 2025Copyright (C) <current_year>(如果已是当前年)

示例:

# 示例输出:命令返回 2026

# 格式 1:年份范围
Edit(
  file_path="src/example.java",
  old_string="Copyright (C) 2024-2025 FIT Framework",
  new_string="Copyright (C) 2024-2026 FIT Framework"
)

# 格式 2:单一年份
Edit(
  file_path="src/another.java",
  old_string="Copyright (C) 2024 FIT Framework",
  new_string="Copyright (C) 2024-2026 FIT Framework"
)

检查清单

在执行 git commit 之前,必须确认:

  • 已使用 date +%Y 动态获取当前年份
  • 不需要也不允许手动输入年份
  • 已检查所有即将提交的修改文件
  • 对于包含版权头的文件,已检查年份是否为当前年份
  • 如果年份不是当前年份,已使用 Edit 工具更新
  • 绝对不要硬编码年份(如 2026)
  • 只更新修改的文件,不批量更新项目中所有文件

Read the full file on GitHub · 476 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. yesterday First seen · 476 lines · 12 tokens per session scan A 85ef66e3fc58

Subscribe to this mod's changes

fit-commit is a command published in the GitHub repository ModelEngine-Group/fit-framework (2,117 stars, last pushed 5mo ago), licensed MIT. It adds 12 tokens to every session and 3,308 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-30.