agit commit
Create a neural commit that links reasoning to your code changes.
Usage
agit commit -m <message>
agit commit --message <message>
Description
Creates both a git commit and a neural commit:
- Reads all entries from the staging area
- Synthesizes a summary from intents and reasoning
- Creates a git commit from staged changes (if any)
- Creates a content-addressable neural commit object
- Links the neural commit to the git commit
- Clears the staging area
Options
| Option | Required | Description |
|---|---|---|
-m, --message | Yes | Commit message |
--amend | No | Amend the previous neural commit |
--edit-summary | No | Edit the synthesized summary before committing |
--force | No | Override semantic conflict detection |
Examples
Basic Commit
agit commit -m "Add user authentication"
Output:
Created git commit: e8d4f1a
Created neural commit: a3f7b2c
Summary: Intent: Add user authentication. Plan: Implement JWT-based auth with refresh tokens.
View Summary Before Committing
agit commit -m "Refactor API" --edit-summary
This shows the synthesized summary and lets you modify it.
How Summaries Work
AGIT synthesizes summaries from your staging area entries:
- Finds last user intent: The most recent
user/intententry - Finds last AI reasoning: The most recent
ai/reasoningentry - Combines them: "Intent: X. Plan: Y."
Example
Staging area:
[10:30] user/intent: Fix authentication bug
[10:31] ai/reasoning: Add null check before token validation
[10:35] user/intent: Also add rate limiting
[10:36] ai/reasoning: Use express-rate-limit middleware
Synthesized summary:
Intent: Also add rate limiting. Plan: Use express-rate-limit middleware.
(Uses the last intent and reasoning)
Semantic Conflict Detection
AGIT protects against "hallucinated" commits by detecting conflicts between your pending thoughts and external changes.
How It Works
Before committing, AGIT checks:
- Ghost commits: Git commits made outside AGIT since your last neural commit
- File references: Files mentioned in your pending thoughts
- Overlap: Whether ghost commits touched files in your thoughts
Safe vs Unsafe Scenarios
Safe (proceeds automatically):
Ghost commit modified: README.md
Your thought mentions: src/auth.rs
→ No overlap, commit proceeds
Unsafe (blocks with warning):
Ghost commit modified: src/auth.rs
Your thought mentions: "fixing auth.rs"
→ File overlap detected
Override with --force
If you're confident the conflict is fine:
agit commit -m "My changes" --force
Conflict Error
Context conflict: external changes touched files in your pending thoughts.
Conflicting files: src/auth.rs
Use --force to commit anyway, or clear pending thoughts with 'agit reset'.
Solution: Review the conflict, then either use --force or clear your thoughts.
Commit Object Structure
Neural commits are stored as JSON:
{
"hash": "a3f7b2c...",
"message": "Add user authentication",
"summary": "Intent: Add auth. Plan: JWT with refresh tokens.",
"git_commit": "e8d4f1a...",
"parent": "previous-neural-hash",
"trace_hash": "hash-of-full-trace",
"timestamp": "2024-01-15T10:45:00Z"
}
Requirements
- AGIT must be initialized
- Git repository must have at least one commit
- Staging area should have entries (or use
--amend)
Errors
No Entries in Staging
No thoughts recorded in staging area.
Use 'agit record' to add thoughts, or the MCP server will log them automatically.
Solution: Record some thoughts first with agit record or use an MCP-enabled editor.
Message Required
Commit message required. Use -m or --message
Solution: Provide a message with -m "Your message".
Merge/Rebase in Progress
⚠️ Merge in progress. Please resolve conflicts and finish the Merge before adding neural memories.
Solution: Complete the merge/rebase before committing to AGIT. See Git Resilience.
Best Practices
- Commit after logical units: Use
agit committo create both git and neural commits in one step - Use clear messages: The message helps find commits later
- Review before committing: Run
agit statusfirst to check entries - Stage first: Run
git add .beforeagit committo include your changes
See Also
- agit status - Check staging area before committing
- agit log - View commit history
- agit show - View full commit details
- Git Resilience - How AGIT handles conflicts