commit: scope-check when committing all pending changes
The no-fileset path told the agent to skip the remaining-files review
because "all changes are already included" — but that's exactly when
`jj commit` can sweep in an unrelated edit (made by the user, a linter,
or a hook between turns) with no prompt. Replaced the skip with an
explicit check that every changed file belongs to the intended commit,
and split out anything that doesn't.
Assisted-by: Claude Opus 4.8 via Claude Code
diff --git a/ai/skills/commit/SKILL.md b/ai/skills/commit/SKILL.md
index a69a238d..285423f2 100644
--- a/ai/skills/commit/SKILL.md
+++ b/ai/skills/commit/SKILL.md
@@ -50,12 +50,20 @@ Fileset (empty means commit all pending changes): `$ARGUMENTS`
### Process
1. Run `jj diff $ARGUMENTS` to view changes being committed
-2. When a fileset is given, run `jj diff` (no args) to see all pending
- changes. Review the remaining files and mention any that look related
- to the fileset — e.g., a lockfile updated alongside a manifest, or a
- config change paired with the code that uses it. Ask the user whether
- to include them. Skip this step when no fileset is provided (all
- changes are already included).
+2. Confirm the commit's scope before writing it.
+ - When a fileset is given, run `jj diff` (no args) to see all pending
+ changes. Review the remaining files and mention any that look
+ related to the fileset — e.g., a lockfile updated alongside a
+ manifest, or a config change paired with the code that uses it. Ask
+ the user whether to include them.
+ - When no fileset is given, `jj commit` sweeps in *every* pending
+ change with no further prompt. Before committing, check that each
+ changed file belongs to the work you intend to commit. Watch for
+ files you didn't touch this session (edited by the user, a linter,
+ or a hook between turns) and for changes that are a separate logical
+ unit. Split those out — commit the intended files by passing them as
+ a fileset, or `jj split` after the fact — rather than letting an
+ unrelated edit ride along.
3. **Adversarial review.** Before writing the commit message, re-read the
diff as a skeptical reviewer trying to find reasons NOT to commit.
Check for: