Configure Context Graph

Context Graph keeps its settings in one configuration file. Setup writes it, and the config command changes it. This page also covers how to use your own Memgraph, run setup again to change your choices, choose what is recorded, and update or uninstall Context Graph.

Configuration file

Setup writes the configuration to ~/.config/context-graph/config.toml, readable only by you. Set the CONTEXT_GRAPH_CONFIG environment variable to use another path.

The file lists every key under a comment that says what it does. A key you haven’t set is commented out, with its default, so you can see all settings in one place. Setup and config set rewrite the file: they keep your values and [redact] patterns, but not comments you add.

The hooks read their settings only from this file, not from environment variables, because agents run hooks without your shell’s environment. Change settings with the config command:

memgraph-context-graph config show
memgraph-context-graph config get memgraph.url
memgraph-context-graph config set identity.user_id alice
memgraph-context-graph config set recall.turns_k ""

An empty value, as in the last command, sets a key back to its default. The exception is capture.connectors, where an empty value records nothing. config set checks each value and refuses one that Context Graph can’t use, so a typo doesn’t break recording later. It takes these keys:

KeyDefaultWhat it sets
identity.user_idYour git user.name, set by setupYour user ID. Your sessions and memories are filed under it, and recall searches only its sessions.
memgraph.urlbolt://localhost:7687The Memgraph Bolt URL
memgraph.userNoneThe Memgraph user name
memgraph.passwordNoneThe Memgraph password. config set memgraph.password without a value prompts for it.
memgraph.databasememgraphThe database, on a Memgraph with multi-tenancy
capture.connectorsskills-graph, actions-graph, sessions-graphWhat the hooks record. See Choose what is recorded.
capture.redacttrueWhether secrets are redacted before they’re stored. See Redact secrets.
capture.max_chars100000The most characters kept from one text field, such as a tool’s output. 0 keeps everything. See Shorten long text.
capture.exclude_toolsNoneTools whose calls and results aren’t recorded, by name or glob. See Exclude tools and projects.
capture.exclude_projectsNoneDirectories in which nothing is recorded, by path or glob
memory.backendnativecontext-graph when Context Graph is the agents’ memory, native when they keep their own. Set it with setup’s --memory-backend, which also changes the agents’ settings.
session_start.resumetrueWhether a session starts with the note on where you left off
recall.*See Recall configurationThe embedding model for recall, which searches run, and how many results each returns
reconcile.auto_reconcilefalseWhether the knowledge graph is built after each session
ontology.pathThe default ontologyAn ontology file for the knowledge graph
ontology.deriveextendWhether Context Graph adds types to your ontology: extend or off
extraction.*See Extraction configurationHow sessions are read into the knowledge graph
llm.anthropic_api_keyNoneAn Anthropic API key, used only to learn your ontology. Used instead of an OpenAI key when both are set.
llm.openai_api_keyNoneAn OpenAI API key, used only to learn your ontology
llm.derive_modelclaude-sonnet-5-5 with Anthropic, gpt-5 with OpenAIThe model that learns your ontology
editioncommunityenterprise to use shared spaces. Set it with memgraph-context-graph join.
github.tokenNoneA GitHub token for resources-graph, used instead of your gh login. Prompts for the value.

Only [redact] patterns are edited in the file directly, because you name them yourself. See Redact secrets.

⚠️

The file holds your Memgraph password and API keys in plain text. Setup creates it with permissions 0600; keep it that way.

Recall configuration

The recall.* keys set which searches recall runs and how many results each returns:

memgraph-context-graph config set recall.turns_k 12
memgraph-context-graph config set recall.lanes "memories, turns, text"
KeyDefaultWhat it sets
recall.embedding_modelBAAI/bge-small-en-v1.5The model Memgraph computes embeddings with
recall.lanesAll sixThe searches to run, as a comma-separated subset of memories, turns, text, entities, facts and user_facts
recall.memories_k5Memory files returned
recall.turns_k8Messages found by meaning
recall.text_k8Messages found by words
recall.entities_k15Entities matched
recall.edges_per_entity6Facts read from each matched entity
recall.facts_k15Facts matched
recall.fact_turns_k8Messages added for the matched facts
recall.user_fact_types2Fact types gathered in full, for questions that count or list things
recall.user_facts_k30Facts returned for those types
recall.turn_chars1500Characters shown per message
recall.query_instructionDepends on the modelText added before the question when it’s embedded. The English bge models get their retrieval instruction; other models get none

When you change recall.embedding_model, Context Graph computes the embeddings again with the new model, so embeddings from two models are never mixed. Memgraph downloads the model on first use.

Extraction configuration

The extraction.* keys set how the knowledge graph reads your sessions. Reconciliation and ontology learning use the same settings, so a session is always read the same way.

memgraph-context-graph config set extraction.entity_threshold 0.3
KeyDefaultWhat it sets
extraction.modelfastino/gliner2.5-base-v1The GLiNER2 model
extraction.entity_thresholdGLiNER2’s defaultThe lowest confidence, from 0 to 1, at which an entity is kept
extraction.relation_thresholdGLiNER2’s defaultThe lowest confidence, from 0 to 1, at which a fact is kept
extraction.chunk_sizeGLiNER2’s defaultWords per chunk
extraction.chunk_overlapGLiNER2’s defaultWords shared by neighboring chunks

Use your own Memgraph

By default, setup starts Memgraph in Docker on your machine. To use another Memgraph, such as a shared server or a high availability cluster, pass its URL to setup. If the instance has authentication, set the user and password first, because setup connects with them:

