Ask before editing any agent configuration file #215
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Defect
Since
adb02f0narrowed the sandbox, nothing asks before an agent editsthe files that configure the agents themselves:
.agents/,AGENTS.md,AGENTS.local.md, the CLAUDE files,.claude/,.codex/,and
.opencode/. The sandbox'sdenyWriteon them went, and.claude/settings.jsonholds noaskrule for them, so inbypassPermissionsmode the file tools edit them with no prompt, and asandboxed command writes them as freely.
Seen at
99fc8652bb.These files decide what every later session follows and runs: the
policy, the skills, the subagent briefs, the hook scripts that the
PreToolUse and PostToolUse hooks run, and the settings. #213 covers
only
.claude/settings.jsonand.claude/settings.local.json; thisissue asks the same for every agent configuration file.
Scenario
A developer runs a session in
bypassPermissionsmode. An instructioninjected into what the agent reads, or a mistaken step, has it rewrite a
hook script under
.agents/hooks/, a skill, orAGENTS.md. Every latersession runs or follows the changed file, and nothing asked first.
Requested behavior
Every edit of an agent configuration file asks the user, in every
permission mode, at every depth below the project root, the worktrees
under
.worktrees/included, so a policy change in a worktree alsoasks.
Smallest fix
Add
Editrules topermissions.askin.claude/settings.json, whichcover every built-in file-editing tool,
Writeincluded, anchored atthe project root as #213 proposes, for example:
A shell write cannot be matched by a rule, so the sandbox's
filesystem.denyWriteon the same paths would come back for commandsinside it, leaving shell edits of these files to a command run outside
the sandbox, which prompts. The README's Hooks and settings section and
the sandbox guide would say which files ask. This supersedes #213 if
taken whole.