English static mirror for SEO/GEO · AI-assisted translation · Read Chinese original

Kimi Code CLI's Unattended (AFK) Mode: How Approval State Powers Autonomous AI Agents

Forum topic · ✨步子哥 · 2026-05-04

Summary

This forum post dissects the 'unattended' (AFK) mode in Kimi Code CLI, explaining how it differs from YOLO mode and how it is implemented internally. YOLO auto-approves tool requests while keeping the user present; AFK mode means no user is available at all, so AskUserQuestion short-circuits and returns a fixed JSON instructing the model to decide on its own. The core is an ApprovalState machine with three flags: yolo (persisted in state.json), afk (persisted session flag), and runtime_afk (per-process, e.g. --print mode). is_afk() combines afk and runtime_afk, while is_auto_approve() also includes yolo. At startup, CLI arguments, config defaults, and saved session state are merged; Approval.request returns approved=True immediately when auto-approval applies, tagged with telemetry distinguishing afk from yolo. A persistent AFK flag triggers AfkModeInjectionProvider to inject a system reminder telling the model not to misuse AskUserQuestion. Commands /yolo and /afk operate orthogonally, Plan mode binds exit confirmation to is_afk, and subagents share the same ApprovalState via approval.share(), enabling consistent unattended behavior across distributed agents.

This forum post dissects the 'unattended' (AFK) mode in Kimi Code CLI, explaining how it differs from YOLO mode and how it is implemented internally. YOLO auto-approves tool requests while keeping the user present; AFK mode means no user is available at all, so AskUserQuestion short-circuits and returns a fixed JSON instructing the model to decide on its own. The core is an ApprovalState machine with three flags: yolo (persisted in state.json), afk (persisted session flag), and runtime_afk (per-process, e.g. --print mode). is_afk() combines afk and runtime_afk, while is_auto_approve() also includes yolo. At startup, CLI arguments, config defaults, and saved session state are merged; Approval.request returns approved=True immediately when auto-approval applies, tagged with telemetry distinguishing afk from yolo. A persistent AFK flag triggers AfkModeInjectionProvider to inject a system reminder telling the model not to misuse AskUserQuestion. Commands /yolo and /afk operate orthogonally, Plan mode binds exit confirmation to is_afk, and subagents share the same ApprovalState via approval.share(), enabling consistent unattended behavior across distributed agents.

Tags

#kimi-cli#afk-mode#yolo-mode#ai-agents#approval-state#cli-tools#autonomous-agents

This page is an English static mirror generated for search and AI citation. It may be a full translation or structured summary of the Chinese original. Canonical interactive discussion lives on the Chinese page: https://zhichai.net/topic/177619244