-
Notifications
You must be signed in to change notification settings - Fork 230
Feature: per-target agent frontmatter transformation during deployment #581
Copy link
Copy link
Closed
Labels
area/content-securityUnicode scanning, Glassworm, apm audit content checks, SARIF output.Unicode scanning, Glassworm, apm audit content checks, SARIF output.area/multi-targetMulti-target deploy spec, target directory creation, agent surface routing.Multi-target deploy spec, target directory creation, agent surface routing.enhancementDeprecated: use type/feature. Kept for issue history; will be removed in milestone 0.10.0.Deprecated: use type/feature. Kept for issue history; will be removed in milestone 0.10.0.needs-designDeprecated: use status/needs-design. Kept for issue history; will be removed in milestone 0.10.0.Deprecated: use status/needs-design. Kept for issue history; will be removed in milestone 0.10.0.status/needs-designDirection approved, design discussion required before code.Direction approved, design discussion required before code.status/triagedInitial agentic triage complete; pending maintainer ratification (silence = approval).Initial agentic triage complete; pending maintainer ratification (silence = approval).theme/portabilityOne manifest, every target. Multi-target deploy, marketplace, packaging, install.One manifest, every target. Multi-target deploy, marketplace, packaging, install.type/bugSomething does not work as documented.Something does not work as documented.
Metadata
Metadata
Assignees
Labels
area/content-securityUnicode scanning, Glassworm, apm audit content checks, SARIF output.Unicode scanning, Glassworm, apm audit content checks, SARIF output.area/multi-targetMulti-target deploy spec, target directory creation, agent surface routing.Multi-target deploy spec, target directory creation, agent surface routing.enhancementDeprecated: use type/feature. Kept for issue history; will be removed in milestone 0.10.0.Deprecated: use type/feature. Kept for issue history; will be removed in milestone 0.10.0.needs-designDeprecated: use status/needs-design. Kept for issue history; will be removed in milestone 0.10.0.Deprecated: use status/needs-design. Kept for issue history; will be removed in milestone 0.10.0.status/needs-designDirection approved, design discussion required before code.Direction approved, design discussion required before code.status/triagedInitial agentic triage complete; pending maintainer ratification (silence = approval).Initial agentic triage complete; pending maintainer ratification (silence = approval).theme/portabilityOne manifest, every target. Multi-target deploy, marketplace, packaging, install.One manifest, every target. Multi-target deploy, marketplace, packaging, install.type/bugSomething does not work as documented.Something does not work as documented.
Type
Fields
Give feedbackNo fields configured for issues without a type.
Projects
StatusShow more project fields
Done
Problem
When APM deploys agent
.mdfiles from a marketplace plugin to multiple targets (Claude Code, OpenCode, Codex, etc.), it copies the same file verbatim to each target directory (.claude/agents/,.opencode/agents/,.codex/agents/).This causes hard crashes on platforms with different frontmatter schemas.
toolsfieldtools: Read, Grep, Globortools: ["Read", "Grep"]tools: {Read: true, Grep: true}(Zod schema:z.record(z.string(), z.boolean()))InvalidError("expected record, received array") — hard crash, unrecoverablecolorfieldcolor: cyan,color: yellow#RRGGBBor theme names (primary,secondary,accent,success,warning,error,info)InvalidError("Invalid hex color format")Impact on OpenCode
OpenCode's
loadAgent()function callsAgent.safeParse()on the parsed frontmatter. On validation failure, itthrows anInvalidErrorwith no catch — a single bad agent file kills the entire application startup. There is no graceful degradation or per-file skip on validation failure.APM already detects the problem but only during compile
apm compilewarns about these files with "Failed to parse primitive ... mapping values are not allowed in this context" — butapm install(which deploys the files) does not validate or warn. The broken files are deployed silently.Proposed solutions
Option A: Transform frontmatter per target during
apm installDuring
apm install --target <platform>, APM transforms agent frontmatter fields to the target platform's expected format:tools: Convert between array/string (Claude) ↔ record (OpenCode) formatscolor: Convert between named colors (Claude) ↔ hex/theme names (OpenCode)This would allow plugin authors to write agent files once in any supported format, and APM would handle the translation during deployment.
Option B: Validate and warn during install (not just compile)
apm installshould validate agent frontmatter against the target platform's schema and warn about incompatible fields before deploying, rather than silently deploying broken files that crash the target tool. The validation logic already exists inapm compile— it should also run duringapm install.Related
z.record(z.string(), z.boolean())for tools,z.union([hex regex, theme enum])for color (source)Environment
data-goblin/power-bi-agentic-developmentv0.17.2