Skip to content

Commit 3468170

Browse files
config: Refactor atomic-commit workflow to single-message contract with plan-aware body rules
Distinguish manual vs automated commit profiles in the generated workflow: - Manual generated commands remain proposal-only and allow split guidance when staged changes mix unrelated goals - Automated OpenCode command skips staging confirmation, generates exactly one commit message, and runs git commit against the staged diff - Both profiles share the staged-plan commit-body requirement: cite affected plan slug(s) and updated task ID(s) when context/plans/*.md is staged, or stop for clarification if the plan diff is ambiguous Update all generated outputs (config/.claude, config/.opencode, config/automated, config/pkl) and context documentation (architecture, context-map, glossary, overview, patterns, sce/atomic-commit-workflow, sce/automated-profile-contract) to reflect the new contract. Remove completed/archived plan files that are no longer active. Co-authored-by: SCE <sce@crocoder.dev>
1 parent 10b25c9 commit 3468170

18 files changed

Lines changed: 188 additions & 646 deletions

config/.claude/skills/sce-atomic-commit/SKILL.md

Lines changed: 35 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,13 @@ compatibility: claude
77

88
## Goal
99

10-
Turn a set of code changes (diff, file list, PR summary, or notes) into atomic commits with repository-style commit messages.
10+
Turn the current staged changes into atomic repository-style commit message proposals.
1111

12-
Atomic means:
13-
- one coherent change per commit
14-
- minimal scope that still builds/tests logically
15-
- a short, technical, actionable commit message
12+
For this workflow:
13+
- analyze the staged diff to identify coherent change units
14+
- propose one or more commit messages when staged changes mix unrelated goals
15+
- keep each proposed message focused on a single coherent change
16+
- stay proposal-only: do not create commits automatically
1617

1718
## Inputs
1819

@@ -22,56 +23,55 @@ Accept any of:
2223
- PR/task summary
2324
- before/after behavior notes
2425

25-
If changes mix unrelated goals, split them.
26-
2726
## Output format
2827

29-
Commit messages must follow:
28+
Produce commit message proposals that follow:
3029
- `scope: Subject`
3130
- imperative verb (Fix/Add/Remove/Implement/Refactor/Simplify/Rename/Update/Ensure/Allow)
3231
- no trailing period in subject
3332
- body when context is needed (why/what changed/impact)
3433
- issue references on their own lines (for example `Fixes #123`)
3534

35+
When staged changes include `context/plans/*.md`, each commit body must also include:
36+
- affected plan slug(s)
37+
- updated task ID(s) (`T0X`)
38+
39+
If staged `context/plans/*.md` changes do not expose the plan slug or updated task ID clearly enough to cite faithfully, stop and ask for clarification instead of inventing references.
40+
3641
## Procedure
3742

38-
1) Identify smallest coherent units
39-
- Group by reason and user-visible effect, not file type.
40-
- Typical atomic boundaries: pure refactor, behavior change, tests, build/config, docs.
41-
- Avoid mixing refactor and behavior unless strictly required.
43+
1) Analyze the staged diff for coherent units
44+
- Infer the main reason(s) for the staged change from the diff first.
45+
- Use optional notes only to refine wording, not to override the staged truth.
46+
- Identify whether staged changes represent one coherent unit or multiple unrelated goals.
4247

43-
2) Choose scope
48+
2) Choose scope for each unit
4449
- Use the smallest stable subsystem/module name recognizable in the repo.
4550
- If unclear, use the primary directory/package of the change.
4651

47-
3) Write subject
52+
3) Write subject for each unit
4853
- Pattern: `<scope>: <Imperative verb> <specific technical summary>`
4954
- Keep concrete and targeted.
5055

5156
4) Add body when needed
5257
- Explain what was wrong/missing, why it matters, what changed conceptually, and impact.
5358
- Add issue references on separate lines.
5459

55-
5) Validate atomicity
56-
- Reverting the commit should cleanly remove one logical change.
57-
- Review should not require unrelated context.
58-
- No drive-by formatting or unrelated refactors.
59-
60-
If atomicity fails, split further.
61-
62-
## Split guidance
60+
5) Apply the plan-update body rule when needed
61+
- Check whether staged changes include `context/plans/*.md`.
62+
- If yes, cite the affected plan slug(s) and updated task ID(s) in the body.
63+
- If the staged plan diff is ambiguous, stop with actionable guidance asking the user to stage or clarify the plan/task reference explicitly.
6364

64-
Split when you see:
65-
- renames with behavior changes
66-
- pure refactors bundled with fixes
67-
- formatting-only changes mixed with logic
68-
- multiple features shipped together
65+
6) Propose split guidance when appropriate
66+
- If staged changes mix unrelated goals (for example: a feature change plus unrelated refactoring), propose separate commit messages for each coherent unit.
67+
- Explain why the split is recommended and which files belong to each proposed commit.
68+
- If staged changes represent one coherent unit, propose a single commit message.
6969

70-
Default split order:
71-
1. mechanical rename/refactor
72-
2. behavior change
73-
3. tests
74-
4. docs
70+
7) Validate each proposed message
71+
- Each message should describe its intended change faithfully.
72+
- The subject should stay concise and technical.
73+
- The body should add useful why/impact context instead of repeating the subject.
74+
- Do not invent plan or task references.
7575

7676
## Context-file guidance gating
7777

@@ -83,6 +83,8 @@ Default split order:
8383

8484
- vague subjects ("cleanup", "updates")
8585
- body repeats subject without adding why
86-
- unrelated changes in one commit
8786
- playful tone in serious fixes/architecture changes
8887
- mention `context/` sync activity in commit messages
88+
- inventing plan slugs or task IDs for staged plan edits
89+
- proposing splits for changes that are already coherent
90+
- forcing unrelated changes into a single commit

config/.opencode/skills/sce-atomic-commit/SKILL.md

Lines changed: 35 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,13 @@ compatibility: opencode
77

88
## Goal
99

10-
Turn a set of code changes (diff, file list, PR summary, or notes) into atomic commits with repository-style commit messages.
10+
Turn the current staged changes into atomic repository-style commit message proposals.
1111

12-
Atomic means:
13-
- one coherent change per commit
14-
- minimal scope that still builds/tests logically
15-
- a short, technical, actionable commit message
12+
For this workflow:
13+
- analyze the staged diff to identify coherent change units
14+
- propose one or more commit messages when staged changes mix unrelated goals
15+
- keep each proposed message focused on a single coherent change
16+
- stay proposal-only: do not create commits automatically
1617

1718
## Inputs
1819

@@ -22,56 +23,55 @@ Accept any of:
2223
- PR/task summary
2324
- before/after behavior notes
2425

25-
If changes mix unrelated goals, split them.
26-
2726
## Output format
2827

29-
Commit messages must follow:
28+
Produce commit message proposals that follow:
3029
- `scope: Subject`
3130
- imperative verb (Fix/Add/Remove/Implement/Refactor/Simplify/Rename/Update/Ensure/Allow)
3231
- no trailing period in subject
3332
- body when context is needed (why/what changed/impact)
3433
- issue references on their own lines (for example `Fixes #123`)
3534

35+
When staged changes include `context/plans/*.md`, each commit body must also include:
36+
- affected plan slug(s)
37+
- updated task ID(s) (`T0X`)
38+
39+
If staged `context/plans/*.md` changes do not expose the plan slug or updated task ID clearly enough to cite faithfully, stop and ask for clarification instead of inventing references.
40+
3641
## Procedure
3742

38-
1) Identify smallest coherent units
39-
- Group by reason and user-visible effect, not file type.
40-
- Typical atomic boundaries: pure refactor, behavior change, tests, build/config, docs.
41-
- Avoid mixing refactor and behavior unless strictly required.
43+
1) Analyze the staged diff for coherent units
44+
- Infer the main reason(s) for the staged change from the diff first.
45+
- Use optional notes only to refine wording, not to override the staged truth.
46+
- Identify whether staged changes represent one coherent unit or multiple unrelated goals.
4247

43-
2) Choose scope
48+
2) Choose scope for each unit
4449
- Use the smallest stable subsystem/module name recognizable in the repo.
4550
- If unclear, use the primary directory/package of the change.
4651

47-
3) Write subject
52+
3) Write subject for each unit
4853
- Pattern: `<scope>: <Imperative verb> <specific technical summary>`
4954
- Keep concrete and targeted.
5055

5156
4) Add body when needed
5257
- Explain what was wrong/missing, why it matters, what changed conceptually, and impact.
5358
- Add issue references on separate lines.
5459

55-
5) Validate atomicity
56-
- Reverting the commit should cleanly remove one logical change.
57-
- Review should not require unrelated context.
58-
- No drive-by formatting or unrelated refactors.
59-
60-
If atomicity fails, split further.
61-
62-
## Split guidance
60+
5) Apply the plan-update body rule when needed
61+
- Check whether staged changes include `context/plans/*.md`.
62+
- If yes, cite the affected plan slug(s) and updated task ID(s) in the body.
63+
- If the staged plan diff is ambiguous, stop with actionable guidance asking the user to stage or clarify the plan/task reference explicitly.
6364

64-
Split when you see:
65-
- renames with behavior changes
66-
- pure refactors bundled with fixes
67-
- formatting-only changes mixed with logic
68-
- multiple features shipped together
65+
6) Propose split guidance when appropriate
66+
- If staged changes mix unrelated goals (for example: a feature change plus unrelated refactoring), propose separate commit messages for each coherent unit.
67+
- Explain why the split is recommended and which files belong to each proposed commit.
68+
- If staged changes represent one coherent unit, propose a single commit message.
6969

70-
Default split order:
71-
1. mechanical rename/refactor
72-
2. behavior change
73-
3. tests
74-
4. docs
70+
7) Validate each proposed message
71+
- Each message should describe its intended change faithfully.
72+
- The subject should stay concise and technical.
73+
- The body should add useful why/impact context instead of repeating the subject.
74+
- Do not invent plan or task references.
7575

7676
## Context-file guidance gating
7777

@@ -83,6 +83,8 @@ Default split order:
8383

8484
- vague subjects ("cleanup", "updates")
8585
- body repeats subject without adding why
86-
- unrelated changes in one commit
8786
- playful tone in serious fixes/architecture changes
8887
- mention `context/` sync activity in commit messages
88+
- inventing plan slugs or task IDs for staged plan edits
89+
- proposing splits for changes that are already coherent
90+
- forcing unrelated changes into a single commit

config/automated/.opencode/command/commit.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,11 @@ Input:
1010

1111
Behavior:
1212
- If arguments are empty, treat input as unstated and infer commit intent from staged changes only.
13-
- If arguments are provided, treat them as optional commit context to refine message proposals.
13+
- If arguments are provided, treat them as optional commit context to refine the one commit message.
1414
- Skip staging confirmation prompt.
1515
- Validate staged content exists; if empty, stop with error: "No staged changes. Stage changes before commit."
1616
- Classify staged diff scope (`context/`-only vs mixed `context/` + non-`context/`) and apply the context-guidance gate from `sce-atomic-commit`.
17-
- Delegate commit-message grammar, atomic split decisions, and split guidance to `sce-atomic-commit`.
18-
19-
- Do not create commits automatically.
20-
- Output only proposed commit message(s) and split guidance when needed.
17+
- Run `sce-atomic-commit` to produce exactly one commit message for the staged diff.
18+
- Do not branch into multi-commit or split guidance.
19+
- Use the resulting message to run `git commit` against the staged changes.
20+
- If `git commit` fails, stop and report the failure without inventing fallback commits.

config/automated/.opencode/skills/sce-atomic-commit/SKILL.md

Lines changed: 25 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,12 @@ compatibility: opencode
77

88
## Goal
99

10-
Turn a set of code changes (diff, file list, PR summary, or notes) into atomic commits with repository-style commit messages.
10+
Turn the current staged changes into one straightforward repository-style commit message.
1111

12-
Atomic means:
13-
- one coherent change per commit
14-
- minimal scope that still builds/tests logically
15-
- a short, technical, actionable commit message
12+
For this workflow:
13+
- produce exactly one commit message
14+
- keep the message focused on the staged change as a single coherent unit
15+
- do not default to multi-commit split planning
1616

1717
## Inputs
1818

@@ -22,23 +22,26 @@ Accept any of:
2222
- PR/task summary
2323
- before/after behavior notes
2424

25-
If changes mix unrelated goals, split them.
26-
2725
## Output format
2826

29-
Commit messages must follow:
27+
Produce one commit message that follows:
3028
- `scope: Subject`
3129
- imperative verb (Fix/Add/Remove/Implement/Refactor/Simplify/Rename/Update/Ensure/Allow)
3230
- no trailing period in subject
3331
- body when context is needed (why/what changed/impact)
3432
- issue references on their own lines (for example `Fixes #123`)
3533

34+
When staged changes include `context/plans/*.md`, the commit body must also include:
35+
- affected plan slug(s)
36+
- updated task ID(s) (`T0X`)
37+
38+
If staged `context/plans/*.md` changes do not expose the plan slug or updated task ID clearly enough to cite faithfully, stop and ask for clarification instead of inventing references.
39+
3640
## Procedure
3741

38-
1) Identify smallest coherent units
39-
- Group by reason and user-visible effect, not file type.
40-
- Typical atomic boundaries: pure refactor, behavior change, tests, build/config, docs.
41-
- Avoid mixing refactor and behavior unless strictly required.
42+
1) Review the staged change as one unit
43+
- Infer the main reason for the staged change from the staged diff first.
44+
- Use optional notes only to refine wording, not to override the staged truth.
4245

4346
2) Choose scope
4447
- Use the smallest stable subsystem/module name recognizable in the repo.
@@ -52,26 +55,16 @@ Commit messages must follow:
5255
- Explain what was wrong/missing, why it matters, what changed conceptually, and impact.
5356
- Add issue references on separate lines.
5457

55-
5) Validate atomicity
56-
- Reverting the commit should cleanly remove one logical change.
57-
- Review should not require unrelated context.
58-
- No drive-by formatting or unrelated refactors.
59-
60-
If atomicity fails, split further.
61-
62-
## Split guidance
63-
64-
Split when you see:
65-
- renames with behavior changes
66-
- pure refactors bundled with fixes
67-
- formatting-only changes mixed with logic
68-
- multiple features shipped together
58+
5) Apply the plan-update body rule when needed
59+
- Check whether staged changes include `context/plans/*.md`.
60+
- If yes, cite the affected plan slug(s) and updated task ID(s) in the body.
61+
- If the staged plan diff is ambiguous, stop with actionable guidance asking the user to stage or clarify the plan/task reference explicitly.
6962

70-
Default split order:
71-
1. mechanical rename/refactor
72-
2. behavior change
73-
3. tests
74-
4. docs
63+
6) Validate the single-message result
64+
- The message should describe the staged diff faithfully as one coherent change.
65+
- The subject should stay concise and technical.
66+
- The body should add useful why/impact context instead of repeating the subject.
67+
- Do not invent plan or task references.
7568

7669
## Context-file Guidance gating
7770

@@ -83,6 +76,6 @@ Default split order:
8376

8477
- vague subjects ("cleanup", "updates")
8578
- body repeats subject without adding why
86-
- unrelated changes in one commit
8779
- playful tone in serious fixes/architecture changes
8880
- mention `context/` sync activity in commit messages
81+
- inventing plan slugs or task IDs for staged plan edits

0 commit comments

Comments
 (0)