Skip to content

The Unified and Autonomous Development Platform

docs(AGENTS): clarify handling of Co-authored-by trailers in commit messages

Robin Shen88d24256eae3
diff --git a/.cursor/rules/no-co-author-in-commits.mdc b/.cursor/rules/no-co-author-in-commits.mdc
index 8117087c1c..29c057601d 100644
--- a/.cursor/rules/no-co-author-in-commits.mdc
+++ b/.cursor/rules/no-co-author-in-commits.mdc
@@ -1,5 +1,5 @@
---
-description: Do not add Co-authored-by trailers when generating commit messages
+description: Do not add or keep Co-authored-by trailers in commit messages
alwaysApply: true
---
@@ -19,3 +19,16 @@ Include only subject, body, and footers required by the project's commit-message
requirement (e.g. `Fixes #123`, breaking-change notices). Add co-author trailers
only if the user explicitly asks for them or a non-empty requirement from
`tod get-commit-message-requirement` mandates them.
+
+## Remove injected co-author trailers
+
+If a commit you just created still contains `Co-authored-by:` or other AI
+attribution footers (for example injected by the environment after
+`git commit` / `git commit --amend`):
+
+1. Verify the commit is yours from this conversation and has not been pushed.
+2. Rewrite the HEAD commit message to the intended text **without** those
+ trailers (for example via `git commit-tree` + `git reset --soft`, or an
+ equivalent rewrite that does not reintroduce the trailer).
+3. Confirm `git log -1 --format='%B'` has no `Co-authored-by:` / AI
+ attribution lines before finishing.
diff --git a/AGENTS.md b/AGENTS.md
index 6f5d230560..2d1f0f0d32 100644
--- a/AGENTS.md
+++ b/AGENTS.md
@@ -1,7 +1,9 @@
# Project Instructions
Do not add `Co-authored-by:` or other co-author / AI attribution footers to
-commit messages unless the user explicitly asks for them.
+commit messages unless the user explicitly asks for them. If such a trailer is
+injected into a commit you just created (and it is not pushed), rewrite the
+commit message to remove it before finishing.
Never modify generated translation files, including any `Translation_*.java`
files and files under