anomalyco / anomalyco/opencode
Permission glob patterns in agent .md files silently never match — docs show relative paths but runtime uses absolute paths
@jlongster is already working on this.
Since Jul 22, 2026.
- Dominant language
- TypeScript
- Stars
- 209k
- Forks
- 27.5k
- PR merge metrics
- PR metrics pending
Description
Description
When defining permissions in a custom agent .md file, path patterns like "docs/specs/**"
silently never match. No error, no warning. The permission falls through to default
(ask/deny) as if the pattern doesn't exist.
This is because the runtime resolves files to absolute paths
(e.g. /home/user/project/docs/specs/api.md) before glob-matching,
but the docs and examples show project-relative patterns.
Plugins
No plugin
OpenCode version
1.18.3
Steps to reproduce
- Create .opencode/agents/spec-writer.md:
name: spec-writer
model: anthropic/claude-sonnet-4-20250514
permission:
edit:
"*": deny
"docs/specs/**": allow
You are a spec writer. Only edit files under docs/specs/.
-
Run opencode, invoke spec-writer, ask it to edit docs/specs/api.md
-
Expected: edit is allowed
(last matching pattern "docs/specs/**" should override "*": deny)Actual: edit is DENIED.
The runtime tests patterns against the absolute path
/home/user/project/docs/specs/api.md.- "*" → matches → deny
- "docs/specs/**" → does NOT match (relative vs absolute)
Last match is "*": deny. Agent cannot edit anything.
-
No warning is emitted. The allow rule is silently dead.
-
Change to "*/docs/specs/**": allow → works as intended:
- "*" → matches → deny
- "*/docs/specs/**" → matches → allow (last hit wins)
Result: ALLOW
Screenshot and/or share link
No response
Operating System
Ubuntu 26.04 LTS
Terminal
Windows treminal
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.