24
src/ralph-loop/continuation-prompt-builder.ts
Normal file
24
src/ralph-loop/continuation-prompt-builder.ts
Normal file
@@ -0,0 +1,24 @@
|
||||
import type { RalphLoopState } from "./types"
|
||||
import { SYSTEM_DIRECTIVE_PREFIX } from "./system-directive"
|
||||
|
||||
const CONTINUATION_PROMPT = `${SYSTEM_DIRECTIVE_PREFIX} - RALPH LOOP {{ITERATION}}/{{MAX}}]
|
||||
|
||||
Your previous attempt did not output the completion promise. Continue working on the task.
|
||||
|
||||
IMPORTANT:
|
||||
- Review your progress so far
|
||||
- Continue from where you left off
|
||||
- When FULLY complete, output: <promise>{{PROMISE}}</promise>
|
||||
- Do not stop until the task is truly done
|
||||
|
||||
Original task:
|
||||
{{PROMPT}}`
|
||||
|
||||
export function buildContinuationPrompt(state: RalphLoopState): string {
|
||||
const continuationPrompt = CONTINUATION_PROMPT.replace("{{ITERATION}}", String(state.iteration))
|
||||
.replace("{{MAX}}", String(state.max_iterations))
|
||||
.replace("{{PROMISE}}", state.completion_promise)
|
||||
.replace("{{PROMPT}}", state.prompt)
|
||||
|
||||
return state.ultrawork ? `ultrawork ${continuationPrompt}` : continuationPrompt
|
||||
}
|
||||
Reference in New Issue
Block a user