Repository navigation
Description
Problem
When APM deploys agent .md files 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.
tools field
- Claude Code expects: comma-separated string or array →
tools: Read, Grep, Globortools: ["Read", "Grep"] - OpenCode expects: record/object →
tools: {Read: true, Grep: true}(Zod schema:z.record(z.string(), z.boolean())) - Result: OpenCode throws
InvalidError("expected record, received array") — hard crash, unrecoverable
color field
- Claude Code expects: named colors →
color: cyan,color: yellow - OpenCode expects: hex
#RRGGBBor theme names (primary,secondary,accent,success,warning,error,info) - Result: OpenCode throws
InvalidError("Invalid hex color format")
Impact on OpenCode
OpenCode's loadAgent() function calls Agent.safeParse() on the parsed frontmatter. On validation failure, it throws an InvalidError with 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 compile warns about these files with "Failed to parse primitive ... mapping values are not allowed in this context" — but apm 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 install
During 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)- Unknown fields: Strip fields not supported by the target platform
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 install should 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 in apm compile — it should also run during apm install.
Related
- Support tool overrides for installed agent packages #293 — Support tool overrides for installed agent packages (consumer-side)
- OpenCode agent schema:
z.record(z.string(), z.boolean())for tools,z.union([hex regex, theme enum])for color (source)
Environment
- APM version: 0.8.10
- Plugin:
data-goblin/power-bi-agentic-developmentv0.17.2 - Targets affected: OpenCode (confirmed hard crash), potentially Codex and Cursor
Metadata
Metadata
Assignees
Labels
Type
Projects
- StatusShow more project fieldsDone
Activity
Mathf18 commentedon Apr 5, 2026
Related: #293 (Support tool overrides for installed agent packages) — that issue covers consumer-side tool overrides in
apm.yml. This issue is about APM itself translating agent frontmatter fields between incompatible platform schemas duringapm install --target <platform>, so plugin authors don't need to worry about per-platform format differences.TPHRyan commentedon Apr 7, 2026
I'm glad this issue has been made - I've just come up against the same issue.
It's somewhat surprising I haven't seen anything like this on the roadmap - for me one of the major sticking points in the current agent landscape is the subtly-different ways that different agents consume the "same" configuration files. As a result, I'd expect a tool aiming to reconcile/unify these agents to at least have plans regarding this
Mathf18 commentedon Apr 7, 2026
Related, but probably separate from the frontmatter transformation problem in this issue:
While validating the OpenCode path, I confirmed that APM does redeploy agents into
~/.config/opencode/agents/for several marketplace plugins (pbi-desktop,reports,semantic-models,tabular-editor,skills-for-fabric). A forced reinstall restored theirtools,color, andmodelfrontmatter as expected.However,
data-goblin/power-bi-agentic-development/plugins/pbipstill does not deploy itspbip-validatoragent at all.Evidence from local validation:
apm install -g -t opencode --update --force -vreports agent integration for the plugins above, but no agent integration forplugins/pbipapm.lock.yamlshowsplugins/pbipaspackage_type: hook_packagepackage_type: marketplace_pluginpbip-validator.mdsource file exists, so this looks more like package discovery/classification than missing contentSo from what I can tell there are two distinct OpenCode/APM problems:
tools,color, etc.)I think this second one should likely be tracked separately, but I wanted to note it here because it showed up during validation of the behavior described in this issue.
sergio-sisternes-epam commentedon Apr 17, 2026
Thanks for the detailed write-up, Mathieu Turcotte (@Mathf18) -- the OpenCode crash reproduction and schema analysis are really helpful. This is a real problem that needs solving.
We want to address this, but there's an architectural question we need to work through first: should frontmatter transformation happen at install time (where files are deployed) or at compile time (where
apm compilealready owns source-to-target-specific output)?Each approach has trade-offs around separation of concerns and user workflow, and we want to get this right before committing to an implementation direction.
Flagging for deeper discussion with Daniel Meppiel (@danielmeppiel). We'll update this issue once we have alignment on the approach.
Mathf18 commentedon Apr 17, 2026
Thanks Sergio Sisternes (@sergio-sisternes-epam), as I remember, the crash happens directly after
apm install. Thanks for the follow-up!github-actions commentedon Apr 26, 2026
Triage decision
needs-design
Proposed labels
Milestone
null
Suggested next action
Split the fix into two phases: Phase 1 (immediate bug fix) -- extend
apm installto validate agent frontmatter against the target platform schema and warn/skip on validation failure, reusing existing compile-time logic; Phase 2 (feature) -- per-target frontmatter transformation during deployment. Confirm the phase split in a comment and open a PR for Phase 1.Suggested issue comment
Per-lens notes (collapsed)
DevX UX Expert -- User-Need Reviewer
This is a genuine and high-severity bug: APM deploys agent files that crash OpenCode on startup, with no graceful degradation. The dual-option framing is appropriate. From a UX perspective, Option B (validate and warn) is the right first fix -- it unblocks users immediately (skip the broken file, show a clear warning) without requiring the complexity of transform tables. Option A (transform) is the right long-term solution but is a separate feature. The issue should be resolved in phases, with Phase 1 (validate and warn) landing first.
Supply Chain Security Expert -- Risk-Surface Reviewer
Frontmatter transformation (Option A) must not silently strip or alter fields that have security implications. The transform table must be an explicit allow-list (fields with known safe transforms) rather than a strip-unknown approach.
area/content-security(transformation of deployed package content) andarea/multi-target(per-target deployment differences) apply.theme/portabilityis the primary theme -- the root cause is that APM copies files verbatim across targets with different schemas.OSS Growth Hacker -- Contributor-Tone Reviewer
Activated -- author has 1 prior interaction on microsoft/apm. The issue body is technically detailed and well-researched (schema references, version info, related issues). The reply should validate the crash report explicitly, acknowledge the OpenCode-specific schema conflict, and give a concrete path for Phase 1 contribution. Warm and encouraging without being condescending.
Python Architect -- Architecture Reviewer
Phase 1 (validate and warn) is straightforward: reuse compile-time validation logic in the install path, wrap in a try/except, emit a warning and skip on failure. Cross-cutting impact is low -- the change lives in
SkillIntegratoror the install pipeline. Phase 2 (transform) requires: a per-platform frontmatter schema registry, transform functions fortoolsandcolorfields, changes toSkillIntegratordeploy logic, and a maintenance commitment to keep the transform table current as platform schemas evolve. The two phases have very different complexity profiles.status/needs-designis correct to settle the Phase 2 transform approach -- Phase 1 does not require design.Doc Writer -- Documentation Reviewer
Activated -- Phase 2 (transform) would require documentation of per-target frontmatter rules. Deferred until design is accepted. Phase 1 (validate and warn) should be documented in the
apm installreference page (new warning output format).area/docs-sitewas considered but not added -- the Phase 1 change is a behavior fix, not a new feature requiring new doc pages.APM CEO -- Triage Arbiter
Real crash bug with clear reproduction. The two-phase approach is the right call: Phase 1 (validate and warn) is a bug fix that can land quickly by reusing existing compile-time logic; Phase 2 (transform) is a feature that needs design.
type/bugis correct (the root cause is silent deployment of incompatible files).status/needs-designreflects that the full resolution (Phase 2) requires a transform table design, while acknowledging Phase 1 is unblocked. Maintainers should confirm the phase split in a comment and open a Phase 1 PR. Theme:theme/portability(the bug is caused by verbatim cross-target deployment without schema awareness).{ "decision": "needs-design", "decision_detail": "Phase 1 (validate and warn during install, reuse compile-time logic) is unblocked; Phase 2 (per-target transform table) requires a design document for the transform rules and unknown-field handling.", "theme": "theme/portability", "areas": ["area/multi-target", "area/content-security"], "type": "type/bug", "status": "status/needs-design", "priority": null, "preserved_labels": [], "milestone": null, "next_action": "Open a Phase 1 PR that validates agent frontmatter against target platform schema during apm install and warns/skips on incompatible files, reusing compile-time validation logic.", "comment_markdown": "Real crash bug confirmed. Two-phase fix: Phase 1 (bug fix) -- validate frontmatter during install and warn/skip on failure (reuse compile-time logic, no design needed); Phase 2 (feature) -- per-target transform table (needs design). Phase 1 PR can start now at skill_integrator.py + compile.py validation logic." }5 remaining items
Mathf18 commentedon Apr 30, 2026
Thanks Daniel, that makes sense. I agree the long-term goal should be community convergence on agent frontmatter schemas. I don’t have a solution in mind yet, but I’m looking forward to seeing what other people facing this issue might come up with! I think it’s really Claude that doesn’t respect the standard more than the other players, haha!
fix(opencode): address Copilot review on frontmatter validator
fix(opencode): polish warning + docs (iter-3 panel nits)
fix(opencode): validate-and-warn on incompatible agent frontmatter at…
fix: remove tools: from agent frontmatter for cross-tool portability
feat(agent-integrator): convert tools list/string to object for openc…
fix(ci): update AC12 boundary check and tests for _write_opencode_agent
feat(agent-integrator): convert tools list/string to object for openc…
fix(ci): update AC12 boundary check and tests for _write_opencode_agent