diff --git a/packages/coding-agent/src/slash-commands/builtin-registry.ts b/packages/coding-agent/src/slash-commands/builtin-registry.ts index 62d827fb1..1f9e4c9df 100644 --- a/packages/coding-agent/src/slash-commands/builtin-registry.ts +++ b/packages/coding-agent/src/slash-commands/builtin-registry.ts @@ -72,7 +72,12 @@ const BUILTIN_SLASH_COMMAND_REGISTRY: ReadonlyArray = [ inlineHint: "[prompt]", allowArgs: true, handleTui: async (command, runtime) => { + const hadArgs = !!command.args; await runtime.ctx.handlePlanModeCommand(command.args || undefined); + if (hadArgs && runtime.ctx.planModeEnabled) { + // plan was already active — preserve the typed command in input history + runtime.ctx.editor.addToHistory(command.text); + } runtime.ctx.editor.setText(""); }, }, @@ -90,7 +95,12 @@ const BUILTIN_SLASH_COMMAND_REGISTRY: ReadonlyArray = [ inlineHint: "[objective]", allowArgs: true, handleTui: async (command, runtime) => { + const hadArgs = !!command.args; await runtime.ctx.handleGoalModeCommand(command.args || undefined); + if (hadArgs && runtime.ctx.goalModeEnabled) { + // goal was already active — preserve the typed command in input history + runtime.ctx.editor.addToHistory(command.text); + } runtime.ctx.editor.setText(""); }, },