pi-commit-planner is a pi extension that turns /commit into a guided commit workflow:
- scan the current Git working tree
- ask the active model to propose a commit plan
- show the plan for confirmation
- apply one or more commits if you approve
- single command:
/commit - no manual staging required
- AI plans one or more commits from all current tracked + untracked changes
- all generated commit messages use Conventional Commits
- plan summaries and grouping explanations are generated in English
- confirmation is always required before Git is mutated
- you can reject a proposed plan and give the planner natural-language feedback to replan
- supports mixed file-level + hunk-level grouping
- supports repositories that already contain partially staged files
- if planning or commit execution fails, the extension restores the original working tree + index state
When a modified text file has multiple independent diff hunks, the planner can assign those hunks to different commits.
Execution works by:
- resetting the repo to the base state
- rebuilding each commit's cumulative file state deterministically
- staging only the paths touched by that commit
- committing incrementally
This avoids relying on brittle patch fuzzing during multi-commit execution.
If a file already has both staged and unstaged changes, /commit no longer rejects it.
The planner ignores the current staging boundary and plans across the full current working tree change set.
If execution fails, the original index and working tree state are restored.
Hunk-level splitting is only used for normal modified text files with multiple diff hunks. Binary files, symlinks, file mode changes, pure adds, pure deletes, and rename-like cases stay whole-file in v2.
This extension always asks for confirmation, so /commit is intended for interactive or other UI-enabled pi modes.
pi -e /path/to/pi-commit-plannerpi install /path/to/pi-commit-plannerInside a Git repo, run:
/commit
The extension will:
- inspect current changes
- normalize them into one or more change units
- whole-file units for simple/non-splittable cases
- hunk units for splittable modified text files
- use the current pi model to generate a commit plan
- always generate Conventional Commit messages plus English plan explanations
- show the proposed commit messages and grouped change units
- present a custom three-choice review UI:
- apply the current plan
- replan
- cancel
- if you choose replan, let you either:
- write custom feedback
- go back
- create the commits if you accept
The planner prompt includes:
- exact change IDs that must be covered exactly once
- explicit instructions to use Conventional Commits and English explanations
- per-file summaries
- whole-file diffs/previews or per-hunk diffs
The model must return JSON with this shape:
{
"summary": "Why this plan makes sense",
"commits": [
{
"message": "refactor(auth): extract token parsing helpers",
"why": "Pure refactor changes grouped together",
"changes": ["H1", "H2", "F3"]
}
]
}If the first plan is not what you want, choose Replan with feedback and describe how the plan should change. Examples:
- reduce this to two commits
- keep tests with implementation
- separate the parser hunks
- split docs from refactors
Commit messages will remain in Conventional Commits format, and plan explanations will remain in English across replans.
The planner receives:
- the current repository snapshot
- the most recent plan
- your feedback history
It then generates a fresh plan that still has to cover every change ID exactly once.
- the planner can only assign provided change IDs
- every change ID must appear exactly once in the plan
- execution is done by the extension, not by the model directly
- the extension snapshots current file state and the Git index before mutating Git
- before apply, it re-scans the repo and replans if the changes drifted during review
- on failure, it rolls the repo back to the original working tree + index state
This package uses a pi manifest in package.json:
{
"pi": {
"extensions": ["./src/index.ts"]
}
}A minimal smoke test is:
pi --no-session --no-context-files --no-extensions --extension . -p /commitThat verifies pi can load the extension package and invoke the command path without needing a normal chat turn.