The report: "every time I configure settings.json it is overwritten and
reset" for permissions.defaultMode = bypassPermissions.
Cause, reproduced in a sandbox HOME with Claude Code 2.1.316: magpie's
writes to ~/.claude/settings.json are key-level and kept the user's
permissions block. Claude Code itself drops the mode: it ignores
bypassPermissions at launch unless skipDangerousModePermissionPrompt is
true, and its auto-mode nudge and /config write defaultMode over it.
Change:
- agent.Field gets Own: the user's own setting of the agent. Apply does
not record it, Disconnect neither clears nor restores it, Pick never
connects the agent for it, magpieValueIn is false for it, and profiles
(Fields, ApplyFields, InUse) and the WSL copy leave it alone. So the
mode outlives disconnecting magpie and switching profiles.
- Claude Code's permission_mode field (default, acceptEdits, plan, auto,
dontAsk, bypassPermissions; "" removes the key) writes
permissions.defaultMode, and bypassPermissions also writes
skipDangerousModePermissionPrompt: true so Claude Code honours it.
- GUI: own fields go in agentJSON.own, apart from fields, and
agentcompact.js draws them in an Advanced fold (collapsed) under the
agent's settings, with the app menu (no <select>). app.js unchanged.
Labels in en, zh, zh-TW, ja, de (zh: 高级 › 权限模式 › 跳过权限确认).
- docs/subsystems/agent-wiring.md: Fields and options row.
Run at this tree (base aa358555f, origin/main at commit time), on mote/mica:
- go test ./internal/agent -run 'Permission|Profile' ; ./internal/profile ;
./internal/gui -run 'Budget|PermissionMode|AgentOwn|AgentModels': ok
- GUI claude-permission-mode.test.cjs in chromium and webkit, en and zh:
4/4; i18n-keys, i18n-en-no-cjk: ok
- gofmt -l: clean. go vet ./..., GOOS=linux go vet -tags nogui ./...,
GOOS=windows go vet ./...: ok
Broken by hand:
- Own: false on the field: TestClaudePermissionModeOutlivesMagpie
("disconnecting took the mode to \"\"") and TestProfileLeavesPermissionMode
("a profile wrote the permission mode") went red.
- Without the GUI own/fields split, the "not a picker on the row" check in
claude-permission-mode.test.cjs went red.
Not run yet: the full go test ./... and the full GUI suite. Both machines
had another session's GUI suite running; they run next and their result
goes on the follow-up. Not tried: a real Claude Code session's /config
changing the mode back (Claude Code's own write; this change can't stop it).