Add /ulw-loop command for ultrawork mode loop (#867)

* feat(ralph-loop): add ultrawork field to RalphLoopState

* feat(ralph-loop): persist ultrawork field in storage

* feat(ralph-loop): accept ultrawork option in startLoop

Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-opencode)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>

* feat(ralph-loop): prepend ultrawork keyword when mode active

Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-opencode)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>

* feat(ralph-loop): custom toast for ultrawork mode

* feat(ralph-loop): add /ulw-loop command for ultrawork mode

* fix(ralph-loop): add non-null assertion for type safety

* fix(ralph-loop): mirror argument parsing in ulw-loop handler

- Parse quoted prompts and strip flags from task text
- Support --max-iterations and --completion-promise options
- Add default prompt for empty input
- Fixes behavior inconsistency with /ralph-loop

---------

Co-authored-by: justsisyphus <sisyphus-dev-ai@users.noreply.github.com>
Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
This commit is contained in:
YeonGyu-Kim
2026-01-17 19:56:50 +09:00
committed by GitHub
parent 36b665ed89
commit d13e8411f0
8 changed files with 176 additions and 16 deletions
+24 -3
View File
@@ -525,9 +525,30 @@ const OhMyOpenCodePlugin: Plugin = async (ctx) => {
: undefined,
completionPromise: promiseMatch?.[1],
});
} else if (command === "cancel-ralph" && sessionID) {
ralphLoop.cancelLoop(sessionID);
}
} else if (command === "cancel-ralph" && sessionID) {
ralphLoop.cancelLoop(sessionID);
} else if (command === "ulw-loop" && sessionID) {
const rawArgs =
args?.command?.replace(/^\/?(ulw-loop)\s*/i, "") || "";
const taskMatch = rawArgs.match(/^["'](.+?)["']/);
const prompt =
taskMatch?.[1] ||
rawArgs.split(/\s+--/)[0]?.trim() ||
"Complete the task as instructed";
const maxIterMatch = rawArgs.match(/--max-iterations=(\d+)/i);
const promiseMatch = rawArgs.match(
/--completion-promise=["']?([^"'\s]+)["']?/i
);
ralphLoop.startLoop(sessionID, prompt, {
ultrawork: true,
maxIterations: maxIterMatch
? parseInt(maxIterMatch[1], 10)
: undefined,
completionPromise: promiseMatch?.[1],
});
}
}
},