Skip to content

CLI Reference

All commands are run from the context-chain project root.

Infrastructure

docker compose up -d

Start Memgraph and Memgraph Lab.

ServicePortURL
Memgraph (bolt)7687bolt://localhost:7687
Memgraph Lab3000http://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.

bash
# 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-templates

Templates 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.

bash
npm run ingest:cpg -- --file data/output.json

npm run ingest:sessions:v2

Extract decisions from Claude Code conversation transcripts. See Session Ingestion for full details.

bash
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 only

npm run connect

Process pending decision comparisons — builds relationship edges (CAUSED_BY, DEPENDS_ON, CONFLICTS_WITH, etc.).

bash
npm run connect

Run after analyze or ingest:sessions:v2 to connect related decisions.

npm run refine

Run the overnight refinement pipeline.

bash
npm run refine                       # all tasks
npm run refine -- --only staleness   # single task

Tasks: 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.

Released under the Apache 2.0 License.