Skip to content

Commit ae930df

Browse files
authored
feat(desktop): safer defaults for builtin terminal agent presets (#3546)
* feat(desktop): safer defaults for builtin terminal agent presets Swap permission-bypass flags for each CLI's intended safe-but-useful mode (claude acceptEdits, codex --full-auto, gemini auto_edit, copilot --allow-all-tools). Drop mastracode/opencode/pi from the default seed since they are YOLO-by-default at the CLI level; they remain available via Quick-Add. Remove cursor-agent's --yolo suffix (silent no-op on the real binary). Existing users are preserved — the v1 terminalPresetsInitialized guard and v2 migration marker ensure stored commands are never rewritten. * test(desktop): update agent-launch-request fixture for new codex default buildPromptAgentLaunchRequest's terminal-command fixture hard-coded the old --dangerously-bypass-approvals-and-sandbox flag. Update it to the new --full-auto default so the test reflects the current builtin. * fix(desktop): address reviewer feedback on safe-default flag choices - gemini promptCommand: add --approval-mode=auto_edit so prompt/task launches use the same safety mode as terminal launches (flagged by cubic, greptile, and CodeRabbit) - copilot: switch from --allow-all-tools to --allow-tool=write. Per GitHub's own docs, --allow-all-tools "allows all tools to run automatically without confirmation" including shell, which contradicts the safe-by-default claim. --allow-tool=write auto- approves file edits only (analog of claude's acceptEdits). - docs: update copilot line; clarify mastracode/opencode/pi opt-in parentheticals so users understand why they're not auto-seeded.
1 parent 27e243b commit ae930df

4 files changed

Lines changed: 21 additions & 25 deletions

File tree

apps/desktop/src/shared/utils/agent-launch-request.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ describe("buildPromptAgentLaunchRequest", () => {
4646
agentType: "codex",
4747
terminal: {
4848
command:
49-
'codex -c model_reasoning_effort="high" --dangerously-bypass-approvals-and-sandbox -c model_reasoning_summary="detailed" -c model_supports_reasoning_summaries=true',
49+
'codex -c model_reasoning_effort="high" -c model_reasoning_summary="detailed" -c model_supports_reasoning_summaries=true --full-auto',
5050
},
5151
});
5252
});

apps/docs/content/docs/terminal-presets.mdx

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -41,15 +41,17 @@ Presets are parallel by default.
4141

4242
## Quick-Add Templates
4343

44-
Pre-configured presets for popular AI agents:
45-
46-
- **amp** - `amp`
47-
- **claude** - `claude --dangerously-skip-permissions`
48-
- **codex** - Full danger mode with high reasoning effort
49-
- **gemini** - `gemini --yolo`
50-
- **pi** - `pi`
51-
- **cursor-agent** - Cursor AI agent
52-
- **opencode** - Open-source AI coding agent
44+
Pre-configured presets for popular AI agents. Defaults are safe-by-default — agents can read and edit files, but still prompt before running shell commands or touching files outside your workspace. Edit any preset to opt into a more permissive mode.
45+
46+
- **amp** - `amp` (built-in permission rules auto-deny destructive ops)
47+
- **claude** - `claude --permission-mode acceptEdits`
48+
- **codex** - `codex ... --full-auto` (workspace-sandboxed)
49+
- **gemini** - `gemini --approval-mode=auto_edit`
50+
- **copilot** - `copilot --allow-tool=write`
51+
- **cursor-agent** - `cursor-agent` (prompts for every action)
52+
- **mastracode** - Mastra's coding agent (opt-in: auto-approves all actions by default at the CLI; no startup flag to restrict)
53+
- **opencode** - Open-source AI coding agent (opt-in: full file and shell access by default at the CLI; no startup flag to restrict)
54+
- **pi** - Minimal terminal coding harness (opt-in: auto-approves all actions by default at the CLI; no startup flag to restrict)
5355

5456
## Preset Bar
5557

packages/shared/src/agent-command.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ describe("buildAgentPromptCommand", () => {
1313
});
1414

1515
expect(command).toContain(
16-
"model_supports_reasoning_summaries=true -- \"$(cat <<'SUPERSET_PROMPT_12345678'",
16+
"model_supports_reasoning_summaries=true --full-auto -- \"$(cat <<'SUPERSET_PROMPT_12345678'",
1717
);
1818
expect(command).toContain("- Only modified file: runtime.ts");
1919
});
@@ -26,7 +26,7 @@ describe("buildAgentPromptCommand", () => {
2626
});
2727

