Context
Our team flagged that the current binary may not support custom commands functionality (.opencode/ commands). This needs investigation to determine:
- Does our current fork support custom commands? Or does it require the upstream permission rework?
- What exactly needs porting to enable full custom command + task permission support?
What to Port from Upstream
Upstream repo: git@github.com:anomalyco/opencode.git
4 commits in order (each depends on the previous):
| # |
Commit |
Date |
Description |
| 1 |
351ddeed9 |
Jan 1, 2026 |
Permission rework — foundation. Creates PermissionNext system. 66 files, 3,587 insertions. This is the big one. |
| 2 |
fd7b7eacd |
Jan 7, 2026 |
Granular task permissions — the main feature. Adds permission.task object support + hidden agent config. 8 files, 580 insertions. |
| 3 |
34c9d106e |
Jan 7, 2026 |
Refactor — simplifies #2, moves filtering into task.ts, removes filterSubagents export. 3 files, net -162 lines. |
| 4 |
5d37e58d3 |
Jan 13, 2026 |
Fix nested permissions — subagents inherit parent's task permissions. 1 file, 13 insertions. |
Files Involved
Core (must port):
packages/opencode/src/permission/next.ts — permission evaluation engine
packages/opencode/src/tool/task.ts — task tool agent filtering
packages/opencode/src/agent/agent.ts — permission composition on agent creation
packages/opencode/src/config/config.ts — config schema for permission.task object + hidden field
packages/opencode/src/session/prompt.ts — tool resolution with permission filtering
Types:
packages/sdk/js/src/v2/gen/types.gen.ts — hidden?: boolean on AgentConfig
Tests:
packages/opencode/test/permission-task.test.ts — 312 lines of coverage
How It Works
- Config parsing:
"task": {"*": "deny", "agent": "allow"} parsed into ordered rules
- Agent filtering: Task tool's
init() filters accessible agents — denied agents removed from tool description entirely (model never sees them)
- Runtime check:
ctx.ask() with permission patterns on execution
- Rule matching: Last matching rule wins. Supports wildcards (
*, prefix-*)
- Actions:
"allow" (no prompt), "deny" (invisible), "ask" (user approval)
Porting Strategy
Commit 351ddeed9 (Permission rework) is the largest dependency — 66 files. If that's too invasive, the team could alternatively extract just the PermissionNext module (next.ts + arity.ts) and wire it into the existing task tool. The 3 subsequent commits are small and targeted.
Investigation Needed
Quality Gates
Context
Our team flagged that the current binary may not support custom commands functionality (
.opencode/commands). This needs investigation to determine:What to Port from Upstream
Upstream repo:
git@github.com:anomalyco/opencode.git4 commits in order (each depends on the previous):
351ddeed9fd7b7eacd34c9d106e5d37e58d3Files Involved
Core (must port):
packages/opencode/src/permission/next.ts— permission evaluation enginepackages/opencode/src/tool/task.ts— task tool agent filteringpackages/opencode/src/agent/agent.ts— permission composition on agent creationpackages/opencode/src/config/config.ts— config schema for permission.task object + hidden fieldpackages/opencode/src/session/prompt.ts— tool resolution with permission filteringTypes:
packages/sdk/js/src/v2/gen/types.gen.ts—hidden?: booleanon AgentConfigTests:
packages/opencode/test/permission-task.test.ts— 312 lines of coverageHow It Works
"task": {"*": "deny", "agent": "allow"}parsed into ordered rulesinit()filters accessible agents — denied agents removed from tool description entirely (model never sees them)ctx.ask()with permission patterns on execution*,prefix-*)"allow"(no prompt),"deny"(invisible),"ask"(user approval)Porting Strategy
Commit
351ddeed9(Permission rework) is the largest dependency — 66 files. If that's too invasive, the team could alternatively extract just the PermissionNext module (next.ts+arity.ts) and wire it into the existing task tool. The 3 subsequent commits are small and targeted.Investigation Needed
.opencode/directory) work in our current fork WITHOUT the permission rework351ddeed9overlap with our fork's changes/custom commands at allQuality Gates