Skip to content

CLI Reference

@flowrag/cli provides a command-line interface for local usage.

Terminal window
npm install -g @flowrag/cli

Initialize the data directory:

Terminal window
flowrag init
flowrag init --data /custom/path

Index documents from a directory:

Terminal window
flowrag index <path> [options]
Option Description
-d, --data <path> Data storage path (default: ./data)
-f, --force Re-index all documents (ignore hashes)
-i, --interactive Review extracted entities interactively

Examples:

Terminal window
flowrag index ./content # Incremental index
flowrag index ./content --force # Re-index everything
flowrag index ./content --interactive # Review entities
flowrag index ./content --data /tmp/mydata # Custom data path

Search the indexed knowledge base:

Terminal window
flowrag search <query> [options]
Option Description
--type <type> Search type: chunks, entities (semantic), relations
--mode <mode> Query mode: hybrid, local, global, naive
--limit <n> Max results (default: 10)
-d, --data <path> Data storage path (default: ./data)

Examples:

Terminal window
flowrag search "how does OCPP work"
flowrag search "OCPP" --type entities
flowrag search "ServiceA" --type relations
flowrag search "query" --mode local --limit 20

Show index statistics:

Terminal window
flowrag stats
flowrag stats --data /custom/path

Knowledge graph operations:

Terminal window
flowrag graph stats # Entity/relation breakdown
flowrag graph export # Export as DOT format
flowrag graph export --format dot # Explicit DOT format

When indexing with --interactive, you review each extraction:

📄 Chunk chunk:abc123 — doc:readme
? Entities — select to keep:
◉ [SERVICE] becky-ocpp16 — "Backend OCPP 1.6..."
◉ [PROTOCOL] OCPP 1.6 — "Open Charge Point Protocol..."
◯ [OTHER] WebSocket — "Communication protocol..."
? What next?
→ Continue to relations
✏️ Edit an entity
➕ Add new entity
📄 Show chunk content

You can accept, reject, edit entities, or add new ones before they’re stored.