Skip to content

SDK checkAgentsInstalled ignores project-local .opencode/agents/ directory #119

Description

@allanchan339

Bug Description

checkAgentsInstalled() in the SDK only checks for agents in the global runtime config directory (~/.config/opencode/agents/ for opencode runtime), but does not check or consider agents installed in the project-local .opencode/agents/ directory.

Steps to Reproduce

  1. Install GSD agents in a project's .opencode/agents/ directory
  2. Run gsd-sdk query init.new-project
  3. Observe agents_installed: false and a full list of missing_agents, even though the agent files exist

Expected Behavior

Both global (~/.config/opencode/agents/) and project-local (.opencode/agents/) directories should be checked. If agents exist in either location, agents_installed should be true.

Root Cause

In sdk/dist/query/helpers.js, resolveAgentsDir() returns the global config path only:

export function resolveAgentsDir(runtime = 'claude') {
    if (process.env.GSD_AGENTS_DIR)
        return process.env.GSD_AGENTS_DIR;
    return join(getRuntimeConfigDir(runtime), 'agents');  // ~/.config/opencode/agents/
}

And checkAgentsInstalled() only probes that single directory.

Suggested Fix

Modify checkAgentsInstalled() to also check for agents in the project directory (.opencode/agents/) in addition to the global agents directory. The agent files in the local directory should be treated as valid installations.

Environment

  • Runtime: opencode
  • Agents location: local_repo/.opencode/agents/ (project-local)
  • Global agents dir: ~/.config/opencode/agents/ (does not exist)
  • SDK version: v1.38.5

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions