Skip to content

Agent guidance: never hand-parse metadata YAML; document meta export as the query path (and make it work with adopter providers) #478

Open

Description

@dmealing

⚠️ Written by Claude (AI) on behalf of Doug Mealing. It may contain errors — take it with a grain of salt and verify before acting.

What happened

An agent (Claude Code, with the generated metaobjects-* skills and .metaobjects/AGENTS.md installed, MetaObjects 1.1.2, C# adopter) needed a one-off answer about the model: which fields on a set of entities hold JSON (@storage: jsonb, JSON in a text column), and what's their @objectRef?

It wrote a throwaway Ruby script that walked metaobjects/**/*.yaml with a plain YAML parser. That skips everything the loader does (extends/inheritance flattening, TPH, package resolution, attr inheritance, overlays), so the answer can be silently wrong. It's exactly the anti-pattern MetaObjects exists to remove.

Why the guidance didn't stop it

  • metaobjects-codegen's trigger ("Use when you need ANY output derived from the MetaObjects model") does cover this in principle. But everything in the skill frames a generator as committed, wired output. An agent doing a quick exploratory query doesn't read "I want a list for myself" as "I need a generator", so the skill never fires.
  • No skill and nothing in AGENTS.md says "never parse metadata files yourself; load them". The closest rule ("The loaded metadata model is READ-ONLY") is about mutation, not reading.
  • meta export ("Flatten loaded metadata to one canonical JSON artifact") is the right tool for an ad-hoc query, but no skill or AGENTS.md mentions it.
  • On a C# adopter with provider-registered vocabulary, meta export fails anyway: meta: Unknown type "object.picklist" — not registered. The type is registered by the project's C# MetaDataProvider, which the Node CLI can't see. So on that stack there is no supported way to query the loaded model short of writing a generator.

Asks

  1. An explicit rule in AGENTS.md and the authoring and codegen skills: to answer any question about the model (which entities/fields have X), load it. Use meta export and query the JSON, or write a generator. Never grep, awk or YAML-parse metaobjects/** yourself, and say why: a raw parse skips extends, inheritance and attr resolution.
  2. Mention meta export in the skills as the ad-hoc query path, with a short jq example (e.g. every field with @storage: jsonb).
  3. Make the model queryable on non-Node stacks with adopter vocabulary. Either a dotnet meta export (and JVM/Python equivalents) that loads the project's own providers, or a way for the Node export to accept the project's registered vocabulary (e.g. a provider manifest the C# runner emits). Until then, the skills should say plainly that on such a stack the query path is a small generator.
  4. Optional: add "exploratory query of the model" to the metaobjects-codegen trigger description, so it fires for one-off questions too.

🤖 Generated with Claude Code

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions