omnigraph-best-practices
Installation
SKILL.md
Operating Omnigraph Locally
This skill captures the operational rules for working with a locally deployed Omnigraph (RustFS-backed or remote S3). Follow them when authoring schema, writing queries, loading data, evolving schema, or automating graph operations.
The Seven Rules
- Lint before commit —
omnigraph lint --schema schema.pg --query queries/foo.gqvalidates both sides against each other. No running repo required. (omnigraph query lintstill works as a deprecated alias.) - Plan before apply — never run
schema applywithout a successfulschema planfirst. Apply is destructive; plan is free. (Cluster mode has the same rule with different verbs:cluster planbeforecluster apply— the plan embeds the engine's real migration steps.) - Branches are for data; apply is for schema — review data ingests on a feature branch then merge. Schema changes go straight to
main(single-graph:omnigraph schema apply; cluster mode: edit the.pgand runcluster apply— there is no directschema applyin cluster deployments). - Pick the right write command —
mutatefor edits (typechecked, parameterized),load --mode mergefor bulk upsert on local repos,ingestfor remote,load --mode overwriteonly for clean slates. - Parameterize everything — never string-interpolate values into
.gqbodies or--params. Declare$var: Typeand pass via--params. - Expose agent operations as aliases — not raw CLI invocations. Aliases decouple the operation name from the query implementation.
- Verify after every remote write — compare
commit list --branch mainhead before and after. The CLI's exit code is not authoritative on remote graphs; proxies can drop the response while the write commits server-side. Seereferences/remote-ops.mdfor the verification ritual and how to recover from 504s.
Five Ontology Design Criteria (Gruber 1993)
Omnigraph schemas are ontologies. The canonical design criteria from Gruber's Toward Principles for the Design of Ontologies Used for Knowledge Sharing (Int. J. Human-Computer Studies 43:907–928) apply directly when authoring .pg files.