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
add an extends frontmatter key for agent markdown files so child agents can inherit prompts, models, permissions, and tooling from a base configuration
resolve extends targets via wiki-link syntax (e.g. [[foo/build]]) using the shortest unique path segments so name collisions are disambiguated automatically
Background
packages/opencode/src/config/config.ts loads agent markdown and schema-validates fields, but there is no inheritance mechanism today
packages/opencode/src/agent/agent.ts merges built-in agents with user-defined ones; this is where resolved inheritance chains need to be flattened into the final runtime map
the existing config markdown helper (packages/opencode/src/config/markdown.ts) only parses @file references; we need equivalent wiki-link parsing to drive extends
Requirements
Accept extends: [[agent-path]] (and multi-hop chains) in agent frontmatter; make parsing errors obvious when the link is malformed or the target agent does not exist
Implement wiki-link path resolution that picks the smallest unique suffix when duplicate filenames exist in different folders, expanding only as needed to uniquely identify the target
Merge inherited settings before exposing agents to the rest of the app: prompts, tools, permissions, and arbitrary option keys should fall back to the parent while allowing explicit overrides in the child
Detect cycles or ambiguous wiki links during config load and raise configuration errors that include the offending filenames/paths
Add docs and tests (e.g. packages/opencode/test/config) that cover the resolver behavior, a successful inheritance chain, and failure modes for collisions or circular references; ensure existing suites still pass
Definition of Done
Agent schema validates extends links and errors early on invalid inputs
wiki-link resolver can uniquely identify any agent markdown using minimal path segments
inherited agents appear in opencode agent list/TUI with merged settings and correct prompts
tests and docs describe how to author extends: [[agent-name]]
Summary
extendsfrontmatter key for agent markdown files so child agents can inherit prompts, models, permissions, and tooling from a base configurationextendstargets via wiki-link syntax (e.g.[[foo/build]]) using the shortest unique path segments so name collisions are disambiguated automaticallyBackground
packages/opencode/src/config/config.tsloads agent markdown and schema-validates fields, but there is no inheritance mechanism todaypackages/opencode/src/agent/agent.tsmerges built-in agents with user-defined ones; this is where resolved inheritance chains need to be flattened into the final runtime mappackages/opencode/src/config/markdown.ts) only parses@filereferences; we need equivalent wiki-link parsing to driveextendsRequirements
extends: [[agent-path]](and multi-hop chains) in agent frontmatter; make parsing errors obvious when the link is malformed or the target agent does not existpackages/opencode/test/config) that cover the resolver behavior, a successful inheritance chain, and failure modes for collisions or circular references; ensure existing suites still passDefinition of Done
Agentschema validatesextendslinks and errors early on invalid inputsopencode agent list/TUI with merged settings and correct promptsextends: [[agent-name]]References