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:
@@ -19,16 +19,23 @@ type MessageInfo = {
|
||||
|
||||
export async function injectContinuationPrompt(
|
||||
ctx: PluginInput,
|
||||
options: { sessionID: string; prompt: string; directory: string; apiTimeoutMs: number },
|
||||
options: {
|
||||
sessionID: string
|
||||
prompt: string
|
||||
directory: string
|
||||
apiTimeoutMs: number
|
||||
inheritFromSessionID?: string
|
||||
},
|
||||
): Promise<void> {
|
||||
let agent: string | undefined
|
||||
let model: { providerID: string; modelID: string } | undefined
|
||||
let tools: Record<string, boolean | "allow" | "deny" | "ask"> | undefined
|
||||
|
||||
try {
|
||||
const sourceSessionID = options.inheritFromSessionID ?? options.sessionID
|
||||
const messagesResp = await withTimeout(
|
||||
ctx.client.session.messages({
|
||||
path: { id: options.sessionID },
|
||||
path: { id: sourceSessionID },
|
||||
}),
|
||||
options.apiTimeoutMs,
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user