fix(start-work): restore atlas native command routing

Route the builtin /start-work command to Atlas when Atlas is available so OpenCode resolves the native command agent correctly before plugin hooks run.

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

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
This commit is contained in:
YeonGyu-Kim
2026-04-01 17:19:37 -07:00
parent 134dd15c29
commit 8fe057b34a
2 changed files with 71 additions and 47 deletions
+21 -1
View File
@@ -1,8 +1,17 @@
import { describe, test, expect } from "bun:test" import { afterEach, beforeEach, describe, test, expect } from "bun:test"
import { loadBuiltinCommands } from "./commands" import { loadBuiltinCommands } from "./commands"
import { HANDOFF_TEMPLATE } from "./templates/handoff" import { HANDOFF_TEMPLATE } from "./templates/handoff"
import { REMOVE_AI_SLOPS_TEMPLATE } from "./templates/remove-ai-slops" import { REMOVE_AI_SLOPS_TEMPLATE } from "./templates/remove-ai-slops"
import type { BuiltinCommandName } from "./types" import type { BuiltinCommandName } from "./types"
import { _resetForTesting, registerAgentName } from "../claude-code-session-state"
beforeEach(() => {
_resetForTesting()
})
afterEach(() => {
_resetForTesting()
})
describe("loadBuiltinCommands", () => { describe("loadBuiltinCommands", () => {
test("should include handoff command in loaded commands", () => { test("should include handoff command in loaded commands", () => {
@@ -69,6 +78,17 @@ describe("loadBuiltinCommands", () => {
//#then //#then
expect(commands["start-work"].agent).toBe("sisyphus") expect(commands["start-work"].agent).toBe("sisyphus")
}) })
test("should preassign Atlas as the native agent for start-work when Atlas is registered", () => {
//#given
registerAgentName("atlas")
//#when
const commands = loadBuiltinCommands()
//#then
expect(commands["start-work"].agent).toBe("atlas")
})
}) })
describe("loadBuiltinCommands — remove-ai-slops", () => { describe("loadBuiltinCommands — remove-ai-slops", () => {
+50 -46
View File
@@ -1,4 +1,5 @@
import type { CommandDefinition } from "../claude-code-command-loader" import type { CommandDefinition } from "../claude-code-command-loader"
import { isAgentRegistered } from "../claude-code-session-state"
import type { BuiltinCommandName, BuiltinCommands } from "./types" import type { BuiltinCommandName, BuiltinCommands } from "./types"
import { INIT_DEEP_TEMPLATE } from "./templates/init-deep" import { INIT_DEEP_TEMPLATE } from "./templates/init-deep"
import { RALPH_LOOP_TEMPLATE, ULW_LOOP_TEMPLATE, CANCEL_RALPH_TEMPLATE } from "./templates/ralph-loop" import { RALPH_LOOP_TEMPLATE, ULW_LOOP_TEMPLATE, CANCEL_RALPH_TEMPLATE } from "./templates/ralph-loop"
@@ -8,58 +9,59 @@ import { START_WORK_TEMPLATE } from "./templates/start-work"
import { HANDOFF_TEMPLATE } from "./templates/handoff" import { HANDOFF_TEMPLATE } from "./templates/handoff"
import { REMOVE_AI_SLOPS_TEMPLATE } from "./templates/remove-ai-slops" import { REMOVE_AI_SLOPS_TEMPLATE } from "./templates/remove-ai-slops"
const BUILTIN_COMMAND_DEFINITIONS: Record<BuiltinCommandName, Omit<CommandDefinition, "name">> = { function createBuiltinCommandDefinitions(): Record<BuiltinCommandName, Omit<CommandDefinition, "name">> {
"init-deep": { return {
description: "(builtin) Initialize hierarchical AGENTS.md knowledge base", "init-deep": {
template: `<command-instruction> description: "(builtin) Initialize hierarchical AGENTS.md knowledge base",
template: `<command-instruction>
${INIT_DEEP_TEMPLATE} ${INIT_DEEP_TEMPLATE}
</command-instruction> </command-instruction>
<user-request> <user-request>
$ARGUMENTS $ARGUMENTS
</user-request>`, </user-request>`,
argumentHint: "[--create-new] [--max-depth=N]", argumentHint: "[--create-new] [--max-depth=N]",
}, },
"ralph-loop": { "ralph-loop": {
description: "(builtin) Start self-referential development loop until completion", description: "(builtin) Start self-referential development loop until completion",
template: `<command-instruction> template: `<command-instruction>
${RALPH_LOOP_TEMPLATE} ${RALPH_LOOP_TEMPLATE}
</command-instruction> </command-instruction>
<user-task> <user-task>
$ARGUMENTS $ARGUMENTS
</user-task>`, </user-task>`,
argumentHint: '"task description" [--completion-promise=TEXT] [--max-iterations=N] [--strategy=reset|continue]', argumentHint: '"task description" [--completion-promise=TEXT] [--max-iterations=N] [--strategy=reset|continue]',
}, },
"ulw-loop": { "ulw-loop": {
description: "(builtin) Start ultrawork loop - continues until completion with ultrawork mode", description: "(builtin) Start ultrawork loop - continues until completion with ultrawork mode",
template: `<command-instruction> template: `<command-instruction>
${ULW_LOOP_TEMPLATE} ${ULW_LOOP_TEMPLATE}
</command-instruction> </command-instruction>
<user-task> <user-task>
$ARGUMENTS $ARGUMENTS
</user-task>`, </user-task>`,
argumentHint: '"task description" [--completion-promise=TEXT] [--strategy=reset|continue]', argumentHint: '"task description" [--completion-promise=TEXT] [--strategy=reset|continue]',
}, },
"cancel-ralph": { "cancel-ralph": {
description: "(builtin) Cancel active Ralph Loop", description: "(builtin) Cancel active Ralph Loop",
template: `<command-instruction> template: `<command-instruction>
${CANCEL_RALPH_TEMPLATE} ${CANCEL_RALPH_TEMPLATE}
</command-instruction>`, </command-instruction>`,
}, },
refactor: { refactor: {
description: description:
"(builtin) Intelligent refactoring command with LSP, AST-grep, architecture analysis, codemap, and TDD verification.", "(builtin) Intelligent refactoring command with LSP, AST-grep, architecture analysis, codemap, and TDD verification.",
template: `<command-instruction> template: `<command-instruction>
${REFACTOR_TEMPLATE} ${REFACTOR_TEMPLATE}
</command-instruction>`, </command-instruction>`,
argumentHint: "<refactoring-target> [--scope=<file|module|project>] [--strategy=<safe|aggressive>]", argumentHint: "<refactoring-target> [--scope=<file|module|project>] [--strategy=<safe|aggressive>]",
}, },
"start-work": { "start-work": {
description: "(builtin) Start Sisyphus work session from Prometheus plan", description: "(builtin) Start Sisyphus work session from Prometheus plan",
agent: "sisyphus", agent: isAgentRegistered("atlas") ? "atlas" : "sisyphus",
template: `<command-instruction> template: `<command-instruction>
${START_WORK_TEMPLATE} ${START_WORK_TEMPLATE}
</command-instruction> </command-instruction>
@@ -71,27 +73,27 @@ Timestamp: $TIMESTAMP
<user-request> <user-request>
$ARGUMENTS $ARGUMENTS
</user-request>`, </user-request>`,
argumentHint: "[plan-name]", argumentHint: "[plan-name]",
}, },
"stop-continuation": { "stop-continuation": {
description: "(builtin) Stop all continuation mechanisms (ralph loop, todo continuation, boulder) for this session", description: "(builtin) Stop all continuation mechanisms (ralph loop, todo continuation, boulder) for this session",
template: `<command-instruction> template: `<command-instruction>
${STOP_CONTINUATION_TEMPLATE} ${STOP_CONTINUATION_TEMPLATE}
</command-instruction>`, </command-instruction>`,
}, },
"remove-ai-slops": { "remove-ai-slops": {
description: "(builtin) Remove AI-generated code smells from branch changes and critically review the results", description: "(builtin) Remove AI-generated code smells from branch changes and critically review the results",
template: `<command-instruction> template: `<command-instruction>
${REMOVE_AI_SLOPS_TEMPLATE} ${REMOVE_AI_SLOPS_TEMPLATE}
</command-instruction> </command-instruction>
<user-request> <user-request>
$ARGUMENTS $ARGUMENTS
</user-request>`, </user-request>`,
}, },
handoff: { handoff: {
description: "(builtin) Create a detailed context summary for continuing work in a new session", description: "(builtin) Create a detailed context summary for continuing work in a new session",
template: `<command-instruction> template: `<command-instruction>
${HANDOFF_TEMPLATE} ${HANDOFF_TEMPLATE}
</command-instruction> </command-instruction>
@@ -103,17 +105,19 @@ Timestamp: $TIMESTAMP
<user-request> <user-request>
$ARGUMENTS $ARGUMENTS
</user-request>`, </user-request>`,
argumentHint: "[goal]", argumentHint: "[goal]",
}, },
}
} }
export function loadBuiltinCommands( export function loadBuiltinCommands(
disabledCommands?: BuiltinCommandName[] disabledCommands?: BuiltinCommandName[]
): BuiltinCommands { ): BuiltinCommands {
const builtinCommandDefinitions = createBuiltinCommandDefinitions()
const disabled = new Set(disabledCommands ?? []) const disabled = new Set(disabledCommands ?? [])
const commands: BuiltinCommands = {} const commands: BuiltinCommands = {}
for (const [name, definition] of Object.entries(BUILTIN_COMMAND_DEFINITIONS)) { for (const [name, definition] of Object.entries(builtinCommandDefinitions)) {
if (!disabled.has(name as BuiltinCommandName)) { if (!disabled.has(name as BuiltinCommandName)) {
const { argumentHint: _argumentHint, ...openCodeCompatible } = definition const { argumentHint: _argumentHint, ...openCodeCompatible } = definition
commands[name] = { ...openCodeCompatible, name } as CommandDefinition commands[name] = { ...openCodeCompatible, name } as CommandDefinition