create commit-message
create commit-message - Generate AI-powered commit messages from staged changes
The create commit-message command uses AI to analyze your staged git changes and generate a structured, conventional commit message that follows project standards and includes module-specific details. The generated message includes a top-level summary and per-module sections describing changes. All output is validated against the commit message contract to ensure consistency and quality. By default, the command outputs the commit message to stdout. Use --debug to save intermediate outputs. Use --commit to automatically create a git commit with the generated message.
Flags
| Flag | Description |
|---|---|
-d, --debug (default: false) |
Enable debug mode to save intermediate outputs (context, prompts, AI responses) to the 'out' directory for troubleshooting and analysis |
-c, --commit (default: false) |
Automatically create git commit with generated message |
Notes
Expected Output:
- Structured conventional commit message to stdout
- Top-level summary and per-module sections
- Validated against commit message contract
- Debug outputs in out/ if --debug enabled
How It Works
The command uses AI generation with format support:
- Format: Generates plaintext commit messages following conventional commit format (type, scope, description, body)
- Validation: Validates message format and structure automatically
- Retry: If validation fails, AI receives error feedback and regenerates improved output
- Customization: Uses three-tier prompt system for team-specific commit message styles
Supported formats: Conventional commits with module-aware sections for monorepo commits.
Custom Prompts
Customize AI behavior using the three-tier prompt system. Prompts are loaded with the following priority:
- Command Flag (highest priority)
-
Team Override (version controlled)
-
Location:
.r2r/eac/templates/ai/commit-message/ -
Committed to git, affects entire team
-
System Default (fallback)
- Location:
templates/ai/commit-message/ - Shipped with r2r
Available Prompts
| Prompt File | Purpose | Override Location |
|---|---|---|
module.md |
Multi-module commit sections | .r2r/eac/templates/ai/commit-message/module.md |
top-level.md |
Top-level commit header | .r2r/eac/templates/ai/commit-message/top-level.md |
Creating Team Overrides
# Copy system default
cp templates/ai/commit-message/module.md .r2r/eac/templates/ai/commit-message/module.md
# Edit for your team's style
nano .r2r/eac/templates/ai/commit-message/module.md
# Commit to git
git add .r2r/eac/templates/ai/commit-message/
git commit -m "chore(eac): customize commit message prompt"
# Test with debug flag to verify
r2r eac create commit-message --debug
See Also
- How-to Guide - Quick start and common workflows
- work commit - Workspace-aware commits
- init - Configure AI provider
- create Commands
Tutorials | How-to Guides | Explanation | Reference
You are here: Reference — information-oriented technical descriptions of the system.