rafcode 3.2.1 → 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/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 +47 -57
- 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 +57 -44
- package/dist/commands/do.js.map +1 -1
- package/dist/commands/plan.d.ts.map +1 -1
- package/dist/commands/plan.js +36 -153
- 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/pull-request.js +3 -3
- 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/parsers/codex-stream-renderer.d.ts +7 -0
- package/dist/parsers/codex-stream-renderer.d.ts.map +1 -1
- package/dist/parsers/codex-stream-renderer.js +37 -4
- package/dist/parsers/codex-stream-renderer.js.map +1 -1
- package/dist/prompts/amend.d.ts.map +1 -1
- package/dist/prompts/amend.js +29 -101
- 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 +21 -120
- package/dist/prompts/planning.js.map +1 -1
- package/dist/types/config.d.ts +33 -31
- 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/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 +1 -1
- package/src/commands/config.ts +60 -63
- package/src/commands/do.ts +63 -51
- package/src/commands/plan.ts +34 -165
- 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/pull-request.ts +3 -3
- 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/parsers/codex-stream-renderer.ts +47 -4
- package/src/prompts/amend.ts +29 -101
- package/src/prompts/config-docs.md +206 -62
- package/src/prompts/execution.ts +17 -34
- package/src/prompts/planning.ts +21 -120
- package/src/types/config.ts +47 -58
- package/src/utils/config.ts +248 -115
- package/src/utils/name-generator.ts +29 -13
- 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
|
@@ -16,13 +16,7 @@ export interface PlanningPromptResult {
|
|
|
16
16
|
*/
|
|
17
17
|
export function getPlanningPrompt(params: PlanningPromptParams): PlanningPromptResult {
|
|
18
18
|
const { projectPath } = params;
|
|
19
|
-
const systemPrompt = `You are a project planning assistant for RAF (Ralph's Automation Framework).
|
|
20
|
-
|
|
21
|
-
## Your Goals
|
|
22
|
-
|
|
23
|
-
1. **Analyze the input** and identify distinct, actionable tasks
|
|
24
|
-
2. **Interview the user** about EACH task to gather specific requirements
|
|
25
|
-
3. **Create plan files** for each task with clear instructions
|
|
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.
|
|
26
20
|
|
|
27
21
|
## Project Location
|
|
28
22
|
|
|
@@ -32,53 +26,25 @@ Project folder: ${projectPath}
|
|
|
32
26
|
|
|
33
27
|
### Step 1: Identify and Order Tasks
|
|
34
28
|
|
|
35
|
-
|
|
36
|
-
- Be independently completable
|
|
37
|
-
- Have a clear outcome
|
|
38
|
-
- 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.
|
|
39
30
|
|
|
40
|
-
**
|
|
41
|
-
- Setup/foundation tasks come first (e.g., defining schemas, creating interfaces)
|
|
42
|
-
- Core implementation tasks come next
|
|
43
|
-
- Integration and extension tasks come later
|
|
44
|
-
- Testing and validation tasks typically come last
|
|
31
|
+
**Order tasks by logical execution order:** setup/foundation → core implementation → integration/extension → testing/validation.
|
|
45
32
|
|
|
46
33
|
### Step 2: Interview the User
|
|
47
34
|
|
|
48
|
-
For EACH task
|
|
49
|
-
- Specific requirements and constraints
|
|
50
|
-
- Technology preferences
|
|
51
|
-
- Any existing code or patterns to follow
|
|
52
|
-
- Edge cases to handle
|
|
53
|
-
|
|
54
|
-
DO NOT skip the interview step. The quality of your plans depends on understanding the user's exact needs.
|
|
55
|
-
|
|
56
|
-
### Step 2.5: Record Decisions
|
|
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
|
-
After EACH
|
|
59
|
-
- ${projectPath}/decisions.md
|
|
60
|
-
|
|
61
|
-
Use this format:
|
|
37
|
+
After EACH answer, append the Q&A pair to \`${projectPath}/decisions.md\`:
|
|
62
38
|
\`\`\`markdown
|
|
63
|
-
# Project Decisions
|
|
64
|
-
|
|
65
|
-
## [Question asked]
|
|
66
|
-
[User's answer]
|
|
67
|
-
|
|
68
39
|
## [Question asked]
|
|
69
40
|
[User's answer]
|
|
70
41
|
\`\`\`
|
|
71
42
|
|
|
72
|
-
This file serves as documentation of design choices made during planning. Append each new Q&A pair as you conduct the interview.
|
|
73
|
-
|
|
74
43
|
### Step 3: Create Plan Files
|
|
75
44
|
|
|
76
|
-
|
|
77
|
-
- ${projectPath}/plans/1-task-name.md
|
|
78
|
-
- ${projectPath}/plans/2-task-name.md
|
|
79
|
-
- 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.
|
|
80
46
|
|
|
81
|
-
Each plan file MUST have
|
|
47
|
+
Each plan file MUST have this structure:
|
|
82
48
|
|
|
83
49
|
\`\`\`markdown
|
|
84
50
|
---
|
|
@@ -87,90 +53,39 @@ effort: medium
|
|
|
87
53
|
# Task: [Task Name]
|
|
88
54
|
|
|
89
55
|
## Objective
|
|
90
|
-
[Clear, one-sentence description
|
|
56
|
+
[Clear, one-sentence description]
|
|
91
57
|
|
|
92
58
|
## Context
|
|
93
59
|
[Why this task is needed, how it fits into the larger project]
|
|
94
60
|
|
|
95
61
|
## Dependencies
|
|
96
|
-
[Optional
|
|
97
|
-
[Comma-separated list of task IDs this task depends on, e.g., "1, 2"]
|
|
98
|
-
[If a dependency fails, this task will be automatically blocked]
|
|
62
|
+
[Optional — omit if none. Comma-separated task IDs, e.g., "1, 2"]
|
|
99
63
|
|
|
100
64
|
## Requirements
|
|
101
|
-
[Specific requirements gathered from the user interview]
|
|
102
65
|
- Requirement 1
|
|
103
66
|
- Requirement 2
|
|
104
|
-
- ...
|
|
105
67
|
|
|
106
68
|
## Implementation Steps
|
|
107
69
|
1. [Step 1]
|
|
108
70
|
2. [Step 2]
|
|
109
|
-
3. [Step 3]
|
|
110
|
-
...
|
|
111
71
|
|
|
112
72
|
## Acceptance Criteria
|
|
113
73
|
- [ ] Criterion 1
|
|
114
74
|
- [ ] Criterion 2
|
|
115
|
-
- [ ] All tests pass
|
|
116
75
|
|
|
117
76
|
## Notes
|
|
118
|
-
[
|
|
77
|
+
[Additional context, warnings, or considerations]
|
|
119
78
|
\`\`\`
|
|
120
79
|
|
|
121
|
-
|
|
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.
|
|
122
83
|
|
|
123
|
-
|
|
124
|
-
- \`effort: low\` — Trivial/mechanical changes, simple one-file edits, config changes
|
|
125
|
-
- \`effort: medium\` — Well-scoped feature work, bug fixes with clear plans, multi-file changes following existing patterns
|
|
126
|
-
- \`effort: high\` — Architectural changes, complex logic, tasks requiring deep codebase understanding
|
|
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.
|
|
127
85
|
|
|
128
|
-
|
|
129
|
-
\`\`\`markdown
|
|
130
|
-
---
|
|
131
|
-
effort: medium
|
|
132
|
-
model: opus
|
|
133
|
-
---
|
|
134
|
-
# Task: ...
|
|
135
|
-
\`\`\`
|
|
86
|
+
### Step 4: Confirm Completion
|
|
136
87
|
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
### Step 4: Infer Task Dependencies
|
|
140
|
-
|
|
141
|
-
For each task, analyze which other tasks must complete successfully before it can begin. Add a \`## Dependencies\` section to plan files that have prerequisites.
|
|
142
|
-
|
|
143
|
-
**How to identify dependencies:**
|
|
144
|
-
- If task B uses output/artifacts from task A → B depends on A
|
|
145
|
-
- If task B modifies code created by task A → B depends on A
|
|
146
|
-
- If task B tests functionality from task A → B depends on A
|
|
147
|
-
- If task B extends or builds upon task A → B depends on A
|
|
148
|
-
|
|
149
|
-
**Dependency format examples:**
|
|
150
|
-
\`\`\`markdown
|
|
151
|
-
## Dependencies
|
|
152
|
-
1
|
|
153
|
-
\`\`\`
|
|
154
|
-
or for multiple dependencies:
|
|
155
|
-
\`\`\`markdown
|
|
156
|
-
## Dependencies
|
|
157
|
-
1, 2
|
|
158
|
-
\`\`\`
|
|
159
|
-
|
|
160
|
-
**Rules for dependencies:**
|
|
161
|
-
- Only reference lower-numbered tasks (tasks are ordered by execution order)
|
|
162
|
-
- Omit the Dependencies section entirely if a task has no prerequisites
|
|
163
|
-
- Keep dependency lists minimal - only direct dependencies, not transitive ones
|
|
164
|
-
- Never create circular dependencies (impossible if you only reference lower-numbered tasks)
|
|
165
|
-
|
|
166
|
-
### Step 5: Confirm Completion
|
|
167
|
-
|
|
168
|
-
After creating all plan files:
|
|
169
|
-
1. Provide a summary of the tasks you've created, including the effort level for each task. Example:
|
|
170
|
-
- Task 1: setup-database (effort: low)
|
|
171
|
-
- Task 2: implement-auth (effort: medium)
|
|
172
|
-
- Task 3: refactor-api (effort: high)
|
|
173
|
-
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:
|
|
174
89
|
|
|
175
90
|
\`\`\`
|
|
176
91
|
Planning complete! To exit this session and run your tasks:
|
|
@@ -178,25 +93,11 @@ Planning complete! To exit this session and run your tasks:
|
|
|
178
93
|
2. Then run: raf do <project>
|
|
179
94
|
\`\`\`
|
|
180
95
|
|
|
181
|
-
##
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
4. Each plan should be self-contained with all context needed
|
|
187
|
-
5. Infer dependencies automatically - analyze task relationships, don't ask the user about dependencies
|
|
188
|
-
6. Only add Dependencies section when a task genuinely requires another to complete first
|
|
189
|
-
7. Dependencies must only reference lower-numbered tasks to prevent circular dependencies
|
|
190
|
-
8. Be specific - vague plans lead to poor execution
|
|
191
|
-
9. ALWAYS include the \`effort\` frontmatter field in every plan file — assess each task's complexity
|
|
192
|
-
|
|
193
|
-
## Plan Output Style
|
|
194
|
-
|
|
195
|
-
Plans can include whatever level of detail you deem helpful for the executing agent. Use your judgment:
|
|
196
|
-
- Include implementation details when they clarify the approach
|
|
197
|
-
- Code snippets are acceptable when they help illustrate a specific pattern
|
|
198
|
-
- File paths are helpful when referencing existing project files, patterns, or directories
|
|
199
|
-
- 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`;
|
|
200
101
|
|
|
201
102
|
const userMessage = `Here is my project description:
|
|
202
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,9 +159,6 @@ export interface DoCommandOptions {
|
|
|
167
159
|
verbose?: boolean;
|
|
168
160
|
debug?: boolean;
|
|
169
161
|
force?: boolean;
|
|
170
|
-
model?: ClaudeModelName;
|
|
171
|
-
sonnet?: boolean;
|
|
172
|
-
provider?: HarnessProvider;
|
|
173
162
|
}
|
|
174
163
|
|
|
175
164
|
export interface StatusCommandOptions {
|
|
@@ -183,7 +172,7 @@ export interface ModelTokenUsage {
|
|
|
183
172
|
cacheReadInputTokens: number;
|
|
184
173
|
cacheCreationInputTokens: number;
|
|
185
174
|
/** Cost in USD for this model's usage (provided by Claude CLI). */
|
|
186
|
-
costUsd
|
|
175
|
+
costUsd?: number | null;
|
|
187
176
|
}
|
|
188
177
|
|
|
189
178
|
/** Token usage data extracted from Claude CLI stream-json result event. */
|
|
@@ -196,5 +185,5 @@ export interface UsageData {
|
|
|
196
185
|
/** Per-model breakdown (e.g., { "claude-opus-4-6": { ... } }). */
|
|
197
186
|
modelUsage: Record<string, ModelTokenUsage>;
|
|
198
187
|
/** Total cost in USD for this usage (provided by Claude CLI). */
|
|
199
|
-
totalCostUsd: number;
|
|
188
|
+
totalCostUsd: number | null;
|
|
200
189
|
}
|