Skip to content
This repository was archived by the owner on Aug 6, 2026. It is now read-only.

Commit 8a9408d

Browse files
authored
feat: Add auto permission mode for Claude adapter (#1749)
## Problem Claude upstream supports an auto mode that uses a model classifier to approve/deny permission prompts, but it was previously skipped in our fork. ## ![CleanShot 2026-04-20 at 20.30.50@2x.png](https://app.graphite.com/user-attachments/assets/301def01-e5d0-4879-995f-48709643caae.png) ## Changes 1. Add auto to CODE_EXECUTION_MODES, available modes and AUTO_ALLOWED_TOOLS 2. Add "auto" option to ExitPlanMode permission options and approval handler 3. Map auto mode to Codex native auto mode 4. Update ModeSelector UI with Robot icon and blue styling for auto mode 5. Update [UPSTREAM.md](http://UPSTREAM.md) to reflect auto mode is now adopted <!-- What did you change and why? --> <!-- If there are frontend changes, include screenshots. --> ## How did you test this? Manually <!-- Describe what you tested -- manual steps, automated tests, or both. --> <!-- If you're an agent, only list tests you actually ran. -->
1 parent b548a39 commit 8a9408d

9 files changed

Lines changed: 30 additions & 20 deletions

File tree

‎apps/code/src/renderer/features/message-editor/components/ModeSelector.tsx‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import {
66
LockOpen,
77
Pause,
88
Pencil,
9+
Robot,
910
ShieldCheck,
1011
} from "@phosphor-icons/react";
1112
import {
@@ -42,8 +43,8 @@ const MODE_STYLES: Record<string, ModeStyle> = {
4243
className: "text-red-11",
4344
},
4445
auto: {
45-
icon: <Pencil size={12} />,
46-
className: "text-gray-11",
46+
icon: <Robot size={12} weight="fill" />,
47+
className: "text-blue-11",
4748
},
4849
"read-only": {
4950
icon: <Eye size={12} />,

‎apps/code/src/renderer/features/settings/components/sections/ClaudeCodeSettings.tsx‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -196,9 +196,9 @@ export function ClaudeCodeSettings() {
196196
<Warning weight="fill" />
197197
</Callout.Icon>
198198
<Callout.Text>
199-
Auto-accept is enabled. All actions (shell commands, file edits, web
200-
requests) run without approval. Pick this mode from the mode menu in
201-
the prompt input per session.
199+
Bypass Permissions is enabled. All actions (shell commands, file
200+
edits, web requests) run without approval. Pick this mode from the
201+
mode menu in the prompt input per session.
202202
</Callout.Text>
203203
</Callout.Root>
204204
)}

‎packages/agent/src/adapters/claude/UPSTREAM.md‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,6 @@ Fork of `@anthropic-ai/claude-agent-acp`. Upstream repo: https://github.com/anth
5151
| Session storage | `this.sessions[sessionId]` (multi) | `this.session` (single) | Architectural choice |
5252
| bypassPermissions | `updatedPermissions` with `destination: "session"` | No `updatedPermissions` | Different permission persistence |
5353
| Auth methods | `claude-ai-login` + `console-login` | Returns empty `authMethods` | Auth handled externally |
54-
| `auto` mode | Model classifier for auto-approval | Not implemented | PostHog uses its own permission model |
5554
| Session fingerprinting | Implicit teardown on cwd/mcp change | Explicit `refreshSession()` | Caller-initiated is more predictable |
5655
| Shutdown on ACP close | Process exits | No standalone process | Agent is embedded in server |
5756

@@ -65,10 +64,10 @@ Fork of `@anthropic-ai/claude-agent-acp`. Upstream repo: https://github.com/anth
6564
- **Mid-stream usage updates** (v0.29.1): Fire `usage_update` from `message_start`/`message_delta` stream events
6665
- **Raw SDK message relay** (v0.27.0): `emitRawSDKMessages` on `NewSessionMeta` for opt-in diagnostics
6766
- **Effort level sync** (v0.25.x): `xhigh` level added, `applyFlagSettings` on effort change
67+
- **Auto permission mode** (v0.25.0): Added to `CODE_EXECUTION_MODES`, available modes, ExitPlanMode options
6868

6969
## Skipped in v0.30.0 Sync
7070

71-
- **`auto` permission mode** (v0.25.0): PostHog has its own permission model
7271
- **Separate auth methods** (v0.25.0): PostHog returns empty authMethods
7372
- **Session fingerprinting** (v0.25.3): PostHog uses explicit `refreshSession()` instead
7473
- **Process exit on ACP close** (v0.27.0): PostHog embeds agent in server

‎packages/agent/src/adapters/claude/permissions/permission-handlers.ts‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,8 @@ async function applyPlanApproval(
164164

165165
if (
166166
response.outcome?.outcome === "selected" &&
167-
(response.outcome.optionId === "default" ||
167+
(response.outcome.optionId === "auto" ||
168+
response.outcome.optionId === "default" ||
168169
response.outcome.optionId === "acceptEdits" ||
169170
response.outcome.optionId === "bypassPermissions")
170171
) {

‎packages/agent/src/adapters/claude/permissions/permission-options.ts‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,11 @@ export function buildExitPlanModePermissionOptions(): PermissionOption[] {
106106
}
107107

108108
options.push(
109+
{
110+
kind: "allow_always",
111+
name: 'Yes, and use "auto" mode',
112+
optionId: "auto",
113+
},
109114
{
110115
kind: "allow_always",
111116
name: "Yes, and auto-accept edits",

‎packages/agent/src/adapters/claude/tools.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,10 +41,10 @@ const BASE_ALLOWED_TOOLS = [
4141
];
4242

4343
const AUTO_ALLOWED_TOOLS: Record<string, Set<string>> = {
44+
auto: new Set(BASE_ALLOWED_TOOLS),
4445
default: new Set(BASE_ALLOWED_TOOLS),
4546
acceptEdits: new Set([...BASE_ALLOWED_TOOLS, ...WRITE_TOOLS]),
4647
plan: new Set(BASE_ALLOWED_TOOLS),
47-
// dontAsk: new Set(BASE_ALLOWED_TOOLS),
4848
};
4949

5050
export function isToolAllowedForMode(

‎packages/agent/src/adapters/codex/codex-agent.ts‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,7 @@ function prependPrContext(params: PromptRequest): PromptRequest {
124124
}
125125

126126
const CODEX_NATIVE_MODE: Record<CodeExecutionMode, CodexNativeMode> = {
127+
auto: "auto",
127128
default: "auto",
128129
acceptEdits: "auto",
129130
plan: "read-only",

‎packages/agent/src/execution-mode.test.ts‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ describe("execution modes", () => {
88
"acceptEdits",
99
"plan",
1010
"bypassPermissions",
11+
"auto",
1112
]);
1213
});
1314

‎packages/agent/src/execution-mode.ts‎

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -25,28 +25,30 @@ const availableModes: ModeInfo[] = [
2525
name: "Plan Mode",
2626
description: "Planning mode, no actual tool execution",
2727
},
28-
// {
29-
// id: "dontAsk",
30-
// name: "Don't Ask",
31-
// description: "Don't prompt for permissions, deny if not pre-approved",
32-
// },
3328
];
3429

3530
if (ALLOW_BYPASS) {
36-
availableModes.push({
37-
id: "bypassPermissions",
38-
name: "Auto-accept Permissions",
39-
description: "Auto-accept all permission requests",
40-
});
31+
availableModes.push(
32+
{
33+
id: "bypassPermissions",
34+
name: "Bypass Permissions",
35+
description: "Auto-accept all permission requests",
36+
},
37+
{
38+
id: "auto",
39+
name: "Auto Mode",
40+
description: "Use a model classifier to approve/deny permission prompts",
41+
},
42+
);
4143
}
4244

4345
// Expose execution mode IDs in type-safe order for type checks
4446
export const CODE_EXECUTION_MODES = [
4547
"default",
4648
"acceptEdits",
4749
"plan",
48-
// "dontAsk",
4950
"bypassPermissions",
51+
"auto",
5052
] as const;
5153

5254
export type CodeExecutionMode = (typeof CODE_EXECUTION_MODES)[number];

0 commit comments

Comments
 (0)