Skip to content

[BUG] - Agent frontmatter is not translated to the target's native dialect #170

@trevor-vaughan

Description

@trevor-vaughan

Bug Description

Summary

Agents authored in one assistant's frontmatter dialect leak that dialect into other targets. OpenCode-style frontmatter (mode: subagent, tools as a {name: bool} map) passes through unchanged to Claude Code, which expects tools as a comma-separated string and has no mode field. The agent installs with frontmatter the target cannot fully parse.

Expected

tools renders in the target's native form. Dialect-only fields are dropped for targets that don't understand them. For Claude Code:

tools: Read, Bash

mode and temperature are stripped.

Actual

The OpenCode tools map and mode: subagent write verbatim into the Claude Code agent file. Claude Code reads tools as a string, so the map is malformed, and mode is meaningless. The tool allowlist does not take effect.

Root cause

_generate_agent_with_frontmatter (src/lola/targets/base.py) copies the authored frontmatter and adds only the per-target fields (name, model: inherit for Claude Code and Cursor; mode: subagent for OpenCode). It never normalizes tools or removes fields foreign to the destination dialect.

Proposed Fix

Normalize the tools field on read (accept an OpenCode {name: bool} map, a Claude comma-separated string, or a list), then render per target:

  • claude-code / cursor: comma-separated string of enabled tools in Claude tool names, with OpenCode-only mode and temperature fields stripped.
  • opencode: {name: bool} map (Claude strings convert back to map form).

Steps to Reproduce

  1. Author an agent with OpenCode-dialect frontmatter:

    ---
    description: Example agent
    mode: subagent
    tools:
      read: true
      bash: true
      write: false
    ---
  2. lola install <module> -a claude-code.

  3. Inspect the generated .claude/agents/<agent>.md frontmatter.

Component

Target assistants (Claude Code, Cursor, etc.)

Lola Version

No response

Python Version

No response

Operating System

No response

Logs and Error Messages

Additional Context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions