Skip to content

Command Reference

Complete reference for all Graphize CLI commands.

graphize init

Initialize a new graph database.

graphize init

Creates the .graphize/ directory with:

  • manifest.json - Source tracking
  • nodes/ - Node storage
  • edges/ - Edge storage
  • cache/ - Extraction cache

graphize add

Add a repository to track.

graphize add <path>

Arguments:

Argument Description
path Path to Go repository

Examples:

graphize add .
graphize add /path/to/repo
graphize add ../sibling-project

graphize status

Show status of tracked sources.

graphize status

Output:

  • Source path
  • Git commit hash
  • Git branch
  • Last analyzed timestamp
  • Currency status (current/stale)

graphize analyze

Extract graph from tracked sources using AST parsing.

graphize analyze [flags]

Flags:

Flag Description Default
--no-cache Disable caching, re-extract all files false
--directed Treat graph as directed (edges flow from→to) true

Output:

  • Number of nodes extracted
  • Number of edges extracted
  • Node types breakdown
  • Edge types breakdown
  • Cache hit/miss statistics

All edges have EXTRACTED confidence level.

graphize enhance

Prepare files for LLM semantic extraction.

graphize enhance [flags]

Flags:

Flag Description Default
--json Output as JSON false
--force Ignore cache, re-extract all files false
--chunk-size Files per chunk for parallel processing 25
--include-docs Include markdown/text documentation files false
--docs-only Only analyze documentation files (skip code) false

Examples:

# Human-readable output
graphize enhance

# JSON for scripting
graphize enhance --json > files.json

# Include documentation files
graphize enhance --include-docs

# Only documentation files
graphize enhance --docs-only

graphize merge

Merge semantic edges from LLM extraction into the graph.

graphize merge [flags]

Flags:

Flag Description Default
-i, --input Input file with semantic edges required

Examples:

graphize merge -i agents/graph/semantic-edges.json

Input Format:

{
  "edges": [
    {
      "from": "func_handler.go.HandleRequest",
      "to": "func_db.go.Query",
      "type": "inferred_depends",
      "confidence": "INFERRED",
      "confidence_score": 0.85
    }
  ]
}

graphize rebuild

Rebuild graph from sources and merge semantic edges.

graphize rebuild

Equivalent to:

graphize analyze && graphize merge -i agents/graph/semantic-edges.json

graphize query

Query the knowledge graph.

graphize query [node-id] [flags]

Arguments:

Argument Description
node-id Node ID to query (optional)

Flags:

Flag Description Default
--from Filter edges by source node
--type Filter edges by type
--limit Maximum results 100
--depth Traversal depth (enables BFS/DFS) 0
--dfs Use depth-first search false
--dir Direction: out, in, both both
--path Find path to this node
--edge-type Filter by edge type(s), comma-separated

Examples:

# Show graph summary
graphize query

# Show edges for a node
graphize query func_main

# BFS traverse 3 levels deep
graphize query func_main --depth 3

# DFS traverse
graphize query func_main --dfs --depth 5

# Only outgoing edges
graphize query func_main --dir out

# Only incoming edges
graphize query func_main --dir in

# Find path between nodes
graphize query func_main --path func_handleRequest

# Filter by edge type
graphize query --type calls

graphize diff

Compare two graph snapshots.

graphize diff [flags]

Flags:

Flag Description Default
--old Path to old graph required

Examples:

graphize diff --old .graphize.bak
graphize diff --old /path/to/old/graph --graph /path/to/new/graph

Output:

  • New nodes added
  • Nodes removed
  • New edges added
  • Edges removed

graphize report

Generate analysis report for the graph.

graphize report [flags]

Flags:

Flag Description Default
--top Number of top items to show 10
-o, --output Output file stdout
--health Include corpus health assessment false

Examples:

graphize report
graphize report --top 20 -o GRAPH_REPORT.md
graphize report --health

Report Sections:

  • Summary (nodes, edges, types)
  • God Nodes (most connected)
  • Communities (Louvain detection)
  • Surprising Connections
  • Isolated Nodes
  • Package Statistics
  • Suggested Questions
  • Corpus Health (with --health flag)

graphize summary

Generate a markdown summary of the graph.

graphize summary [flags]

Flags:

Flag Description Default
-o, --output Output file stdout

graphize export

Export graph to various formats.

graphize export <format> [flags]

Formats:

Format Description
html Interactive Cytoscape.js visualization
htmlsite Multi-page HTML documentation site
toon Token-optimized notation
json Cytoscape.js JSON format
graphml GraphML XML (for Gephi, yEd)
cypher Neo4j Cypher CREATE statements
obsidian Wiki-style Obsidian vault

Common Flags:

Flag Description Default
-o, --output Output file or directory stdout

Examples:

graphize export html -o graph.html
graphize export htmlsite -o ./site
graphize export toon -o GRAPH.toon
graphize export json -o graph.json
graphize export graphml -o graph.graphml
graphize export cypher -o graph.cypher
graphize export obsidian -o ./vault

graphize export cypher

Export graph as Neo4j Cypher CREATE statements.

graphize export cypher [flags]

Flags:

Flag Description Default
-o, --output Output file stdout

Generates CREATE statements for all nodes and edges, including:

  • Node labels and properties
  • Edge types and properties
  • Confidence metadata for semantic edges

graphize export htmlsite

Export graph as a multi-page HTML documentation site.

graphize export htmlsite [flags]

Flags:

