Split work into logical conventional commits; uses agent session history when available
Create standardized, semantic git commits using the Conventional Commits specification. Default to multiple commits — one logical change per commit. Only create a single commit when all changes clearly belong together or the user explicitly asks for one commit.
<type>[optional scope]: <description>
[optional body]
[optional footer(s)]
| Type | Purpose |
|---|---|
feat | New feature |
fix | Bug fix |
docs | Documentation only |
style | Formatting/style (no logic) |
refactor | Code refactor (no feature/fix) |
perf | Performance improvement |
test | Add/update tests |
build | Build system/dependencies |
ci | CI/config changes |
chore | Maintenance/misc |
revert | Revert commit |
git add . or git add -A — stage only the files or hunks planned for the current commitgit add -p (or git add -N then git add -p) — do not commit the whole filegit status --porcelain
git diff # unstaged
git diff --staged # already staged
git log -5 --oneline # match repo style
Collect every changed, added, or deleted path relative to the repo root.
Use both signals below. Agent history is the primary source when available.
When the user worked across multiple agent chats or sessions, each session usually maps to one commit.
Cursor transcripts live under:
~/.cursor/projects/<workspace-slug>/agent-transcripts/<session-id>/<session-id>.jsonl
<workspace-slug> is the workspace path with / replaced by - (leading slash dropped). Example: /home/user/my-app → home-user-my-app.
For each .jsonl file (newest sessions first):
user_query — that is the session intentWrite, StrReplace, EditNotebook, Deletepath (or target_notebook) from each tool callBuild a map: session → { intent, files[] }
Rules:
git add -p if the diff shows unrelated editsAlso use current and recent chat history in this conversation: if the user describes parallel work ("here I removed comments, here I added an index"), treat each described task as its own group even when transcripts are missing.
When agent history is unavailable or leaves files unassigned, group by:
| Signal | Group as |
|---|---|
*.prisma migrations / schema | feat or fix with schema scope — often first in commit order |
**/migrations/** | Own commit, before app code that depends on it |
**/*.{test,spec}.* | test |
**/*.md, docs folders | docs |
.github/**, CI configs | ci |
package.json, lockfiles, build configs | build |
| Comment-only or whitespace-only hunks | style or chore |
| Same directory + same concern | Single commit (e.g. all changes under bin/) |
| Same file, mixed concerns | Split with git add -p |
Merge session-based groups and fallback groups. Do not over-split — if two sessions both edited the same feature and the diffs are tightly coupled, one commit is fine.
Before committing, present a numbered plan:
Commit 1: feat(cli): add clear installed skills option
Files: bin/cli.js, README.md
Source: agent session "add option to clear skills…"
Commit 2: refactor(grill-me): tighten invocation rules
Files: skills/grill-me/SKILL.md
Source: agent session "review validations and migrate to zod…"
Commit 3: chore(schema): add index on user email
Files: prisma/schema.prisma
Source: diff semantics (unmapped)
Ask for approval when grouping is ambiguous or when there are 3+ commits. Proceed without asking when groups are obvious and the user said "commit" plainly.
Commit order: schema/migrations → core logic → tests → docs/style/chore. Dependencies first.
For each approved group, in order:
# Reset staging so each commit starts clean
git reset HEAD
# Stage only this group's files
git add path/to/file1 path/to/file2
# Mixed file? Stage selected hunks only
git add -p path/to/mixed-file.js
# Verify the staged diff matches the plan — nothing extra
git diff --staged
# Commit
git commit -m "$(cat <<'EOF'
<type>[scope]: <description>
<optional body>
EOF
)"
If a pre-commit hook fails, fix the issue and create a new commit for that group — do not amend unless the user explicitly requested amend and the prior commit was yours and unpushed.
After all groups:
git status
git log -n <number-of-commits> --oneline
Report what was committed and anything still unstaged.
Create only one commit when:
Closes #123, Refs #456git add -i, git rebase -i) — use git add -p non-interactively by answering hunks in the command, or stage whole files when hunks are uniform