From ec671bd68cad53b962424ea049dc542b3f60f42b Mon Sep 17 00:00:00 2001 From: liruifengv Date: Thu, 28 May 2026 19:59:05 +0800 Subject: [PATCH 1/2] feat: add /auto slash command and --auto CLI flag --- .changeset/add-auto-slash-command-and-flag.md | 5 ++++ apps/kimi-code/src/cli/commands.ts | 3 +++ apps/kimi-code/src/cli/options.ts | 10 +++++++ apps/kimi-code/src/cli/run-shell.ts | 1 + apps/kimi-code/src/main.ts | 1 + apps/kimi-code/src/tui/commands/config.ts | 26 ++++++++++++++++++- apps/kimi-code/src/tui/commands/dispatch.ts | 5 ++++ apps/kimi-code/src/tui/commands/registry.ts | 7 +++++ .../src/tui/controllers/auth-flow.ts | 6 ++++- apps/kimi-code/src/tui/kimi-tui.ts | 9 +++++-- apps/kimi-code/src/tui/types.ts | 1 + apps/kimi-code/test/cli/main.test.ts | 1 + apps/kimi-code/test/cli/run-prompt.test.ts | 1 + apps/kimi-code/test/cli/run-shell.test.ts | 12 +++++++++ apps/kimi-code/test/tui/activity-pane.test.ts | 1 + .../test/tui/create-tui-state.test.ts | 1 + .../test/tui/kimi-tui-message-flow.test.ts | 1 + .../test/tui/kimi-tui-startup.test.ts | 1 + .../kimi-code/test/tui/message-replay.test.ts | 1 + .../test/tui/signal-handlers.test.ts | 1 + 20 files changed, 90 insertions(+), 4 deletions(-) create mode 100644 .changeset/add-auto-slash-command-and-flag.md diff --git a/.changeset/add-auto-slash-command-and-flag.md b/.changeset/add-auto-slash-command-and-flag.md new file mode 100644 index 0000000000..2d682d9a2c --- /dev/null +++ b/.changeset/add-auto-slash-command-and-flag.md @@ -0,0 +1,5 @@ +--- +"@moonshot-ai/kimi-code": minor +--- + +Add `/auto` slash command and `--auto` CLI flag for auto permission mode. diff --git a/apps/kimi-code/src/cli/commands.ts b/apps/kimi-code/src/cli/commands.ts index 8f7946866f..2cdd4bd082 100644 --- a/apps/kimi-code/src/cli/commands.ts +++ b/apps/kimi-code/src/cli/commands.ts @@ -42,6 +42,7 @@ export function createProgram( ) .option('-C, --continue', 'Continue the previous session for the working directory.', false) .option('-y, --yolo', 'Automatically approve all actions.', false) + .option('--auto', 'Start in auto permission mode.', false) .addOption( new Option( '-m, --model ', @@ -90,11 +91,13 @@ export function createProgram( const rawSession = raw['session'] ?? raw['resume']; const sessionValue = rawSession === true ? '' : (rawSession as string | undefined); const yoloValue = raw['yolo'] === true || raw['yes'] === true || raw['autoApprove'] === true; + const autoValue = raw['auto'] === true; const opts: CLIOptions = { session: sessionValue, continue: raw['continue'] as boolean, yolo: yoloValue, + auto: autoValue, plan: raw['plan'] as boolean, model: raw['model'] as string | undefined, outputFormat: raw['outputFormat'] as CLIOptions['outputFormat'], diff --git a/apps/kimi-code/src/cli/options.ts b/apps/kimi-code/src/cli/options.ts index 67bc86d4fe..5b1c50699e 100644 --- a/apps/kimi-code/src/cli/options.ts +++ b/apps/kimi-code/src/cli/options.ts @@ -5,6 +5,7 @@ export interface CLIOptions { session: string | undefined; continue: boolean; yolo: boolean; + auto: boolean; plan: boolean; model: string | undefined; outputFormat: PromptOutputFormat | undefined; @@ -39,6 +40,9 @@ export function validateOptions(opts: CLIOptions): ValidatedOptions { if (promptMode && opts.yolo) { throw new OptionConflictError('Cannot combine --prompt with --yolo.'); } + if (promptMode && opts.auto) { + throw new OptionConflictError('Cannot combine --prompt with --auto.'); + } if (promptMode && opts.plan) { throw new OptionConflictError('Cannot combine --prompt with --plan.'); } @@ -48,9 +52,15 @@ export function validateOptions(opts: CLIOptions): ValidatedOptions { if (opts.continue && opts.session !== undefined) { throw new OptionConflictError('Cannot combine --continue, --session.'); } + if (opts.yolo && opts.auto) { + throw new OptionConflictError('Cannot combine --yolo with --auto.'); + } if (!promptMode && (opts.continue || opts.session !== undefined) && opts.yolo) { throw new OptionConflictError('Cannot combine --yolo with --continue or --session.'); } + if (!promptMode && (opts.continue || opts.session !== undefined) && opts.auto) { + throw new OptionConflictError('Cannot combine --auto with --continue or --session.'); + } if (!promptMode && (opts.continue || opts.session !== undefined) && opts.plan) { throw new OptionConflictError('Cannot combine --plan with --continue or --session.'); } diff --git a/apps/kimi-code/src/cli/run-shell.ts b/apps/kimi-code/src/cli/run-shell.ts index a697499255..a68d2f896d 100644 --- a/apps/kimi-code/src/cli/run-shell.ts +++ b/apps/kimi-code/src/cli/run-shell.ts @@ -147,6 +147,7 @@ export async function runShell( trackLifecycle('started', { resumed, yolo: opts.yolo, + auto: opts.auto, plan: opts.plan, afk: false, }); diff --git a/apps/kimi-code/src/main.ts b/apps/kimi-code/src/main.ts index 85a4b62f5e..ffa13412fe 100644 --- a/apps/kimi-code/src/main.ts +++ b/apps/kimi-code/src/main.ts @@ -65,6 +65,7 @@ const MIGRATE_CLI_OPTIONS: CLIOptions = { session: undefined, continue: false, yolo: false, + auto: false, plan: false, model: undefined, outputFormat: undefined, diff --git a/apps/kimi-code/src/tui/commands/config.ts b/apps/kimi-code/src/tui/commands/config.ts index dc20cb96d3..a083610fce 100644 --- a/apps/kimi-code/src/tui/commands/config.ts +++ b/apps/kimi-code/src/tui/commands/config.ts @@ -79,13 +79,37 @@ export async function handleYoloCommand(host: SlashCommandHost, args: string): P if (enabled) { host.showNotice( 'YOLO mode: ON', - 'All actions will be approved automatically. Use with caution.', + 'Workspace tools auto-approved.', ); return; } host.showNotice('YOLO mode: OFF'); } +export async function handleAutoCommand(host: SlashCommandHost, args: string): Promise { + const session = host.session; + if (session === undefined) { + host.showError(NO_ACTIVE_SESSION_MESSAGE); + return; + } + + let enabled: boolean; + if (args === 'on') enabled = true; + else if (args === 'off') enabled = false; + else enabled = host.state.appState.permissionMode !== 'auto'; + + await session.setPermission(enabled ? 'auto' : 'manual'); + host.setAppState({ permissionMode: enabled ? 'auto' : 'manual' }); + if (enabled) { + host.showNotice( + 'Auto mode: ON', + 'Tools auto-approved. Agent will not ask questions.', + ); + return; + } + host.showNotice('Auto mode: OFF'); +} + export async function handleCompactCommand(host: SlashCommandHost, args: string): Promise { const session = host.session; if (session === undefined) { diff --git a/apps/kimi-code/src/tui/commands/dispatch.ts b/apps/kimi-code/src/tui/commands/dispatch.ts index 20e1be7f50..28ccf8bc0e 100644 --- a/apps/kimi-code/src/tui/commands/dispatch.ts +++ b/apps/kimi-code/src/tui/commands/dispatch.ts @@ -22,6 +22,7 @@ import type { TUIState } from '../tui-state'; import { handleConnectCommand, handleLoginCommand, handleLogoutCommand } from './auth'; import { + handleAutoCommand, handleCompactCommand, handleEditorCommand, handleModelCommand, @@ -52,6 +53,7 @@ export { handleLogoutCommand, } from './auth'; export { + handleAutoCommand, handleCompactCommand, handleEditorCommand, handleModelCommand, @@ -246,6 +248,9 @@ async function handleBuiltInSlashCommand( case 'yolo': await handleYoloCommand(host, args); return; + case 'auto': + await handleAutoCommand(host, args); + return; case 'plan': await handlePlanCommand(host, args); return; diff --git a/apps/kimi-code/src/tui/commands/registry.ts b/apps/kimi-code/src/tui/commands/registry.ts index b18bccb1ce..faf76b57bb 100644 --- a/apps/kimi-code/src/tui/commands/registry.ts +++ b/apps/kimi-code/src/tui/commands/registry.ts @@ -8,6 +8,13 @@ export const BUILTIN_SLASH_COMMANDS = [ priority: 100, availability: 'always', }, + { + name: 'auto', + aliases: [], + description: 'Toggle auto permission mode', + priority: 100, + availability: 'always', + }, { name: 'permission', aliases: [], diff --git a/apps/kimi-code/src/tui/controllers/auth-flow.ts b/apps/kimi-code/src/tui/controllers/auth-flow.ts index d19e6008fc..5b5f956265 100644 --- a/apps/kimi-code/src/tui/controllers/auth-flow.ts +++ b/apps/kimi-code/src/tui/controllers/auth-flow.ts @@ -66,7 +66,11 @@ export class AuthFlowController { workDir: host.state.appState.workDir, model, thinking: level, - permission: host.options.startup.yolo ? 'yolo' : undefined, + permission: host.options.startup.auto + ? 'auto' + : host.options.startup.yolo + ? 'yolo' + : undefined, planMode: host.state.appState.planMode ? true : undefined, }); await host.setSession(session); diff --git a/apps/kimi-code/src/tui/kimi-tui.ts b/apps/kimi-code/src/tui/kimi-tui.ts index 878e503744..da6e0d5d13 100644 --- a/apps/kimi-code/src/tui/kimi-tui.ts +++ b/apps/kimi-code/src/tui/kimi-tui.ts @@ -143,7 +143,11 @@ export interface KimiTUIStartupInput { type EffectiveActivityPaneMode = ActivityPaneMode | 'idle' | 'session'; function createInitialAppState(input: KimiTUIStartupInput): AppState { - const startupPermission: PermissionMode = input.cliOptions.yolo ? 'yolo' : 'manual'; + const startupPermission: PermissionMode = input.cliOptions.auto + ? 'auto' + : input.cliOptions.yolo + ? 'yolo' + : 'manual'; return { model: '', workDir: input.workDir, @@ -238,6 +242,7 @@ export class KimiTUI { sessionFlag: startupInput.cliOptions.session, continueLast: startupInput.cliOptions.continue, yolo: startupInput.cliOptions.yolo, + auto: startupInput.cliOptions.auto, plan: startupInput.cliOptions.plan, model: startupInput.cliOptions.model, startupNotice: startupInput.startupNotice, @@ -431,7 +436,7 @@ export class KimiTUI { const createSessionOptions: CreateSessionOptions = { workDir, model: startup.model, - permission: startup.yolo ? 'yolo' : undefined, + permission: startup.auto ? 'auto' : startup.yolo ? 'yolo' : undefined, planMode: startup.plan ? true : undefined, }; diff --git a/apps/kimi-code/src/tui/types.ts b/apps/kimi-code/src/tui/types.ts index 40dbdc3f0a..7d18bead8e 100644 --- a/apps/kimi-code/src/tui/types.ts +++ b/apps/kimi-code/src/tui/types.ts @@ -155,6 +155,7 @@ export interface TUIStartupOptions { readonly sessionFlag?: string; readonly continueLast: boolean; readonly yolo: boolean; + readonly auto: boolean; readonly plan: boolean; readonly model?: string; readonly startupNotice?: string; diff --git a/apps/kimi-code/test/cli/main.test.ts b/apps/kimi-code/test/cli/main.test.ts index 8ab1ea976f..ab02ed0253 100644 --- a/apps/kimi-code/test/cli/main.test.ts +++ b/apps/kimi-code/test/cli/main.test.ts @@ -68,6 +68,7 @@ function defaultOpts(): CLIOptions { session: undefined, continue: false, yolo: false, + auto: false, plan: false, model: undefined, outputFormat: undefined, diff --git a/apps/kimi-code/test/cli/run-prompt.test.ts b/apps/kimi-code/test/cli/run-prompt.test.ts index 8b4e62662f..74341b0844 100644 --- a/apps/kimi-code/test/cli/run-prompt.test.ts +++ b/apps/kimi-code/test/cli/run-prompt.test.ts @@ -126,6 +126,7 @@ function opts(overrides: Partial[0]> = {}) { session: undefined, continue: false, yolo: false, + auto: false, plan: false, model: undefined, outputFormat: undefined, diff --git a/apps/kimi-code/test/cli/run-shell.test.ts b/apps/kimi-code/test/cli/run-shell.test.ts index 01f9415a8a..8aa72d9455 100644 --- a/apps/kimi-code/test/cli/run-shell.test.ts +++ b/apps/kimi-code/test/cli/run-shell.test.ts @@ -174,6 +174,7 @@ describe('runShell', () => { session: undefined, continue: false, yolo: true, + auto: false, plan: true, model: undefined, outputFormat: undefined, @@ -232,6 +233,7 @@ describe('runShell', () => { expect(mocks.lifecycleTrack).toHaveBeenCalledWith('started', { resumed: false, yolo: true, + auto: false, plan: true, afk: false, }); @@ -261,6 +263,7 @@ describe('runShell', () => { session: undefined, continue: false, yolo: false, + auto: false, plan: false, model: undefined, outputFormat: undefined, @@ -300,6 +303,7 @@ describe('runShell', () => { session: undefined, continue: false, yolo: false, + auto: false, plan: false, model: undefined, outputFormat: undefined, @@ -337,6 +341,7 @@ describe('runShell', () => { session: 'ses-1', continue: false, yolo: false, + auto: false, plan: false, model: undefined, outputFormat: undefined, @@ -349,6 +354,7 @@ describe('runShell', () => { expect(mocks.lifecycleTrack).toHaveBeenCalledWith('started', { resumed: true, yolo: false, + auto: false, plan: false, afk: false, }); @@ -373,6 +379,7 @@ describe('runShell', () => { session: undefined, continue: false, yolo: false, + auto: false, plan: false, model: undefined, outputFormat: undefined, @@ -405,6 +412,7 @@ describe('runShell', () => { session: undefined, continue: false, yolo: false, + auto: false, plan: false, model: undefined, outputFormat: undefined, @@ -455,6 +463,7 @@ describe('runShell', () => { session: '', continue: false, yolo: false, + auto: false, plan: false, model: undefined, outputFormat: undefined, @@ -491,6 +500,7 @@ describe('runShell', () => { session: undefined, continue: false, yolo: false, + auto: false, plan: false, model: undefined, outputFormat: undefined, @@ -527,6 +537,7 @@ describe('runShell', () => { session: undefined, continue: false, yolo: false, + auto: false, plan: false, model: undefined, outputFormat: undefined, @@ -579,6 +590,7 @@ describe('runShell', () => { session: undefined, continue: false, yolo: false, + auto: false, plan: false, model: undefined, outputFormat: undefined, diff --git a/apps/kimi-code/test/tui/activity-pane.test.ts b/apps/kimi-code/test/tui/activity-pane.test.ts index f0cbc4ac31..ec954e77ee 100644 --- a/apps/kimi-code/test/tui/activity-pane.test.ts +++ b/apps/kimi-code/test/tui/activity-pane.test.ts @@ -13,6 +13,7 @@ function makeStartupInput(): KimiTUIStartupInput { session: undefined, continue: false, yolo: false, + auto: false, plan: false, model: undefined, outputFormat: undefined, diff --git a/apps/kimi-code/test/tui/create-tui-state.test.ts b/apps/kimi-code/test/tui/create-tui-state.test.ts index 76fa03f882..f82d93fee9 100644 --- a/apps/kimi-code/test/tui/create-tui-state.test.ts +++ b/apps/kimi-code/test/tui/create-tui-state.test.ts @@ -36,6 +36,7 @@ describe('createTUIState', () => { startup: { continueLast: false, yolo: false, + auto: false, plan: false, }, }; diff --git a/apps/kimi-code/test/tui/kimi-tui-message-flow.test.ts b/apps/kimi-code/test/tui/kimi-tui-message-flow.test.ts index 9a68b76dc0..28b6ea1290 100644 --- a/apps/kimi-code/test/tui/kimi-tui-message-flow.test.ts +++ b/apps/kimi-code/test/tui/kimi-tui-message-flow.test.ts @@ -83,6 +83,7 @@ function makeStartupInput(): KimiTUIStartupInput { session: undefined, continue: false, yolo: false, + auto: false, plan: false, model: undefined, outputFormat: undefined, diff --git a/apps/kimi-code/test/tui/kimi-tui-startup.test.ts b/apps/kimi-code/test/tui/kimi-tui-startup.test.ts index 682c6fcd90..e36abe15d3 100644 --- a/apps/kimi-code/test/tui/kimi-tui-startup.test.ts +++ b/apps/kimi-code/test/tui/kimi-tui-startup.test.ts @@ -66,6 +66,7 @@ function makeStartupInput( session: undefined, continue: false, yolo: false, + auto: false, plan: false, model: undefined, outputFormat: undefined, diff --git a/apps/kimi-code/test/tui/message-replay.test.ts b/apps/kimi-code/test/tui/message-replay.test.ts index c4a64fc99c..e9b347c27a 100644 --- a/apps/kimi-code/test/tui/message-replay.test.ts +++ b/apps/kimi-code/test/tui/message-replay.test.ts @@ -32,6 +32,7 @@ function makeStartupInput(): KimiTUIStartupInput { session: undefined, continue: false, yolo: false, + auto: false, plan: false, model: undefined, outputFormat: undefined, diff --git a/apps/kimi-code/test/tui/signal-handlers.test.ts b/apps/kimi-code/test/tui/signal-handlers.test.ts index 6416466dee..f240f70fd1 100644 --- a/apps/kimi-code/test/tui/signal-handlers.test.ts +++ b/apps/kimi-code/test/tui/signal-handlers.test.ts @@ -15,6 +15,7 @@ function makeStartupInput(): KimiTUIStartupInput { session: undefined, continue: false, yolo: false, + auto: false, plan: false, model: undefined, outputFormat: undefined, From d8ae28636c2689ab3d48b3774c10c655cbbebdaa Mon Sep 17 00:00:00 2001 From: liruifengv Date: Thu, 28 May 2026 19:59:05 +0800 Subject: [PATCH 2/2] feat: add /auto slash command and --auto CLI flag --- apps/kimi-code/src/tui/commands/config.ts | 88 ++++++++++++++++------- docs/en/reference/kimi-command.md | 11 ++- docs/en/reference/slash-commands.md | 3 +- docs/zh/reference/kimi-command.md | 11 ++- docs/zh/reference/slash-commands.md | 3 +- 5 files changed, 88 insertions(+), 28 deletions(-) diff --git a/apps/kimi-code/src/tui/commands/config.ts b/apps/kimi-code/src/tui/commands/config.ts index a083610fce..2f512d0340 100644 --- a/apps/kimi-code/src/tui/commands/config.ts +++ b/apps/kimi-code/src/tui/commands/config.ts @@ -69,21 +69,41 @@ export async function handleYoloCommand(host: SlashCommandHost, args: string): P return; } - let enabled: boolean; - if (args === 'on') enabled = true; - else if (args === 'off') enabled = false; - else enabled = host.state.appState.permissionMode !== 'yolo'; + const subcmd = args.trim().toLowerCase(); + const currentMode = host.state.appState.permissionMode; - await session.setPermission(enabled ? 'yolo' : 'manual'); - host.setAppState({ permissionMode: enabled ? 'yolo' : 'manual' }); - if (enabled) { - host.showNotice( - 'YOLO mode: ON', - 'Workspace tools auto-approved.', - ); + if (subcmd === 'on') { + if (currentMode === 'yolo') { + host.showNotice('YOLO mode is already on'); + return; + } + await session.setPermission('yolo'); + host.setAppState({ permissionMode: 'yolo' }); + host.showNotice('YOLO mode: ON', 'Workspace tools auto-approved.'); return; } - host.showNotice('YOLO mode: OFF'); + + if (subcmd === 'off') { + if (currentMode !== 'yolo') { + host.showNotice('YOLO mode is already off'); + return; + } + await session.setPermission('manual'); + host.setAppState({ permissionMode: 'manual' }); + host.showNotice('YOLO mode: OFF'); + return; + } + + // toggle + if (currentMode === 'yolo') { + await session.setPermission('manual'); + host.setAppState({ permissionMode: 'manual' }); + host.showNotice('YOLO mode: OFF'); + } else { + await session.setPermission('yolo'); + host.setAppState({ permissionMode: 'yolo' }); + host.showNotice('YOLO mode: ON', 'Workspace tools auto-approved.'); + } } export async function handleAutoCommand(host: SlashCommandHost, args: string): Promise { @@ -93,21 +113,41 @@ export async function handleAutoCommand(host: SlashCommandHost, args: string): P return; } - let enabled: boolean; - if (args === 'on') enabled = true; - else if (args === 'off') enabled = false; - else enabled = host.state.appState.permissionMode !== 'auto'; + const subcmd = args.trim().toLowerCase(); + const currentMode = host.state.appState.permissionMode; - await session.setPermission(enabled ? 'auto' : 'manual'); - host.setAppState({ permissionMode: enabled ? 'auto' : 'manual' }); - if (enabled) { - host.showNotice( - 'Auto mode: ON', - 'Tools auto-approved. Agent will not ask questions.', - ); + if (subcmd === 'on') { + if (currentMode === 'auto') { + host.showNotice('Auto mode is already on'); + return; + } + await session.setPermission('auto'); + host.setAppState({ permissionMode: 'auto' }); + host.showNotice('Auto mode: ON', 'Tools auto-approved. Agent will not ask questions.'); return; } - host.showNotice('Auto mode: OFF'); + + if (subcmd === 'off') { + if (currentMode !== 'auto') { + host.showNotice('Auto mode is already off'); + return; + } + await session.setPermission('manual'); + host.setAppState({ permissionMode: 'manual' }); + host.showNotice('Auto mode: OFF'); + return; + } + + // toggle + if (currentMode === 'auto') { + await session.setPermission('manual'); + host.setAppState({ permissionMode: 'manual' }); + host.showNotice('Auto mode: OFF'); + } else { + await session.setPermission('auto'); + host.setAppState({ permissionMode: 'auto' }); + host.showNotice('Auto mode: ON', 'Tools auto-approved. Agent will not ask questions.'); + } } export async function handleCompactCommand(host: SlashCommandHost, args: string): Promise { diff --git a/docs/en/reference/kimi-command.md b/docs/en/reference/kimi-command.md index 088e6c34ee..cca98e032f 100644 --- a/docs/en/reference/kimi-command.md +++ b/docs/en/reference/kimi-command.md @@ -21,6 +21,7 @@ The table below lists all options supported by the `kimi` main command. All flag | `--prompt ` | `-p` | Run one prompt non-interactively and stream assistant output to stdout. This mode uses `auto` permission for tool calls and does not open the TUI. | | `--output-format ` | | Set the non-interactive output format. Supported values are `text` and `stream-json`. Only valid with `--prompt`; defaults to `text`. | | `--yolo` | `-y` | Auto-approve ordinary tool calls, skipping approval requests; Plan mode `Bash` approval and Plan mode exit approval are not skipped. | +| `--auto` | | Start in auto permission mode. Tool approvals are handled automatically and the agent will not ask questions. | | `--plan` | | Start a new session in Plan mode, where the AI favors read-only tools for exploration and planning and can write the current plan file; Plan mode `Bash` is handled separately according to the permission mode. | | `--skills-dir ` | | Load Skills from the specified directory, replacing the auto-discovered user and project directories. Can be passed multiple times to stack several directories. See [Custom Skills directories](#custom-skills-directories) below. | @@ -36,8 +37,10 @@ The following combinations are rejected at startup: - `--continue` and `--session` are mutually exclusive: both mean "resume a previous session" and overlap in meaning. - `--yolo` cannot be combined with `--continue` or `--session`: when resuming a session, the original session's approval settings are preserved. This rule only applies to interactive mode; in `--prompt` mode, `--yolo` is rejected earlier because it is mutually exclusive with `--prompt`. +- `--auto` cannot be combined with `--continue` or `--session`: same rationale as `--yolo`. +- `--auto` cannot be combined with `--yolo`: the two permission modes are mutually exclusive. - `--plan` cannot be combined with `--continue` or `--session`: Plan mode only applies to new sessions. -- `--prompt` cannot be combined with `--yolo` or `--plan`: non-interactive mode always uses `auto` permission and does not enter Plan mode. +- `--prompt` cannot be combined with `--yolo`, `--auto`, or `--plan`: non-interactive mode always uses `auto` permission and does not enter Plan mode. - `--prompt` can be combined with `--continue` or `--session ` with an ID; bare `--session` without an ID would open the interactive picker and therefore cannot be used in non-interactive mode. - `--output-format` can only be used with `--prompt`; the interactive TUI does not support writing the full event stream as stdout JSONL. @@ -69,6 +72,12 @@ When the task is trivial and you don't want to be interrupted by frequent approv kimi --yolo ``` +If you want the agent to handle approvals on its own and not ask questions, use `--auto`: + +```sh +kimi --auto +``` + If you want the AI to read the code and produce an implementation plan first, rather than immediately editing files, use `--plan` to enter Plan mode: ```sh diff --git a/docs/en/reference/slash-commands.md b/docs/en/reference/slash-commands.md index c975d51824..26968e257a 100644 --- a/docs/en/reference/slash-commands.md +++ b/docs/en/reference/slash-commands.md @@ -39,7 +39,8 @@ Some commands are only available in the idle state. Running them while the sessi | Command | Alias | Description | Always available | | --- | --- | --- | --- | -| `/yolo [on\|off]` | `/yes` | Toggle auto-approve mode. Without arguments, flip the current state; pass `on`/`off` explicitly to force the corresponding state. When enabled, ordinary tool call approvals are skipped; the Plan mode exit approval is not skipped. | Yes | +| `/yolo [on\|off]` | `/yes` | Toggle YOLO mode. Without arguments, flip the current state; pass `on`/`off` explicitly to force the corresponding state. When enabled, ordinary tool call approvals are skipped; the Plan mode exit approval is not skipped. | Yes | +| `/auto [on\|off]` | — | Toggle auto permission mode. Without arguments, flip the current state; pass `on`/`off` explicitly to force the corresponding state. When enabled, tool approvals are handled automatically and the agent will not ask questions. | Yes | | `/plan [on\|off]` | — | Toggle Plan mode. Without arguments, flip the current state; pass `on`/`off` explicitly to force the corresponding state. Toggling alone does not create an empty plan file. | Yes | | `/plan clear` | — | Clear the current plan. | No | diff --git a/docs/zh/reference/kimi-command.md b/docs/zh/reference/kimi-command.md index 78365bda8c..d50c9ae0ad 100644 --- a/docs/zh/reference/kimi-command.md +++ b/docs/zh/reference/kimi-command.md @@ -21,6 +21,7 @@ kimi [options] | `--prompt ` | `-p` | 非交互执行单次 prompt,并把 Assistant 输出流式写到 stdout。该模式会使用 `auto` 权限处理工具调用,不会打开 TUI。 | | `--output-format ` | | 设置非交互输出格式,支持 `text` 与 `stream-json`。仅可与 `--prompt` 一起使用,默认 `text`。 | | `--yolo` | `-y` | 自动批准普通工具调用,跳过审批请求;Plan 模式中的 `Bash` 审批和退出审批不会被跳过。 | +| `--auto` | | 以 auto 权限模式启动。工具审批自动处理,Agent 不会向用户提问。 | | `--plan` | | 以 Plan 模式启动新会话,AI 会优先使用只读工具进行探索和规划,可以写入当前计划文件;Plan 模式中的 `Bash` 按权限模式单独处理。 | | `--skills-dir ` | | 从指定目录加载 Skills,替换自动发现的用户和项目目录。可重复传入以叠加多个目录。详见下文 [自定义 Skills 目录](#自定义-skills-目录)。 | @@ -36,8 +37,10 @@ kimi [options] - `--continue` 与 `--session` 互斥:两者都表示"恢复历史会话",含义重叠。 - `--yolo` 不能与 `--continue` 或 `--session` 同时使用:恢复会话时会沿用原会话的审批设置。此规则仅适用于交互式模式;在 `--prompt` 模式下,`--yolo` 已因与 `--prompt` 互斥而被更早拦截。 +- `--auto` 不能与 `--continue` 或 `--session` 同时使用:与 `--yolo` 同理。 +- `--auto` 不能与 `--yolo` 同时使用:两种权限模式互斥。 - `--plan` 不能与 `--continue` 或 `--session` 同时使用:Plan 模式只对新会话生效。 -- `--prompt` 不能与 `--yolo` 或 `--plan` 同时使用:非交互模式固定使用 `auto` 权限,并且不进入 Plan 模式。 +- `--prompt` 不能与 `--yolo`、`--auto` 或 `--plan` 同时使用:非交互模式固定使用 `auto` 权限,并且不进入 Plan 模式。 - `--prompt` 可以与 `--continue` 或带 ID 的 `--session ` 一起使用;不带 ID 的 `--session` 会尝试打开选择器,因此不能用于非交互模式。 - `--output-format` 只能与 `--prompt` 一起使用;交互式 TUI 不支持把完整事件流写成 stdout JSONL。 @@ -69,6 +72,12 @@ kimi --session 01HZ...XYZ kimi --yolo ``` +希望 Agent 自行处理审批且不再向用户提问时,使用 `--auto`: + +```sh +kimi --auto +``` + 需要先让 AI 阅读代码、产出实现计划,而不是立刻动手修改文件时,使用 `--plan` 进入 Plan 模式: ```sh diff --git a/docs/zh/reference/slash-commands.md b/docs/zh/reference/slash-commands.md index e9319b597c..8871288051 100644 --- a/docs/zh/reference/slash-commands.md +++ b/docs/zh/reference/slash-commands.md @@ -39,7 +39,8 @@ | 命令 | 别名 | 说明 | 随时可用 | | --- | --- | --- | --- | -| `/yolo [on\|off]` | `/yes` | 切换自动批准模式(auto-approve)。不带参数时按当前状态翻转;显式传 `on`/`off` 时强制设为对应状态。开启后跳过普通工具调用审批;Plan 模式的退出审批不会被跳过。 | 是 | +| `/yolo [on\|off]` | `/yes` | 切换 YOLO 模式。不带参数时按当前状态翻转;显式传 `on`/`off` 时强制设为对应状态。开启后跳过普通工具调用审批;Plan 模式的退出审批不会被跳过。 | 是 | +| `/auto [on\|off]` | — | 切换 auto 权限模式。不带参数时按当前状态翻转;显式传 `on`/`off` 时强制设为对应状态。开启后工具审批自动处理,Agent 不会向用户提问。 | 是 | | `/plan [on\|off]` | — | 切换 Plan 模式。不带参数时按当前状态翻转;显式传 `on`/`off` 时强制设为对应状态。单纯切换不会创建空计划文件。 | 是 | | `/plan clear` | — | 清除当前 plan 方案。 | 否 |