56
src/ralph-loop/commands.ts
Normal file
56
src/ralph-loop/commands.ts
Normal file
@@ -0,0 +1,56 @@
|
||||
export const RALPH_LOOP_TEMPLATE = `You are starting a Ralph Loop - a self-referential development loop that runs until task completion.
|
||||
|
||||
## How Ralph Loop Works
|
||||
|
||||
1. You will work on the task continuously
|
||||
2. When you believe the task is FULLY complete, output: \`<promise>{{COMPLETION_PROMISE}}</promise>\`
|
||||
3. If you don't output the promise, the loop will automatically inject another prompt to continue
|
||||
4. Maximum iterations: Configurable (default 100)
|
||||
|
||||
## Rules
|
||||
|
||||
- Focus on completing the task fully, not partially
|
||||
- Don't output the completion promise until the task is truly done
|
||||
- Each iteration should make meaningful progress toward the goal
|
||||
- If stuck, try different approaches
|
||||
- Use todos to track your progress
|
||||
|
||||
## Exit Conditions
|
||||
|
||||
1. **Completion**: Output your completion promise tag when fully complete
|
||||
2. **Max Iterations**: Loop stops automatically at limit
|
||||
3. **Cancel**: User runs \`/cancel-ralph\` command
|
||||
|
||||
## Your Task
|
||||
|
||||
Parse the arguments below and begin working on the task. The format is:
|
||||
\`"task description" [--completion-promise=TEXT] [--max-iterations=N] [--strategy=reset|continue]\`
|
||||
|
||||
Default completion promise is "DONE" and default max iterations is 100.`
|
||||
|
||||
export const CANCEL_RALPH_TEMPLATE = `Cancel the currently active Ralph Loop.
|
||||
|
||||
This will:
|
||||
1. Stop the loop from continuing
|
||||
2. Clear the loop state file
|
||||
3. Allow the session to end normally
|
||||
|
||||
Check if a loop is active and cancel it. Inform the user of the result.`
|
||||
|
||||
export const RALPH_LOOP_COMMANDS: Record<string, unknown> = {
|
||||
"ralph-loop": {
|
||||
name: "ralph-loop",
|
||||
description: "(builtin) Start self-referential development loop until completion",
|
||||
template: `<command-instruction>\n${RALPH_LOOP_TEMPLATE}\n</command-instruction>\n\n<user-task>\n$ARGUMENTS\n</user-task>`,
|
||||
},
|
||||
"ulw-loop": {
|
||||
name: "ulw-loop",
|
||||
description: "(builtin) Start ultrawork loop - continues until completion with ultrawork mode",
|
||||
template: `<command-instruction>\n${RALPH_LOOP_TEMPLATE}\n</command-instruction>\n\n<user-task>\n$ARGUMENTS\n</user-task>`,
|
||||
},
|
||||
"cancel-ralph": {
|
||||
name: "cancel-ralph",
|
||||
description: "(builtin) Cancel active Ralph Loop",
|
||||
template: `<command-instruction>\n${CANCEL_RALPH_TEMPLATE}\n</command-instruction>`,
|
||||
},
|
||||
}
|
||||
Reference in New Issue
Block a user