Skip to content

Watch Mode

Fresh

Overview

Watch mode keeps the knowledge graph live during active development. Graphify monitors your directory for file changes and triggers incremental rebuilds automatically.

Start Watch Mode

bash
/graphify . --watch
/graphify ./src --watch    # Watch a specific subfolder

The process runs in the foreground. Stop it with Ctrl+C.

How It Works

flowchart TD
    A[Watch mode started] --> B[Monitor directory for changes]
    B --> C{File changed?}
    C -->|No| B
    C -->|Code file| D[Tree-sitter AST rebuild - instant]
    C -->|Prose or doc file| E[LLM extraction - seconds]
    C -->|Image or video| F[Vision and transcription]
    D --> G[Merge into graph]
    E --> G
    F --> G
    G --> B

Performance Characteristics

Change TypeRebuild TimeLLM Call?
Code file (.py, .ts, .go, etc.)< 1 secondNo
Markdown / text file2-5 secondsYes
PDF5-15 secondsYes
Image3-10 secondsYes (vision)
Video30s+Yes (transcription)

Code Changes Are Fast

Watch mode is particularly well-suited to code-heavy development. Editing Python, TypeScript, Go, or Rust files triggers near-instant rebuilds because tree-sitter AST extraction runs entirely locally without LLM calls.

Running in Background

To run watch mode in the background while you work:

bash
# macOS/Linux
nohup graphify . --watch > /tmp/graphify-watch.log 2>&1 &
echo "Watch started, PID: $!"

# Stop it later
kill <PID>

Or use a terminal multiplexer:

bash
# tmux
tmux new-session -d -s graphify 'graphify . --watch'
tmux attach -t graphify    # to see output
tmux kill-session -t graphify    # to stop

Combining with --no-viz

For faster watch mode (skip HTML regeneration):

bash
/graphify . --watch --no-viz

This updates graph.json and GRAPH_REPORT.md only — no HTML rebuild on every change. Useful if you're primarily querying via slash commands rather than the browser visualization.

Use Cases

Active Feature Development

Keep watch mode running during a long coding session. Your AI assistant's graph context stays current with every save.

Code Review Prep

Run watch mode while making review changes. Query the final graph to verify your changes are reflected correctly before pushing.

Pair Programming

One person runs watch mode. Both developers get live graph updates as code evolves.

Verification

bash
# Start watch mode
/graphify . --watch

# In another terminal, make a change
echo "# Test" >> README.md

# Watch mode should log: "Detected change: README.md — rebuilding..."
# Then: "Graph updated: 1 file reprocessed"