[Bug]: OpenCode project-local agents are missing from the agent picker
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 23k
- Forks
- 5.9k
- Avg merge
- 11h 14m
- Merged PRs (30d)
- 357
Description
Before submitting
- I searched existing issues and did not find a duplicate.
- I included enough detail to reproduce or investigate the problem.
Area
apps/server
Steps to reproduce
-
Create a project-local OpenCode agent at
.opencode/agent/readonly.mdinside a project's folder, not global config:--- description: Read-only agent for inspecting the project. mode: all permission: edit: deny bash: deny todowrite: deny --- You are a read-only agent. -
From the project directory, run:
opencode agent list -
Confirm that OpenCode reports the project-local agent:
build (primary) plan (primary) readonly (all) -
Add or open the same directory as a project in T3 Code.
-
Select the OpenCode provider and open the agent selector.
Expected behavior
T3 Code should include visible project-local OpenCode agents whose mode is primary or all.
The readonly agent should appear alongside the built-in build and plan agents, matching the agents OpenCode reports when invoked from that project directory.
Actual behavior
The project-local readonly agent is absent from the T3 Code agent selector.
The OpenCode provider cache contains only the globally discovered build and plan agents, even though:
- The chat session is started with the correct project directory.
opencode agent listfrom that directory reportsreadonly (all).- The agent definition is valid and available in the native OpenCode interface.
This appears to happen because OpenCode agent capabilities are cached at the provider-instance level using a discovery directory that can differ from the selected project's directory. Project-local agents are therefore not represented in the cached model capabilities used by the composer.
Impact
Major degradation or frequent failure
Project-specific agents are a supported OpenCode configuration mechanism. Their absence means workflows and permission profiles defined by individual projects cannot be selected through T3 Code.
Version or commit
- T3 Code: 0.0.40
- OpenCode: 1.18.31
Environment
Linux, T3 Code web/server mode, OpenCode provider.
Logs or stack traces
# From the affected project:
$ opencode agent list
build (primary)
compaction (primary)
explore (subagent)
general (subagent)
plan (primary)
summary (primary)
title (primary)
readonly (all)
# Agent options represented in ~/.t3/caches/opencode.json:
[
"build",
"plan"
]
The corresponding OpenCode session metadata confirms that T3 starts the chat with the affected project as its working directory.
Related issues
- #7853 reported globally configured custom agents being omitted. It was closed after #8480 changed discovery to OpenCode's native
app.agentsAPI. This report is different: globally available built-ins are discovered, but agents defined under a specific project's.opencode/agent/directory are still absent. - #9833 concerns the separate client-side feature flag that hides the built-in
planagent. It does not cover project-local agent discovery.
Workaround
Use the project-local agent through the native OpenCode tui or web ui. No T3 Code workaround is currently known.
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.
Research direction
Start in apps/server and trace OpenCode provider capability discovery and its provider-level cache, paying attention to the discovery directory versus the selected project directory. Reproduce with a project-local .opencode/agent/readonly.md and compare the cached agents with opencode agent list. Done means project-local agents with primary or all mode appear in the T3 Code agent selector.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 70/100