Graph Compact
graph_compactShrink a memory to the part that still earns its place. PREMIUM (license).
Ranks entities by how connected they are and how much is recorded about them, keeps anything you name outright, and drops the rest along with the relations that pointed at them. Typical input {"graph": {...}, "max_entities": 50, "keep": ["Acme Corp"]} returns {"graph": {...}, "kept": 50, "dropped_entities": ["Old Note", ...], "dropped_relations": 12, "ranking": "degree, then observation count, then name"}.
Use when a graph has outgrown the context you can spend on it. Not for removing wrong facts - graph_lint finds those, and deleting them is a decision you should make deliberately rather than by ranking. Errors: on invalid, missing, or malformed input this tool never raises a protocol error — it returns {"error": ""}. Every call is read-only and idempotent, so after correcting the input it is always safe to retry.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| keep | No | Entity names to keep regardless of rank, e.g. ["Acme Corp"]. Matched case-insensitively. | |
| graph | Yes | The graph document to compact. | |
| max_entities | No | How many entities to keep. Default 50. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||