39 lines
1.7 KiB
Markdown
39 lines
1.7 KiB
Markdown
---
|
|
description: Apply an approved kg-changeset.json to the memory hub. Backs up the graph first; confirms each destructive operation.
|
|
allowed-tools:
|
|
- Read
|
|
- mcp__memory__read_graph
|
|
- mcp__memory__create_entities
|
|
- mcp__memory__create_relations
|
|
- mcp__memory__add_observations
|
|
- mcp__memory__delete_entities
|
|
- mcp__memory__delete_relations
|
|
- mcp__memory__delete_observations
|
|
---
|
|
|
|
You apply an approved change-set to the memory-hub knowledge graph. This is the
|
|
ONLY place that writes to the graph.
|
|
|
|
## Safety procedure — do not skip
|
|
1. **Backup first.** Call `mcp__memory__read_graph` and write the full dump to
|
|
`./kg-backup-<ISO-timestamp>.json`. Confirm the file exists before any write.
|
|
2. Read `./kg-changeset.json` (or the path in $ARGUMENTS).
|
|
3. Print a human-readable diff grouped by operation type
|
|
(merges, new_relations, deletions, type_migrations, renames) with counts.
|
|
4. **Ask for confirmation per destructive group.** Merges and deletions are
|
|
irreversible at the graph level — require an explicit "yes" for each group.
|
|
New relations and non-destructive adds can be batched after a single "yes".
|
|
5. Apply in this safe order:
|
|
1. create new entities / relations (additive, low risk),
|
|
2. add observations,
|
|
3. perform merges (re-point relations to canonical, copy observations,
|
|
then delete the redundant members),
|
|
4. apply type migrations / renames,
|
|
5. perform standalone deletions last.
|
|
6. After each group, re-read affected nodes to verify, and report what changed.
|
|
|
|
If `kg-changeset.json` is missing or malformed, stop and tell the user to run
|
|
`/kg-curate` first. Never invent changes that aren't in the change-set.
|
|
|
|
$ARGUMENTS
|