Skip to content

web: session in nested project folder opens at git repo root, nested .opencode/skills not discovered #51191

Description

@emad-elsaid

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

  1. Have a git repo at ~/Documents and a subdirectory ~/Documents/knowledgebase containing .opencode/skills/<id>/SKILL.md files (valid frontmatter with name + description).
  2. In the web UI, open ~/Documents/knowledgebase — it appears in the project list as its own project, separate from Documents.
  3. Start a new session in that project.
  4. 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

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions