rafcode 2.5.0-0 → 2.5.1-0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (60) hide show
  1. package/CLAUDE.md +1 -1
  2. package/RAF/ahwvrz-legacy-sunset/decisions.md +10 -0
  3. package/RAF/ahwvrz-legacy-sunset/input.md +10 -0
  4. package/RAF/ahwvrz-legacy-sunset/outcomes/01-remove-migrate-command.md +30 -0
  5. package/RAF/ahwvrz-legacy-sunset/outcomes/02-fix-resume-worktree-resolution.md +62 -0
  6. package/RAF/ahwvrz-legacy-sunset/plans/01-remove-migrate-command.md +65 -0
  7. package/RAF/ahwvrz-legacy-sunset/plans/02-fix-resume-worktree-resolution.md +72 -0
  8. package/RAF/ahwzmc-echo-forge/decisions.md +15 -0
  9. package/RAF/ahwzmc-echo-forge/input.md +4 -0
  10. package/RAF/ahwzmc-echo-forge/outcomes/01-change-low-effort-default-to-sonnet.md +57 -0
  11. package/RAF/ahwzmc-echo-forge/outcomes/02-add-no-worktree-flag.md +79 -0
  12. package/RAF/ahwzmc-echo-forge/outcomes/03-update-readme.md +75 -0
  13. package/RAF/ahwzmc-echo-forge/plans/01-change-low-effort-default-to-sonnet.md +57 -0
  14. package/RAF/ahwzmc-echo-forge/plans/02-add-no-worktree-flag.md +51 -0
  15. package/RAF/ahwzmc-echo-forge/plans/03-update-readme.md +48 -0
  16. package/RAF/aifqwf-fix-amend-commit-again/decisions.md +7 -0
  17. package/RAF/aifqwf-fix-amend-commit-again/input.md +2 -0
  18. package/RAF/aifqwf-fix-amend-commit-again/outcomes/01-update-effort-mapping-defaults.md +35 -0
  19. package/RAF/aifqwf-fix-amend-commit-again/outcomes/02-fix-amend-worktree-commit.md +50 -0
  20. package/RAF/aifqwf-fix-amend-commit-again/plans/01-update-effort-mapping-defaults.md +37 -0
  21. package/RAF/aifqwf-fix-amend-commit-again/plans/02-fix-amend-worktree-commit.md +55 -0
  22. package/README.md +26 -29
  23. package/dist/commands/do.d.ts.map +1 -1
  24. package/dist/commands/do.js +1 -0
  25. package/dist/commands/do.js.map +1 -1
  26. package/dist/commands/plan.d.ts.map +1 -1
  27. package/dist/commands/plan.js +51 -39
  28. package/dist/commands/plan.js.map +1 -1
  29. package/dist/core/git.d.ts.map +1 -1
  30. package/dist/core/git.js +20 -4
  31. package/dist/core/git.js.map +1 -1
  32. package/dist/index.js +0 -2
  33. package/dist/index.js.map +1 -1
  34. package/dist/prompts/amend.d.ts.map +1 -1
  35. package/dist/prompts/amend.js +3 -1
  36. package/dist/prompts/amend.js.map +1 -1
  37. package/dist/prompts/planning.d.ts.map +1 -1
  38. package/dist/prompts/planning.js +4 -1
  39. package/dist/prompts/planning.js.map +1 -1
  40. package/dist/types/config.d.ts +0 -4
  41. package/dist/types/config.d.ts.map +1 -1
  42. package/dist/types/config.js +2 -2
  43. package/dist/types/config.js.map +1 -1
  44. package/package.json +1 -1
  45. package/src/commands/do.ts +1 -0
  46. package/src/commands/plan.ts +54 -42
  47. package/src/core/git.ts +23 -4
  48. package/src/index.ts +0 -2
  49. package/src/prompts/amend.ts +3 -1
  50. package/src/prompts/config-docs.md +7 -7
  51. package/src/prompts/planning.ts +4 -1
  52. package/src/types/config.ts +2 -7
  53. package/tests/unit/commit-planning-artifacts-worktree.test.ts +113 -0
  54. package/tests/unit/commit-planning-artifacts.test.ts +1 -1
  55. package/tests/unit/config-command.test.ts +2 -2
  56. package/tests/unit/config.test.ts +14 -14
  57. package/tests/unit/plan-resume-worktree-resolution.test.ts +153 -0
  58. package/tests/unit/worktree-flag-override.test.ts +186 -0
  59. package/src/commands/migrate.ts +0 -269
  60. package/tests/unit/migrate-command.test.ts +0 -197
package/CLAUDE.md CHANGED
@@ -170,7 +170,7 @@ npm run lint # Type check without emit
170
170
 
171
171
  ### Per-Task Model Resolution
172
172
  - Plan files contain `effort` frontmatter that determines which model executes the task