Flag Description Default
-o, --output Output directory required
-t, --title Site title "Code Graph"
--dark Use dark mode theme false
--no-communities Skip community pages false

Output Structure:

site/
├── index.html           # System overview with topology
├── services/            # Per-service subgraphs (multi-service mode)
│   ├── api/index.html
│   └── payments/index.html
└── communities/         # Optional community groupings
    └── 1.html

Modes:

  • Multi-service mode (system-spec present): Index shows system topology, service pages show per-repo code graphs
  • Single-repo mode (no system-spec): Index shows full graph, optional community pages

Examples:

# Basic usage
graphize export htmlsite -o ./site

# Dark mode with custom title
graphize export htmlsite -o ./docs --dark --title "Platform Architecture"

# Skip community detection
graphize export htmlsite -o ./site --no-communities

graphize export obsidian

Export graph as an Obsidian vault with wikilinks.

graphize export obsidian [flags]

Flags:

Flag Description Default
-o, --output Output directory required
--top Number of top nodes to include 20
--min-degree Minimum degree for node pages 3

Output Structure:

vault/
├── index.md           # Entry point with god nodes
├── communities/       # One page per community
│   ├── community-0.md
│   └── community-1.md
└── nodes/             # One page per significant node
    ├── func_main.md
    └── type_Config.md

Pages are interconnected with [[wikilinks]] for Obsidian navigation.

graphize serve

Start MCP server for graph queries.

graphize serve

Starts a Model Context Protocol server over stdio.

Available Tools:

Tool Description
query_graph Search and traverse the graph
get_node Get details for a specific node
get_neighbors Get neighbors of a node
get_community Get nodes in a community
graph_summary Get overall graph statistics

See MCP Server for integration details.

graphize path

Find the shortest path between two nodes.

graphize path <from> <to> [flags]

Arguments:

Argument Description
from Starting node ID
to Target node ID

Flags:

Flag Description Default
--max-depth Maximum search depth 10

Examples:

graphize path func_main func_handleRequest
graphize path type_Config type_Options --max-depth 5

Output:

Shows the path with intermediate nodes and edge types:

func_main
  --[calls]--> func_init
  --[calls]--> func_handleRequest

graphize benchmark

Show token reduction statistics comparing raw corpus to TOON output.

graphize benchmark

Output:

  • Raw corpus size (total bytes of source files)
  • TOON output size (compressed graph representation)
  • Compression ratio
  • Token estimates (raw vs TOON)

graphize explain

Get comprehensive context about a specific node.

graphize explain <node-id> [flags]

Arguments:

Argument Description
node-id Node ID to explain (supports partial matching)

Flags:

Flag Description Default
--depth Neighbor traversal depth 1
--max-edges Maximum edges to display 20
--json Output as JSON false

Examples:

graphize explain func_main
graphize explain func_main --depth 2
graphize explain func_main --json
graphize explain Config  # Partial match

Output:

  • Node info (ID, type, label, attributes)
  • Community membership (ID, label, size, bridge status)
  • Centrality metrics (betweenness score, rank, hub/bridge status)
  • Incoming and outgoing edges with types and confidence

graphize install

Install integrations with AI assistants.

graphize install <platform> [flags]

Platforms:

Platform Description Config Location
claude Claude Desktop MCP server ~/Library/.../claude_desktop_config.json
cursor Cursor IDE rules .cursor/rules/graphize.mdc
copilot GitHub Copilot skills .github/copilot/skills/graphize.md
codex OpenAI Codex CLI hooks.json
gemini Google Gemini CLI .gemini/context/graphize.md
aider Aider/OpenClaw AGENTS.md section

Flags:

Flag Description Default
--status Check installation status false
--uninstall Remove integration false
--force Overwrite existing configuration false
--dry-run Show what would be changed false
--json Output status as JSON false

Examples:

# Install Claude Desktop integration
graphize install claude

# Check status of all platforms
graphize install claude --status
graphize install cursor --status

# Remove integration
graphize install aider --uninstall

# Preview changes
graphize install copilot --dry-run

graphize watch

Monitor tracked sources for changes and auto-rebuild the graph.

graphize watch [flags]

Flags:

Flag Description Default
--debounce Debounce delay for rapid changes 500ms
--html Regenerate HTML visualization on changes false
--report Regenerate analysis report on changes false
--verbose Show detailed file change events false

Examples:

# Basic watch mode
graphize watch

# Also regenerate HTML and report
graphize watch --html --report

# Increase debounce for slower systems
graphize watch --debounce 1s

Press Ctrl+C to stop watching.

graphize hook

Manage git hooks for automatic graph updates.

graphize hook install

Install git hooks in the repository.

graphize hook install

Installs:

  • post-commit: Auto-run graphize analyze after commits
  • post-checkout: Check if graph is stale after checkout

graphize hook uninstall

Remove graphize git hooks.

graphize hook uninstall

graphize hook status

Check git hook installation status.

graphize hook status

graphize init-agents

Initialize agent framework directories.

graphize init-agents

Creates:

agents/
├── specs/       # multi-agent-spec definitions
├── plugins/     # assistantkit-generated plugins
└── graph/       # Graph artifacts

graphize completion

Generate shell completion scripts.

graphize completion <shell>

Shells:

  • bash
  • zsh
  • fish
  • powershell

Examples:

# Bash
graphize completion bash > /etc/bash_completion.d/graphize

# Zsh
graphize completion zsh > "${fpath[1]}/_graphize"

# Fish
graphize completion fish > ~/.config/fish/completions/graphize.fish