feat(claude): ask before agent config file edits #216
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "feat/agent-config-ask"
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?
Why
Since
adb02f0narrowed the sandbox, nothing asks before Claude's filetools edit the files that configure the agents. In
bypassPermissionsmode an agent rewrote
.claude/settings.local.jsonwith no prompt, andthe same holds for the hook scripts, skills, briefs, and
AGENTS.md:one mistaken step or injected instruction can lift a protection that
every later session then loses. Closes #215 and #213.
Claude Code's permissions and permission-modes pages say an explicit
askrule prompts in every mode,bypassPermissionsincluded, and thatEditrules cover every built-in file-editing tool. Restoring thesandbox's
filesystem.denyWriteon the same paths, as #215 alsoproposes, was set aside: it would undo part of adb02f0's narrowing.
What changed
Before, an agent's
Edit,Write, orNotebookEditof.agents/,AGENTS.md,AGENTS.local.md, the CLAUDE files,.claude/,.codex/,or
.opencode/ran unasked inbypassPermissionsmode. Now each asks,in every mode, at the project root and every depth below it, the
worktrees under
.worktrees/included. A shell command that writesthose files is unchanged.
The README's Hooks and settings section says which edits ask, what a
shell write meets instead, and that a developer's own settings cannot
lift an ask rule.
Every policy edit in a worktree, as in this source's own maintenance,
now prompts.
How to verify
With this branch merged into the main checkout, start Claude Code at the
root in
bypassPermissionsmode and ask it to add a blank line toAGENTS.md, then to a file under.worktrees/<branch>/.agents/: eachedit asks first. On main both go through unasked.
bash tests/verify-agent-config.sh(234 passed),bash tests/check-work-folder.sh,.agents/hooks/shellcheck.sh repo,prettier --check '**/*.md',scripts/verify-agent-config.sh, andgit diff --check mainpass on the tip; the bubblewrap and python3tests were skipped inside Claude Code's sandbox. The test "asks before a
file tool edits an agent configuration file, …" fails on main. The live
prompt check above was not run, since the rules take effect only from
the main checkout's settings.
Considerations
Claude Code's docs do not say verbatim that
/**/matches the projectroot's top level, which
Edit(/**/AGENTS.md)needs; the live checksettles it. No
UPGRADING.mdmigration announces the new prompts to anupgrading repository, by the maintainer's choice.