Files
claude_mac/skills/commit-change/SKILL.md
T
Bastien Chanot 07253e093c feat(doctrine): W6 — prose sweep + BDR-077 + LRN-137 + plan execution notes
LRN-113 whole-surface sweep: client-handover x2 + commit-change prose
repointed to the two-mode reality; code-cleaner/status historic notes
kept (accurate). Memory: BDR-077 (full architecture), LRN-137
(mode-based re-tiering + fail-safe pin rule), journal. Plan carries
as-built EXECUTION NOTES.
2026-07-19 23:44:24 +02:00

4.7 KiB

name, description, allowed-tools
name description allowed-tools
commit-change Analyze all pending changes (staged, unstaged, untracked) and create atomic commits grouped by logical unit, retracing the work. Any git repository. Triggers: "commit my changes", "smart commit", "auto commit", "commit everything", "analyse et commit", or any variation of committing messy pending work intelligently.
Bash
Read
Grep
Glob
Agent
AskUserQuestion

/commit-change — propose → confirm → apply dispatcher

Grouping (propose, model="opus" override — judgment) and committing (apply, sonnet pin — mechanical) both run on the dispatched commit-changer subagent (dispatch makes the pin effective). No inline reflection happens in this dispatcher to protect, so there is no model gate. This dispatcher owns the two approval gates that used to live inside the subagent: commit-plan approval and capitalize approval — the subagent never asks; MODE: propose only proposes, MODE: apply only executes what this dispatcher confirms. Never auto-commit blind — a wrong group is harder to undo than not committing.

STEP 0 — Pre-flight (STOP conditions, before any dispatch)

git rev-parse --abbrev-ref HEAD                        # "HEAD" = detached
git status --porcelain=v1 | grep -c '^UU\|^AA\|^DD'     # unmerged conflicts
git status --porcelain=v1 | wc -l                       # nothing pending?
git config user.email
  • Detached HEAD → STOP, report the state, do not dispatch.
  • Any unmerged conflict entries (UU/AA/DD) → STOP, tell the user to resolve conflicts first, do not dispatch.
  • Nothing pending (git status --porcelain empty) → STOP, tell the user there's nothing to commit.
  • git config user.email empty → STOP, ask the user to configure identity first, do not dispatch.

On a protected base (main/develop) the subagent runs the gitflow aiguillage itself inside MODE: propose (its Phase 0) and branches to chore/* before drafting the plan — code never lands directly on a protected branch.

STEP 1 — Propose

Agent(subagent_type="commit-changer", model="opus")
prompt: "MODE: propose
$ARGUMENTS"

(model="opus" — BDR-077: propose = narrative reconstruction + capitalize routing, judgment tier; the call-site override takes precedence over the sonnet frontmatter pin. Apply, STEP 4, stays on the pin.)

Read the returned COMMIT PLAN + EDGE CASES + CAPITALIZE CANDIDATES, terminated by READY TO APPLY — awaiting dispatcher confirmation.

The subagent reported BLOCKED: unresolved merge conflicts... instead of a plan (a race with STEP 0) → STOP, surface it, do not proceed.

STEP 2 — Gate 1: commit-plan approval

Show the COMMIT PLAN and any EDGE CASES verbatim, then:

AskUserQuestion:
  Approve the commit plan? (all / <numbers> / edit <n> / skip)
  • all → every step in the plan is approved as-is.
  • <numbers> (e.g. 1,3) → only those steps are approved; the rest stay uncommitted for a later run.
  • edit <n> → re-dispatch commit-changer with MODE: propose and the user's correction for step N folded into the prompt, so all grouping / message judgment stays on the dispatched propose mode (model="opus", BDR-077 — never redrawn inline on the session model); show the redrawn plan and re-ask.
  • skip → exit cleanly, no commits created, no MODE: apply dispatch. Note: if the propose run created a chore/* branch (gitflow aiguillage off a protected base), that branch stays checked out with the work uncommitted — mention it so the user isn't surprised by the branch switch.

STEP 3 — Gate 2: capitalize approval

If the STEP 1 output said CAPITALIZE: nothing to log, skip this gate — treat the capitalize entries as none and go straight to STEP 4.

Otherwise show the CAPITALIZE CANDIDATES block, then:

AskUserQuestion:
  Valider les entrées mémoire ? (all / <IDs> / skip)
  • all → every candidate entry is approved verbatim.
  • <IDs> (e.g. BDR-041,LRN-019) → only those entries are approved.
  • skip → no memory write; MODE: apply still runs for the code commits.

STEP 4 — Apply

Agent(subagent_type="commit-changer")
prompt: "MODE: apply
APPROVED PLAN: <the STEP-2-approved steps — numbers, messages, files,
  exactly as confirmed, including any edits>
APPROVED CAPITALIZE ENTRIES: <the STEP-3-approved entries verbatim, or none>"

Parse the COMMIT-EXEC REPORT:

  • STATUS: DONE → report the COMMITS + MEMORY hashes to the user.
  • STATUS: BLOCKED → surface the blocker verbatim and stop. Do not retry automatically — a blocked step (e.g. one file needs an interactive git add -p split) needs a human decision.