ctxloom Documentation
Complete reference for all CLI commands, MCP tools, and configuration options.
Quick Start
Up and running in under a minute. No API keys, no cloud, no Python.
Install
npm install -g ctxloom-proConfigure AI tools
One-time. Detects all MCP clients automatically.
ctxloom setupIndex project
cd /path/to/your/project
ctxloom indexPrefer manual configuration? Add this to your MCP client config:
{
"mcpServers": {
"ctxloom": {
"command": "npx",
"args": ["-y", "ctxloom"],
"env": { "CTXLOOM_ROOT": "/path/to/project" }
}
}
}CLI Commands
| Command | Description |
|---|---|
ctxloom | Start MCP server (Stdio transport) |
ctxloom index | Index current directory + build dependency graph |
ctxloom dashboard | Open the web dashboard at http://localhost:7842 |
ctxloom dashboard --port=N | Start dashboard on a custom port |
ctxloom dashboard --open | Launch and open browser automatically |
ctxloom setup | Detect and configure MCP-compatible AI tools (interactive) |
ctxloom register <path> | Register a repo for cross-repo search |
ctxloom repos | List all registered repos |
ctxloom grammars | Show grammar cache status |
ctxloom grammars --download | Pre-download all language grammars |
ctxloom rules check | Check .ctxloom/rules.yml against the dependency graph |
ctxloom rules check --json | JSON output (schemaVersion: 1) for CI parsers |
ctxloom rules check --use-snapshot | Skip re-indexing, use existing graph snapshot |
ctxloom rules check --limit=N | Limit text output to N violations (default: 50) |
ctxloom --help | Show help |
MCP Tools32
ctx_blast_radius, ctx_hub_nodes, ctx_bridge_nodes, ctx_architecture_overview, ctx_knowledge_gaps, ctx_surprising_connections, ctx_detect_changes.ctx_searchHybrid semantic + graph search. Use it when: finding files by concept or relationship.
ctx_get_fileSafe file read, 5 MB limit, path traversal protected. Use it when: reading a specific file safely.
ctx_get_context_packetPrimary file + dependency skeletons + reverse importers in one call. Use it when: giving AI full context for a file.
ctx_similar_filesFind semantically similar files via vector embeddings. Use it when: finding related implementations.
ctx_cross_repo_searchFederated search across all registered repos. Use it when: working across multiple repos.
ctx_full_text_searchHybrid keyword + vector with regex. Use it when: finding exact strings or patterns.
ctx_blast_radius"What breaks if I change this?" import + call graph traversal. Supports detail_level="minimal".
ctx_hub_nodesTop-N files by import degree (chokepoints). Supports detail_level="minimal".
ctx_bridge_nodesTop-N files by betweenness centrality (connectors). Supports detail_level="minimal".
ctx_community_listLouvain clustering — groups files into architectural modules.
ctx_architecture_overviewHigh-level summary: communities, hubs, coupling. Supports detail_level="minimal".
ctx_knowledge_gapsIsolated files, untested hubs, dead code candidates. Supports detail_level="minimal".
ctx_surprising_connectionsCircular deps, cross-community imports, prod→test violations. Supports detail_level="minimal".
ctx_find_large_functionsFunctions/classes exceeding a line threshold, sorted by size.
ctx_get_call_graphBidirectional call graph with configurable depth.
ctx_get_definitionSymbol definition lookup via AST index.
ctx_execution_flowDFS call graph traversal from entry point with cycle detection.
ctx_refactor_previewRead-only symbol rename diff preview across entire codebase.
ctx_apply_refactorWrite symbol renames atomically (supports dry_run).
ctx_git_diff_reviewAll-in-one review packet: git diffs + skeletons + blast radius.
ctx_wiki_generateGenerate .ctxloom/wiki/ — one Markdown page per community. No LLM needed.
ctx_graph_exportExport to GraphML, DOT, Obsidian, SVG, or interactive D3.js HTML.
ctx_suggested_questionsGraph-driven review questions without LLM.
ctx_detect_changesRisk-scored change analysis (critical/high/medium/low). Supports detail_level="minimal".
ctx_graph_snapshotSave named checkpoint of the dependency graph.
ctx_graph_diffDiff two named snapshots — added/removed nodes and edges.
ctx_git_couplingCo-change analysis from git history (Jaccard + recency decay).
ctx_risk_overlayPer-file composite risk: churn 35% + bug density 30% + bus factor 20% + coupling 15%.
ctx_rules_checkCheck .ctxloom/rules.yml against the live dependency graph. Returns {schemaVersion:1, violations, warnings}. Config reloaded on every call.
ctx_get_rulesInject project rules from .cursorrules, CLAUDE.md, .ctxloomrc.
ctx_statusServer status: graph size, vector count, init state.
ctx_get_workflowPre-written tool sequences for review/debug/onboard/refactor/audit.
Git Risk Overlay
ctxloom . --with-git --git-window-days=365ctxloom . --no-gitNew tools
ctx_git_couplingGiven a file, returns top co-changed siblings with confidence score.
- node — target file path
- limit — default 10
- minConfidence — default 0.1
- windowDays — default 365
ctx_risk_overlayPer-file composite risk score 0–1.
Enriched tools
ctx_detect_changes— each file now includes overlay_risk block with churn, bug density, owners, coupled siblings.ctx_blast_radius— adds historicalCoupling section for files that co-change but aren't reachable via imports.Architecture Rules Engine
Enforce import boundaries as a CI lint step — no runtime overhead, no flaky tests.
Quick start
# Check rules against the indexed dependency graph
ctxloom rules check
# JSON output (CI-friendly)
ctxloom rules check --json
# Use existing snapshot, skip re-indexing
ctxloom rules check --use-snapshotConfig — .ctxloom/rules.yml
version: 1
rules:
- name: domain must not import infra
type: no-import
from: "src/domain/**"
to: "src/infra/**"
severity: error # optional, defaults to "error"
- name: no legacy shared imports
type: no-import
from: "src/features/**"
to: "src/shared/legacy/**"
severity: warningRule fields
| Field | Required | Description |
|---|---|---|
| name | ✅ | Human-readable label shown in violations |
| type | ✅ | Always no-import in v1 |
| from | ✅ | picomatch glob — files that must not import |
| to | ✅ | picomatch glob — files that must not be imported |
| severity | ❌ | "error" (default) or "warning" |
Exit codes
| Code | Meaning |
|---|---|
| 0 | Clean — no error violations (warnings are allowed) |
| 1 | One or more error-severity violations found |
| 2 | Config file invalid or I/O error |
CI integration
name: Architecture rules
on: [push, pull_request]
jobs:
check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with: { node-version: '20' }
- run: npm install -g ctxloom-pro
- run: ctxloom index
- run: ctxloom rules check --jsonMCP tool — ctx_rules_check
Exposes the same engine to your AI assistant. Config is reloaded on every call — no server restart needed when rules change.
{
"schemaVersion": 1,
"violations": [
{
"rule": "domain must not import infra",
"severity": "error",
"from": "src/domain/user.ts",
"to": "src/infra/db.ts"
}
],
"warnings": []
}ctxloom-botBeta
What ctxloom-bot does on every PR:
- →Posts risk-scored summary: overall risk label + score, blast radius, top high-risk files
- →Inline review comments at highest-risk lines
- →Suggests reviewers from git ownership data
- →Slash commands: /ctxloom explain <file>, /ctxloom ignore, /ctxloom refresh
- →Optional Check Run to gate merges on risk threshold
Config via .ctxloom.yml
risk_threshold: 0.7
inline_comments: true
suggested_reviewers: true
check_run: false
excluded_paths: []
max_inline_per_pr: 10Web Dashboard
A local web UI that visualises your codebase's graph, risk, ownership, and community data in real time — no cloud required.
Launch
# Index first (with git history for full metrics)
ctxloom index --with-git
# Start the dashboard
ctxloom dashboardVisit http://localhost:7842 — no browser extension required. Use --port=N to change the port or --open to auto-launch the browser.
Views
| View | What it shows |
|---|---|
| Overview | File count, edge count, community count, git status, risk breakdown donut, top architectural hubs |
| Dependency Graph | Interactive D3 force-directed graph — hover for details, click to highlight neighbours, search to pan, community colour legend, risk rings for high/critical files |
| Risk | Sortable, filterable table with composite risk score (churn × 0.3 + bug density × 0.3 + bus factor × 0.2 + coupling × 0.2) |
| Communities | Auto-detected Louvain modules — expandable cluster cards listing all member files |
| Ownership | Per-file primary owner, share %, bus factor — filterable by file or contributor name |
| Guide | In-app reference explaining every metric and how to interpret the data |
Interactivity
- ◆Click any filename in Risk, Ownership, or Communities to open a file preview drawer with full source and an Open in IDE button (VS Code, Cursor, or system default).
- ◆Auto-reload — the dashboard watches
.ctxloom/graph-snapshot.jsonand reloads in-place whenctxloom indexupdates it. No server restart needed. - ◆↻ Refresh button in the Overview header triggers a manual reload of all graph and git data.
Risk Tiers
| Tier | Score | Meaning |
|---|---|---|
| critical | > 0.8 | Urgent — high churn, sole owner, heavily coupled |
| high | > 0.6 | Should be addressed soon |
| medium | > 0.3 | Monitor — watch for growth |
| low | ≤ 0.3 | Acceptable |
ctxloom index --with-git to enable the full risk overlay before launching the dashboard.Language Support
| Language | Import Graph | Symbol Index | Skeletonization |
|---|---|---|---|
| TypeScript / JavaScript | ✅ Full AST | ✅ | ✅ |
| Python | ✅ Relative imports | ✅ | ✅ |
| Rust | ✅ mod resolution | ✅ | ✅ |
| Go | ✅ go.mod module-path | ✅ | ✅ |
| Java | ✅ Dot-to-slash | ✅ | ✅ |
| C# | ✅ Namespace resolution | ✅ | ✅ |
| Ruby | ✅ Relative paths | ✅ | ✅ |
| Kotlin | ✅ Package imports | ✅ | ✅ |
| Swift | ✅ Module imports | ✅ | ✅ |
| PHP | ✅ PSR-4 + require_once | ✅ | ❌ |
| Dart | ✅ Relative imports | ✅ | ❌ |
| Vue SFC | ✅ Script block | ✅ | ❌ |
| Jupyter Notebook | ✅ Python cell imports | ✅ | ❌ |
Architecture
MCP Interface
Stdio transport
32 Tools — ToolRegistry
Dependency
Graph
VectorDB
LanceDB
Skeletonizer
tree-sitter
File Watcher
chokidar · 200ms debounce · incremental re-index
Snapshot Manager
atomic writes · crash-safe · local filesystem
How search works
- 1Embed — Query embedded with sentence-transformers/all-MiniLM-L6-v2 (local, 384-dim)
- 2Vector search — ANN query against LanceDB
- 3Graph expansion — Results expanded via import graph (importers/imports get score boost)
- 4Skeletonize — Dependency files reduced to signature-only views (~92% token reduction)
Token Reduction Benchmarks
Measured on real open-source repos — not estimated.
| Repository | Language | Raw tokens | Skeleton tokens | Reduction |
|---|---|---|---|---|
| expressjs/express | JavaScript | ~4,646 | ~390 | 92% |
| sindresorhus/got | TypeScript | ~10,807 | ~742 | 93% |
| SergioBenitez/Rocket | Rust | ~1,281 | ~90 | 93% |
| fastify/fastify | JavaScript | ~2,136 | ~202 | 91% |
| Average | 92% |
npm run bench:reposSecurity
- ✓Path traversal prevention (CWE-22), symlink-aware — all file inputs validated against project root
- ✓Shell injection prevention — execFileSync with argument arrays, no shell string interpolation
- ✓XML injection prevention — all user-controlled strings escaped before XML output
- ✓File size limits — files over 5 MB rejected and skipped by indexer
- ✓Input bounds — limit capped at 100, depth capped at 20 across all tools
- ✓Atomic snapshot writes — written to .tmp then renamed, prevents torn reads
- ✓Snapshot schema validation — validated before hydration, prevents prototype pollution
Environment Variables
| Variable | Description | Default |
|---|---|---|
| CTXLOOM_ROOT | Project root directory to index | Current working directory |
| LOG_LEVEL | Logging verbosity: debug / info / warn / error | info |
| CTXLOOM_GRAMMAR_CDN | CDN base URL for grammar downloads (air-gapped environments) | Built-in |
Build from Source
git clone https://github.com/kodiii/ctxloom.git
cd ctxloom
npm install
npm run build
ctxloom index
node dist/index.jsChangelog
- +ctxloom rules check CLI — lint import boundaries against the dependency graph
- +ctx_rules_check MCP tool — same engine available to AI assistants, config reloaded per call
- +.ctxloom/rules.yml — picomatch glob rules with no-import type and error/warning severity
- +--json, --use-snapshot, --limit flags on rules check
- +Exit codes: 0 = clean, 1 = error violations, 2 = config error
- +ctx_git_coupling — co-change coupling from git history
- +ctx_risk_overlay — per-file composite risk score
- +ctxloom-bot — GitHub App with PR comments, inline annotations, slash commands
- +--with-git flag (on by default), --no-git to disable
- ~ctx_detect_changes enriched — overlay_risk block per file
- ~ctx_blast_radius enriched — historicalCoupling section
- +ctx_find_large_functions
- +detail_level="minimal" on 7 tools (40–60% fewer tokens)
- +PHP, Dart, Vue SFC language support
- +Graph export: SVG + interactive D3.js HTML formats
- +Real benchmark numbers: 92% on 5 real repos
- +ctx_full_text_search, ctx_suggested_questions, ctx_detect_changes
- +ctx_apply_refactor (dry_run supported)
- +ctx_get_workflow (5 workflow templates)
- +ctx_graph_snapshot, ctx_graph_diff
- +Jupyter notebook support
- +ctx_community_list, ctx_architecture_overview, ctx_knowledge_gaps
- +ctx_surprising_connections, ctx_wiki_generate, ctx_graph_export
- +ctx_git_diff_review, ctx_refactor_preview, ctx_execution_flow
- +ctx_cross_repo_search, go.mod module-path resolution