rafcode 3.0.0 → 3.8.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.
- package/.claude/settings.local.json +3 -1
- package/CLAUDE.md +0 -1
- package/RAF/38-dual-wielder/decisions.md +9 -0
- package/RAF/38-dual-wielder/input.md +6 -1
- package/RAF/38-dual-wielder/outcomes/8-e2e-test-codex-provider.md +139 -0
- package/RAF/38-dual-wielder/plans/8-e2e-test-codex-provider.md +95 -0
- package/RAF/39-pathless-rover/decisions.md +16 -0
- package/RAF/39-pathless-rover/input.md +2 -0
- package/RAF/39-pathless-rover/outcomes/1-fix-codex-stream-renderer.md +21 -0
- package/RAF/39-pathless-rover/outcomes/2-wire-provider-flag.md +28 -0
- package/RAF/39-pathless-rover/outcomes/3-remove-worktree-flag-do.md +41 -0
- package/RAF/39-pathless-rover/outcomes/4-remove-worktree-flag-plan-amend.md +30 -0
- package/RAF/39-pathless-rover/outcomes/5-update-prompts-and-docs.md +26 -0
- package/RAF/39-pathless-rover/plans/1-fix-codex-stream-renderer.md +43 -0
- package/RAF/39-pathless-rover/plans/2-wire-provider-flag.md +48 -0
- package/RAF/39-pathless-rover/plans/3-remove-worktree-flag-do.md +41 -0
- package/RAF/39-pathless-rover/plans/4-remove-worktree-flag-plan-amend.md +43 -0
- package/RAF/39-pathless-rover/plans/5-update-prompts-and-docs.md +31 -0
- package/RAF/40-numeric-order-fix/decisions.md +7 -0
- package/RAF/40-numeric-order-fix/input.md +19 -0
- package/RAF/40-numeric-order-fix/outcomes/1-fix-numeric-sort-order.md +18 -0
- package/RAF/40-numeric-order-fix/outcomes/2-add-npm-keywords.md +10 -0
- package/RAF/40-numeric-order-fix/plans/1-fix-numeric-sort-order.md +48 -0
- package/RAF/40-numeric-order-fix/plans/2-add-npm-keywords.md +23 -0
- package/RAF/41-echo-chamber/decisions.md +13 -0
- package/RAF/41-echo-chamber/input.md +4 -0
- package/RAF/41-echo-chamber/outcomes/1-update-codex-model-defaults.md +24 -0
- package/RAF/41-echo-chamber/outcomes/2-e2e-test-codex-provider.md +74 -0
- package/RAF/41-echo-chamber/plans/1-update-codex-model-defaults.md +28 -0
- package/RAF/41-echo-chamber/plans/2-e2e-test-codex-provider.md +103 -0
- package/RAF/42-patch-parade/decisions.md +29 -0
- package/RAF/42-patch-parade/input.md +9 -0
- package/RAF/42-patch-parade/outcomes/1-fix-codex-model-resolution.md +36 -0
- package/RAF/42-patch-parade/outcomes/2-fix-provider-aware-name-generation.md +31 -0
- package/RAF/42-patch-parade/outcomes/3-fix-codex-error-event-rendering.md +32 -0
- package/RAF/42-patch-parade/outcomes/4-update-cli-help-docs.md +28 -0
- package/RAF/42-patch-parade/outcomes/5-update-default-codex-models-to-gpt-5-4.md +33 -0
- package/RAF/42-patch-parade/outcomes/6-unify-model-config-schema.md +89 -0
- package/RAF/42-patch-parade/plans/1-fix-codex-model-resolution.md +35 -0
- package/RAF/42-patch-parade/plans/2-fix-provider-aware-name-generation.md +38 -0
- package/RAF/42-patch-parade/plans/3-fix-codex-error-event-rendering.md +32 -0
- package/RAF/42-patch-parade/plans/4-update-cli-help-docs.md +31 -0
- package/RAF/42-patch-parade/plans/5-update-default-codex-models-to-gpt-5-4.md +35 -0
- package/RAF/42-patch-parade/plans/6-unify-model-config-schema.md +46 -0
- package/RAF/43-swiss-army/decisions.md +34 -0
- package/RAF/43-swiss-army/input.md +7 -0
- package/RAF/43-swiss-army/outcomes/1-fix-model-validation.md +21 -0
- package/RAF/43-swiss-army/outcomes/2-update-commit-format.md +31 -0
- package/RAF/43-swiss-army/outcomes/3-wire-reasoning-effort.md +28 -0
- package/RAF/43-swiss-army/outcomes/4-remove-provider-flag.md +27 -0
- package/RAF/43-swiss-army/outcomes/5-config-wizard-validation.md +23 -0
- package/RAF/43-swiss-army/outcomes/6-add-fast-mode.md +32 -0
- package/RAF/43-swiss-army/outcomes/7-config-preset.md +31 -0
- package/RAF/43-swiss-army/plans/1-fix-model-validation.md +38 -0
- package/RAF/43-swiss-army/plans/2-update-commit-format.md +46 -0
- package/RAF/43-swiss-army/plans/3-wire-reasoning-effort.md +39 -0
- package/RAF/43-swiss-army/plans/4-remove-provider-flag.md +43 -0
- package/RAF/43-swiss-army/plans/5-config-wizard-validation.md +42 -0
- package/RAF/43-swiss-army/plans/6-add-fast-mode.md +46 -0
- package/RAF/43-swiss-army/plans/7-config-preset.md +51 -0
- package/RAF/44-config-api-change/decisions.md +22 -0
- package/RAF/44-config-api-change/input.md +5 -0
- package/RAF/44-config-api-change/outcomes/1-restructure-config-subcommands.md +19 -0
- package/RAF/44-config-api-change/outcomes/2-move-preset-under-config.md +17 -0
- package/RAF/44-config-api-change/outcomes/3-update-existing-tests-for-config-api.md +14 -0
- package/RAF/44-config-api-change/outcomes/4-update-config-command-docs.md +11 -0
- package/RAF/44-config-api-change/outcomes/5-fix-codex-name-generation.md +18 -0
- package/RAF/44-config-api-change/plans/1-restructure-config-subcommands.md +37 -0
- package/RAF/44-config-api-change/plans/2-move-preset-under-config.md +38 -0
- package/RAF/44-config-api-change/plans/3-update-existing-tests-for-config-api.md +38 -0
- package/RAF/44-config-api-change/plans/4-update-config-command-docs.md +36 -0
- package/RAF/44-config-api-change/plans/5-fix-codex-name-generation.md +49 -0
- package/RAF/45-signal-cairn/decisions.md +7 -0
- package/RAF/45-signal-cairn/input.md +2 -0
- package/RAF/45-signal-cairn/outcomes/1-rename-provider-to-harness.md +19 -0
- package/RAF/45-signal-cairn/outcomes/2-normalize-model-display-names.md +18 -0
- package/RAF/45-signal-cairn/plans/1-rename-provider-to-harness.md +40 -0
- package/RAF/45-signal-cairn/plans/2-normalize-model-display-names.md +41 -0
- package/RAF/45-signal-lantern/decisions.md +10 -0
- package/RAF/45-signal-lantern/input.md +2 -0
- package/RAF/45-signal-lantern/outcomes/1-add-effort-and-fast-to-do-model-display.md +15 -0
- package/RAF/45-signal-lantern/outcomes/2-capture-codex-post-run-token-usage.md +15 -0
- package/RAF/45-signal-lantern/outcomes/3-show-codex-token-summaries-without-fake-cost.md +14 -0
- package/RAF/45-signal-lantern/plans/1-add-effort-and-fast-to-do-model-display.md +38 -0
- package/RAF/45-signal-lantern/plans/2-capture-codex-post-run-token-usage.md +37 -0
- package/RAF/45-signal-lantern/plans/3-show-codex-token-summaries-without-fake-cost.md +40 -0
- package/RAF/46-lantern-arc/decisions.md +19 -0
- package/RAF/46-lantern-arc/input.md +6 -0
- package/RAF/46-lantern-arc/outcomes/1-remove-spark-alias.md +16 -0
- package/RAF/46-lantern-arc/outcomes/2-clean-up-worktree-plan-command.md +30 -0
- package/RAF/46-lantern-arc/outcomes/3-fix-token-usage-accumulation.md +32 -0
- package/RAF/46-lantern-arc/outcomes/4-display-effort-in-compact-mode.md +22 -0
- package/RAF/46-lantern-arc/outcomes/5-codex-fast-mode-research.md +38 -0
- package/RAF/46-lantern-arc/outcomes/6-optimize-llm-prompts.md +39 -0
- package/RAF/46-lantern-arc/plans/1-remove-spark-alias.md +38 -0
- package/RAF/46-lantern-arc/plans/2-clean-up-worktree-plan-command.md +33 -0
- package/RAF/46-lantern-arc/plans/3-fix-token-usage-accumulation.md +33 -0
- package/RAF/46-lantern-arc/plans/4-display-effort-in-compact-mode.md +28 -0
- package/RAF/46-lantern-arc/plans/5-codex-fast-mode-research.md +34 -0
- package/RAF/46-lantern-arc/plans/6-optimize-llm-prompts.md +48 -0
- package/RAF/47-signal-trim/decisions.md +13 -0
- package/RAF/47-signal-trim/input.md +2 -0
- package/RAF/47-signal-trim/plans/1-remove-cache-from-status.md +73 -0
- package/README.md +50 -63
- package/dist/commands/config.d.ts.map +1 -1
- package/dist/commands/config.js +47 -49
- package/dist/commands/config.js.map +1 -1
- package/dist/commands/do.d.ts +2 -0
- package/dist/commands/do.d.ts.map +1 -1
- package/dist/commands/do.js +91 -230
- package/dist/commands/do.js.map +1 -1
- package/dist/commands/plan.d.ts.map +1 -1
- package/dist/commands/plan.js +54 -259
- package/dist/commands/plan.js.map +1 -1
- package/dist/commands/preset.d.ts +3 -0
- package/dist/commands/preset.d.ts.map +1 -0
- package/dist/commands/preset.js +158 -0
- package/dist/commands/preset.js.map +1 -0
- package/dist/core/claude-runner.d.ts +2 -0
- package/dist/core/claude-runner.d.ts.map +1 -1
- package/dist/core/claude-runner.js +36 -12
- package/dist/core/claude-runner.js.map +1 -1
- package/dist/core/codex-runner.d.ts +1 -0
- package/dist/core/codex-runner.d.ts.map +1 -1
- package/dist/core/codex-runner.js +26 -7
- package/dist/core/codex-runner.js.map +1 -1
- package/dist/core/failure-analyzer.js +2 -1
- package/dist/core/failure-analyzer.js.map +1 -1
- package/dist/core/git.d.ts +2 -2
- package/dist/core/git.d.ts.map +1 -1
- package/dist/core/git.js +53 -3
- package/dist/core/git.js.map +1 -1
- package/dist/core/project-manager.d.ts.map +1 -1
- package/dist/core/project-manager.js +2 -2
- package/dist/core/project-manager.js.map +1 -1
- package/dist/core/pull-request.js +5 -5
- package/dist/core/pull-request.js.map +1 -1
- package/dist/core/runner-factory.d.ts +4 -4
- package/dist/core/runner-factory.d.ts.map +1 -1
- package/dist/core/runner-factory.js +8 -8
- package/dist/core/runner-factory.js.map +1 -1
- package/dist/core/runner-interface.d.ts +1 -1
- package/dist/core/runner-types.d.ts +17 -4
- package/dist/core/runner-types.d.ts.map +1 -1
- package/dist/core/state-derivation.js +3 -3
- package/dist/core/state-derivation.js.map +1 -1
- package/dist/parsers/codex-stream-renderer.d.ts +28 -4
- package/dist/parsers/codex-stream-renderer.d.ts.map +1 -1
- package/dist/parsers/codex-stream-renderer.js +110 -0
- package/dist/parsers/codex-stream-renderer.js.map +1 -1
- package/dist/prompts/amend.d.ts +0 -1
- package/dist/prompts/amend.d.ts.map +1 -1
- package/dist/prompts/amend.js +31 -104
- package/dist/prompts/amend.js.map +1 -1
- package/dist/prompts/execution.d.ts.map +1 -1
- package/dist/prompts/execution.js +17 -34
- package/dist/prompts/execution.js.map +1 -1
- package/dist/prompts/planning.d.ts.map +1 -1
- package/dist/prompts/planning.js +23 -123
- package/dist/prompts/planning.js.map +1 -1
- package/dist/types/config.d.ts +33 -32
- package/dist/types/config.d.ts.map +1 -1
- package/dist/types/config.js +14 -28
- package/dist/types/config.js.map +1 -1
- package/dist/utils/config.d.ts +36 -16
- package/dist/utils/config.d.ts.map +1 -1
- package/dist/utils/config.js +209 -104
- package/dist/utils/config.js.map +1 -1
- package/dist/utils/name-generator.d.ts.map +1 -1
- package/dist/utils/name-generator.js +25 -12
- package/dist/utils/name-generator.js.map +1 -1
- package/dist/utils/paths.d.ts +5 -0
- package/dist/utils/paths.d.ts.map +1 -1
- package/dist/utils/paths.js +9 -0
- package/dist/utils/paths.js.map +1 -1
- package/dist/utils/terminal-symbols.d.ts +15 -2
- package/dist/utils/terminal-symbols.d.ts.map +1 -1
- package/dist/utils/terminal-symbols.js +36 -4
- package/dist/utils/terminal-symbols.js.map +1 -1
- package/dist/utils/token-tracker.d.ts +6 -1
- package/dist/utils/token-tracker.d.ts.map +1 -1
- package/dist/utils/token-tracker.js +84 -51
- package/dist/utils/token-tracker.js.map +1 -1
- package/dist/utils/validation.d.ts +1 -2
- package/dist/utils/validation.d.ts.map +1 -1
- package/dist/utils/validation.js +4 -25
- package/dist/utils/validation.js.map +1 -1
- package/package.json +7 -2
- package/src/commands/config.ts +60 -63
- package/src/commands/do.ts +96 -262
- package/src/commands/plan.ts +55 -279
- package/src/commands/preset.ts +186 -0
- package/src/core/claude-runner.ts +45 -5
- package/src/core/codex-runner.ts +32 -7
- package/src/core/failure-analyzer.ts +2 -1
- package/src/core/git.ts +57 -3
- package/src/core/project-manager.ts +2 -1
- package/src/core/pull-request.ts +5 -5
- package/src/core/runner-factory.ts +9 -9
- package/src/core/runner-interface.ts +1 -1
- package/src/core/runner-types.ts +17 -4
- package/src/core/state-derivation.ts +3 -3
- package/src/parsers/codex-stream-renderer.ts +149 -4
- package/src/prompts/amend.ts +30 -105
- package/src/prompts/config-docs.md +206 -62
- package/src/prompts/execution.ts +17 -34
- package/src/prompts/planning.ts +23 -124
- package/src/types/config.ts +47 -59
- package/src/utils/config.ts +248 -115
- package/src/utils/name-generator.ts +29 -13
- package/src/utils/paths.ts +10 -0
- package/src/utils/terminal-symbols.ts +46 -6
- package/src/utils/token-tracker.ts +96 -57
- package/src/utils/validation.ts +5 -30
- package/tests/unit/amend-prompt.test.ts +3 -2
- package/tests/unit/claude-runner-interactive.test.ts +21 -3
- package/tests/unit/claude-runner.test.ts +39 -0
- package/tests/unit/codex-runner.test.ts +163 -0
- package/tests/unit/codex-stream-renderer.test.ts +127 -0
- package/tests/unit/command-output.test.ts +57 -0
- package/tests/unit/commit-planning-artifacts-worktree.test.ts +24 -7
- package/tests/unit/commit-planning-artifacts.test.ts +26 -4
- package/tests/unit/config-command.test.ts +215 -303
- package/tests/unit/config.test.ts +319 -235
- package/tests/unit/dependency-integration.test.ts +27 -1
- package/tests/unit/do-model-display.test.ts +35 -0
- package/tests/unit/execution-prompt.test.ts +49 -19
- package/tests/unit/name-generator.test.ts +82 -12
- package/tests/unit/plan-command-auto-flag.test.ts +7 -10
- package/tests/unit/plan-command.test.ts +14 -17
- package/tests/unit/planning-prompt.test.ts +9 -8
- package/tests/unit/terminal-symbols.test.ts +94 -3
- package/tests/unit/token-tracker.test.ts +180 -1
- package/tests/unit/validation.test.ts +9 -41
- package/tests/unit/worktree-flag-override.test.ts +0 -186
package/src/prompts/planning.ts
CHANGED
|
@@ -15,16 +15,8 @@ export interface PlanningPromptResult {
|
|
|
15
15
|
* - userMessage: Reference to input.md file (via positional argument, triggers the LLM to start)
|
|
16
16
|
*/
|
|
17
17
|
export function getPlanningPrompt(params: PlanningPromptParams): PlanningPromptResult {
|
|
18
|
-
const { projectPath
|
|
19
|
-
const
|
|
20
|
-
|
|
21
|
-
const systemPrompt = `You are a project planning assistant for RAF (Ralph's Automation Framework). Your task is to analyze the user's project description and create detailed task plans.
|
|
22
|
-
|
|
23
|
-
## Your Goals
|
|
24
|
-
|
|
25
|
-
1. **Analyze the input** and identify distinct, actionable tasks
|
|
26
|
-
2. **Interview the user** about EACH task to gather specific requirements
|
|
27
|
-
3. **Create plan files** for each task with clear instructions
|
|
18
|
+
const { projectPath } = params;
|
|
19
|
+
const systemPrompt = `You are a project planning assistant for RAF (Ralph's Automation Framework). Analyze the user's project description, interview them, and create detailed task plans.
|
|
28
20
|
|
|
29
21
|
## Project Location
|
|
30
22
|
|
|
@@ -34,53 +26,25 @@ Project folder: ${projectPath}
|
|
|
34
26
|
|
|
35
27
|
### Step 1: Identify and Order Tasks
|
|
36
28
|
|
|
37
|
-
|
|
38
|
-
- Be independently completable
|
|
39
|
-
- Have a clear outcome
|
|
40
|
-
- Take roughly 10-30 minutes of work
|
|
29
|
+
Identify distinct tasks from the project description. Each task should be independently completable, have a clear outcome, and take roughly 10-30 minutes.
|
|
41
30
|
|
|
42
|
-
**
|
|
43
|
-
- Setup/foundation tasks come first (e.g., defining schemas, creating interfaces)
|
|
44
|
-
- Core implementation tasks come next
|
|
45
|
-
- Integration and extension tasks come later
|
|
46
|
-
- Testing and validation tasks typically come last
|
|
31
|
+
**Order tasks by logical execution order:** setup/foundation → core implementation → integration/extension → testing/validation.
|
|
47
32
|
|
|
48
33
|
### Step 2: Interview the User
|
|
49
34
|
|
|
50
|
-
For EACH task
|
|
51
|
-
- Specific requirements and constraints
|
|
52
|
-
- Technology preferences
|
|
53
|
-
- Any existing code or patterns to follow
|
|
54
|
-
- Edge cases to handle
|
|
55
|
-
|
|
56
|
-
DO NOT skip the interview step. The quality of your plans depends on understanding the user's exact needs.
|
|
35
|
+
For EACH task, use the AskUserQuestion tool to gather specific requirements, technology preferences, existing patterns to follow, and edge cases. Do not skip this step.
|
|
57
36
|
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
After EACH interview question is answered, record the Q&A pair in the decisions file:
|
|
61
|
-
- ${projectPath}/decisions.md
|
|
62
|
-
|
|
63
|
-
Use this format:
|
|
37
|
+
After EACH answer, append the Q&A pair to \`${projectPath}/decisions.md\`:
|
|
64
38
|
\`\`\`markdown
|
|
65
|
-
# Project Decisions
|
|
66
|
-
|
|
67
|
-
## [Question asked]
|
|
68
|
-
[User's answer]
|
|
69
|
-
|
|
70
39
|
## [Question asked]
|
|
71
40
|
[User's answer]
|
|
72
41
|
\`\`\`
|
|
73
42
|
|
|
74
|
-
This file serves as documentation of design choices made during planning. Append each new Q&A pair as you conduct the interview.
|
|
75
|
-
|
|
76
43
|
### Step 3: Create Plan Files
|
|
77
44
|
|
|
78
|
-
|
|
79
|
-
- ${projectPath}/plans/1-task-name.md
|
|
80
|
-
- ${projectPath}/plans/2-task-name.md
|
|
81
|
-
- etc.
|
|
45
|
+
Create plan files in \`${projectPath}/plans/\` numbered in execution order (e.g., \`1-task-name.md\`, \`2-task-name.md\`). Use kebab-case names.
|
|
82
46
|
|
|
83
|
-
Each plan file MUST have
|
|
47
|
+
Each plan file MUST have this structure:
|
|
84
48
|
|
|
85
49
|
\`\`\`markdown
|
|
86
50
|
---
|
|
@@ -89,116 +53,51 @@ effort: medium
|
|
|
89
53
|
# Task: [Task Name]
|
|
90
54
|
|
|
91
55
|
## Objective
|
|
92
|
-
[Clear, one-sentence description
|
|
56
|
+
[Clear, one-sentence description]
|
|
93
57
|
|
|
94
58
|
## Context
|
|
95
59
|
[Why this task is needed, how it fits into the larger project]
|
|
96
60
|
|
|
97
61
|
## Dependencies
|
|
98
|
-
[Optional
|
|
99
|
-
[Comma-separated list of task IDs this task depends on, e.g., "1, 2"]
|
|
100
|
-
[If a dependency fails, this task will be automatically blocked]
|
|
62
|
+
[Optional — omit if none. Comma-separated task IDs, e.g., "1, 2"]
|
|
101
63
|
|
|
102
64
|
## Requirements
|
|
103
|
-
[Specific requirements gathered from the user interview]
|
|
104
65
|
- Requirement 1
|
|
105
66
|
- Requirement 2
|
|
106
|
-
- ...
|
|
107
67
|
|
|
108
68
|
## Implementation Steps
|
|
109
69
|
1. [Step 1]
|
|
110
70
|
2. [Step 2]
|
|
111
|
-
3. [Step 3]
|
|
112
|
-
...
|
|
113
71
|
|
|
114
72
|
## Acceptance Criteria
|
|
115
73
|
- [ ] Criterion 1
|
|
116
74
|
- [ ] Criterion 2
|
|
117
|
-
- [ ] All tests pass
|
|
118
75
|
|
|
119
76
|
## Notes
|
|
120
|
-
[
|
|
121
|
-
\`\`\`
|
|
122
|
-
|
|
123
|
-
### Frontmatter Requirements
|
|
124
|
-
|
|
125
|
-
The \`effort\` field is REQUIRED in every plan file. It indicates task complexity and determines which model will execute the task:
|
|
126
|
-
- \`effort: low\` — Trivial/mechanical changes, simple one-file edits, config changes
|
|
127
|
-
- \`effort: medium\` — Well-scoped feature work, bug fixes with clear plans, multi-file changes following existing patterns
|
|
128
|
-
- \`effort: high\` — Architectural changes, complex logic, tasks requiring deep codebase understanding
|
|
129
|
-
|
|
130
|
-
Optionally, you can add an explicit \`model\` field to override the effort-based model selection:
|
|
131
|
-
\`\`\`markdown
|
|
132
|
-
---
|
|
133
|
-
effort: medium
|
|
134
|
-
model: opus
|
|
135
|
-
---
|
|
136
|
-
# Task: ...
|
|
77
|
+
[Additional context, warnings, or considerations]
|
|
137
78
|
\`\`\`
|
|
138
79
|
|
|
139
|
-
|
|
80
|
+
**Frontmatter fields:**
|
|
81
|
+
- \`effort\` (REQUIRED): \`low\` (trivial/mechanical), \`medium\` (well-scoped feature work), \`high\` (architectural/complex)
|
|
82
|
+
- \`model\` (optional): Override effort-based model selection. Rarely needed — prefer \`effort\` so the user's config controls the model.
|
|
140
83
|
|
|
141
|
-
|
|
84
|
+
**Dependencies:** Infer automatically from task relationships (don't ask the user). Only reference lower-numbered tasks. Only direct dependencies, not transitive ones. Omit section if no prerequisites.
|
|
142
85
|
|
|
143
|
-
|
|
86
|
+
### Step 4: Confirm Completion
|
|
144
87
|
|
|
145
|
-
|
|
146
|
-
- If task B uses output/artifacts from task A → B depends on A
|
|
147
|
-
- If task B modifies code created by task A → B depends on A
|
|
148
|
-
- If task B tests functionality from task A → B depends on A
|
|
149
|
-
- If task B extends or builds upon task A → B depends on A
|
|
150
|
-
|
|
151
|
-
**Dependency format examples:**
|
|
152
|
-
\`\`\`markdown
|
|
153
|
-
## Dependencies
|
|
154
|
-
1
|
|
155
|
-
\`\`\`
|
|
156
|
-
or for multiple dependencies:
|
|
157
|
-
\`\`\`markdown
|
|
158
|
-
## Dependencies
|
|
159
|
-
1, 2
|
|
160
|
-
\`\`\`
|
|
161
|
-
|
|
162
|
-
**Rules for dependencies:**
|
|
163
|
-
- Only reference lower-numbered tasks (tasks are ordered by execution order)
|
|
164
|
-
- Omit the Dependencies section entirely if a task has no prerequisites
|
|
165
|
-
- Keep dependency lists minimal - only direct dependencies, not transitive ones
|
|
166
|
-
- Never create circular dependencies (impossible if you only reference lower-numbered tasks)
|
|
167
|
-
|
|
168
|
-
### Step 5: Confirm Completion
|
|
169
|
-
|
|
170
|
-
After creating all plan files:
|
|
171
|
-
1. Provide a summary of the tasks you've created, including the effort level for each task. Example:
|
|
172
|
-
- Task 1: setup-database (effort: low)
|
|
173
|
-
- Task 2: implement-auth (effort: medium)
|
|
174
|
-
- Task 3: refactor-api (effort: high)
|
|
175
|
-
2. Display this exit message to the user:
|
|
88
|
+
Provide a summary with effort levels (e.g., "Task 1: setup-database (effort: low)"), then display:
|
|
176
89
|
|
|
177
90
|
\`\`\`
|
|
178
91
|
Planning complete! To exit this session and run your tasks:
|
|
179
92
|
1. Press Ctrl-C twice to exit
|
|
180
|
-
2. Then run: raf do <project
|
|
93
|
+
2. Then run: raf do <project>
|
|
181
94
|
\`\`\`
|
|
182
95
|
|
|
183
|
-
##
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
4. Each plan should be self-contained with all context needed
|
|
189
|
-
5. Infer dependencies automatically - analyze task relationships, don't ask the user about dependencies
|
|
190
|
-
6. Only add Dependencies section when a task genuinely requires another to complete first
|
|
191
|
-
7. Dependencies must only reference lower-numbered tasks to prevent circular dependencies
|
|
192
|
-
8. Be specific - vague plans lead to poor execution
|
|
193
|
-
9. ALWAYS include the \`effort\` frontmatter field in every plan file — assess each task's complexity
|
|
194
|
-
|
|
195
|
-
## Plan Output Style
|
|
196
|
-
|
|
197
|
-
Plans can include whatever level of detail you deem helpful for the executing agent. Use your judgment:
|
|
198
|
-
- Include implementation details when they clarify the approach
|
|
199
|
-
- Code snippets are acceptable when they help illustrate a specific pattern
|
|
200
|
-
- File paths are helpful when referencing existing project files, patterns, or directories
|
|
201
|
-
- Focus on clarity — the goal is for the executing agent to understand what needs to be done`;
|
|
96
|
+
## Rules
|
|
97
|
+
|
|
98
|
+
- Each plan must be self-contained with all context needed for execution
|
|
99
|
+
- Be specific — vague plans lead to poor execution
|
|
100
|
+
- Include implementation details, code snippets, and file paths when they clarify the approach`;
|
|
202
101
|
|
|
203
102
|
const userMessage = `Here is my project description:
|
|
204
103
|
|
package/src/types/config.ts
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
/** CLI harness
|
|
2
|
-
export type
|
|
1
|
+
/** CLI harness name */
|
|
2
|
+
export type HarnessName = 'claude' | 'codex';
|
|
3
3
|
|
|
4
4
|
/** Short alias for a Claude model family */
|
|
5
5
|
export type ClaudeModelAlias = 'sonnet' | 'haiku' | 'opus';
|
|
6
6
|
|
|
7
7
|
/** Short alias for a Codex model family */
|
|
8
|
-
export type CodexModelAlias = '
|
|
8
|
+
export type CodexModelAlias = 'codex' | 'gpt54';
|
|
9
9
|
|
|
10
|
-
/**
|
|
10
|
+
/** Harness-agnostic model alias (union of all harness aliases) */
|
|
11
11
|
export type ModelAlias = ClaudeModelAlias | CodexModelAlias;
|
|
12
12
|
|
|
13
13
|
/**
|
|
@@ -17,7 +17,7 @@ export type ModelAlias = ClaudeModelAlias | CodexModelAlias;
|
|
|
17
17
|
*/
|
|
18
18
|
export type ClaudeModelName = ClaudeModelAlias | (string & { __brand?: 'FullModelId' });
|
|
19
19
|
|
|
20
|
-
/**
|
|
20
|
+
/** Harness-agnostic model name — accepts any alias, full ID, or harness-prefixed format */
|
|
21
21
|
export type ModelName = string & { __brand?: 'ModelName' };
|
|
22
22
|
|
|
23
23
|
/** Task complexity label for per-task effort frontmatter. Maps to models via effortMapping. */
|
|
@@ -26,23 +26,38 @@ export type TaskEffortLevel = 'low' | 'medium' | 'high';
|
|
|
26
26
|
export type ModelScenario = 'plan' | 'execute' | 'nameGeneration' | 'failureAnalysis' | 'prGeneration' | 'config';
|
|
27
27
|
export type CommitFormatType = 'task' | 'plan' | 'amend';
|
|
28
28
|
|
|
29
|
+
/**
|
|
30
|
+
* A harness-aware model configuration entry.
|
|
31
|
+
* Stores model, harness, and optional reasoning effort together.
|
|
32
|
+
*/
|
|
33
|
+
export interface ModelEntry {
|
|
34
|
+
/** Model name: short alias (opus, sonnet, gpt-5.4) or full ID */
|
|
35
|
+
model: string;
|
|
36
|
+
/** Which CLI harness to use for this entry */
|
|
37
|
+
harness: HarnessName;
|
|
38
|
+
/** Optional reasoning effort hint. Codex accepts: "none", "minimal", "low", "medium", "high", "xhigh" */
|
|
39
|
+
reasoningEffort?: string;
|
|
40
|
+
/** Enable fast mode for faster output (Claude only). Default: false/omitted. */
|
|
41
|
+
fast?: boolean;
|
|
42
|
+
}
|
|
43
|
+
|
|
29
44
|
export interface ModelsConfig {
|
|
30
|
-
plan:
|
|
31
|
-
execute:
|
|
32
|
-
nameGeneration:
|
|
33
|
-
failureAnalysis:
|
|
34
|
-
prGeneration:
|
|
35
|
-
config:
|
|
45
|
+
plan: ModelEntry;
|
|
46
|
+
execute: ModelEntry;
|
|
47
|
+
nameGeneration: ModelEntry;
|
|
48
|
+
failureAnalysis: ModelEntry;
|
|
49
|
+
prGeneration: ModelEntry;
|
|
50
|
+
config: ModelEntry;
|
|
36
51
|
}
|
|
37
52
|
|
|
38
53
|
/**
|
|
39
|
-
* Maps task complexity labels to model
|
|
54
|
+
* Maps task complexity labels to harness-aware model entries.
|
|
40
55
|
* Used to resolve per-task effort frontmatter to a model.
|
|
41
56
|
*/
|
|
42
57
|
export interface EffortMappingConfig {
|
|
43
|
-
low:
|
|
44
|
-
medium:
|
|
45
|
-
high:
|
|
58
|
+
low: ModelEntry;
|
|
59
|
+
medium: ModelEntry;
|
|
60
|
+
high: ModelEntry;
|
|
46
61
|
}
|
|
47
62
|
|
|
48
63
|
export interface CommitFormatConfig {
|
|
@@ -59,15 +74,9 @@ export interface DisplayConfig {
|
|
|
59
74
|
}
|
|
60
75
|
|
|
61
76
|
export interface RafConfig {
|
|
62
|
-
/** CLI harness provider. Default: 'claude' */
|
|
63
|
-
provider: HarnessProvider;
|
|
64
77
|
models: ModelsConfig;
|
|
65
|
-
/** Maps task complexity labels (low/medium/high) to
|
|
78
|
+
/** Maps task complexity labels (low/medium/high) to model entries. Used for per-task effort frontmatter. */
|
|
66
79
|
effortMapping: EffortMappingConfig;
|
|
67
|
-
/** Codex model assignments per scenario */
|
|
68
|
-
codexModels: ModelsConfig;
|
|
69
|
-
/** Maps task complexity labels to Codex models */
|
|
70
|
-
codexEffortMapping: EffortMappingConfig;
|
|
71
80
|
timeout: number;
|
|
72
81
|
maxRetries: number;
|
|
73
82
|
autoCommit: boolean;
|
|
@@ -79,32 +88,18 @@ export interface RafConfig {
|
|
|
79
88
|
}
|
|
80
89
|
|
|
81
90
|
export const DEFAULT_CONFIG: RafConfig = {
|
|
82
|
-
provider: 'claude',
|
|
83
91
|
models: {
|
|
84
|
-
plan: 'opus',
|
|
85
|
-
execute: 'opus',
|
|
86
|
-
nameGeneration: 'sonnet',
|
|
87
|
-
failureAnalysis: 'haiku',
|
|
88
|
-
prGeneration: 'sonnet',
|
|
89
|
-
config: 'sonnet',
|
|
92
|
+
plan: { model: 'opus', harness: 'claude' },
|
|
93
|
+
execute: { model: 'opus', harness: 'claude' },
|
|
94
|
+
nameGeneration: { model: 'sonnet', harness: 'claude' },
|
|
95
|
+
failureAnalysis: { model: 'haiku', harness: 'claude' },
|
|
96
|
+
prGeneration: { model: 'sonnet', harness: 'claude' },
|
|
97
|
+
config: { model: 'sonnet', harness: 'claude' },
|
|
90
98
|
},
|
|
91
99
|
effortMapping: {
|
|
92
|
-
low: 'sonnet',
|
|
93
|
-
medium: 'opus',
|
|
94
|
-
high: 'opus',
|
|
95
|
-
},
|
|
96
|
-
codexModels: {
|
|
97
|
-
plan: 'gpt-5.3-codex',
|
|
98
|
-
execute: 'gpt-5.4',
|
|
99
|
-
nameGeneration: 'gpt-5.3-codex-spark',
|
|
100
|
-
failureAnalysis: 'gpt-5.3-codex-spark',
|
|
101
|
-
prGeneration: 'gpt-5.3-codex',
|
|
102
|
-
config: 'gpt-5.3-codex',
|
|
103
|
-
},
|
|
104
|
-
codexEffortMapping: {
|
|
105
|
-
low: 'gpt-5.3-codex-spark',
|
|
106
|
-
medium: 'gpt-5.3-codex',
|
|
107
|
-
high: 'gpt-5.4',
|
|
100
|
+
low: { model: 'sonnet', harness: 'claude' },
|
|
101
|
+
medium: { model: 'opus', harness: 'claude' },
|
|
102
|
+
high: { model: 'opus', harness: 'claude' },
|
|
108
103
|
},
|
|
109
104
|
timeout: 60,
|
|
110
105
|
maxRetries: 3,
|
|
@@ -112,9 +107,9 @@ export const DEFAULT_CONFIG: RafConfig = {
|
|
|
112
107
|
worktree: false,
|
|
113
108
|
syncMainBranch: true,
|
|
114
109
|
commitFormat: {
|
|
115
|
-
task: '{prefix}[{
|
|
116
|
-
plan: '{prefix}[{
|
|
117
|
-
amend: '{prefix}[{
|
|
110
|
+
task: '{prefix}[{projectName}:{taskId}] {description}',
|
|
111
|
+
plan: '{prefix}[{projectName}] Plan: {description}',
|
|
112
|
+
amend: '{prefix}[{projectName}] Amend: {description}',
|
|
118
113
|
prefix: 'RAF',
|
|
119
114
|
},
|
|
120
115
|
display: {
|
|
@@ -131,9 +126,9 @@ export type UserConfig = DeepPartial<RafConfig>;
|
|
|
131
126
|
|
|
132
127
|
export const VALID_MODEL_ALIASES: readonly ClaudeModelAlias[] = ['sonnet', 'haiku', 'opus'];
|
|
133
128
|
|
|
134
|
-
export const VALID_CODEX_MODEL_ALIASES: readonly CodexModelAlias[] = ['
|
|
129
|
+
export const VALID_CODEX_MODEL_ALIASES: readonly CodexModelAlias[] = ['codex', 'gpt54'];
|
|
135
130
|
|
|
136
|
-
export const
|
|
131
|
+
export const VALID_HARNESSES: readonly HarnessName[] = ['claude', 'codex'];
|
|
137
132
|
|
|
138
133
|
/**
|
|
139
134
|
* Regex for full Claude model IDs (e.g., `claude-sonnet-4-5-20250929`, `claude-opus-4-5-20251101`).
|
|
@@ -157,9 +152,6 @@ export const DEFAULT_RAF_CONFIG = {
|
|
|
157
152
|
|
|
158
153
|
export interface PlanCommandOptions {
|
|
159
154
|
projectName?: string;
|
|
160
|
-
model?: ClaudeModelName;
|
|
161
|
-
sonnet?: boolean;
|
|
162
|
-
provider?: HarnessProvider;
|
|
163
155
|
}
|
|
164
156
|
|
|
165
157
|
export interface DoCommandOptions {
|
|
@@ -167,10 +159,6 @@ export interface DoCommandOptions {
|
|
|
167
159
|
verbose?: boolean;
|
|
168
160
|
debug?: boolean;
|
|
169
161
|
force?: boolean;
|
|
170
|
-
model?: ClaudeModelName;
|
|
171
|
-
sonnet?: boolean;
|
|
172
|
-
worktree?: boolean;
|
|
173
|
-
provider?: HarnessProvider;
|
|
174
162
|
}
|
|
175
163
|
|
|
176
164
|
export interface StatusCommandOptions {
|
|
@@ -184,7 +172,7 @@ export interface ModelTokenUsage {
|
|
|
184
172
|
cacheReadInputTokens: number;
|
|
185
173
|
cacheCreationInputTokens: number;
|
|
186
174
|
/** Cost in USD for this model's usage (provided by Claude CLI). */
|
|
187
|
-
costUsd
|
|
175
|
+
costUsd?: number | null;
|
|
188
176
|
}
|
|
189
177
|
|
|
190
178
|
/** Token usage data extracted from Claude CLI stream-json result event. */
|
|
@@ -197,5 +185,5 @@ export interface UsageData {
|
|
|
197
185
|
/** Per-model breakdown (e.g., { "claude-opus-4-6": { ... } }). */
|
|
198
186
|
modelUsage: Record<string, ModelTokenUsage>;
|
|
199
187
|
/** Total cost in USD for this usage (provided by Claude CLI). */
|
|
200
|
-
totalCostUsd: number;
|
|
188
|
+
totalCostUsd: number | null;
|
|
201
189
|
}
|