AIToday
AI Coding AssistantsAI Safety & AlignmentZenn AI/MLPublished: Oct 8, 2026, 22:00 JST

Claude Code vs OpenCode: opposite permission order trips users

Claude Code vs OpenCode: opposite permission order trips users

3 Key Points

  1. What happened

    Testing Claude Code 2.1.287 and OpenCode 1.18.34, the author found Claude Code applies deny → ask → allow and stops at the first match, while OpenCode lets the last matching rule win.

  2. Why it matters

    In the test, a request to delete data/notes.txt was blocked by OpenCode's edit setting, not by its rm deny rule, because the agent used apply_patch rather than Bash.

  3. What to watch

    Since v2.1.283, interactive Claude Code sessions start in auto mode, and acceptEdits auto-approves rm inside the working folder.

WHO IT HITSDevelopers and platform teams who hand routine coding tasks to AI agents need to audit both the Bash rules and the file-editing rules, because a deletion can slip through whichever path is left on allow. For teams running these agents in CI, OpenCode auto-rejects ask prompts in non-interactive runs, so an ask rule there effectively means a hard stop.

Not sure about something? Ask the AI

Questions and answers are published on this page.

Summaries like this, in your inbox every morning.

Context & Analysis

The article frames permission settings not as a security wall but as a way to reduce the accidents that happen with the commands an agent normally writes. Claude Code's own documentation notes that instructions in prompts or CLAUDE.md affect what Claude tries to do but not what Claude Code permits, so writing "don't read .env" in an instruction file is not a restriction.

Both tools match rules against command strings. Bash(rm *) stops rm -rf build/ but not /bin/rm -rf build/ or bash -c 'rm -rf build/', and Bash(git push *) does not match git -C . push origin main — the article suggests combining sandboxing or containers when OS-level limits are needed.

The comparison table also flags a gap: Claude Code applies a repository's allow rules only after the trust dialog is accepted, while the author found no equivalent statement in OpenCode's documentation. The suggested check is to actually ask each agent four things in a practice repository — read .env, delete a file, git push, and run tests — then verify output with git status and git diff rather than trusting the agent's own report.

FAQ
In what order does each tool check permission rules?
Claude Code evaluates deny, then ask, then allow, and the first match decides; specificity does not change the order. OpenCode applies the last matching rule, so general rules go first and exceptions go last.
Why was a file deletion still blocked in OpenCode despite an rm deny rule?
The agent deleted the file with a file-editing tool (apply_patch's Delete File) rather than Bash, so the edit: ask setting blocked it. If edit had been left on its default allow, the deletion could have gone through.
Do allow rules from a cloned repository take effect immediately?
In Claude Code, permissions.allow entries in a project's .claude/settings.json are not applied until you accept that folder's trust dialog. deny and ask rules only add restrictions, so they apply before trust is granted.

AI news that matters for your work, delivered every morning.

Pick your industry and the AI tools you use, and get news related to your work every day.

Free · 30 seconds with Google · unsubscribe anytimeWhat is AIToday? →

Ask AI

Ask AI anything about this article. The AI reads this article, earlier AIToday articles, and Wikipedia, and cites its sources. Q&As are published on this page for other readers too.

Questions and answers are published on this page.

Related Articles

Next articleArmature's agent.reviews lets AI agents rate software