forked from anomalyco/opencode
-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Description
Summary
- add an
extendsfrontmatter key for agent markdown files so child agents can inherit prompts, models, permissions, and tooling from a base configuration - resolve
extendstargets 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.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 map- the existing config markdown helper (
packages/opencode/src/config/markdown.ts) only parses@filereferences; we need equivalent wiki-link parsing to driveextends
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
Agentschema validatesextendslinks 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]]
References
- spec/explicit-prototypal-agent.md
Metadata
Metadata
Assignees
Labels
No labels