codegraph install --target=hermes writes invalid YAML when platform_toolsets already exists
Summary
When the target ~/.hermes/config.yaml already has a platform_toolsets.cli list using Hermes Agent's native indentation style (dash at the same column as the parent key, i.e. 2-space indent), codegraph install --target=hermes writes the new - mcp-codegraph entry with 4-space indentation. This breaks the list's structure and makes the file unparseable by PyYAML — Hermes Agent then fails to start.
Environment
- CodeGraph:
0.9.3 (npm @colbymchenry/codegraph)
- Hermes Agent:
v0.14.0 (2026.5.16)
- OS: WSL2 (Ubuntu 24.04) on Windows 11, ext4
- Node:
v22.22.2
- Python (for YAML check): 3.13
Minimal reproduction
Starting config (~/.hermes/config.yaml):
streaming:
enabled: false
platform_toolsets:
cli:
- browser
- clarify
- terminal
mcp_servers:
existing-server:
command: echo
args: [hello]
enabled: true
Run:
codegraph install --target=hermes --yes
Resulting file:
streaming:
enabled: false
platform_toolsets:
cli:
- mcp-codegraph # ← 4-space indent (new entry)
- browser # ← 2-space indent (existing entries)
- clarify
- terminal
mcp_servers:
existing-server:
command: echo
args: [hello]
enabled: true
codegraph:
command: codegraph
args:
- serve
- --mcp
timeout: 120
connect_timeout: 60
enabled: true
YAML parser error:
yaml.parser.ParserError: while parsing a block mapping
in "~/.hermes/config.yaml", line 4, column 3
expected <block end>, but found '-'
in "~/.hermes/config.yaml", line 6, column 3
Root cause (apparent)
The installer is emitting list items under platform_toolsets.cli with 4-space indent ( - mcp-codegraph), but Hermes Agent's own config uses the indentation style where dashes sit at the parent key's column (2-space indent: - browser). Both are valid YAML in isolation, but mixing them inside the same list makes the parser think the 2-space dashes belong to a sibling of cli: rather than items of cli.
Suggested fix
Two options, either is fine:
- Detect the existing list's dash column in
platform_toolsets.cli and match it (most robust — handles users who use either style).
- Use the same 2-space-dash style Hermes Agent uses by default. The Hermes config writer follows PyYAML default flow style, which is
- item (no extra indent).
Side note: this platform_toolsets edit appears unnecessary
Hermes Agent's native MCP client doc (skill_view native-mcp) explicitly says:
After discovery, MCP tools are automatically injected into all hermes-* platform toolsets (CLI, Discord, Telegram, etc.). This means MCP tools are available in every conversation without any additional configuration.
So writing mcp_servers.codegraph alone is enough — the platform_toolsets.cli: [- mcp-codegraph] patch is redundant. If you remove that patch entirely, the bug disappears and the install becomes more minimal. Just adding mcp_servers.codegraph (which already gets its own indentation right) is the safer change.
Workaround for users hit by this
sed -i 's/^ - mcp-codegraph$/ - mcp-codegraph/' ~/.hermes/config.yaml
# verify:
python3 -c "import yaml; yaml.safe_load(open('$HOME/.hermes/config.yaml'))" && echo OK
Affected agent: Hermes only
Verified Claude Code, OpenCode, Cursor configs are all correctly written. The bug is specific to the Hermes Agent target.
codegraph install --target=hermeswrites invalid YAML whenplatform_toolsetsalready existsSummary
When the target
~/.hermes/config.yamlalready has aplatform_toolsets.clilist using Hermes Agent's native indentation style (dash at the same column as the parent key, i.e. 2-space indent),codegraph install --target=hermeswrites the new- mcp-codegraphentry with 4-space indentation. This breaks the list's structure and makes the file unparseable by PyYAML — Hermes Agent then fails to start.Environment
0.9.3(npm@colbymchenry/codegraph)v0.14.0 (2026.5.16)v22.22.2Minimal reproduction
Starting config (
~/.hermes/config.yaml):Run:
Resulting file:
YAML parser error:
Root cause (apparent)
The installer is emitting list items under
platform_toolsets.cliwith 4-space indent (- mcp-codegraph), but Hermes Agent's own config uses the indentation style where dashes sit at the parent key's column (2-space indent:- browser). Both are valid YAML in isolation, but mixing them inside the same list makes the parser think the 2-space dashes belong to a sibling ofcli:rather than items ofcli.Suggested fix
Two options, either is fine:
platform_toolsets.cliand match it (most robust — handles users who use either style).- item(no extra indent).Side note: this
platform_toolsetsedit appears unnecessaryHermes Agent's native MCP client doc (
skill_view native-mcp) explicitly says:So writing
mcp_servers.codegraphalone is enough — theplatform_toolsets.cli: [- mcp-codegraph]patch is redundant. If you remove that patch entirely, the bug disappears and the install becomes more minimal. Just addingmcp_servers.codegraph(which already gets its own indentation right) is the safer change.Workaround for users hit by this
Affected agent: Hermes only
Verified Claude Code, OpenCode, Cursor configs are all correctly written. The bug is specific to the Hermes Agent target.