|
1 | | -Evaluate implementation changes and decide whether refinement is warranted. |
| 1 | +Spawn `code-refiner` to review recent changes for simplification opportunities. |
2 | 2 |
|
3 | | -## Two-Phase Process |
| 3 | +## Workflow |
4 | 4 |
|
5 | | -1. **Evaluate**: Review the diff yourself and assess whether refinement would add value |
6 | | -2. **Refine**: Spawn `code-refiner` only when evaluation reveals genuine issues |
| 5 | +1. **Commit current work** - Create a WIP baseline to compare against |
| 6 | +2. **Spawn code-refiner** - Launch with minimal context for fresh perspective |
| 7 | +3. **Review changes** - Accept or reject refiner's suggestions |
| 8 | +4. **Commit properly** - Amend the WIP with a real commit message via `committer` |
7 | 9 |
|
8 | | -Small, focused changes rarely benefit from refinement. Evaluate first, then decide. |
| 10 | +## Step 1: Commit Baseline |
9 | 11 |
|
10 | | -## Evaluation |
| 12 | +```bash |
| 13 | +git add -A && git commit -m "wip: checkpoint before refinement" |
| 14 | +``` |
11 | 15 |
|
12 | | -Run `git diff` (or `git diff main...HEAD` for clean trees) and assess: |
| 16 | +Before spawning, note for yourself: What constraints matter? What complexity is intentional? Keep this ready for Step 3. |
13 | 17 |
|
14 | | -| Factor | Consider | |
15 | | -|--------|----------| |
16 | | -| Size | Under 30 lines? Likely skip. Over 50 lines? Likely refine. | |
17 | | -| Complexity | Multiple abstraction layers for simple operations? | |
18 | | -| Clarity | Would another developer understand this immediately? | |
19 | | -| Idioms | Does it follow language conventions? | |
| 18 | +## Step 2: Spawn Refiner |
20 | 19 |
|
21 | | -### Skip Refinement |
| 20 | +Launch `code-refiner` with this prompt: |
22 | 21 |
|
23 | | -- Changes under 30 lines with straightforward logic |
24 | | -- Code follows existing patterns in the codebase |
25 | | -- Uses idiomatic language constructs |
26 | | -- No multi-step conditionals that could be simplified |
| 22 | +> Review the recent changes and apply refinement principles. Look for over-engineering, unnecessary abstraction, and opportunities for simplification. |
27 | 23 |
|
28 | | -### Run Refinement |
| 24 | +## Step 3: Review and Resolve |
29 | 25 |
|
30 | | -- Changes over 50 lines |
31 | | -- Multi-level nesting or indirection for simple operations |
32 | | -- Comments explaining WHAT instead of self-documenting code |
33 | | -- Language idiom violations (e.g., verbose loops instead of map/filter) |
| 26 | +Check what changed: |
34 | 27 |
|
35 | | -## Spawning Refiners |
| 28 | +```bash |
| 29 | +git diff HEAD~1 |
| 30 | +``` |
36 | 31 |
|
37 | | -When spawning `code-refiner`, include context so it preserves intentional decisions: |
| 32 | +Then choose: |
38 | 33 |
|
39 | | -- Problem being solved: What requirement drove this change? |
40 | | -- Why this approach: What constraints led to this implementation? |
41 | | -- What to preserve: Non-obvious decisions that should not be simplified away |
| 34 | +- **Accept**: Keep refiner's improvements |
| 35 | +- **Reject**: Revert to baseline (`git reset HEAD~1`) and provide constraints to refiner for second pass |
| 36 | +- **Partial**: Revert specific files (`git checkout HEAD~1 -- path/to/file`), keep others |
42 | 37 |
|
43 | | -## Output |
| 38 | +## Step 4: Commit |
44 | 39 |
|
45 | | -State your decision before taking action: |
| 40 | +Launch the `committer` agent to amend the WIP checkpoint into a proper commit. The message should describe what the code does, not how it was developed. |
46 | 41 |
|
47 | | -When skipping: |
48 | | -> No refinement needed. [Rationale: e.g., "15-line change, idiomatic code, follows existing patterns."] |
49 | | -
|
50 | | -When refining: |
51 | | -> Running refinement. [Rationale: e.g., "60 lines with nested conditionals that could be flattened."] |
52 | | -
|
53 | | -After refinement completes, summarize what changed. |
| 42 | +**Important**: Do not skip refinement because changes seem "too simple." You cannot objectively assess code you just wrote. Always spawn the refiner. |
0 commit comments