Skip to content

Custom agent configs in oh-my-opencode.json are silently ignored #468

@fparrav

Description

@fparrav

Problem

Custom agents (like conductor from opencode-conductor-plugin) configured in oh-my-opencode.json are silently ignored. Only the hardcoded list of builtin agents is accepted.

Expected Behavior

// oh-my-opencode.json
{
  "agents": {
    "conductor": {
      "model": "google/gemini-3-flash"
    }
  }
}

Should configure the conductor agent to use Gemini Flash.

Actual Behavior

The config is silently discarded. The conductor agent uses the default model instead.

Root Cause

Bug 1: AgentOverridesSchema has hardcoded whitelist

In src/config/schema.ts, the AgentOverridesSchema only accepts specific agent names:

export const AgentOverridesSchema = z.object({
  build: AgentOverrideConfigSchema.optional(),
  plan: AgentOverrideConfigSchema.optional(),
  Sisyphus: AgentOverrideConfigSchema.optional(),
  // ... other hardcoded agents
  "multimodal-looker": AgentOverrideConfigSchema.optional()
});

Any agent not in this list (like conductor) is stripped by Zod validation.

Bug 2: loadAgentsFromDir() ignores model field

In src/features/claude-code-agent-loader/loader.ts, the loadAgentsFromDir() function only extracts a subset of frontmatter fields:

const config = {
  description: formattedDescription,
  mode: "subagent",  // hardcoded!
  prompt: body.trim()
};

It ignores: model, temperature, top_p, permission, color, and uses hardcoded mode: "subagent".

Proposed Fix

Fix 1: Use z.record() for arbitrary agents

export const AgentOverridesSchema = z.record(
  z.string(),
  AgentOverrideConfigSchema
).optional();

Fix 2: Extract all frontmatter fields

const config: AgentConfig = {
  description: formattedDescription,
  mode: data.mode || "subagent",
  model: data.model,
  temperature: data.temperature,
  top_p: data.top_p,
  permission: data.permission,
  color: data.color,
  prompt: body.trim()
};

Impact

This affects any plugin that defines custom agents (like opencode-conductor-plugin). Users cannot configure these agents via oh-my-opencode.json as documented.

Workaround

Configure custom agents in opencode.json under "agent" instead:

{
  "agent": {
    "conductor": {
      "model": "google/gemini-3-flash"
    }
  }
}

Related

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