schemas
AGENTS.md85 starsChanged 30 days agoApache-2.0View on GitHub
This is the central schema repository for the Meshery platform. Schemas here drive Go struct generation, TypeScript type generation, and RTK Query client generation. Mistakes in schema design propagate into generated code across multiple downstream repos (meshery/meshery, layer5io/meshery-cloud). This file is a routing and policy overview. The critical rules - the dual-schema pattern, casing, and generated-artifact warnings - live inline below. Long-form reference material lives in docs/ and is linked from the Detailed references section. Keep this file concise: Claude…
- Commits and pushes
Where files are headingNew AGENTS.md files have more rules about keeping secrets out of the code, and fewer about code style.
Of the AGENTS.md files we read, the 31,542 first seen in the last six months, against the older ones: the kind of rule that gained most share, and the kind that lost most. About files like this in general, not this one, and an estimate, since a kind is a pattern in the words.
In this repository12 other files it gives its agents.
- .github/copilot-instructions.mdCopilot instructions
- chrome-devtools-axiSkill
- create-openapi-schemas-from-golang-modelsSkill
- cut-releaseSkill
- gh-axiSkill
- iterate-prSkill
- lavishSkill
- openapi-schema-best-practicesSkill
- quota-axiSkill
- create-openapi-schemas-from-golang-modelsSkill
- meshery-schemas-releaseSkill
- openapi-schema-best-practicesSkill
The file
Show its rules and text
We split this AGENTS.md into the rules it gives an agent
24 rules. About 0 are common, 11 are distinctive, and 13 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈11
Distinctive · estimate
This author's own choices. Worth a look.
13
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- could be automatic: a setting could enforce it
- Distinctive: line 22
When a downstream repository's implementation diverges from the schema contract defined here, this repository is correct and the downstream …
- Distinctive: line 23
When cross-construct consistency requires a change that conflicts with current downstream implementation, make the breaking change here and …
- Distinctive: line 24
Do not weaken schema contracts, skip validation rules, or introduce inconsistent patterns to accommodate legacy downstream code.
- Distinctive: line 56
Tests accompany every behavioral change: Run every locally-runnable test before requesting review.
- Very specific: line 64
Schema-aware changes: run make validate-schemas && make consumer-audit before pushing.
- Very specific: line 68
Always run make build, go test ./..., and npm run build before committing schema changes.
- Very specific: line 72
Use the gh-axi CLI tool to interact with GitHub.
- Very specific: line 73
Use chrome-devtools-axi for browser automation (navigate, snapshot, click, fill forms, run JS, inspect console/network) in place of raw …
- Very specific: line 74
Run quota-axi to check local agent-provider quota windows before long-running work.
- Very specific: line 75
Use the lavish skill (lavish-axi CLI) to turn a plan, comparison, or report into a reviewable HTML artifact.
- Very specific: line 108
All server-generated fields defined in properties: id, created_at, updated_at, deleted_at
- Very specific: line 133
When uncertain, model new schemas on these:
- Distinctive: line 142
Before opening a PR that adds an entity schema, walk the "(New entity)" and "(New endpoint)" items in the Checklist for Schema Changes.
- Distinctive: line 171
Partial casing migrations are forbidden: Do not recase selected fields within a published API version.
- Very specific: line 175
Every construct directory schemas/constructs/<version>/<construct>/ holds api.yml (OpenAPI spec: endpoints + all schema definitions), …
- Distinctive: line 230
If you're unsure about any schema modification:
- Very specific: line 232
Check existing schemas for patterns (e.g., environment.yaml, connection.yaml)
- Very specific: line 233
Look at schemas/constructs/v1alpha1/core/api.yml for available core schema definitions
- Very specific: line 235
Check generated .d.ts files for actual type/property names
- Very specific: line 237
Test your changes with make build before committing
- Distinctive: line 241
Keep this file for knowledge useful to almost every future agent session in this project.
- Distinctive: line 242
Do not repeat what the codebase already shows.
- Distinctive: line 243
Prefer rewriting or pruning existing entries over appending new ones.
- Distinctive: line 244
When updating this file, preserve this bar for all agents and keep entries concise.
≈ “Common” is an estimate: at least 1 in 5 of the 40,246 AGENTS.md files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Meshery Schemas - Coding Agent Instructions
This is the central schema repository for the Meshery platform. Schemas here drive Go struct generation, TypeScript type generation, and RTK Query client generation. Mistakes in schema design propagate into generated code across multiple downstream repos (meshery/meshery, layer5io/meshery-cloud).
This file is a routing and policy overview. The critical rules - the dual-schema pattern, casing, and generated-artifact warnings - live inline below. Long-form reference material lives in
docs/and is linked from the Detailed references section. Keep this file concise: Claude Code warns when it exceeds 40k characters.
CLAUDE.mdis a symlink to this file. EditAGENTS.mdonly.
Source of Truth
The source of truth for a construct's API contract depends on where it is in the migration lifecycle:
- Pre-migration - While a construct is being migrated from a downstream repository (e.g.,
layer5io/meshery-cloud) into meshery/schemas, the downstream implementation is the reference for field discovery: field names, types, JSON tags, and database column mappings. - Post-migration - Once a construct has been fully migrated and its schema is defined here, meshery/schemas becomes the permanent, authoritative source of truth. Downstream repositories must conform to the contract defined here, not the reverse.
For constructs that have been migrated:
- When a downstream repository's implementation diverges from the schema contract defined here, this repository is correct and the downstream code must be updated.
- When cross-construct consistency requires a change that conflicts with current downstream implementation, make the breaking change here and open issues in affected repositories documenting the required migration.
- Do not weaken schema contracts, skip validation rules, or introduce inconsistent patterns to accommodate legacy downstream code.
Build
make build # generate Go structs + TypeScript types + RTK clients
make validate-schemas # run repository schema validation rules
npm run build # build TypeScript distribution (dist/)Generated artifacts (models/, typescript/generated/, python/generated/) are committed by automation on master. The TypeScript distribution in dist/ is produced by the npm build/publish workflow and is not committed to this repo. Do not edit generated artifacts by hand, and do not manually commit regenerated output in normal PRs unless the change explicitly requires it (a PR that alters a bundled Python pilot spec must commit regenerated python/generated/ output; see docs/schema-tooling.md).
Never hand-edit generated output:
- ❌ Generated Go code in
models/ - ❌ Generated TypeScript in
typescript/generated/ - ❌ Generated Python client in
python/generated/(pyproject.tomlandsrc/meshery_schemas/__init__.pyare hand-maintained scaffolding, not generator output) - ❌ Built files in
dist/
The Go generators (build/generate-golang.js, build/generate-permission-golang.js)
run every file they emit through gofmt -w as their final step via
build/lib/gofmt.js, so generated Go under models/ is gofmt-clean as generated.
Any new emitter of Go source must do the same. Hand-written Go in models/
(*_helper.go, const.go, import.go, *_conversion.go, models/core/) is not
covered by that step.
Removing a construct removes its generated output in the same PR. The generators prune
output directories whose construct is gone, and make test-generated-outputs fails while
one is committed. See docs/superseded-construct-consumer-verification.md.
Required on Every PR
- Tests accompany every behavioral change. Run every locally-runnable test before requesting review; never defer runnable coverage to reviewers or follow-up PRs.
- Documentation accompanies every behavioral change, in both forms:
- External, user-facing: docs.meshery.io and the published OpenAPI documentation - update whenever the change is user-visible.
- Internal, developer-facing: this repo's
docs/- update whenever architecture, workflows, or contracts change.
- Schema-aware changes: run
make validate-schemas && make consumer-auditbefore pushing. - Sign off every commit (
git commit -s). - No AI attribution in commits, PR descriptions, comments, or code.
Always run make build, go test ./..., and npm run build before committing schema changes. See Common Mistakes and the Checklist for Schema Changes for the full pre-PR list.
AXI Agent Tooling
- Use the
gh-axiCLI tool to interact with GitHub. Prefergh-axiovergh. - Use
chrome-devtools-axifor browser automation (navigate, snapshot, click, fill forms, run JS, inspect console/network) in place of raw Playwright/chrome-devtools MCP for ad hoc tasks. - Run
quota-axito check local agent-provider quota windows before long-running work. - Use the
lavishskill (lavish-axiCLI) to turn a plan, comparison, or report into a reviewable HTML artifact. - Work in a treehouse worktree, never in the main clone. Other agent sessions and the
no-mistakes pipeline share the main clone. Take a worktree with
treehouse get --lease -b <branch>(it prints the path;--base <branch>starts it from another branch), work there, and release it withtreehouse return <path>once the change has merged.treehouse statuslists the pool. Never make one withgit worktree addor a second clone. - Land every change through no-mistakes, at most three runs per pull request. Commit in
the worktree, then run
no-mistakes axi run --intent "<goal>"(a clone without ano-mistakesremote needsno-mistakes initonce).no-mistakes axi statusshows the step and its findings, andno-mistakes axi respondanswers a review gate. The pipeline reviews, tests, pushes and opens the pull request. After the third run, merge the pull request as it stands and open an issue for anything still flagged. A run that stopped on a usage limit counts; one cancelled before it did anything does not.
Where skills live
.agents/skills/ is the single source of truth for this repo's agent skills. .claude/skills is a
relative symlink to it - add, edit, and remove skills under .agents/skills/ only, and never replace
that symlink with a real directory. Codex and OpenCode read .agents/skills natively, so no
.codex/skills or .opencode/skills link is needed.
The Dual-Schema Pattern (REQUIRED)
This is the most critical design rule in this repo. Every agent or contributor MUST follow it.
Rule 1: <construct>.yaml = response schema only
The YAML file for an entity represents the full server-side object as returned in API responses. It is NOT a request body schema.
Required properties of every entity .yaml:
additionalProperties: falseat the top level- All server-generated fields defined in
properties:id,created_at,updated_at,deleted_at - Server-generated fields that are always present belong in
required
Exception: an event-metadata construct (no endpoints; recorded and read back verbatim as an Event's metadata) has no server-generated fields, so it declares none and its *Payload carries the same field set. See the authoring reference.
Exception: a read-through construct (has endpoints but no stored row; every call reads the object from another system or computes it, e.g. oauth_consent_request) declares no id, created_at, updated_at or deleted_at. See the authoring reference.
Exception: a definition construct (no endpoints and no stored row; a document components publish as files, e.g. error) declares no id, created_at, updated_at or deleted_at. See the authoring reference.
Rule 2: Every writable entity needs a *Payload schema in api.yml
For any entity that has POST or PUT operations, define a {Construct}Payload schema in api.yml that:
- Contains only client-settable fields - no
created_at,updated_at,deleted_at - Makes
idoptional withjson:"id,omitempty"for upsert patterns - Is the schema referenced by all
requestBodyentries forPOST/PUT
Rule 3: POST/PUT requestBody MUST reference *Payload, never the entity schema
Referencing the full entity schema in a requestBody is WRONG - it forces clients to supply server-generated fields. Reference the {Construct}Payload schema instead.
Worked YAML examples for all three rules (entity schema, payload schema, WRONG vs CORRECT requestBody) live in Dual-schema pattern examples.
Canonical reference implementations
When uncertain, model new schemas on these:
schemas/constructs/v1beta1/connection/-connection.yaml+ConnectionPayloadinapi.ymlschemas/constructs/v1beta1/key/-key.yaml+KeyPayloadinapi.ymlschemas/constructs/v1beta1/team/-team.yaml+teamPayload/teamUpdatePayloadinapi.ymlschemas/constructs/v1beta1/environment/-environment.yaml+environmentPayloadinapi.yml
Checklist for new entity schemas
Before opening a PR that adds an entity schema, walk the "(New entity)" and "(New endpoint)" items in the Checklist for Schema Changes.
Casing rules at a glance
(The ecosystem's identifier naming conventions. Downstream repos cite this section as meshery/schemas/AGENTS.md § Casing rules at a glance - do not rename it.)
Casing is the single most error-prone area. The full authority - the per-layer casing table and its compatibility caveats - lives in
docs/casing-rules.md. The reader-friendly cross-repo directory (26-row before/after table) is indocs/identifier-naming-contributor-guide.md(canonical URL: https://github.com/meshery/schemas/blob/master/docs/identifier-naming-contributor-guide.md).
Wire is camelCase everywhere; DB is snake_case; Go fields follow Go idiom; the ORM layer is the sole translation boundary.
This repo IS the authority for that contract. The contract is not optional; deviations block PRs via the schemas consumer-audit CI gate. On any conflict, schemas wins - downstream repos file discrepancies as issues against meshery/schemas, not locally.
- Property names: for newly authored API versions, use camelCase on the wire, uniformly. New schema properties and their JSON tags use
camelCase. For DB-backed fields, thex-oapi-codegen-extra-tags.dbtag carries the snake_case DB column name separately from the wire identifier. For an already-published API version that publishessnake_caseon the wire, additions to that same version must preserve the version's published wire casing until the resource is version-bumped; do not perform partial casing migrations within a version. - ID-suffix fields:
lowerCamelCase+Id(modelId,registrantId) Id(camelCase), neverID, in URL params, JSON tags, and TypeScript properties.- New enum values: lowercase words (
enabled,ignored,duplicate); preserve published enum literals as-is within the same API version - Object names: singular nouns (
model,component,design) components/schemasnames: PascalCase nouns (Model,Component,KeychainPayload)- Files/folders: lowercase (
api.yml,keychain.yaml,templates/keychain_template.json) - Endpoint paths: kebab-case, plural nouns, and the
/apiprefix that the authenticated API surface is served under (/api/workspaces,/api/environments). The declared path must equal the route the server serves - nothing prepends/apiat build time, so a path that does not match ships a client that 404s at runtime without failing any build or validation step. Carry/apionly where the router group actually applies it:/user/schedulesis registered on the bare router and is correct without it. Verify against the consumer's route registration (Echo groups supply the prefix); seedocs/http-api-design.md. - Path params: camelCase with
Idsuffix ({subscriptionId},{connectionId},{orgId}- NOT{orgID}, NOT{org_id}) operationId: lower camelCase verbNoun (createKeychain,updateEnvironment- NOTCreateKeychain, NOTUpdateEnvironment)
Partial casing migrations are forbidden. Do not recase selected fields within a published API version. If the wire format must change, introduce a new API version and migrate the resource consistently there. See docs/casing-rules.md.
File structure for a construct
Every construct directory schemas/constructs/<version>/<construct>/ holds api.yml (OpenAPI spec: endpoints + all schema definitions), <construct>.yaml (entity/response schema), templates/ (example instances), and optional forms/ (RJSF form schemas). Full layout: File structure for a construct.
Auto-generated Go structs live in models/<version>/<construct>/<construct>.go (do not edit); manual helpers in <construct>_helper.go (SQL driver, Entity interface, TableName()). See Go helper files.
x-internal annotation
Required on every operation. The bundler and validate-schemas Rule 14 reject operations that omit it:
x-internal: ["cloud"]- cloud-only (_openapi_build/cloud_openapi.yml)x-internal: ["meshery"]- Meshery-only (_openapi_build/meshery_openapi.yml)x-internal: ["cloud", "meshery"]- both bundled outputs
Route ownership (x-supersedes)
A newer version moves a route from an older one by setting x-supersedes: <older version> on the operation. The bundler then merges only the owner's declaration. Any other duplicate route fails the bundle. See docs/http-api-design.md.
Release Procedure
Use the meshery-schemas-release skill (/meshery-schemas-release) to cut releases - it automates the entire procedure and includes safeguards.
CRITICAL: Do not manually create releases - no gh release create, no manual npm publish, no hand-edited release notes, no manual version bumps.
The chain: push to master -> generate-artifacts-from-schemas.yml self-commits generated artifacts -> release-drafter.yml refreshes the draft release -> a human publishes the draft -> publish workflows fan out (publish-schemas.yml, npm publish, downstream notifications, OpenAPI docs).
Full procedure, the What NOT to Do list, and versioning policy: docs/release-procedure.md. Skill usage and troubleshooting: docs/release-procedure-skill.md.
Detailed references
Long-form reference material lives in docs/ to keep this file concise. Consult these when you need the full detail:
docs/casing-rules.md- the authoritative per-layer casing table (DB / Go / wire / URL / operationId / TS) and its compatibility caveats.docs/identifier-naming-contributor-guide.md- reader-friendly cross-repo naming directory with before/after examples.docs/http-api-design.md- HTTP method semantics, response codes, bulk-delete-via-POST, resource grouping, path structure.docs/schema-authoring-reference.md- dual-schema worked examples, per-property validation rules (37-42),x-id-format: external, RJSF form schemas + enforcement tests, Go helper files,x-internal, SQL driver (Scan/Value) rules.docs/schema-review-checklist.md- intentional design decisions (do not flag), the common mistakes to avoid, and the full pre-PR schema-change checklist.docs/schema-tooling.md- identifier-naming migration status, advisory baseline, consumer audit tooling and CI behavior.docs/superseded-construct-consumer-verification.md- how to prove no downstream consumer is still on anx-superseded-byconstruct version; why import-path grepping is invalid on the TypeScript/RTK surface.docs/release-procedure.md- full release flow, What NOT to Do, and versioning policy.docs/release-procedure-skill.md- using themeshery-schemas-releaseskill, verification commands, troubleshooting.docs/environment-purpose-contract.md- whatEnvironment.purposemeans, why it is not client-settable, and what each consumer must enforce for that to hold.docs/profile-contract.md- the profile construct, its workspace assignment, and its permission keys.docs/mention-alias-contract.md- the mention alias construct: who's who per platform, its unique key, the upsert, and the keys that guard it.docs/token-scoping-contract.md-Token.keychainIds(unrestricted only whenkeychainScopedis false andkeychainIdsis empty) andexpiresAt, set throughTokenCreatePayload, and the effective-keys rule every token kind must enforce.docs/oauth-consent-contract.md- the OAuth consent construct: list and revoke a user's connected apps byclientId.docs/agent-approval-preference.md- the typedagentsActWithoutApprovalpreference and its migration from the free-formremoteProviderPreferencesvalue.docs/content-item-contract.md- the content item's rules of engagement (tighten only) and thread fields, and why a reply's wait for its parent is client behaviour rather than a claim rule.docs/claim-contract.md- the claim construct: connection holders, expiry at read time, kept history, release outcomes, and its permission keys.docs/oauth-consent-request-contract.md- the pending OAuth consent request: reading it by challenge, allow and deny, ownership, single-use challenges, and the verified mark that marks trust and never blocks.docs/media-asset-contract.md- the media asset construct: create-upload-complete flow, per-use download URLs,r2/gdrivebackends with no credential on the wire, limits, expiry andlocationStripped.docs/event-organization-contract.md-Event.organizationIdand thegetEventsscopequery.docs/design-event-metadata-contract.md- the named shapes of design event metadata, its banned keys and 16 KB guard, thestatuserrorrule for an operation that did not complete, and why they have no*Payloadtwins.docs/connection-design-organization-contract.md-Connection.organizationIdand designorganizationId(meshery_patterns), both server-assigned.docs/relationship-evaluation-engine-contract.md- the authoritative relationship-evaluation wire contract for downstream evaluators.docs/relationship-definition-taxonomy.md- canonical kind/type/subType combinations and mutator vs mutated patch paths for relationship definitions.docs/schedule-visibility-and-public-feed-contract.md- the schedule visibility enum and the unauthenticated public activity feed wire contract.
Questions?
If you're unsure about any schema modification:
- Check existing schemas for patterns (e.g.,
environment.yaml,connection.yaml) - Look at
schemas/constructs/v1alpha1/core/api.ymlfor available core schema definitions - Examine any construct's
api.ymlto see how subschemas are referenced and endpoints are defined - Check generated
.d.tsfiles for actual type/property names - Review this document and the linked
docs/references for guidelines - Test your changes with
make buildbefore committing
Maintaining this file
Keep this file for knowledge useful to almost every future agent session in this project. Do not repeat what the codebase already shows; point to the authoritative file or command instead. Prefer rewriting or pruning existing entries over appending new ones. When updating this file, preserve this bar for all agents and keep entries concise.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