memgraph-context-graph config set memgraph.user alice
memgraph-context-graph config set memgraph.password
memgraph-context-graph setup --memgraph-url bolt://memgraph.example.com:7687

For a high availability cluster, use the neo4j:// scheme with a coordinator’s address, so the client routes writes to the MAIN instance:

memgraph-context-graph config set memgraph.url neo4j://coordinator.example.com:7687

The instance needs the Memgraph version, MAGE and memory listed in the prerequisites. To see all labels and properties with SHOW SCHEMA INFO, start it with --schema-info-enabled=true. The Memgraph that setup starts has it enabled.

Each user on a shared Memgraph should have their own identity.user_id. On a shared Memgraph with Memgraph Enterprise, shared spaces give each user a database of their own.

Run setup again

Every choice in setup is also a flag of memgraph-context-graph setup. To change a choice, run setup again with its flag:

memgraph-context-graph setup codex --memgraph-url bolt://memgraph.example.com:7687
FlagWhat it sets
RUNTIME ...The runtime names of the agents to connect. The default is every agent on your PATH.
--project-dir DIRA project to connect the per-project agents in. Repeat it for more projects. The default is the current directory.
--memgraph-url URLThe Memgraph to use, instead of setup’s own container.
--user-id NAMEYour user ID in the graph. The default is the configured one, then your git user.name.
--memory-backend BACKENDcontext-graph makes Context Graph the agents’ memory; native gives memory back to the agent.
--memgraph-container NAMESetup’s own container, which it finds or starts. The default is context-graph-memgraph.
--no-viewerDon’t install the terminal viewer.
--planPrint what setup would do and change nothing.
--no-tuiPrint plain output, even on a terminal.

For example, to connect the per-project agents in more projects:

memgraph-context-graph setup cursor --project-dir ~/work/billing --project-dir ~/work/crawler

Choose what is recorded

capture.connectors lists the packages the hooks send events to. Each one records one part of a session:

ConnectorRecords
actions-graphPrompts, replies, tool calls and tool results
skills-graphThe agent skills a session used
sessions-graphThe session, its user and project, and memories. Recall needs it.
resources-graphThe GitHub resources a session read. Off by default.

For example, to also remember GitHub resources:

memgraph-context-graph config set capture.connectors "skills-graph, actions-graph, sessions-graph, resources-graph"
memgraph-context-graph setup

Setup installs the connectors the setting names. An empty value records nothing, without disconnecting the agents.

Update Context Graph

Context Graph doesn’t update itself. Upgrading the packages changes the code the hooks run, but the plugins, hook files and Model Context Protocol (MCP) registrations that setup wrote stay as they were. The update command upgrades both in one step:

memgraph-context-graph update

It runs these steps in order:

  1. Upgrades the packages: memgraph-context-graph and its connectors.
  2. Updates the Claude Code and Codex plugins from the Context Graph plugin marketplace, if they’re installed.
  3. Rewrites the hook files and MCP registrations of the per-project agents, in the current directory or the --project-dir directories.
  4. Creates the indexes and constraints in Memgraph that are missing.
  5. Checks the setup, the same way as doctor.

Then restart running agent sessions, because a session keeps the hooks it started with.

FlagWhat it does
RUNTIME ...Update only these agents. The default is every connected agent.
--project-dir DIRA project whose per-project agents to update. Repeat it for more projects. The default is the current directory.
--no-upgradeSkip the package upgrade, and only refresh the plugins, hook files, registrations, indexes and constraints

update doesn’t change your own hooks, the configuration file or the data in the graph, and running it twice changes nothing.

Update the plugins manually

If you manage plugins yourself, update the Context Graph plugin with the agent’s own commands. Claude Code updates the plugin in place:

claude plugin marketplace update context-graph-plugins
claude plugin update context-graph@context-graph-plugins

Codex has no update command, so refresh the marketplace and add the plugin again:

codex plugin marketplace upgrade context-graph-plugins
codex plugin add context-graph@context-graph-plugins

Updating only the plugin doesn’t upgrade the packages its hooks run. Run memgraph-context-graph update as well, or upgrade the tool with uv tool upgrade memgraph-context-graph.

Uninstall Context Graph

The uninstall command disconnects your agents: it removes the plugins, hook files and MCP registrations, and gives the agents’ memory back.

memgraph-context-graph uninstall

On a terminal, it then asks about each of these, and keeps it unless you answer yes:

  • The graph: the Memgraph container that setup started and its data volume, with every recorded session and memory.
  • The configuration: the configuration file and the log of failed recordings.
  • The tool: the memgraph-context-graph command and its packages.

To remove everything without questions, for example in a script:

memgraph-context-graph uninstall --all
FlagWhat it does
RUNTIME ...Disconnect only these agents. The default is every connected agent.
--project-dir DIRA project to disconnect the per-project agents from. Repeat it for more projects. The default is the current directory.
--graphAlso delete the graph: setup’s Memgraph container and its volume
--configAlso delete the configuration file and the log of failed recordings
--toolAlso uninstall the memgraph-context-graph tool
--all--graph, --config and --tool together
--memgraph-container NAMEThe container setup started. The default is context-graph-memgraph.
--no-tuiDon’t ask; remove the agent connections and what the flags name

Without a terminal, uninstall removes only the agent connections and what the flags name. It deletes only the container setup started, by name, never a Memgraph you run yourself. On Windows, the running tool can’t remove itself, so uninstall prints the uv tool uninstall command to run afterwards.

⚠️

Deleting the graph deletes everything your agents recorded, including your memories, and can’t be undone.