feat(ralph-loop): add strategy option for fresh context per iteration
Closes #1901 Add 'default_strategy' config option (default: 'continue') to control whether ralph-loop creates a new session per iteration ('reset') or keeps the same session ('continue'). The 'reset' strategy keeps the model in the smart zone by starting with fresh context for each iteration. Supports --strategy flag for per-command override.
This commit is contained in:
@@ -49,6 +49,7 @@ export function readState(directory: string, customPath?: string): RalphLoopStat
|
||||
prompt: body.trim(),
|
||||
session_id: data.session_id ? stripQuotes(data.session_id) : undefined,
|
||||
ultrawork: data.ultrawork === true || data.ultrawork === "true" ? true : undefined,
|
||||
strategy: data.strategy === "reset" || data.strategy === "continue" ? data.strategy : undefined,
|
||||
}
|
||||
} catch {
|
||||
return null
|
||||
@@ -70,13 +71,14 @@ export function writeState(
|
||||
|
||||
const sessionIdLine = state.session_id ? `session_id: "${state.session_id}"\n` : ""
|
||||
const ultraworkLine = state.ultrawork !== undefined ? `ultrawork: ${state.ultrawork}\n` : ""
|
||||
const strategyLine = state.strategy ? `strategy: "${state.strategy}"\n` : ""
|
||||
const content = `---
|
||||
active: ${state.active}
|
||||
iteration: ${state.iteration}
|
||||
max_iterations: ${state.max_iterations}
|
||||
completion_promise: "${state.completion_promise}"
|
||||
started_at: "${state.started_at}"
|
||||
${sessionIdLine}${ultraworkLine}---
|
||||
${sessionIdLine}${ultraworkLine}${strategyLine}---
|
||||
${state.prompt}
|
||||
`
|
||||
|
||||
|
||||
Reference in New Issue
Block a user