You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
docs: agents and skills pages say discovery stops at the project root #64289
The agents and skills docs say project discovery stops at the project root:
agents.mdx: "OpenCode discovers project .opencode directories from the current directory up to the project root."
skills.mdx: "For project sources, OpenCode searches from the current directory up to the project root …"
It doesn't. ConfigDiscovery.discover (packages/core/src/config/discovery.ts) walks fs.up from the current directory with no stop, so .opencode, .claude and .agents directories above the repo root are loaded too. config.mdx already says "to the filesystem root", so the pages contradict each other. Instruction discovery does stop at the project root, so instructions.mdx is fine.
I'd assume the docs are what's wrong here, not the code — happy to send a PR fixing the two sentences.
Plugins
none
OpenCode version
2.3.0
Steps to reproduce
Put an agent at ~/code/.opencode/agents/demo.md (mode: subagent).
Have a separate git repo at ~/code/some-repo.
opencode api get "/api/agent?location[directory]=$HOME/code/some-repo" — demo is listed, although it's above that project's root.
opencode api get "/api/agent?location[directory]=$HOME/code/some-repo" lists demo, and /api/skill lists demo-skill, although both are above that repo's root. The first request can come back before the location has loaded, so the script below polls and waits a few seconds before reading the lists.
It still happens on the latest dev (7745079). There, agents.mdx and skills.mdx still say discovery runs "up to the project root", while config.mdx says "to the filesystem root". ConfigDiscovery still walks up with no stop, so the agents and skills pages don't match the code or the config page.
The script below reproduces it. Maintainers will decide whether the docs or the behaviour should change.
Reproduction script (repro.sh)
#!/usr/bin/env bash# Reproduces #64289: project agents/skills are discovered above the git project root.# Usage: ./repro.sh (uses `opencode` from PATH)# OC="bun --conditions=browser --preload=<repo>/packages/tui/node_modules/@opentui/solid/scripts/preload.js <repo>/packages/cli/src/index.ts" ./repro.shset -u
OC=${OC:-opencode}export HOME=$(mktemp -d /tmp/opencode/home.XXXX)export XDG_CONFIG_HOME=$HOME/.config XDG_DATA_HOME=$HOME/.local/share XDG_STATE_HOME=$HOME/.local/state XDG_CACHE_HOME=$HOME/.cache
mkdir -p "$HOME/code/.opencode/agents""$HOME/code/.opencode/skills/demo-skill""$HOME/code/some-repo"printf -- '---\ndescription: Demo agent above the repo root\nmode: subagent\n---\nYou are demo.\n'>"$HOME/code/.opencode/agents/demo.md"printf -- '---\nname: demo-skill\ndescription: Demo skill above the repo root\n---\nBody\n'>"$HOME/code/.opencode/skills/demo-skill/SKILL.md"
git -C "$HOME/code/some-repo" init -q
git -C "$HOME/code/some-repo" -c user.email=a@b -c user.name=a commit -q --allow-empty -m init
cd"$HOME/code/some-repo"$OC --version
DIR="$HOME/code/some-repo"# The first request can return before the location has loaded; poll until built-ins appear.foriin$(seq 1 30);do$OC api get "/api/agent?location[directory]=$DIR"2>/dev/null | grep -q '"id":"build"'&&break; sleep 1;done
sleep 5
echo"== git project root: $(git rev-parse --show-toplevel)"echo"== agents:"$OC api get "/api/agent?location[directory]=$DIR"2>&1| grep -o '"id":"[^"]*"'| tr '\n''';echoecho"== skills:"$OC api get "/api/skill?location[directory]=$DIR"2>&1| grep -o '"name":"[^"]*"'| tr '\n''';echo
pkill -f "serve --service">/dev/null 2>&1||true
Activity
opencodejr commentedon Nov 16, 2026
Thanks for the clear report. I reproduced this on 2.3.0 with the released CLI.
I used an isolated HOME with:
$HOME/code/.opencode/agents/demo.md(mode: subagent)$HOME/code/.opencode/skills/demo-skill/SKILL.md$HOME/code/some-repoopencode api get "/api/agent?location[directory]=$HOME/code/some-repo"listsdemo, and/api/skilllistsdemo-skill, although both are above that repo's root. The first request can come back before the location has loaded, so the script below polls and waits a few seconds before reading the lists.It still happens on the latest
dev(7745079). There,agents.mdxandskills.mdxstill say discovery runs "up to the project root", whileconfig.mdxsays "to the filesystem root".ConfigDiscoverystill walks up with no stop, so the agents and skills pages don't match the code or the config page.The script below reproduces it. Maintainers will decide whether the docs or the behaviour should change.
Reproduction script (repro.sh)
Run it:
bash repro.sh