docs: document YAML anchors, aliases and merge keys#3175
Merged
Conversation
Add a "Reusable YAML (anchors & aliases)" section to the configuration overview and an examples/yaml-anchors.yaml file, showing how to reuse a value across agents with &anchor / *alias / <<, which the parser already supports. Document the constraints the strict loader imposes: anchors must live on a real value in a known section, and overriding a merged key works in agents: but not in models:/mcps:/providers:/rag:. Closes #3112
docker-agent
left a comment
There was a problem hiding this comment.
Assessment: 🟢 APPROVE
Reviewed: docs/configuration/overview/index.md, examples/yaml-anchors.yaml
This is a documentation-only PR. The automated analysis examined the added content for factual inaccuracies, YAML validity issues, schema path correctness, and consistency between the doc snippets and the runnable example.
No confirmed bugs or issues were found. Specific checks that passed:
yaml-language-server: $schema=../agent-schema.jsonresolves correctly fromexamples/to the repo rootagent-schema.jsontoolsetsis the correct field name inAgentConfig(nottools)- The merge-key override example in
documentercorrectly uses<<: *specialist+description:override, which the PR notes works inagents:due toMapSlicepre-resolution - The documented behavior table (anchor+alias works everywhere;
<<override fails outsideagents:) matches the callout warnings in the added doc text - The chained anchor pattern (
&house_rules→*house_rulesinside&specialist→*specialist) is valid YAML - The warning about
defaults:top-level block being rejected is consistent with the known behavior
Note: The drafter agent returned
review_complete: false(likely context exhaustion on a small diff). All hypotheses examined were dismissed as non-issues. No findings were escalated to verification.
dgageot
approved these changes
Jun 19, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Documents that Docker Agent already supports YAML anchors (
&name), aliases (*name) and merge keys (<<), and adds a runnable example. Covers the same-file DRY use cases from #3112.Why
#3112 asks for reusable config fragments. The recommended option there (native YAML anchors) needs no code: the parser already resolves anchors, aliases and merge keys. What was missing is documentation.
Changes
docs/configuration/overview/index.mdexamples/yaml-anchors.yaml&anchor,*aliasand<<Documented behavior (verified against the loader)
agents:models:/mcps:/ others<<adding only new keys<<overriding a merged keydefaults:blockThe override asymmetry comes from the strict parser. The
agents:section round-trips each entry through aMapSlicebefore decoding, so the merge resolves first. Other sections are decoded directly underyaml.Strict(), which flags the overridden key as a duplicate.Out of scope
The cross-file
!includeand${var}templating ideas from #3112 are separate features and are not part of this change. The doc points users to the existing env-var expansion for dynamic values, and notes that!includetags are ignored rather than acted on.Testing
TestParseExamples/TestParseExamplesAfterMarshallingTestDocYAMLSnippetsAreValidagent-schema.jsonCloses #3112