Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 8 additions & 6 deletions skills/omnigraph/SKILL.md
Comment thread
aaltshuler marked this conversation as resolved.
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
name: omnigraph
description: Store, retrieve, and query knowledge, memory, and relationships in an Omnigraph graph, and operate a local or remote Omnigraph deployment. Use when the user wants to capture or recall facts, notes, or entities, build or query a knowledge graph or agent memory, or run Omnigraph — and whenever you see Omnigraph CLI commands (omnigraph init/query/mutate/load/schema/lint/embed/branch/commit/login/profile/cluster), .pg schema or .gq query files, s3:// graph URIs, bearer-authed graph endpoints, 504 errors, or a cluster.yaml / omnigraph.yaml / ~/.omnigraph/config.yaml. Covers cluster-mode deployments (cluster.yaml plan/apply, omnigraph-server --cluster), the two config surfaces (cluster.yaml + ~/.omnigraph/config.yaml), schema evolution, query linting, data writes (mutate; load needs --mode/--from), branches, embeddings, Cedar policy, and remote ops. Especially important before schema apply (plan first), any load (--mode required), any .gq/.pg edit (lint after), or any remote write (verify via commit list).
license: MIT (see LICENSE at repo root)
compatibility: Requires omnigraph CLI >= 0.7.0 — the unified `load`, the two config surfaces (cluster.yaml + ~/.omnigraph/config.yaml), and cluster apply/serve all require 0.7.0.
compatibility: Requires omnigraph CLI >= 0.7.0 — the unified `load`, the two config surfaces (cluster.yaml + ~/.omnigraph/config.yaml), and cluster apply/serve all require 0.7.0. Version-gated features are marked inline (undirected traversal `<edge>` and enum widening in `schema apply` require >= 0.8.1).
metadata:
author: ModernRelay
version: "0.7.0"
version: "0.8.1"
repository: https://github.com/ModernRelay/omnigraph
---

Expand Down Expand Up @@ -96,7 +96,8 @@ The non-obvious facts that bite, then the full grammar:
- **Scalar param types**: `String Bool I32 I64 U32 U64 F32 F64 DateTime Date Blob`. Modifiers: `T?` (optional), `[T]` (list), `Vector(N)`. There is **no `Int`** — use `I64`.
- **A read query needs `match` *and* `return`** (`order`/`limit` optional); a mutation has neither — only `insert`/`update`/`delete`.
- **`limit` takes an integer literal, not a param** — `limit 50`, never `limit $n`.
- **Variable-hop traversal**: `$p knows{1,3} $f` (`{1,}` = unbounded).
- **Variable-hop traversal**: `$p knows{1,3} $f` — bounds are **required to be finite** (`{1,}` is rejected: "unbounded traversal is disabled").
- **Undirected traversal** (omnigraph >= 0.8.1): `$p <knows> $f` matches the edge in either direction, deduplicated (a pair connected both ways appears once). Same-endpoint-type edges only (e.g. `Related: Issue -> Issue`) — asymmetric edges are rejected (T22). Composes with bounds (`$p <knows>{1,3} $f`) and `not { }`. Replaces the query-both-directions-and-merge workaround for symmetric relations.
- **Literals & calls**: `now()`, `date("2026-04-29")`, `datetime("…T00:00:00Z")`, list `[…]`.
- **Filters** `= != > < >= <= contains`; **aggregates** `count/sum/avg/min/max` (`count($f) as n`).
- **Stored-query metadata**: `@description("…")` / `@instruction("…")` may follow the param list.
Expand Down Expand Up @@ -159,8 +160,9 @@ prop_match_list = { prop_match ~ ("," ~ prop_match)* ~ ","? }
prop_match = { ident ~ ":" ~ match_value }
match_value = { literal | variable | now_call }

// Traversal: $p knows $f
traversal = { variable ~ edge_ident ~ traversal_bounds? ~ variable }
// Traversal: $p knows $f (directional) or $p <knows> $f (undirected, >= 0.8.1)
traversal = { variable ~ (undirected_edge | edge_ident) ~ traversal_bounds? ~ variable }
undirected_edge = { "<" ~ edge_ident ~ ">" }
traversal_bounds = { "{" ~ integer ~ "," ~ integer? ~ "}" }

