From dc2e082ac9a0135199401a486c79bfc61b2e1376 Mon Sep 17 00:00:00 2001 From: herjarsa <204746071+herjarsa@users.noreply.github.com> Date: Tue, 19 May 2026 18:53:24 +0200 Subject: [PATCH] fix(default-mode): skip ultrawork system prompt when ralph_loop is also enabled MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When both default_mode.ultrawork and default_mode.ralph_loop are true, the ralph loop handles ultrawork behavior via its continuation mechanism (prepends 'ultrawork' to each iteration prompt). Injecting the ultrawork system prompt on top would be redundant — the continuation prompt re-triggers keyword detection, which defeats the purpose of invisible system prompt injection. The ultrawork flag still controls loop behavior (500 max iterations + Oracle verification gate) via chat-message.ts startLoop({ ultrawork }). --- src/plugin/system-transform.ts | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/plugin/system-transform.ts b/src/plugin/system-transform.ts index 39356a380..cb1e86afd 100644 --- a/src/plugin/system-transform.ts +++ b/src/plugin/system-transform.ts @@ -12,6 +12,13 @@ export function createSystemTransformHandler( return async (input, output): Promise => { if (!defaultMode?.ultrawork || !getUltraworkMessage) return + // When ralph_loop is also enabled, skip system prompt injection: the loop's + // own continuation mechanism handles ultrawork re-injection on each iteration. + // Injecting both would be redundant — the continuation prompt prepends + // "ultrawork" and re-triggers keyword detection, defeating invisibility. + // The `ultrawork` flag still controls loop behavior (500 iters + Oracle gate). + if (defaultMode?.ralph_loop) return + // Avoid re-injecting if the ultrawork prompt is already in the system prompt // (e.g. after compaction the system prompt is rebuilt and this hook fires again) if (output.system.some((part) => part.includes(ULTRAWORK_MODE_TAG))) return