Command-line interface for scripting, automation, and power users. The kg command provides access to all knowledge graph operations.
cd cli
npm run build
./install.shVerify with kg health.
Find concepts by meaning, not keywords.
# Semantic search
kg search query "causes of inflation"
# Get full concept details with evidence
kg search details c_abc123
# Find related concepts (2 hops)
kg search related c_abc123 --depth 2
# Find path between concepts
kg search connect "supply chain" "consumer prices"What you can do: Discover concepts without knowing exact terms, trace relationships, find unexpected connections.
Add documents to your knowledge graph.
# Single file
kg ingest file research-paper.pdf --ontology economics
# Directory (recursive)
kg ingest directory ./papers --ontology economics --recursive
# Raw text
kg ingest text "The Federal Reserve controls interest rates..." --ontology economics
# Image with vision AI
kg ingest image diagram.png --ontology economicsWhat you can do: Build knowledge graphs from document collections, process images with vision AI, organize by ontology.
Browse ingested content.
# List documents in an ontology
kg document list --ontology economics
# Get document details
kg document show doc_abc123
# Access original source text
kg source show src_abc123Manage knowledge domains.
# List all ontologies
kg ontology list
# Get statistics
kg ontology info economics
# List source files
kg ontology files economics
# Delete (with confirmation)
kg ontology delete test-data --forceAnalyze semantic dimensions.
# Project concepts onto an axis
kg polarity analyze --positive "modern" --negative "traditional"
# List saved analyses
kg polarity listWhat you can do: Discover where concepts fall on semantic spectrums, find concepts that balance opposing viewpoints.
Manage relationship types.
# Check vocabulary health
kg vocabulary status
# List all relationship types
kg vocabulary listAccess saved computation results.
# List saved artifacts
kg artifact list
# Show artifact details
kg artifact show art_abc123Control the extraction pipeline.
# List jobs by status
kg job list --status pending
# Watch job progress
kg job status job_abc123 --watch
# Approve pending jobs
kg job approve job_abc123
# Cancel running job
kg job cancel job_abc123
# Clean up old jobs
kg job cleanup --older-than 7d --status completedWhat you can do: Control when extraction happens, monitor costs, clean up completed work.
System administration.
# Check system health
kg admin status
# Create backup
kg admin backup --type full
# Restore from backup
kg admin restore --file backup.sqlManage credentials.
# Login
kg login
# Logout
kg logout
# Create MCP credentials
kg oauth create-mcp
# List OAuth clients
kg oauth clientsFamiliar commands for quick access.
# List resources
kg ls ontologies
kg ls concepts --ontology economics
# Show details
kg cat concept c_abc123
kg stat ontology economics
# Delete
kg rm job job_abc123# Ingest all PDFs, auto-approve
for f in papers/*.pdf; do
kg ingest file "$f" --ontology research --auto-approve
done# Search and pipe to jq
kg search query "machine learning" --format json | jq '.concepts[].label'# Validate graph health in CI
kg health --exit-code
kg database stats --format json# View current config
kg config get
# Set auto-approval
kg config set auto-approve true
# Set API URL
kg config set api-url http://localhost:8000Config stored in ~/.config/kg-cli/config.json.

