Commit With Agent
Preserve the active commit workflow and change only its commit-message output.
Prefer semantic triggering for ordinary requests about committing with AI attribution. Treat $commit-with-agent ... as the single explicit trigger for forced agent selection.
Workflow
- Check whether the user supplied an explicit agent override after the skill name, for example
$commit-with-agent claude, $commit-with-agent claude code, or $commit-with-agent claude,codex.
- If an explicit override is present, normalize it to one or more supported agent identities and bypass runtime agent detection entirely.
- If no explicit override is present, detect the current AI agent before preparing the commit message.
- Read only the matching template or templates:
- Codex or OpenAI Codex: references/codex.md
- Claude Code: references/cc.md
- Follow the existing
/commit skill, explicit user instructions, or default commit behavior for repository inspection, staging, message generation, commit execution, and any later push behavior.
- Edit the generated commit message before the commit command runs:
- Preserve the generated subject and body.
- Ensure exactly one blank line before the trailer block.
- Append each matching
Co-authored-by trailer in the explicit order requested by the user, or the single detected-agent trailer when no override was provided.
- Do not duplicate an equivalent trailer, matched case-insensitively by email address.
- Execute the original commit workflow with the edited message.
Explicit Agent Overrides
When the user provides agent names after $commit-with-agent, treat them as an instruction to force those co-author trailers even if the active agent is different.
Supported normalization:
codex, openai codex -> Codex
claude, cluade, claude code -> Claude Code
Parsing rules:
- Split multiple requested agents on commas.
- Trim whitespace around each requested item.
- Normalize case-insensitively.
- Preserve the first occurrence order after normalization.
- If every requested agent is invalid or ambiguous, ask the user to choose from the supported set before committing.
Agent Detection
Skip this section entirely when an explicit agent override is present.
Use the strongest available evidence in this order:
- Use the identity declared by the active system or developer instructions.
- Use explicit runtime or harness metadata that names the agent.
- Use agent-specific environment or configuration markers only as supporting evidence.
- If the identity remains ambiguous, ask the user which agent attribution to use before committing.
Do not infer the AI agent from Git author configuration, repository contents, an installed skill, or the co-author trailers of previous commits.
Codex Behavior
When running as Codex:
- Read references/codex.md.
- Let the active commit workflow generate or select the normal commit message.
- Add
Co-authored-by: Codex <codex@openai.com> to that message before invoking git commit, unless an explicit override supplied a different set of trailers.
- Pass the complete edited message through the same command or mechanism the original workflow would have used.
- Continue with the original workflow after the commit. Do not add, remove, or trigger a push unless that workflow or the user already requires it.
For a command-line commit, use multiple -m arguments or an equivalent message-file mechanism so the trailer is part of the commit created initially. Preserve multiline bodies exactly where practical.
Boundaries
- Do not install, edit, or depend on Git hooks.
- Do not change local or global Git configuration.
- Do not replace the repository's configured human author.
- Do not amend or rewrite an existing commit unless the user explicitly asks.
- Do not change which files are staged or committed beyond the original workflow.
- Do not change push, pull-request, or publication behavior.
- Do not invoke a second competing commit workflow after one has already been selected.
- Stop before committing if the selected agent template is empty or missing.
- Do not silently map unknown names to a supported agent. Only the documented aliases above may bypass detection.
Message Shape
Use the selected reference or references as the shape, not as literal placeholder text:
<original subject>
<original body, when present>
Co-authored-by: <agent name> <agent email>
Co-authored-by: <agent name> <agent email>
1---2name: commit-with-agent3description: Add AI co-author attribution to a new Git commit without changing the user's normal commit workflow. Use when the user wants to commit changes and also wants AI co-authored info, a `Co-authored-by` trailer, AI attribution in the commit message, or wording like "commit with AI co-author", "commit with Codex/Claude co-author", or "add AI collaborator info to this commit". Support one explicit override trigger, `$commit-with-agent ...`, when the user wants to force one or more specific agent trailers such as `claude`, `codex`, or `claude,codex`.4license: MIT5---67# Commit With Agent89Preserve the active commit workflow and change only its commit-message output.1011Prefer semantic triggering for ordinary requests about committing with AI attribution. Treat `$commit-with-agent ...` as the single explicit trigger for forced agent selection.1213## Workflow14151. Check whether the user supplied an explicit agent override after the skill name, for example `$commit-with-agent claude`, `$commit-with-agent claude code`, or `$commit-with-agent claude,codex`.162. If an explicit override is present, normalize it to one or more supported agent identities and bypass runtime agent detection entirely.173. If no explicit override is present, detect the current AI agent before preparing the commit message.184. Read only the matching template or templates:19 - Codex or OpenAI Codex: [references/codex.md](references/codex.md)20 - Claude Code: [references/cc.md](references/cc.md)215. Follow the existing `/commit` skill, explicit user instructions, or default commit behavior for repository inspection, staging, message generation, commit execution, and any later push behavior.226. Edit the generated commit message before the commit command runs:23 - Preserve the generated subject and body.24 - Ensure exactly one blank line before the trailer block.25 - Append each matching `Co-authored-by` trailer in the explicit order requested by the user, or the single detected-agent trailer when no override was provided.26 - Do not duplicate an equivalent trailer, matched case-insensitively by email address.277. Execute the original commit workflow with the edited message.2829## Explicit Agent Overrides3031When the user provides agent names after `$commit-with-agent`, treat them as an instruction to force those co-author trailers even if the active agent is different.3233Supported normalization:3435- `codex`, `openai codex` -> Codex36- `claude`, `cluade`, `claude code` -> Claude Code3738Parsing rules:3940- Split multiple requested agents on commas.41- Trim whitespace around each requested item.42- Normalize case-insensitively.43- Preserve the first occurrence order after normalization.44- If every requested agent is invalid or ambiguous, ask the user to choose from the supported set before committing.4546## Agent Detection4748Skip this section entirely when an explicit agent override is present.4950Use the strongest available evidence in this order:51521. Use the identity declared by the active system or developer instructions.532. Use explicit runtime or harness metadata that names the agent.543. Use agent-specific environment or configuration markers only as supporting evidence.554. If the identity remains ambiguous, ask the user which agent attribution to use before committing.5657Do not infer the AI agent from Git author configuration, repository contents, an installed skill, or the co-author trailers of previous commits.5859## Codex Behavior6061When running as Codex:62631. Read [references/codex.md](references/codex.md).642. Let the active commit workflow generate or select the normal commit message.653. Add `Co-authored-by: Codex <codex@openai.com>` to that message before invoking `git commit`, unless an explicit override supplied a different set of trailers.664. Pass the complete edited message through the same command or mechanism the original workflow would have used.675. Continue with the original workflow after the commit. Do not add, remove, or trigger a push unless that workflow or the user already requires it.6869For a command-line commit, use multiple `-m` arguments or an equivalent message-file mechanism so the trailer is part of the commit created initially. Preserve multiline bodies exactly where practical.7071## Boundaries7273- Do not install, edit, or depend on Git hooks.74- Do not change local or global Git configuration.75- Do not replace the repository's configured human author.76- Do not amend or rewrite an existing commit unless the user explicitly asks.77- Do not change which files are staged or committed beyond the original workflow.78- Do not change push, pull-request, or publication behavior.79- Do not invoke a second competing commit workflow after one has already been selected.80- Stop before committing if the selected agent template is empty or missing.81- Do not silently map unknown names to a supported agent. Only the documented aliases above may bypass detection.8283## Message Shape8485Use the selected reference or references as the shape, not as literal placeholder text:8687```text88<original subject>8990<original body, when present>9192Co-authored-by: <agent name> <agent email>93Co-authored-by: <agent name> <agent email>94```