// Filter: $f.age > 25
Expand Down Expand Up @@ -375,7 +377,7 @@ These are the traps most likely to bite. Scan this table before debugging any pa
| `load --mode merge` after `@embed` source change | stale embeddings | `omnigraph embed --reembed_all` or `load --mode overwrite` |
| `schema apply` with feature branches open | rejected | Merge or delete branches first |
| `nearest(...)` / `bm25(...)` / `rrf(...)` without `limit` | compile error | Add `limit N` |
| Adding non-nullable property without backfill | unsupported migration | Make optional → backfill → tighten in follow-up apply |
| Adding non-nullable property without backfill | unsupported migration | Make optional → backfill; keep it optional (tightening `T?` → `T` is refused, OG-MF-106) |
| `omnigraph init --json` | `unexpected argument --json` | `init` doesn't support `--json`; drop the flag |
| `omnigraph init` on an already-initialized URI | `AlreadyInitialized` error (v0.6.0+) | `--force` to re-init (skips the schema preflight; does **not** purge data) |
| `schema apply` dropping a property/type | soft-dropped or rejected (no data loss) | add `--allow-data-loss` to actually drop the column |
Expand Down
22 changes: 21 additions & 1 deletion skills/omnigraph/references/queries.md
Comment thread
aaltshuler marked this conversation as resolved.
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,26 @@ query employees_of($company: String) {
}
```

### Undirected traversal (omnigraph >= 0.8.1)

For symmetric relations (same-endpoint-type edges like `IssueRelated: Issue -> Issue`),
angle brackets match the edge in **either direction**, deduplicated — one
pattern replaces querying both directions and merging:

```gq
query related_to($slug: String) {
match {
$i: Issue { slug: $slug }
$i <issueRelated> $r
}
return { $r.slug }
}
```
Comment thread
aaltshuler marked this conversation as resolved.

Composes with hop bounds (`$a <knows>{1,3} $b`) and `not { }` ("no edge in
either direction"). Asymmetric edges (e.g. `Comment -> Issue`) are rejected at
typecheck (T22) — use the directional form there.

### Negation

```gq
Expand Down Expand Up @@ -271,7 +291,7 @@ query add_and_link($slug: String, $pattern: String, $createdAt: DateTime, $updat

There's no `upsert` keyword at the query level — use `load --mode merge` for bulk upsert.

> **Insert/update-only OR delete-only (the D₂ rule).** A single mutation query may contain inserts and updates, **or** deletes — never both. Mixing a `delete` with an `insert`/`update` in the same query is rejected at parse time. (Inserts/updates go through a staged two-phase publish; deletes inline-commit — omnigraph doesn't yet use Lance's two-phase delete API (it shipped in Lance 7.0.0 but isn't wired in) — so they can't share one atomic statement.) Split a delete-then-insert into two separate mutations.
> **Insert/update-only OR delete-only (the D₂ rule).** A single mutation query may contain inserts and updates, **or** deletes — never both. Mixing a `delete` with an `insert`/`update` in the same query is rejected at parse time. (Deletes stage through the same two-phase publish as inserts/updates since 0.8.0; the D₂ split is a deliberate semantic boundary — one mutation query is constructive XOR destructive, keeping read-your-writes unambiguous — not an implementation gap.) Split a delete-then-insert into two separate mutations.

### Date and DateTime values

Expand Down
12 changes: 11 additions & 1 deletion skills/omnigraph/references/schema.md
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,17 @@ Adding a non-nullable property to an existing node is rejected as unsupported. P
1. Add as optional: `new_prop: String?`
2. Apply
3. Backfill via a `mutate` or `load --mode merge`
4. Tighten to required in a follow-up apply: `new_prop: String`
4. Keep it optional: tightening `T?` -> `T` is currently refused by the planner
(a property-type change, OG-MF-106). Enforce presence at write time by
convention until required-tightening ships as a migration step.

### Enum widening is a supported apply (omnigraph >= 0.8.1)

Adding variants to an `enum(...)` property is a metadata-only migration step:
`schema plan` shows `extend enum ...`, `apply` touches no table data, and new
variants are accepted immediately on every write surface. Narrowing, renaming
a variant, or converting enum <-> `String` still refuse (OG-MF-106) — those
remain rebuild territory. Value *order* never matters (values are normalized).

### Keep `@key` stable

Expand Down