Problem
Claude Code's --permission-mode CLI flag allows overriding the default permission mode (default, plan, acceptEdits, bypassPermissions, etc.). Users may have "defaultMode": "plan" in their global ~/.claude/settings.json for interactive sessions, but this causes Takopi sessions to get permanently stuck — ExitPlanMode requires terminal interaction that can't happen in -p mode.
There's currently no way to configure --permission-mode in takopi.toml for the Claude engine. The runner builds CLI args with --allowedTools and --dangerously-skip-permissions, but not --permission-mode.
Proposed Solution
Add permission_mode as a config option in the [claude] section:
[claude]
allowed_tools = ["Bash", "Read", "Edit", "Write", "Glob", "Grep"]
permission_mode = "acceptEdits"
Implementation (3 lines)
runners/claude.py — ClaudeRunner dataclass:
permission_mode: str | None = None
runners/claude.py — _build_args():
if self.permission_mode is not None:
args.extend(["--permission-mode", self.permission_mode])
runners/claude.py — build_runner():
permission_mode = config.get("permission_mode")
if permission_mode is not None:
permission_mode = str(permission_mode)
Then pass it to ClaudeRunner(permission_mode=permission_mode, ...).
Why This Matters
Without this, users who prefer "defaultMode": "plan" for interactive Claude Code sessions have no way to override it for Takopi. The session enters plan mode, calls ExitPlanMode, and blocks forever waiting for terminal approval that can never come.
Setting permission_mode = "acceptEdits" in takopi.toml cleanly separates interactive (plan mode) from non-interactive (accept edits) behavior.
Workaround
I've monkey-patched this locally and confirmed it works — sessions that previously got stuck in plan mode now execute normally. Happy to open a PR if preferred.
Related
Environment
- Takopi v0.21.5
- Claude Code with
--permission-mode flag (available in current versions)
Problem
Claude Code's
--permission-modeCLI flag allows overriding the default permission mode (default,plan,acceptEdits,bypassPermissions, etc.). Users may have"defaultMode": "plan"in their global~/.claude/settings.jsonfor interactive sessions, but this causes Takopi sessions to get permanently stuck —ExitPlanModerequires terminal interaction that can't happen in-pmode.There's currently no way to configure
--permission-modeintakopi.tomlfor the Claude engine. The runner builds CLI args with--allowedToolsand--dangerously-skip-permissions, but not--permission-mode.Proposed Solution
Add
permission_modeas a config option in the[claude]section:Implementation (3 lines)
runners/claude.py—ClaudeRunnerdataclass:runners/claude.py—_build_args():runners/claude.py—build_runner():Then pass it to
ClaudeRunner(permission_mode=permission_mode, ...).Why This Matters
Without this, users who prefer
"defaultMode": "plan"for interactive Claude Code sessions have no way to override it for Takopi. The session enters plan mode, callsExitPlanMode, and blocks forever waiting for terminal approval that can never come.Setting
permission_mode = "acceptEdits"intakopi.tomlcleanly separates interactive (plan mode) from non-interactive (accept edits) behavior.Workaround
I've monkey-patched this locally and confirmed it works — sessions that previously got stuck in plan mode now execute normally. Happy to open a PR if preferred.
Related
Environment
--permission-modeflag (available in current versions)