How Yolo Mode Automatically Approves All Tool Calls in Kimi CLI

Yolo mode bypasses every approval prompt by returning approved=True immediately in the Approval.request() method, preventing the ApprovalRuntime from ever creating a pending request on the wire.

MoonshotAI's Kimi CLI includes a yolo mode that eliminates interactive approval prompts for tool invocations. When enabled via the --yolo flag or the /yolo slash command, this setting modifies the approval runtime to automatically authorize every tool request without user intervention. Understanding this mechanism requires examining how the Approval class short-circuits the request flow before it reaches the wire protocol.

Enabling Yolo Mode in Kimi CLI

Command Line Activation

In src/kimi_cli/cli/__init__.py, the CLI argument parser accepts a --yolo flag that initializes the session with automatic approvals enabled. Passing this flag sets the yolo attribute in the session configuration, which propagates to the ApprovalState object.


# Enable Yolo mode for the entire session

kimi --yolo process-data --input files/

Interactive Toggle with Slash Commands

Users can also toggle Yolo mode dynamically during an active session. The /yolo slash command implementation in src/kimi_cli/soul/slash.py flips the session.state.approval.yolo boolean flag without restarting the CLI.


# In the Kimi CLI interactive shell

>>> /yolo          # Turns Yolo mode on

>>> /yolo          # Turns Yolo mode off

The Approval Runtime Short-Circuit Mechanism

State Management and Auto-Approve Logic

The Approval class in src/kimi_cli/soul/approval.py maintains an ApprovalState object that tracks the yolo boolean flag. The is_auto_approve() method evaluates whether to skip user prompts by checking self._state.yolo alongside other auto-approval conditions.

When is_auto_approve() returns True, the system treats all incoming tool requests as pre-approved.

Early Return in the Request Flow

The core bypass occurs in the Approval.request() method. Before creating any pending approval requests, the code checks if self.is_auto_approve(): and immediately returns an ApprovalResult(approved=True) object.

This early return prevents the ApprovalRuntime from ever invoking create_request() in src/kimi_cli/approval_runtime/runtime.py, meaning no ApprovalRequest message is emitted on the wire and no UI prompt is rendered.

Telemetry and Logging

Even in Yolo mode, the system logs approval events for observability. When automatic approval triggers due to the Yolo flag (as opposed to AFK mode), the telemetry records approval_mode="yolo" alongside the tool_approved event. This allows session replay to distinguish between user-approved and automatically-approved actions.

Code Examples

Standard CLI Execution

Enable Yolo mode at startup to run automation scripts without interruptions:

kimi --yolo deploy-production --config production.yaml

Tool Implementation Agnosticism

Tool implementations remain unaware of the approval mode. The following code executes identically regardless of Yolo state, though in Yolo mode it returns instantly without blocking:

async def delete_temporary_files(ctx):
    result = await ctx.approval.request(
        sender="cleanup_tool",
        action="delete",
        description="Remove /tmp/cache files",
        display=[...]
    )
    # In Yolo mode, result.approved is always True

    if result.approved:
        await execute_delete()

Architecture Impact

In normal operation, the approval runtime creates a pending request object and waits for user input via the wire protocol. Yolo mode eliminates this handshake entirely. By short-circuiting at the Approval.request() level in src/kimi_cli/soul/approval.py, the system avoids the network overhead and state synchronization required by ApprovalRuntime.create_request() in src/kimi_cli/approval_runtime/runtime.py.

The KimiSoul class exposes this state through the is_yolo() method in src/kimi_cli/soul/kimisoul.py, allowing the UI layer to display visual indicators when automatic approval is active.

Summary

  • Yolo mode automatically approves every tool request in Kimi CLI without user interaction
  • Activation occurs via the --yolo CLI flag or interactive /yolo slash command in src/kimi_cli/soul/slash.py
  • The Approval.is_auto_approve() method in src/kimi_cli/soul/approval.py checks self._state.yolo to determine eligibility
  • When active, Approval.request() returns ApprovalResult(approved=True) immediately, bypassing the ApprovalRuntime wire protocol entirely
  • Telemetry logs these approvals with approval_mode="yolo" for audit purposes
  • Tool implementations require no special code to support Yolo mode; the approval layer handles transparency

Frequently Asked Questions

Is Yolo mode persistent across sessions?

No. The Yolo flag is stored in the ephemeral session state (session.state.approval.yolo) and resets when you exit the CLI. You must pass --yolo on startup or execute /yolo in each new session to enable automatic approvals.

What is the difference between Yolo mode and AFK mode?

Both modes trigger is_auto_approve() to return True in src/kimi_cli/soul/approval.py, but they represent different user intentions. Yolo mode explicitly opts into automatic approvals via the --yolo flag or command, while AFK mode activates during idle periods. The telemetry distinguishes them via approval_mode="yolo" versus AFK-specific logging.

Can I enable Yolo mode for specific tools only?

No. Yolo mode is binary and global within the session. When enabled, the is_auto_approve() check applies to all Approval.request() calls regardless of the sender or action type. For granular control, you must disable Yolo mode and approve individual requests manually.

Is there a visual indicator when Yolo mode is active?

Yes. The KimiSoul.is_yolo() method in src/kimi_cli/soul/kimisoul.py exposes the current state to the UI layer, allowing the interface to display a status indicator whenever the flag is active. This helps prevent accidental automatic approvals during sensitive operations.

Have a question about this repo?

These articles cover the highlights, but your codebase questions are specific. Give your agent direct access to the source. Share this with your agent to get started:

Share the following with your agent to get started:
curl -s "https://instagit.com/install.md"

Works with
Claude Codex Cursor VS Code OpenClaw Any MCP Client

Maintain an open-source project? Get it listed too →