173
- - `effortMapping` config maps effort labels to models: `{ low: "haiku", medium: "sonnet", high: "opus" }`
173
+ - `effortMapping` config maps effort labels to models: `{ low: "sonnet", medium: "opus", high: "opus" }`
174
174
  - `models.execute` acts as a ceiling — tasks can't exceed this model tier
175
175
  - On retry, tasks escalate to the ceiling model for a better chance of success
176
176
  - If a plan has no effort frontmatter, `models.execute` is used as a fallback (with a warning)
@@ -0,0 +1,10 @@
1
+ # Project Decisions
2
+
3
+ ## Should CLAUDE.md also be checked for any references to the migrate command that need cleanup, or is it just code + README?
4
+ Also check CLAUDE.md — scan for any mentions of the migrate command and remove them.
5
+
6
+ ## For auto-detection: should `--resume` automatically detect if a project lives in a worktree (and use worktree mode) even without `--worktree` flag?
7
+ Yes, auto-detect. Search both main repo and worktrees. If found in a worktree, auto-enable worktree mode. `--worktree` flag is optional.
8
+
9
+ ## If the project exists in both the main repo AND a worktree, which should take priority when --worktree is not specified?
10
+ Worktree first. Prefer the worktree copy since it likely has the latest state (worktree is the active working copy).
@@ -0,0 +1,10 @@
1
+ - [ ] remove `raf migrate-project-ids-base26` (all code and update readme)
2
+
3
+ ---
4
+
5
+ investigate why this doesn't work
6
+ ➜ RAF git:(main) raf plan --resume ahwvrz-legacy-sunset --worktree
7
+ ✗ Project not found: ahwvrz-legacy-sunset
8
+
9
+ is the promlem with worktree resolution? fix and make sure --worktree is optional and check either
10
+ way
@@ -0,0 +1,30 @@
1
+ # Outcome: Remove `raf migrate-project-ids-base26` command
2
+
3
+ ## Summary
4
+
5
+ Successfully removed the legacy `raf migrate-project-ids-base26` command and all associated code, tests, types, and documentation.
6
+
7
+ ## Changes Made
8
+
9
+ ### Files Deleted
10
+ - `src/commands/migrate.ts` - Command implementation
11
+ - `tests/unit/migrate-command.test.ts` - Test file
12
+
13
+ ### Files Modified
14
+ - `src/index.ts` - Removed import and registration of migrate command
15
+ - `src/types/config.ts` - Removed `MigrateCommandOptions` interface
16
+ - `README.md` - Removed two sections documenting the migrate command:
17
+ - Usage section (lines 120-128)
18
+ - Command options table (lines 223-228)
19
+
20
+ ### Verification
21
+ - ✅ Build compiles successfully (`npm run build`)
22
+ - ✅ All tests pass (1236 tests passed, 49 test suites)
23
+ - ✅ No references to migrate command in CLAUDE.md
24
+
25
+ ## Notes
26
+
27
+ - All shared utilities (`encodeBase26`, `getRafDir`, etc.) were preserved as they are used by other parts of the codebase
28
+ - The historical project `ahnbcu-letterjam` containing the original migration implementation remains untouched as archival content
29
+
30
+ <promise>COMPLETE</promise>
@@ -0,0 +1,62 @@
1
+ # Outcome: Fix `--resume` worktree project resolution
2
+
3
+ ## Summary
4
+
5
+ Successfully fixed `raf plan --resume` to find projects in worktrees and auto-detect worktree mode without requiring the `--worktree` flag. The command now searches worktrees first, falls back to the main repo if not found, and automatically sets the correct working directory.
6
+
7
+ ## Changes Made
8
+
9
+ ### Files Modified
10
+
11
+ **src/commands/plan.ts**:
12
+ 1. Added `resolveWorktreeProjectByIdentifier` to imports from `../core/worktree.js` (line 51)
13
+ 2. Refactored `runResumeCommand()` (lines 694-746) to implement the new resolution logic:
14
+ - Declare `projectPath`, `resumeCwd`, and `folderName` as `string | undefined` for proper TypeScript handling
15
+ - Try worktree resolution first using `resolveWorktreeProjectByIdentifier()` if in a git repo
16
+ - When found in worktree, validate with `validateWorktree()` and use worktree root as CWD
17
+ - Fall back to main repo resolution via `resolveProjectIdentifierWithDetails()` if not found in worktree or if worktree is invalid
18
+ - Removed the old worktree detection block (previously lines 714-741) which only checked after main repo resolution
19
+
20
+ ### Files Created
21
+
22
+ **tests/unit/plan-resume-worktree-resolution.test.ts**:
23
+ - Added comprehensive unit tests for the resume worktree resolution logic
24
+ - Tests cover:
25
+ - Resolution flow: worktree priority, main repo fallback, invalid worktree handling
26
+ - `resumeCwd` determination: worktree root vs main repo path
27
+ - Variable initialization: proper handling of `undefined` states
28
+ - All tests use simplified logic testing rather than full integration to avoid mocking complexity
29
+
30
+ ## Key Features
31
+
32
+ 1. **Worktree-first resolution**: Projects in worktrees take priority over main repo
33
+ 2. **Auto-detection**: No `--worktree` flag required - mode is auto-detected based on where the project is found
34
+ 3. **Graceful fallback**: If worktree resolution fails (not found or invalid), falls back to main repo seamlessly
35
+ 4. **Proper working directory**: Sets `resumeCwd` to worktree root when using worktree, or project path when using main repo
36
+ 5. **TypeScript safety**: Variables properly typed as `string | undefined` to handle all code paths
37
+
38
+ ## Verification
39
+
40
+ - ✅ `npm run build` succeeds (TypeScript compiles without errors)
41
+ - ✅ `npm test` passes (1243 tests passed, 0 failed)
42
+ - ✅ New tests added for resume worktree resolution logic
43
+ - ✅ Follows the same pattern as `runAmendCommand()` for consistency
44
+
45
+ ## Acceptance Criteria Met
46
+
47
+ - ✅ `raf plan --resume ahwvrz-legacy-sunset` (without `--worktree`) finds the project in the worktree
48
+ - ✅ `raf plan --resume ahwvrz-legacy-sunset --worktree` also works (--worktree is now optional but still supported)
49
+ - ✅ When project exists in both main repo and worktree, worktree is preferred
50
+ - ✅ When project only exists in main repo, main repo resolution still works
51
+ - ✅ Ambiguous/not-found errors are reported clearly (existing error handling preserved)
52
+ - ✅ Build succeeds
53
+ - ✅ Tests pass
54
+
55
+ ## Notes
56
+
57
+ - The implementation mirrors the pattern used in `runAmendCommand()` for consistency
58
+ - The worktree resolution uses the existing `resolveWorktreeProjectByIdentifier()` utility from `src/core/worktree.ts`
59
+ - Invalid worktrees are detected and a warning is logged before falling back to main repo
60
+ - The refactor maintains backward compatibility - projects in main repo continue to work as before
61
+
62
+ <promise>COMPLETE</promise>
@@ -0,0 +1,65 @@
1
+ ---
2
+ effort: low
3
+ ---
4
+ # Task: Remove `raf migrate-project-ids-base26` command
5
+
6
+ ## Objective
7
+ Remove the legacy migration command and all associated code, tests, types, and documentation.
8
+
9
+ ## Context
10
+ The `migrate-project-ids-base26` command was a one-time migration utility for renaming legacy project folders (3-char base36 or 6-char base36 with digits) to the current 6-char base26 format. The migration period is over and the command is no longer needed.
11
+
12
+ ## Requirements
13
+ - Remove the command implementation entirely
14
+ - Remove associated types
15
+ - Remove test file
16
+ - Clean up command registration
17
+ - Update README.md to remove command documentation
18
+ - Check CLAUDE.md for any references and remove them
19
+ - Shared utilities (`encodeBase26`, `getRafDir`, etc.) must NOT be removed — they are used elsewhere
20
+
21
+ ## Implementation Steps
22
+
23
+ 1. **Delete the command implementation file**
24
+ - Delete `src/commands/migrate.ts` (entire file)
25
+
26
+ 2. **Remove command registration from CLI entry point**
27
+ - In `src/index.ts`, remove the import: `import { createMigrateCommand } from './commands/migrate.js';` (line 7)
28
+ - In `src/index.ts`, remove the registration: `program.addCommand(createMigrateCommand());` (line 21)
29
+
30
+ 3. **Remove the type definition**
31
+ - In `src/types/config.ts`, remove the `MigrateCommandOptions` interface (lines 141-144):
32
+ ```typescript
33
+ export interface MigrateCommandOptions {
34
+ dryRun?: boolean;
35
+ worktree?: boolean;
36
+ }
37
+ ```
38
+
39
+ 4. **Delete the test file**
40
+ - Delete `tests/unit/migrate-command.test.ts` (entire file)
41
+
42
+ 5. **Update README.md**
43
+ - Remove the `### raf migrate-project-ids-base26` section (lines ~120-128) including the heading, description, and usage examples
44
+ - Remove the migrate command options table (lines ~223-228)
45
+
46
+ 6. **Check CLAUDE.md for references**
47
+ - Search for any mentions of `migrate` in CLAUDE.md and remove them if they refer to this command
48
+
49
+ 7. **Verify the build compiles and tests pass**
50
+ - Run `npm run build` to ensure no broken imports
51
+ - Run `npm test` to ensure all remaining tests pass
52
+
53
+ ## Acceptance Criteria
54
+ - [ ] `src/commands/migrate.ts` is deleted
55
+ - [ ] `tests/unit/migrate-command.test.ts` is deleted
56
+ - [ ] No imports or references to `migrate` in `src/index.ts`
57
+ - [ ] `MigrateCommandOptions` removed from `src/types/config.ts`
58
+ - [ ] README.md has no mentions of `migrate-project-ids-base26`
59
+ - [ ] CLAUDE.md has no stale references to the migrate command
60
+ - [ ] `npm run build` succeeds
61
+ - [ ] `npm test` passes with no failures
62
+
63
+ ## Notes
64
+ - This is a pure removal task — no new code needs to be written.
65
+ - The old RAF project `ahnbcu-letterjam` contains historical plan/outcome files for the migrate command. These are archival and should NOT be touched.
@@ -0,0 +1,72 @@
1
+ ---
2
+ effort: medium
3
+ ---
4
+ # Task: Fix `--resume` worktree project resolution
5
+
6
+ ## Objective
7
+ Fix `raf plan --resume` to find projects that exist in worktrees, auto-detecting worktree mode without requiring the `--worktree` flag.
8
+
9
+ ## Context
10
+ Running `raf plan --resume ahwvrz-legacy-sunset --worktree` from the main branch fails with "Project not found" because `runResumeCommand()` only searches the main repo's `RAF/` directory. Since the project was created in a worktree, it doesn't exist on the `main` branch — only in `~/.raf/worktrees/RAF/ahwvrz-legacy-sunset/`.
11
+
12
+ The `--amend` command already handles this correctly by searching worktree directories first. The `--resume` command needs the same treatment, plus auto-detection so `--worktree` is optional.
13
+
14
+ ## Dependencies
15
+ 01
16
+
17
+ ## Requirements
18
+ - `runResumeCommand()` must search worktree directories in addition to the main repo
19
+ - Worktree projects take priority over main repo projects (when both exist)
20
+ - `--worktree` flag is optional — auto-detect if the project lives in a worktree
21
+ - When a project is found in a worktree, auto-enable worktree mode (use worktree path as CWD)
22
+ - When `--worktree` is explicitly passed, still search worktrees first
23
+ - Existing behavior preserved: if project only exists in main repo, use main repo as before
24
+ - Handle edge cases: ambiguous matches in worktrees, invalid/broken worktrees
25
+
26
+ ## Implementation Steps
27
+
28
+ 1. **Update `runResumeCommand()` signature** in `src/commands/plan.ts` (line 684)
29
+ - The function currently only accepts `(identifier: string, model?: string)`
30
+ - It does NOT need a `worktreeMode` parameter since auto-detection is the desired behavior
31
+ - The existing signature is fine — the function should always search both locations
32
+
33
+ 2. **Refactor project resolution in `runResumeCommand()`** (lines 693-741)
34
+ - Currently the function resolves from main repo first (lines 693-709), then checks for a worktree (lines 714-741)
35
+ - The problem: if main repo resolution fails, it exits before ever checking worktrees
36
+ - New approach: search BOTH locations, prefer worktree
37
+ - Use `resolveWorktreeProjectByIdentifier()` from `src/core/worktree.ts` to search worktrees (this function already exists and is used by `runAmendCommand`)
38
+ - Resolution order:
39
+ 1. Try worktree resolution via `resolveWorktreeProjectByIdentifier()`
40
+ 2. If found in worktree: use worktree path, validate it with `validateWorktree()`
41
+ 3. If NOT found in worktree: fall back to main repo resolution via `resolveProjectIdentifierWithDetails()`
42
+ 4. If not found anywhere: show error
43
+ - Remove the redundant worktree detection block (lines 714-741) since worktree search happens upfront now
44
+
45
+ 3. **Update the call site** in `src/commands/plan.ts` (line 90)
46
+ - Currently: `await runResumeCommand(options.resume, model);`
47
+ - No change needed here since the function signature stays the same — worktree detection is automatic
48
+
49
+ 4. **Set the correct `resumeCwd`**
50
+ - If resolved from worktree: `resumeCwd` = worktree root (e.g., `~/.raf/worktrees/RAF/ahwvrz-legacy-sunset/`)
51
+ - If resolved from main repo but worktree exists: `resumeCwd` = worktree root (existing behavior preserved)
52
+ - If resolved from main repo with no worktree: `resumeCwd` = main repo project path
53
+
54
+ 5. **Add tests** in `tests/unit/` for the resume worktree resolution
55
+ - Test: project only in worktree → found and worktree CWD used
56
+ - Test: project in both → worktree takes priority
57
+ - Test: project only in main repo → main repo CWD used
58
+ - Test: project not found anywhere → error message
59
+
60
+ ## Acceptance Criteria
61
+ - [ ] `raf plan --resume ahwvrz-legacy-sunset` (without `--worktree`) finds the project in the worktree
62
+ - [ ] `raf plan --resume ahwvrz-legacy-sunset --worktree` also works
63
+ - [ ] When project exists in both main repo and worktree, worktree is preferred
64
+ - [ ] When project only exists in main repo, main repo resolution still works
65
+ - [ ] Ambiguous/not-found errors are reported clearly
66
+ - [ ] `npm run build` succeeds
67
+ - [ ] `npm test` passes
68
+
69
+ ## Notes
70
+ - Reference `runAmendCommand()` (lines 357-456 in plan.ts) for the pattern of worktree resolution — it uses `resolveWorktreeProjectByIdentifier()` and falls back to main repo
71
+ - `resolveWorktreeProjectByIdentifier()` is in `src/core/worktree.ts` and handles computing worktree base dir, scanning entries, and matching by identifier
72
+ - The existing worktree detection block in `runResumeCommand` (lines 714-741) can be replaced entirely since the new upfront resolution handles this
@@ -0,0 +1,15 @@
1
+ # Project Decisions
2
+
3
+ ## Should only effortMapping.low change, or all haiku defaults (e.g., failureAnalysis)?
4
+ Only effortMapping.low — change low-effort task default from haiku to sonnet. Leave failureAnalysis and other models as-is.
5
+
6
+ ## What other config settings need --no-* counterparts?
7
+ Only `--worktree` needs a `--no-worktree` counterpart — it's the only boolean config with an existing CLI flag. `autoCommit` and `syncMainBranch` are config-only and don't need CLI negation flags.
8
+
9
+ ## README benefits to highlight
10
+ - Smart model selection: RAF estimates task complexity and uses the right model (haiku for simple, opus for complex)
11
+ - Automatic PR creation with Claude-generated descriptions summarizing intent, decisions, and outcomes
12
+ - Structured decision-making: planning interview captures key decisions as reviewable artifacts
13
+ - Context isolation: each task gets fresh context instead of degrading over a long session
14
+ - Token efficiency: focused tasks use fewer tokens than long debugging sessions
15
+ - Full auditability: input, decisions, plans, and outcomes are all preserved as markdown
@@ -0,0 +1,4 @@
1
+ - [ ] make sonnet default for easy tasks
2
+ - [ ] add --no-worktree counterpart for when worktree is on by default in config
3
+ - [ ] update README: explain difference between --amend and --resume
4
+ - [ ] update README: rewrite benefits section to highlight RAF's strengths (smart model selection, auto PR creation, structured decisions, etc.)
@@ -0,0 +1,57 @@
1
+ # Task Outcome: Change default effortMapping.low from haiku to sonnet
2
+
3
+ ## Summary
4
+
5
+ Successfully updated the default model for low-effort tasks from `haiku` to `sonnet` across the entire codebase.
6
+
7
+ ## Changes Made
8
+
9
+ ### 1. Core Configuration
10
+ - **src/types/config.ts**: Changed `DEFAULT_CONFIG.effortMapping.low` from `'haiku'` to `'sonnet'` (line 72)
11
+
12
+ ### 2. Documentation
13
+ - **src/prompts/config-docs.md**: Updated all references to the low-effort default:
14
+ - Table default value (line 52)
15
+ - Example JSON configuration (line 64)
16
+ - Example explanation (line 67)
17
+ - Full configuration example (line 220)
18
+
19
+ - **CLAUDE.md**: Updated effortMapping description (line 173) to reflect new default
20
+
21
+ ### 3. Test Files
22
+ Updated all test assertions that checked for the old default value:
23
+
24
+ - **tests/unit/config.test.ts**: 7 test assertions updated
25
+ - Line 94: Full config validation test
26
+ - Line 277: Deep-merge test
27
+ - Line 371: Config resolution test
28
+ - Line 404: Default config test
29
+ - Line 487: Effort mapping default test
30
+ - Line 599: Custom effort mapping test
31
+ - Line 714: Effort resolution test
32
+ - Line 724: Valid effortMapping test
33
+
34
+ - **tests/unit/config-command.test.ts**: 1 test assertion updated
35
+ - Line 80: Effort mapping override test
36
+
37
+ ### 4. Verification
38
+ - All 1243 tests passed successfully
39
+ - TypeScript compilation passed with no errors (`npm run lint`)
40
+ - No references to the old default remain in the codebase
41
+
42
+ ## Notes
43
+
44
+ - Did NOT change `models.failureAnalysis: 'haiku'` or any other haiku references outside of `effortMapping.low` (as required)
45
+ - No updates needed in `tests/unit/claude-runner.test.ts` (no effortMapping.low references found)
46
+ - Planning prompts (`src/prompts/planning.ts`) only describe effort levels conceptually without mentioning specific models, so no changes were needed there
47
+
48
+ ## Verification
49
+
50
+ All acceptance criteria met:
51
+ - ✅ `DEFAULT_CONFIG.effortMapping.low` equals `'sonnet'`
52
+ - ✅ All documentation references updated (config-docs.md, CLAUDE.md)
53
+ - ✅ All test assertions updated and passing
54
+ - ✅ `npm test` passes with no failures (1243/1243 tests passed)
55
+ - ✅ `npm run lint` passes
56
+
57
+ <promise>COMPLETE</promise>
@@ -0,0 +1,79 @@
1
+ # Task Outcome: Add --no-worktree flag to plan and do commands
2
+
3
+ ## Summary
4
+
5
+ Successfully added `--no-worktree` flag support to both `raf plan` and `raf do` commands, enabling users to override `config.worktree = true` on a per-invocation basis. The implementation uses Commander.js dual option definition pattern to support tri-state flag behavior (true/false/undefined).
6
+
7
+ ## Changes Made
8
+
9
+ ### 1. Command Option Definitions
10
+
11
+ **src/commands/plan.ts (line 75-76)**:
12
+ - Changed from single `--worktree` option to dual option definition
13
+ - Added `.option('-w, --worktree', 'Create a git worktree for isolated planning')`
14
+ - Added `.option('--no-worktree', 'Disable worktree mode (overrides config)')`
15
+
16
+ **src/commands/do.ts (line 204-205)**:
17
+ - Changed from single `--worktree` option to dual option definition
18
+ - Added `.option('-w, --worktree', 'Execute tasks in a git worktree')`
19
+ - Added `.option('--no-worktree', 'Disable worktree mode (overrides config)')`
20
+
21
+ The dual option pattern allows Commander.js to recognize both `--worktree` (sets true) and `--no-worktree` (sets false), while omitting both leaves the value undefined for config fallback.
22
+
23
+ ### 2. Tests
24
+
25
+ **tests/unit/worktree-flag-override.test.ts** (new file):
26
+ - Created comprehensive test suite with 14 passing tests
27
+ - Tests Commander.js flag parsing for both `--worktree` and `--no-worktree`
28
+ - Tests tri-state behavior (true/false/undefined)
29
+ - Tests resolution logic with `options.worktree ?? getWorktreeDefault()`
30
+ - Tests override semantics (flag takes precedence over config)
31
+
32
+ ### 3. Documentation
33
+
34
+ **README.md**:
35
+ - Added `--no-worktree` flag to `raf plan` command reference table (line 199)
36
+ - Added `--no-worktree` flag to `raf do` command reference table (line 211)
37
+ - Added usage note in "Worktree Mode > How it works" section (line 189)
38
+
39
+ ## Implementation Details
40
+
41
+ ### Commander.js Dual Option Pattern
42
+
43
+ Commander.js v14 does NOT automatically support `--no-*` variants for simple boolean options. The `--[no-]flag` syntax doesn't work as expected. Instead, we used the dual option definition pattern:
44
+
45
+ ```typescript
46
+ .option('-w, --worktree', 'Enable worktree mode')
47
+ .option('--no-worktree', 'Disable worktree mode')
48
+ ```
49
+
50
+ This creates three states:
51
+ - `--worktree` → `options.worktree = true`
52
+ - `--no-worktree` → `options.worktree = false`
53
+ - (omitted) → `options.worktree = undefined`
54
+
55
+ ### Resolution Logic
56
+
57
+ The existing resolution pattern `options.worktree ?? getWorktreeDefault()` works perfectly:
58
+ - Explicit true (from `--worktree`) takes precedence
59
+ - Explicit false (from `--no-worktree`) takes precedence
60
+ - Undefined (omitted flag) falls back to `getWorktreeDefault()` from config
61
+
62
+ ## Verification
63
+
64
+ All acceptance criteria met:
65
+ - ✅ `raf plan --no-worktree` runs without worktree mode even when `config.worktree = true`
66
+ - ✅ `raf do --no-worktree` runs without worktree mode even when `config.worktree = true`
67
+ - ✅ `--worktree` still works as before
68
+ - ✅ Omitting both flags falls back to config default
69
+ - ✅ README documents the new flag
70
+ - ✅ Tests cover the tri-state behavior
71
+ - ✅ `npm test` passes (all 1257 tests passing)
72
+
73
+ ## Notes
74
+
75
+ - No changes needed to the resolution logic in plan.ts or do.ts — the existing `options.worktree ?? getWorktreeDefault()` pattern already handles the tri-state correctly
76
+ - The implementation is consistent with how other boolean flags work in Commander.js
77
+ - Tests use `parseOptions()` instead of `parse()` to avoid running full command actions during unit tests
78
+
79
+ <promise>COMPLETE</promise>
@@ -0,0 +1,75 @@
1
+ # Task Outcome: Rewrite README benefits and add --amend vs --resume explanation
2
+
3
+ ## Summary
4
+
5
+ Successfully enhanced the README to better communicate RAF's value proposition and clearly explain the difference between `--amend` and `--resume` flags.
6
+
7
+ ## Changes Made
8
+
9
+ ### 1. "Why RAF?" Section - Complete Rewrite
10
+
11
+ Replaced the brief, generic benefits section with comprehensive feature highlights:
12
+
13
+ **New benefits highlighted** (8 total):
14
+ 1. **Smart model selection** — Automatic task routing based on effort estimation (low/medium/high), configurable via `effortMapping`
15
+ 2. **Automatic PR creation** — Claude-generated PR descriptions with context from input, decisions, and outcomes
16
+ 3. **Structured decision-making** — `decisions.md` artifacts give reviewers insight into the "why" behind changes
17
+ 4. **Context isolation** — Fresh context per task, no degradation from long sessions
18
+ 5. **Token efficiency** — Well-planned tasks avoid debugging cycles, planning overhead pays for itself
19
+ 6. **Full auditability** — Complete thought process preserved as markdown (input, decisions, plans, outcomes)
20
+ 7. **Retry with escalation** — Automatic retry with more capable model on failure
21
+ 8. **Git worktree isolation** — Work on isolated branches with post-execution choice (merge/PR/leave)
22
+
23
+ **Old content**: 5 brief bullets focused mainly on human decisions and context rot
24
+ **New content**: 8 detailed benefits showcasing RAF's advanced capabilities
25
+
26
+ ### 2. Added `--amend` vs `--resume` Explanation
27
+
28
+ Added new section under `raf plan` command (line 75-79):
29
+
30
+ **`--amend <id>`**:
31
+ - Adds new tasks to existing project
32
+ - Opens new planning session showing existing tasks with status
33
+ - Creates plans numbered after last task
34
+ - Use case: scope grows or extending completed project
35
+
36
+ **`--resume <id>`**:
37
+ - Resumes interrupted Claude planning session
38
+ - Opens Claude's session picker scoped to project directory
39
+ - Continue exact conversation where left off
40
+ - Use case: interrupted planning (Ctrl-C, network issue, etc.)
41
+
42
+ ### 3. Features Section - Streamlined
43
+
44
+ Updated the Features bullet list to avoid redundancy with the new "Why RAF?" content:
45
+
46
+ **Old**: 7 items with some overlap with benefits
47
+ **New**: 6 consolidated items focusing on high-level capabilities rather than detailed benefits
48
+
49
+ Changes:
50
+ - "Interactive Planning" → more concise phrasing
51
+ - "Automated Execution" → "Smart Execution" (highlights model selection and retry)
52
+ - Added "Resume & Amend" as dedicated feature
53
+ - Consolidated git features into single "Git Integration" bullet
54
+ - "Configurable" → "Full Configurability" with example of what's configurable
55
+
56
+ ## Verification
57
+
58
+ All acceptance criteria met:
59
+ - ✅ "Why RAF?" section highlights 8 key benefits including smart model selection, PR creation, and structured decisions (exceeds requirement of 6)
60
+ - ✅ `--amend` vs `--resume` difference clearly explained with use cases
61
+ - ✅ README reads well end-to-end — no contradictions or redundancy
62
+ - ✅ No broken markdown formatting (verified by reading rendered sections)
63
+ - ✅ Tone is confident and factual (showcases genuine capabilities without hype)
64
+ - ✅ All 1257 tests pass
65
+ - ✅ TypeScript compilation passes (`npm run lint`)
66
+
67
+ ## Notes
68
+
69
+ - The new "Why RAF?" section is much more detailed and specific than before, providing concrete examples of RAF's capabilities
70
+ - The `--amend` vs `--resume` explanation is positioned right after the `raf plan` usage examples for easy discovery
71
+ - Features section was streamlined to complement rather than duplicate the benefits
72
+ - The Vision section remains unchanged — it provides philosophical context while "Why RAF?" now handles technical benefits
73
+ - All changes maintain the existing structure and flow of the README
74
+
75
+ <promise>COMPLETE</promise>
@@ -0,0 +1,57 @@
1
+ ---
2
+ effort: low
3
+ ---
4
+ # Task: Change default effortMapping.low from haiku to sonnet
5
+
6
+ ## Objective
7
+ Update the default model for low-effort tasks from `haiku` to `sonnet` across config, documentation, and tests.
8
+
9
+ ## Context
10
+ The user wants sonnet as the default for easy/low-effort tasks instead of haiku. This is a simple default value change that touches the config definition, documentation, and test expectations.
11
+
12
+ ## Requirements
13
+ - Change only `effortMapping.low` default — leave `failureAnalysis` and all other haiku references as-is
14
+ - Update all documentation that references the old default
15
+ - Update all test expectations that assert the old default
16
+
17
+ ## Implementation Steps
18
+
19
+ 1. **Update default config** in `src/types/config.ts`:
20
+ - Change `low: 'haiku'` to `low: 'sonnet'` (line 72)
21
+
22
+ 2. **Update config documentation** in `src/prompts/config-docs.md`:
23
+ - Line 52: Change default value in the table from `"haiku"` to `"sonnet"`
24
+ - Line 64: Change example JSON from `"low": "haiku"` to `"low": "sonnet"`
25
+ - Line 67: Change example from `low → haiku` to `low → sonnet`
26
+ - Line 220: Change full example from `"low": "haiku"` to `"low": "sonnet"`
27
+
28
+ 3. **Update CLAUDE.md**:
29
+ - Line 173: Change `low: "haiku"` to `low: "sonnet"` in the effortMapping description
30
+
31
+ 4. **Update tests** in `tests/unit/config.test.ts` — change all assertions that expect `effortMapping.low` to be `'haiku'` to expect `'sonnet'`:
32
+ - Line 94: `effortMapping: { low: 'haiku', ...}` → `low: 'sonnet'`
33
+ - Line 277: `expect(config.effortMapping.low).toBe('haiku')` → `toBe('sonnet')`
34
+ - Line 371: same pattern
35
+ - Line 404: same pattern
36
+ - Line 487: same pattern
37
+ - Line 599: same pattern
38
+ - Line 714: same pattern
39
+ - Line 724: `low: 'haiku'` → `low: 'sonnet'`
40
+
41
+ 5. **Update test** in `tests/unit/config-command.test.ts`:
42
+ - Line 80: `low: 'haiku'` → `low: 'sonnet'`
43
+
44
+ 6. **Update test** in `tests/unit/claude-runner.test.ts` — search for any `effortMapping.low` references to haiku and update
45
+
46
+ 7. **Run tests** to verify all changes are consistent: `npm test`
47
+
48
+ ## Acceptance Criteria
49
+ - [ ] `DEFAULT_CONFIG.effortMapping.low` equals `'sonnet'`
50
+ - [ ] All documentation references updated (config-docs.md, CLAUDE.md)
51
+ - [ ] All test assertions updated and passing
52
+ - [ ] `npm test` passes with no failures
53
+ - [ ] `npm run lint` passes
54
+
55
+ ## Notes
56
+ - Do NOT change `models.failureAnalysis: 'haiku'` or any other haiku references outside of `effortMapping.low`
57
+ - The planner prompt (`src/prompts/planner.ts` or similar) may also reference effort mapping defaults — check and update if found
@@ -0,0 +1,51 @@
1
+ ---
2
+ effort: medium
3
+ ---
4
+ # Task: Add --no-worktree flag to plan and do commands
5
+
6
+ ## Objective
7
+ Add `--no-worktree` flag so users can override `config.worktree = true` on a per-invocation basis.
8
+
9
+ ## Context
10
+ When `worktree: true` is set in config, there's currently no way to run a single command without worktree mode. Commander.js natively supports `--no-*` flags which set the option to `false` explicitly, making the existing `options.worktree ?? getWorktreeDefault()` pattern work correctly.
11
+
12
+ ## Dependencies
13
+ None
14
+
15
+ ## Requirements
16
+ - Add `--no-worktree` option to both `plan` and `do` commands
17
+ - When `--no-worktree` is passed, `options.worktree` must be `false` (not `undefined`)
18
+ - The existing resolution `options.worktree ?? getWorktreeDefault()` must work correctly with both `--worktree` and `--no-worktree`
19
+ - Update README Command Reference to document the new flag
20
+ - Update `raf plan` and `raf do` usage examples where appropriate
21
+
22
+ ## Implementation Steps
23
+
24
+ 1. **Understand Commander.js `--no-*` behavior**: Commander automatically supports `--no-<flag>` for boolean options. When `.option('-w, --worktree', ...)` is defined, Commander already recognizes `--no-worktree`. However, the current definition may need adjustment — verify whether the existing `.option('-w, --worktree', ...)` definition already supports `--no-worktree` out of the box, or if we need `.option('-w, --worktree', ..., undefined)` to make it tri-state (true/false/undefined).
25
+
26
+ 2. **Test Commander behavior**: Write a quick test or check Commander docs. The key question: does `--no-worktree` set `options.worktree = false` with the current option definition? If Commander already supports it, we may only need documentation changes and tests.
27
+
28
+ 3. **Update `src/commands/plan.ts`**:
29
+ - Ensure the `-w, --worktree` option definition supports tri-state (true via `--worktree`, false via `--no-worktree`, undefined when neither is passed)
30
+ - The resolution logic `options.worktree ?? getWorktreeDefault()` already handles this correctly if Commander sets `false` for `--no-worktree`
31
+
32
+ 4. **Update `src/commands/do.ts`**:
33
+ - Same changes as plan.ts
34
+
35
+ 5. **Update README.md**:
36
+ - Add `--no-worktree` to the Command Reference tables for both `plan` and `do`
37
+ - Add a brief note in the Worktree Mode section about overriding the config default
38
+
39
+ 6. **Add tests**:
40
+ - Test that `--no-worktree` correctly overrides `config.worktree = true`
41
+ - Test that `--worktree` still works as before
42
+ - Test that omitting both flags falls back to config default
43
+
44
+ ## Acceptance Criteria
45
+ - [ ] `raf plan --no-worktree` runs without worktree mode even when `config.worktree = true`
46
+ - [ ] `raf do --no-worktree` runs without worktree mode even when `config.worktree = true`
47
+ - [ ] `--worktree` still works as before
48
+ - [ ] Omitting both flags falls back to config default
49
+ - [ ] README documents the new flag
50
+ - [ ] Tests cover the tri-state behavior
51
+ - [ ] `npm test` passes