feat(cli): add --plan flag and default_plan_mode config#1665
Open
leonidlouis wants to merge 4 commits intoMoonshotAI:mainfrom
Open
feat(cli): add --plan flag and default_plan_mode config#1665leonidlouis wants to merge 4 commits intoMoonshotAI:mainfrom
leonidlouis wants to merge 4 commits intoMoonshotAI:mainfrom
Conversation
Add ability to start Kimi CLI in plan mode via: - CLI flag: --plan (similar to --yolo) - Config option: default_plan_mode = true/false in ~/.kimi/config.toml Behavior: - For new sessions: CLI flag > config > default (false) - For resumed sessions: session state preserved, config not applied - Full activation with _set_plan_mode() for proper side effects Files changed: - config.py: add default_plan_mode field - cli/__init__.py: add --plan flag - app.py: handle plan mode activation logic - tests/core/test_config.py: update snapshot
Address PR review feedback: 1. Fix resumed flag in CLI (cli/__init__.py): - Track actual session restoration vs creation - resumed=True only when session was actually found - Fixes --session NEW_ID being treated as resumed 2. Add resumed=True to ACP server (acp/server.py): - ACP always loads/resumes existing sessions - Prevents config.default_plan_mode from overriding persisted state 3. Add resumed=True to web worker (web/runner/worker.py): - Web worker loads existing sessions by ID - Prevents config.default_plan_mode from overriding persisted state
Add missing resumed=True to the _setup_session method in ACP server. This method is used by load_session() and resume_session() to load existing sessions, so it should pass resumed=True to preserve the session's persisted plan_mode state. This corrects the previous commit which mistakenly added resumed=True to new_session instead of _setup_session.
new_session() creates a brand-new session via Session.create(), so it should NOT pass resumed=True. Doing so caused config.default_plan_mode to be skipped for ACP new sessions. resumed=True is correctly kept in _setup_session() which loads existing sessions via Session.find().
6 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Add ability to start Kimi CLI in plan mode via CLI flag and config option.
Motivation
Currently, plan mode can only be triggered interactively via:
There was no way to start a session directly in plan mode, unlike --yolo which has both CLI flag and config option.
Changes
New Features
Behavior
Files Changed
Testing
Checklist