Real-Time Graph Updates

July 21, 2026 ยท View on GitHub

For active development, keep your knowledge graph automatically synchronised with code changes using the real-time updater.

What It Does

  • Watches your repository for file changes (create, modify, delete)
  • Automatically updates the knowledge graph in real-time
  • Maintains consistency by recalculating all function call relationships
  • Filters out irrelevant files (.git, node_modules, etc.)

Usage

Run the real-time updater in a separate terminal:

python realtime_updater.py /path/to/your/repo

Or using the Makefile:

make watch REPO_PATH=/path/to/your/repo

With Custom Memgraph Settings

python realtime_updater.py /path/to/your/repo \
  --host localhost --port 7687 --batch-size 1000
make watch REPO_PATH=/path/to/your/repo HOST=localhost PORT=7687 BATCH_SIZE=1000

Multi-Terminal Workflow

# Terminal 1: Start the real-time updater
python realtime_updater.py ~/my-project

# Terminal 2: Run the AI assistant
cgr start --repo-path ~/my-project

CLI Arguments

ArgumentRequiredDefaultDescription
repo_pathYesPath to repository to watch
--hostNolocalhostMemgraph host
--portNo7687Memgraph port
--batch-sizeNoNumber of buffered nodes/relationships before flushing to Memgraph

Performance Note

The updater batches rapid saves with a debounce window and recalculates all CALLS relationships on every processed change to ensure consistency. This prevents "island" problems where changes in one file aren't reflected in relationships from other files, but may impact performance on very large codebases with frequent changes. Optimisation of this behaviour is a work in progress.