anomalyco / anomalyco/opencode

Permission glob patterns in agent .md files silently never match — docs show relative paths but runtime uses absolute paths

Open
#38,351 1 comment 0 reactions 1 assignee View on GitHub

@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
  1. 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/.

  1. Run opencode, invoke spec-writer, ask it to edit docs/specs/api.md

  2. 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.
  3. No warning is emitted. The allow rule is silently dead.

  4. 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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.