2828
expect(command).toStartWith(
29-
"claude --dangerously-skip-permissions \"$(cat <<'SUPERSET_PROMPT_abcdefgh'",
29+
"claude --permission-mode acceptEdits \"$(cat <<'SUPERSET_PROMPT_abcdefgh'",
3030
);
3131
});
3232

packages/shared/src/builtin-terminal-agents.ts

Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ export const BUILTIN_TERMINAL_AGENTS = [
6262
label: "Claude",
6363
description:
6464
"Anthropic's coding agent for reading code, editing files, and running terminal workflows.",
65-
command: "claude --dangerously-skip-permissions",
65+
command: "claude --permission-mode acceptEdits",
6666
includeInDefaultTerminalPresets: true,
6767
}),
6868
createBuiltinTerminalAgent({
@@ -80,19 +80,18 @@ export const BUILTIN_TERMINAL_AGENTS = [
8080
description:
8181
"OpenAI's coding agent for reading, modifying, and running code across tasks.",
8282
command:
83-
'codex -c model_reasoning_effort="high" --dangerously-bypass-approvals-and-sandbox -c model_reasoning_summary="detailed" -c model_supports_reasoning_summaries=true',
83+
'codex -c model_reasoning_effort="high" -c model_reasoning_summary="detailed" -c model_supports_reasoning_summaries=true --full-auto',
8484
promptCommand:
85-
'codex -c model_reasoning_effort="high" --dangerously-bypass-approvals-and-sandbox -c model_reasoning_summary="detailed" -c model_supports_reasoning_summaries=true --',
85+
'codex -c model_reasoning_effort="high" -c model_reasoning_summary="detailed" -c model_supports_reasoning_summaries=true --full-auto --',
8686
includeInDefaultTerminalPresets: true,
8787
}),
8888
createBuiltinTerminalAgent({
8989
id: "gemini",
9090
label: "Gemini",
9191
description:
9292
"Google's open-source terminal agent for coding, problem-solving, and task work.",
93-
command: "gemini --yolo",
94-
promptCommand: "gemini",
95-
promptCommandSuffix: "--yolo",
93+
command: "gemini --approval-mode=auto_edit",
94+
promptCommand: "gemini --approval-mode=auto_edit",
9695
includeInDefaultTerminalPresets: true,
9796
}),
9897
createBuiltinTerminalAgent({
@@ -101,32 +100,28 @@ export const BUILTIN_TERMINAL_AGENTS = [
101100
description:
102101
"Mastra's coding agent for building, debugging, and shipping code from the terminal.",
103102
command: "mastracode",
104-
includeInDefaultTerminalPresets: true,
105103
}),
106104
createBuiltinTerminalAgent({
107105
id: "opencode",
108106
label: "OpenCode",
109107
description: "Open-source coding agent for the terminal, IDE, and desktop.",
110108
command: "opencode",
111109
promptCommand: "opencode --prompt",
112-
includeInDefaultTerminalPresets: true,
113110
}),
114111
createBuiltinTerminalAgent({
115112
id: "pi",
116113
label: "Pi",
117114
description:
118115
"Minimal terminal coding harness for flexible coding workflows.",
119116
command: "pi",
120-
includeInDefaultTerminalPresets: true,
121117
}),
122118
createBuiltinTerminalAgent({
123119
id: "copilot",
124120
label: "Copilot",
125121
description:
126122
"GitHub's coding agent for planning, editing, and building in your repo.",
127-
command: "copilot --allow-all",
128-
promptCommand: "copilot -i --allow-all",
129-
promptCommandSuffix: "--yolo",
123+
command: "copilot --allow-tool=write",
124+
promptCommand: "copilot -i --allow-tool=write",
130125
includeInDefaultTerminalPresets: true,
131126
}),
132127
createBuiltinTerminalAgent({
@@ -135,7 +130,6 @@ export const BUILTIN_TERMINAL_AGENTS = [
135130
description:
136131
"Cursor's coding agent for editing, running, and debugging code in parallel.",
137132
command: "cursor-agent",
138-
promptCommandSuffix: "--yolo",
139133
}),
140134
] as const;
141135

0 commit comments

Comments
 (0)