Skip to content

install --target=hermes writes invalid YAML when platform_toolsets.cli already exists #368

@0Dy6h

Description

@0Dy6h

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:

  1. Detect the existing list's dash column in platform_toolsets.cli and match it (most robust — handles users who use either style).
  2. 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.

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