Graph modeling and mutation
Translate a domain change into canonical types, validate it, and apply the
smallest governed mutation with a verification and rollback plan.
Action reference
| Tool |
Actions |
Notes |
graph_write |
add_node, add_edge, delete_node, delete_edge, register_external_graph, bulk_ingest, compare_and_set (atomic conditional update — applies updates only if every field in conditions still matches), store_memory, recall_memory, recall_media, log_chat, submit_sdd, register_execution, check_loop |
the primary KG mutation interface |
graph_memory |
engine methods (1:1, dashes→underscores): create_summary, consolidate, maintain, add_scene_object, world_transform, start_trajectory, append_step, discounted_return, get_*; unified memory-CRUD store (agent_id+content[+memory_type,tags]), recall (query), link |
episodic→semantic consolidation, the spatial scene graph, RL trajectories; the unified CRUD actions route into the SAME graph_write memory core as the REST /graph/write/memory twins |
graph_ontology + object layer |
graph_ontology: load/list/get/update/delete/validate/activate/deactivate/sync_packages (SHACL-validated, versioned, native-reasoner-loaded); ontology_property_types/ontology_value_types (type registry: list/describe/validate/coerce); ontology_interface (implementers/conforms/owl, registry='enterprise' for standard contracts); ontology_sampling_profile (task-aware LLM sampling profiles — list/describe/resolve/set/evolve/owl); ontology_function (typed versioned functions, list/invoke); ontology_derive (compute derived properties live at read time); ontology_link_materialize (reify a many-to-many link as a junction triple); ontology_leanix_sync (mirror the live LeanIX metamodel as OWL/RDF, dry_run first); object_edits (durable object-edit ledger — record/revert/history/as_of, optimistic expect); object_index (search-index lifecycle — sync/reindex/status); object_permissioning (redact/restricted_view/mark, ambient actor); object_set (Foundry-style object sets — of_type/search/filter/pivot/aggregate/union/intersect/subtract) |
the whole ontology + Foundry-style object layer, one skill wraps all thirteen tools |
ontology_classification_claims |
the reviewed claim lifecycle for a classification: propose_identity/record to raise one, review/promote/reject/supersede to move it, query/history/lifecycle_history/categories/resolve_evidence to read it back |
a claim is a REVIEWED assertion, not a direct ontology edit — promotion, not graph_write, is what makes it authoritative |
ontology_repository_provenance |
branch, tag, snapshot, change_event |
write-only: every action constructs one typed provenance node and commits it through the shared envelope-ingest write path, so repository history becomes queryable KG structure rather than free text |
concept_registry (text → structured concepts) |
parses unstructured text (transcripts/papers/specs) into Concept/Reference nodes + SUB_CLASS_OF/DEFINED_IN edges, then compiles idempotent parameterized MERGE Cypher for graph_write |
3-step pipeline: parse extracted terms → structure into node/edge schemas → compile the transaction; validate parameter-backed bindings before writing (no injection) |
Reversible derivations (truth maintenance)
A derived/computed node (a mined finding, a computed capability-index entry, a
materialized view) registered as a live materialization auto-marks Stale the
moment a committed change touches something it depends on — dependency-directed,
paraconsistent (a contradiction elsewhere never cascades into unrelated
stale-ing). Requires the opt-in epistemic-tms engine feature (both actions
below degrade to {"error": ...} without it).
- Write the derivation with its provenance intact: the node itself
(
graph_write(action="add_node", ...)) plus explicit DERIVED_FROM/
GENERATED_BY edges to every fact it actually depends on
(graph_write(action="add_edge", ..., rel_type="DERIVED_FROM")). The engine
reads exactly these edges — not a caller-supplied list — to build the
dependency set, so get them right.
- Register once:
engine_query(action="register_materialization", params_json='{"derived_id": "<id>"}') → {"id", "depends_on", ...} — treat a
shorter-than-expected depends_on list as a sign the dependency edges weren't
written correctly.
- Check freshness later:
engine_query(action="materialization_status", params_json='{"id": "<id>"}') → "Fresh" / "Stale" / "Retracted" / null
(never registered). On Stale, re-run whatever produced the derivation and
re-register — there is no automatic recompute (see limits below).
Honest limits: the live CDC hook that marks dependents Stale fires on exactly
two mutation shapes — RemoveNode/RemoveEdge (→ Deleted) and
CompareAndSetNodeFields (→ Updated). A plain AddNode on a dependency is
not mapped (no pre-image capture on that path), so adding a brand-new fact
never staleness-marks a materialization that would logically depend on it — only
removing or CAS-updating an existing dependency does. Nothing currently
consumes staleness automatically — the engine computes the staled-id set on
every qualifying mutation but drops it after logging; there is no scheduler,
watcher, or Loop stage that reacts to a Stale materialization and recomputes it
(a tracked, open gap, not something to paper over). The truth-maintenance index
is in-memory, process-global, and resets on restart — re-register after a
restart if you need continued tracking.
Workflow
1. Model before mutating
- Search the existing ontology and object model for an equivalent type or
property.
- Extend the canonical model instead of creating a parallel vocabulary.
- Specify identity, required properties, relationship direction, cardinality,
tenant scope, and lifecycle.
- Distinguish asserted facts from derived facts and memories.
Use graph_ontology, ontology_property_types, ontology_value_types, and
ontology_interface to inspect or define the model. Use
ontology_sampling_profile to ground a proposed type in representative data.
2. Select the mutation surface
| Change |
Primary operation |
| Canonical nodes or relationships |
graph_write |
| Episodic, semantic, spatial, or RL memories |
graph_memory |
| Concept registration |
concept_registry |
| Object edits and sets |
object_edits, object_set |
| Object indexes |
object_index |
| Object access rules |
object_permissioning |
| Derived values or links |
ontology_derive, ontology_link_materialize |
| Executable ontology logic |
ontology_function |
| External architecture sync |
ontology_leanix_sync |
| Governed classification claims |
ontology_classification_claims |
| Repository provenance records |
ontology_repository_provenance |
Keep a simple, reversible update direct. Delegate a schema migration or
multi-stage derivation through graph_workflows with explicit preconditions,
postconditions, and approval boundaries.
3. Validate and preview
- Validate ontology connectivity and constraints before the data write.
- Confirm referenced nodes exist and identifiers are stable.
- Preview affected object counts with a bounded read.
- Define rollback or compensating operations before a high-impact change.
4. Apply atomically
For a design, review, or preview-only request, return the proposed model,
affected counts, verification, and rollback plan, then stop before this stage.
- Use a transaction or compare-and-set operation when concurrent writers can
race.
- Attach provenance, actor, observed time, and evidence to material changes.
- Keep derived artifacts linked to their inputs so they can be recomputed or
retracted.
- Never broaden permissions as an incidental side effect.
5. Verify
- Read the changed objects through the normal query surface.
- Re-run constraints and check that unrelated objects did not change.
- Confirm retries are idempotent.
- Record the mutation outcome and any remaining manual action.
Use an economy model for inventory and deterministic conformance checks. Use a
stronger reasoning model for ontology tradeoffs, migrations, and blast-radius
judgment.
Guardrails
- Do not bypass policy, approval, or tenant boundaries.
- Do not use unbounded object sets for mutations.
- Do not embed credentials or private source data in ontology definitions.
- Do not claim success from an accepted job alone; verify the resulting state.
1---2name: graph-modeling-and-mutation3description: Design canonical ontology-backed graph models and perform governed mutations through Graph-OS object and memory surfaces. Use for nodes, edges, memories, concepts, property or value types, ontology functions, derivations, object sets, permissions, indexes, linked materialization, reversible changes, or transactional write planning. For low-level native engine compute, storage, transaction, or cluster primitives, use graph-engine-and-modalities.4---56# Graph modeling and mutation78Translate a domain change into canonical types, validate it, and apply the9smallest governed mutation with a verification and rollback plan.1011## Action reference1213| Tool | Actions | Notes |14|---|---|---|15| `graph_write` | `add_node`, `add_edge`, `delete_node`, `delete_edge`, `register_external_graph`, `bulk_ingest`, `compare_and_set` (atomic conditional update — applies `updates` only if every field in `conditions` still matches), `store_memory`, `recall_memory`, `recall_media`, `log_chat`, `submit_sdd`, `register_execution`, `check_loop` | the primary KG mutation interface |16| `graph_memory` | engine methods (1:1, dashes→underscores): `create_summary`, `consolidate`, `maintain`, `add_scene_object`, `world_transform`, `start_trajectory`, `append_step`, `discounted_return`, `get_*`; unified memory-CRUD `store` (`agent_id`+`content`[+`memory_type`,`tags`]), `recall` (`query`), `link` | episodic→semantic consolidation, the spatial scene graph, RL trajectories; the unified CRUD actions route into the SAME `graph_write` memory core as the REST `/graph/write/memory` twins |17| `graph_ontology` + object layer | `graph_ontology`: `load`/`list`/`get`/`update`/`delete`/`validate`/`activate`/`deactivate`/`sync_packages` (SHACL-validated, versioned, native-reasoner-loaded); `ontology_property_types`/`ontology_value_types` (type registry: list/describe/validate/coerce); `ontology_interface` (`implementers`/`conforms`/`owl`, `registry='enterprise'` for standard contracts); `ontology_sampling_profile` (task-aware LLM sampling profiles — list/describe/resolve/set/evolve/owl); `ontology_function` (typed versioned functions, `list`/`invoke`); `ontology_derive` (compute derived properties live at read time); `ontology_link_materialize` (reify a many-to-many link as a junction triple); `ontology_leanix_sync` (mirror the live LeanIX metamodel as OWL/RDF, `dry_run` first); `object_edits` (durable object-edit ledger — record/revert/history/as_of, optimistic `expect`); `object_index` (search-index lifecycle — sync/reindex/status); `object_permissioning` (`redact`/`restricted_view`/`mark`, ambient actor); `object_set` (Foundry-style object sets — `of_type`/`search`/`filter`/`pivot`/`aggregate`/`union`/`intersect`/`subtract`) | the whole ontology + Foundry-style object layer, one skill wraps all thirteen tools |18| `ontology_classification_claims` | the reviewed claim lifecycle for a classification: `propose_identity`/`record` to raise one, `review`/`promote`/`reject`/`supersede` to move it, `query`/`history`/`lifecycle_history`/`categories`/`resolve_evidence` to read it back | a claim is a REVIEWED assertion, not a direct ontology edit — promotion, not `graph_write`, is what makes it authoritative |19| `ontology_repository_provenance` | `branch`, `tag`, `snapshot`, `change_event` | write-only: every action constructs one typed provenance node and commits it through the shared envelope-ingest write path, so repository history becomes queryable KG structure rather than free text |20| `concept_registry` (text → structured concepts) | parses unstructured text (transcripts/papers/specs) into `Concept`/`Reference` nodes + `SUB_CLASS_OF`/`DEFINED_IN` edges, then compiles idempotent parameterized `MERGE` Cypher for `graph_write` | 3-step pipeline: parse extracted terms → structure into node/edge schemas → compile the transaction; validate parameter-backed bindings before writing (no injection) |2122### Reversible derivations (truth maintenance)2324A derived/computed node (a mined finding, a computed capability-index entry, a25materialized view) registered as a live materialization auto-marks `Stale` the26moment a committed change touches something it depends on — dependency-directed,27paraconsistent (a contradiction elsewhere never cascades into unrelated28stale-ing). Requires the opt-in `epistemic-tms` engine feature (both actions29below degrade to `{"error": ...}` without it).30311. Write the derivation with its provenance intact: the node itself32 (`graph_write(action="add_node", ...)`) plus explicit `DERIVED_FROM`/33 `GENERATED_BY` edges to every fact it actually depends on34 (`graph_write(action="add_edge", ..., rel_type="DERIVED_FROM")`). The engine35 reads exactly these edges — not a caller-supplied list — to build the36 dependency set, so get them right.372. Register once: `engine_query(action="register_materialization",38 params_json='{"derived_id": "<id>"}')` → `{"id", "depends_on", ...}` — treat a39 shorter-than-expected `depends_on` list as a sign the dependency edges weren't40 written correctly.413. Check freshness later: `engine_query(action="materialization_status",42 params_json='{"id": "<id>"}')` → `"Fresh"` / `"Stale"` / `"Retracted"` / `null`43 (never registered). On `Stale`, re-run whatever produced the derivation and44 re-register — there is no automatic recompute (see limits below).4546Honest limits: the live CDC hook that marks dependents `Stale` fires on exactly47two mutation shapes — `RemoveNode`/`RemoveEdge` (→ `Deleted`) and48`CompareAndSetNodeFields` (→ `Updated`). A plain `AddNode` on a dependency is49**not** mapped (no pre-image capture on that path), so adding a brand-new fact50never staleness-marks a materialization that would logically depend on it — only51removing or CAS-updating an existing dependency does. **Nothing currently52consumes staleness automatically** — the engine computes the staled-id set on53every qualifying mutation but drops it after logging; there is no scheduler,54watcher, or Loop stage that reacts to a `Stale` materialization and recomputes it55(a tracked, open gap, not something to paper over). The truth-maintenance index56is in-memory, process-global, and resets on restart — re-register after a57restart if you need continued tracking.5859## Workflow6061### 1. Model before mutating6263- Search the existing ontology and object model for an equivalent type or64 property.65- Extend the canonical model instead of creating a parallel vocabulary.66- Specify identity, required properties, relationship direction, cardinality,67 tenant scope, and lifecycle.68- Distinguish asserted facts from derived facts and memories.6970Use `graph_ontology`, `ontology_property_types`, `ontology_value_types`, and71`ontology_interface` to inspect or define the model. Use72`ontology_sampling_profile` to ground a proposed type in representative data.7374### 2. Select the mutation surface7576| Change | Primary operation |77|---|---|78| Canonical nodes or relationships | `graph_write` |79| Episodic, semantic, spatial, or RL memories | `graph_memory` |80| Concept registration | `concept_registry` |81| Object edits and sets | `object_edits`, `object_set` |82| Object indexes | `object_index` |83| Object access rules | `object_permissioning` |84| Derived values or links | `ontology_derive`, `ontology_link_materialize` |85| Executable ontology logic | `ontology_function` |86| External architecture sync | `ontology_leanix_sync` |87| Governed classification claims | `ontology_classification_claims` |88| Repository provenance records | `ontology_repository_provenance` |8990Keep a simple, reversible update direct. Delegate a schema migration or91multi-stage derivation through `graph_workflows` with explicit preconditions,92postconditions, and approval boundaries.9394### 3. Validate and preview9596- Validate ontology connectivity and constraints before the data write.97- Confirm referenced nodes exist and identifiers are stable.98- Preview affected object counts with a bounded read.99- Define rollback or compensating operations before a high-impact change.100101### 4. Apply atomically102103For a design, review, or preview-only request, return the proposed model,104affected counts, verification, and rollback plan, then stop before this stage.105106- Use a transaction or compare-and-set operation when concurrent writers can107 race.108- Attach provenance, actor, observed time, and evidence to material changes.109- Keep derived artifacts linked to their inputs so they can be recomputed or110 retracted.111- Never broaden permissions as an incidental side effect.112113### 5. Verify114115- Read the changed objects through the normal query surface.116- Re-run constraints and check that unrelated objects did not change.117- Confirm retries are idempotent.118- Record the mutation outcome and any remaining manual action.119120Use an economy model for inventory and deterministic conformance checks. Use a121stronger reasoning model for ontology tradeoffs, migrations, and blast-radius122judgment.123124## Guardrails125126- Do not bypass policy, approval, or tenant boundaries.127- Do not use unbounded object sets for mutations.128- Do not embed credentials or private source data in ontology definitions.129- Do not claim success from an accepted job alone; verify the resulting state.