CLI Reference
All commands are run from the context-chain project root.
Infrastructure
docker compose up -d
Start Memgraph and Memgraph Lab.
| Service | Port | URL |
|---|---|---|
| Memgraph (bolt) | 7687 | bolt://localhost:7687 |
| Memgraph Lab | 3000 | http://localhost:3000 |
npm run db:schema
Initialize indexes and constraints in Memgraph.
npm run db:reset
DANGER
Clears all data from the graph. Irreversible.
Analysis
npm run analyze
The main analysis command. Uses the analyze_function building block to extract decisions per function.
# Full scan — all functions in a repo
npm run analyze -- --repo my-repo
# Resume an interrupted scan
npm run analyze -- --repo my-repo --continue
# Analyze a single function
npm run analyze -- --function createOrder --file store/orderStore.js --repo my-repo
# Use a specific template
npm run analyze -- --repo my-repo --template deep-analysis
# List available templates
npm run analyze -- --list-templatesTemplates control context depth (caller/callee hops), code granularity (full/truncated/signature), finding types, max decisions per function, and prompt wording. See Configuration for template details.
npm run ingest:cpg
Import code structure from Joern-generated JSON.
npm run ingest:cpg -- --file data/output.jsonnpm run ingest:sessions:v2
Extract decisions from Claude Code conversation transcripts. See Session Ingestion for full details.
npm run ingest:sessions:v2 # all new sessions
npm run ingest:sessions:v2 -- --project my-project # one project
npm run ingest:sessions:v2 -- --auto-approve # skip interactive prompt
npm run ingest:sessions:v2 -- --dry-run # preview onlynpm run connect
Process pending decision comparisons — builds relationship edges (CAUSED_BY, DEPENDS_ON, CONFLICTS_WITH, etc.).
npm run connectRun after analyze or ingest:sessions:v2 to connect related decisions.
npm run refine
Run the overnight refinement pipeline.
npm run refine # all tasks
npm run refine -- --only staleness # single taskTasks: staleness detection, anchor precision upgrade, keyword normalization, decision edge completion, gap detection.
MCP Server
npm run mcp
Start the MCP server. Usually managed automatically by Claude Code via .mcp.json.
Dashboard
npm run dashboard
Start the web dashboard at http://localhost:3001. Supports EN/ZH.