rai graph
Build, query, and manage the knowledge graph. The graph is a unified index of all context sources: governance, memory (patterns, calibration, sessions), skills, work tracking, and discovered components.
rai graph build
Section titled “rai graph build”Build the graph index from all sources. By default, diffs against the previous build and saves the diff to .raise/rai/personal/last-diff.json.
| Flag | Short | Description |
|---|---|---|
--output | -o | Path to save index JSON |
--no-diff | Skip diff computation |
# Build index to default locationrai graph build
# Build without diffrai graph build --no-diff
# Save to custom locationrai graph build --output custom_index.jsonExit codes: 0 success.
rai graph query
Section titled “rai graph query”Search the knowledge graph for relevant concepts.
| Argument | Description |
|---|---|
QUERY_STR | Query string — keywords or concept ID (required) |
| Flag | Short | Description |
|---|---|---|
--format | -f | Output format: human, json. Default: human |
--output | -o | Output file path (default: stdout) |
--strategy | -s | Query strategy: keyword_search, concept_lookup |
--types | -t | Filter by types (comma-separated: pattern, calibration, principle, etc.) |
--edge-types | Filter by edge types (comma-separated: constrained_by, depends_on, etc.) | |
--limit | -l | Maximum number of results. Default: 10 |
--index | -i | Graph index path |
# Search by keywordsrai graph query "planning estimation"
# Filter to patterns onlyrai graph query "testing" --types pattern,calibration
# Lookup specific concept by IDrai graph query "PAT-001" --strategy concept_lookup
# Compact JSON outputrai graph query "velocity" --format jsonrai graph context
Section titled “rai graph context”Show full architectural context for a module. Returns bounded context (domain), architectural layer, guardrails, and dependencies.
| Argument | Description |
|---|---|
MODULE_ID | Module ID, e.g. mod-memory (required) |
| Flag | Short | Description |
|---|---|---|
--format | -f | Output format: human, json. Default: human |
--index | -i | Graph index path |
# Show context for memory modulerai graph context mod-memory
# JSON outputrai graph context mod-memory --format jsonrai graph validate
Section titled “rai graph validate”Validate graph index structure and relationships. Checks for cycles in depends_on relationships, valid relationship types, and that all edge targets exist as nodes.
| Flag | Short | Description |
|---|---|---|
--index | -i | Path to index JSON file |
# Validate default indexrai graph validate
# Validate specific index filerai graph validate --index custom_index.jsonExit codes: 0 valid, 1 validation errors found.
rai graph extract
Section titled “rai graph extract”Extract concepts from governance markdown files. Without arguments, extracts from all standard governance locations (governance/prd.md, governance/vision.md, framework/reference/constitution.md).
| Argument | Description |
|---|---|
FILE_PATH | Path to governance file (optional — extracts all if omitted) |
| Flag | Short | Description |
|---|---|---|
--format | -f | Output format: human, json. Default: human |
# Extract from all governance filesrai graph extract
# Extract from specific filerai graph extract governance/prd.mdrai graph list
Section titled “rai graph list”List concepts in the knowledge graph.
| Flag | Short | Description |
|---|---|---|
--format | -f | Output format: human, json, table. Default: table |
--output | -o | Output file path (default: stdout) |
--index | -i | Graph index path |
--memory-only / --all | Show only memory types (pattern, calibration, session) or all. Default: --all |
# Show summary tablerai graph list
# Show only patterns/calibrations/sessionsrai graph list --memory-only
# Export as JSONrai graph list --format json --output graph.jsonrai graph viz
Section titled “rai graph viz”Generate an interactive HTML visualization of the knowledge graph. Creates a self-contained HTML file with a D3.js force-directed graph. Nodes are color-coded by type, filterable, zoomable, and searchable.
| Flag | Short | Description |
|---|---|---|
--output | -o | Output HTML file path |
--index | -i | Graph index path |
--open / --no-open | Open in browser after generating. Default: --open |
# Generate and open in browserrai graph viz
# Generate to specific pathrai graph viz --output graph.html
# Generate without openingrai graph viz --no-openSee also: rai graph build, rai pattern