Summary
Starting a session in a project whose folder is a subdirectory of a git repository creates the session at the repository root instead of the picked folder. As a result, everything discovery-scoped to the picked folder — most notably .opencode/skills/ — is not loaded for the session.
Environment
- opencode version: 2.0.12 (server; web UI served via
opencode serve --port 4000)
- OS: Arch Linux x86_64, kernel 7.2.6-arch2-1
- Terminal: n/a (web UI in a browser)
- Shell: /usr/bin/bash
- Install/channel: latest channel, native binary at
/usr/bin/opencode
- Active plugins: none
Reproduction
- Have a git repo at
~/Documents and a subdirectory ~/Documents/knowledgebase containing .opencode/skills/<id>/SKILL.md files (valid frontmatter with name + description).
- In the web UI, open
~/Documents/knowledgebase — it appears in the project list as its own project, separate from Documents.
- Start a new session in that project.
- Inspect the session:
GET /api/session/{sessionID} shows location.directory = ~/Documents (the git repo root), and the session's available skills do not include the skills from knowledgebase/.opencode/skills/.
Expected Behavior
The session should be rooted at the opened folder (~/Documents/knowledgebase). The server API already models this correctly — creating a session with an explicit nested directory keeps the directory and records the relationship to the parent project via subpath:
POST /api/session {"location":{"directory":"~/Documents/knowledgebase"}}
→ {"data":{"projectID":"24386f…","subpath":"knowledgebase",
"location":{"directory":"~/Documents/knowledgebase"}}}
Skill discovery then works for that location:
GET /api/skill?location[directory]=~/Documents/knowledgebase
→ opencode, report, bug-finder, nested-skill-1 … nested-skill-6 (9 skills)
GET /api/skill?location[directory]=~/Documents
→ opencode, report, bug-finder (nested skills missing)
Actual Behavior
The session created by the web UI is registered at the git repo root, so skill discovery — which scans .opencode/skills from the session directory upward and never into child directories — cannot see knowledgebase/.opencode/skills/. None of the nested skills are advertised to the model. The project path shown for the session is also the repo root rather than the opened folder.
Additional Context
Summary
Starting a session in a project whose folder is a subdirectory of a git repository creates the session at the repository root instead of the picked folder. As a result, everything discovery-scoped to the picked folder — most notably
.opencode/skills/— is not loaded for the session.Environment
opencode serve --port 4000)/usr/bin/opencodeReproduction
~/Documentsand a subdirectory~/Documents/knowledgebasecontaining.opencode/skills/<id>/SKILL.mdfiles (valid frontmatter withname+description).~/Documents/knowledgebase— it appears in the project list as its own project, separate fromDocuments.GET /api/session/{sessionID}showslocation.directory=~/Documents(the git repo root), and the session's available skills do not include the skills fromknowledgebase/.opencode/skills/.Expected Behavior
The session should be rooted at the opened folder (
~/Documents/knowledgebase). The server API already models this correctly — creating a session with an explicit nested directory keeps the directory and records the relationship to the parent project viasubpath:Skill discovery then works for that location:
Actual Behavior
The session created by the web UI is registered at the git repo root, so skill discovery — which scans
.opencode/skillsfrom the session directory upward and never into child directories — cannot seeknowledgebase/.opencode/skills/. None of the nested skills are advertised to the model. The project path shown for the session is also the repo root rather than the opened folder.Additional Context
POST /api/session/{id}/move) fixes it — after the move, all nested skills load correctly. This confirms the skills and discovery are fine and only the initial session location is wrong.