Merge claudedo/5d627df8 — #12 planning permission-mode default

This commit is contained in:
mika kuns
2026-07-24 13:20:19 +02:00
4 changed files with 29 additions and 11 deletions
@@ -99,8 +99,8 @@ public sealed class WindowsTerminalLauncher : ITerminalLauncher
return Task.CompletedTask;
}
// Resumes a session by id in default (interactive) permission mode: the user drives
// tool approvals in the terminal, unlike planning which pins --permission-mode plan.
// Resumes a session by id with no extra flags: the user drives every tool approval in the
// terminal, unlike planning which additionally allowlists its MCP planning tools.
internal static string BuildResumeCommand(string claudePath, string claudeSessionId) =>
BuildPwshCommand(claudePath, BuildResumeArgs(claudeSessionId));
@@ -130,7 +130,12 @@ public sealed class WindowsTerminalLauncher : ITerminalLauncher
return new[]
{
"--model", Model,
"--permission-mode", "plan",
// NOT --permission-mode plan: plan mode gates EVERY MCP tool call regardless of
// --allowedTools, so the session would prompt the user on the first CreateChildTask
// (the whole point of a planning session). Default mode honours the allowlist below,
// and file edits stay blocked anyway — the planning system prompt forbids them and
// AllowedTools omits Write/Edit/Bash (an unexpected edit would prompt, not run silently).
"--permission-mode", "default",
"--allowedTools", AllowedTools,
"--add-dir", ctx.Files.SessionDirectory,
"--append-system-prompt-file", ctx.Files.SystemPromptPath,
@@ -139,9 +144,10 @@ public sealed class WindowsTerminalLauncher : ITerminalLauncher
}
// The raw claude CLI args for an interactive planning RESUME, shared with the embedded-ConPTY
// planning path. Pins --permission-mode plan (unlike a plain --resume pickup).
// planning path. Re-passes the planning allowlist in default mode (not --resume alone): the CLI
// does not restore --allowedTools across a resume, and plan mode would gate the MCP tools.
internal static IReadOnlyList<string> BuildPlanningResumeArgs(string claudeSessionId) =>
new[] { "--permission-mode", "plan", "--resume", claudeSessionId };
new[] { "--permission-mode", "default", "--allowedTools", AllowedTools, "--resume", claudeSessionId };
private string ResolveWtOrThrow() =>
Resolve(_wtPath) ?? throw new TerminalLaunchException($"Windows Terminal not found: {_wtPath}");