Skip to content

Commit 7a0ec39

Browse files
fix(prompt): use explicit {{PROGRESS_PATH}} instead of ambiguous progress.md
The agent prompt referenced "progress.md" without a full path, causing it to be written to the working directory instead of co-located with prd.json. Add a {{PROGRESS_PATH}} template variable substituted at runtime, matching the existing {{PRD_PATH}} pattern.
1 parent c46a1d4 commit 7a0ec39

5 files changed

Lines changed: 23 additions & 11 deletions

File tree

embed/embed.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,10 @@ var convertPromptTemplate string
2222
//go:embed detect_setup_prompt.txt
2323
var detectSetupPromptTemplate string
2424

25-
// GetPrompt returns the agent prompt with the PRD path substituted.
26-
func GetPrompt(prdPath string) string {
27-
return strings.ReplaceAll(promptTemplate, "{{PRD_PATH}}", prdPath)
25+
// GetPrompt returns the agent prompt with the PRD and progress paths substituted.
26+
func GetPrompt(prdPath, progressPath string) string {
27+
result := strings.ReplaceAll(promptTemplate, "{{PRD_PATH}}", prdPath)
28+
return strings.ReplaceAll(result, "{{PROGRESS_PATH}}", progressPath)
2829
}
2930

3031
// GetInitPrompt returns the PRD generator prompt with the PRD directory and optional context substituted.

embed/embed_test.go

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,18 +7,29 @@ import (
77

88
func TestGetPrompt(t *testing.T) {
99
prdPath := "/path/to/prd.json"
10-
prompt := GetPrompt(prdPath)
10+
progressPath := "/path/to/progress.md"
11+
prompt := GetPrompt(prdPath, progressPath)
1112

1213
// Verify the PRD path placeholder was substituted
1314
if strings.Contains(prompt, "{{PRD_PATH}}") {
1415
t.Error("Expected {{PRD_PATH}} to be substituted")
1516
}
1617

18+
// Verify the progress path placeholder was substituted
19+
if strings.Contains(prompt, "{{PROGRESS_PATH}}") {
20+
t.Error("Expected {{PROGRESS_PATH}} to be substituted")
21+
}
22+
1723
// Verify the PRD path appears in the prompt
1824
if !strings.Contains(prompt, prdPath) {
1925
t.Errorf("Expected prompt to contain PRD path %q", prdPath)
2026
}
2127

28+
// Verify the progress path appears in the prompt
29+
if !strings.Contains(prompt, progressPath) {
30+
t.Errorf("Expected prompt to contain progress path %q", progressPath)
31+
}
32+
2233
// Verify the prompt contains key instructions
2334
if !strings.Contains(prompt, "chief-complete") {
2435
t.Error("Expected prompt to contain chief-complete instruction")

embed/prompt.txt

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,17 @@ You are an autonomous coding agent working on a software project.
55
## Your Task
66

77
1. Read the PRD at `{{PRD_PATH}}`
8-
2. Read `progress.md` if it exists (check Codebase Patterns section first)
8+
2. Read `{{PROGRESS_PATH}}` if it exists (check Codebase Patterns section first)
99
3. Pick the **highest priority** user story where `passes: false` -- After determining which story to work on, output exact story id, e.g.: <ralph-status>US-056</ralph-status>
1010
4. Implement that single user story
1111
5. Run quality checks (e.g., typecheck, lint, test - use whatever your project requires)
1212
6. If checks pass, commit ALL changes with message: `feat: [Story ID] - [Story Title]`
1313
7. Update the PRD to set `passes: true` for the completed story
14-
8. Append your progress to `progress.md`
14+
8. Append your progress to `{{PROGRESS_PATH}}`
1515

1616
## Progress Report Format
1717

18-
APPEND to progress.md (never replace, always append):
18+
APPEND to `{{PROGRESS_PATH}}` (never replace, always append):
1919
```
2020
## [Date/Time] - [Story ID]
2121
- What was implemented
@@ -31,7 +31,7 @@ The learnings section is critical - it helps future iterations avoid repeating m
3131

3232
## Consolidate Patterns
3333

34-
If you discover a **reusable pattern** that future iterations should know, add it to the `## Codebase Patterns` section at the TOP of progress.md (create it if it doesn't exist). This section should consolidate the most important learnings:
34+
If you discover a **reusable pattern** that future iterations should know, add it to the `## Codebase Patterns` section at the TOP of `{{PROGRESS_PATH}}` (create it if it doesn't exist). This section should consolidate the most important learnings:
3535

3636
```
3737
## Codebase Patterns
@@ -63,4 +63,4 @@ If there are still stories with `passes: false`, end your response normally (ano
6363
- Work on ONE story per iteration
6464
- Commit frequently
6565
- Keep CI green
66-
- Read the Codebase Patterns section in progress.md before starting
66+
- Read the Codebase Patterns section in `{{PROGRESS_PATH}}` before starting

internal/loop/loop.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ func NewLoopWithWorkDir(prdPath, workDir string, prompt string, maxIter int) *Lo
7878
// NewLoopWithEmbeddedPrompt creates a new Loop instance using the embedded agent prompt.
7979
// The PRD path placeholder in the prompt is automatically substituted.
8080
func NewLoopWithEmbeddedPrompt(prdPath string, maxIter int) *Loop {
81-
prompt := embed.GetPrompt(prdPath)
81+
prompt := embed.GetPrompt(prdPath, prd.ProgressPath(prdPath))
8282
return NewLoop(prdPath, prompt, maxIter)
8383
}
8484

internal/loop/manager.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,7 @@ func (m *Manager) Start(name string) error {
225225
// Create a new loop instance, using worktree-aware constructor if WorktreeDir is set.
226226
// When no worktree is configured, run from the project root (baseDir) so that
227227
// CLAUDE.md and other project-level files are visible to Claude.
228-
prompt := embed.GetPrompt(instance.PRDPath)
228+
prompt := embed.GetPrompt(instance.PRDPath, prd.ProgressPath(instance.PRDPath))
229229
workDir := instance.WorktreeDir
230230
if workDir == "" {
231231
m.mu.RLock()

0 commit comments

Comments
 (0)