Docs navigation

Guides / Introduction · Edit on GitHub

Introduction to rgctl

What rgctl is and how a code knowledge graph works — concepts before commands.

Hands-on: Installation · Guides (CoolStore) · User Guide (ecommerce-java).
Agents: agent-skill · USER_AGENTS_TEMPLATE · rgctl install --skill.
Contribute to rgctl: AGENTS.md. JSON: json-api.md.


What problem does rgctl solve?

Modern codebases are too large to hold in your head — or in an LLM context window. Changing a function raises reachability questions: who calls it, what depends on it, are security-sensitive paths involved, where is complexity concentrated?

rgctl turns the repository into a structured graph — functions, types, calls, imports, docs, and more — so you ask structural questions and get deterministic answers instead of grepping and guessing. Built in Rust for speed and predictable memory on large repos. Primary consumer output is compact -f json for agents and scripts.


What is a code knowledge graph?

Everyday ideaIn rgctl
Places on the mapNodes — functions, classes, files, modules, headings, …
RoadsEdges — typed relations (CALLS, CONTAINS, IMPORTS, VIOLATES, …)
The map fileArtifacts under {repo}/.rgctl/ after discover

Reachability (who can reach whom along call paths) is pre-computed and stored compactly — that is why blast-radius stays fast on large graphs.

You do not need graph theory to use the CLI: indexing builds the map; commands query the map.


How the pieces fit

  Your repo (source)
      │
      │  discover  (cd repo && rgctl discover .   — or  rgctl -r PATH discover)
      ▼
  artifact root ({repo}/.rgctl/)
      │  primary: graph.snapshot.bin (RGCL v2 columnar mmap)
      │
      ├── find / callers / callees / relations / inventory / blast-radius / metrics / communities / clones / cpg / slice / inspect
      ├── check / review check / review paths / diff   (CI + temporal PR gate + snapshot compare)
      ├── update / watch / merge                       (incremental + multi-repo park-and-resolve)
      ├── semantic index + query                       (opt-in embedder)
      ├── export                                       (JSON, GraphML, Mermaid, Obsidian, …)
      └── serve                                        (optional HTTP dashboard + semantic API)
  1. Once (or after large changes): discover from the repo you mean to index — see Discovering and indexing for -r vs . pitfalls.
  2. Many times: query commands read {repo}/.rgctl/. Prefer -f json and never scrape stderr (JSON API).
  3. Agents: install the pack (rgctl install --skill --tools …) — single skill rgctl (agent-skill).
  4. Dashboard: optional UI after discover --with-dashboard + serve — not required for structural answers.

Capability designs for contributors: design/.

Discover depth (common flags)

FlagsUse
(default)Fast graph + metrics caches → .rgctl/graph.snapshot.bin (RGCL v2)
--with-cfgWhole-repo CFG/PDG archive (v3 cfg_pdg.bin); needed for taint --sink, cpg mutations, richest inspect. Not required for slice / cpg flows (lazy single-function build)
--with-taintDiscover-time taint (with CFG)
--with-gitGit churn hotspots + CoChangesWith edges (metrics --churn)
--scip PATHSCIP overlay — upgrades ambiguous calls (resolution = "scip")
--with-kantraKonveyor Kantra rule eval (Java-oriented; VIOLATES edges)
--fullFull pipeline (large corpora / Gate B style runs)
--with-dashboard / --export-migration-hintsOpt-in UI bundle / migration JSON
rgctl discover . -l java,kotlin,python --with-cfg
rgctl discover . --with-git --git-since 90.days
rgctl discover . --scip index.scip
rgctl discover . -e node_modules,target,.git,vendor

Capability map (concepts only)

Step-by-step how-tos: Guides. Full CLI walkthrough: User Guide.

CapabilityIntent
discoverIndex repo → RGCL v2 graph + analytics caches under .rgctl/
find / callers / callees / relations / inventoryStructured graph queries (agent-facing; query … is a compatibility alias)
blast-radiusUpstream impact / reachability for a symbol
slice / taintStatement-level data/control dependence; source→sink (slice lazy-builds CFG/PDG; --with-alias)
inspectCFG / PDG / dominance for one function
cpgHybrid CALL + CFG/PDG façade (flows lazy; mutations needs --with-cfg)
clonesExact / bloom / fragment (SESE hammock + 2-iter 1-WL) with --seed
metrics / communitiesFastPageRank, SampledBetweenness, HyperBallHarmonic; Fast-Leiden communities ($\mu+4\sigma$ hub strip)
merge / update / watchMulti-repo park-and-resolve merge; incremental / live update
semanticOpt-in natural-language / keyword search over functions
exportSubgraph / projection export (JSON, GraphML, Mermaid, Obsidian, …)
check / review checkCI blast-radius policy; temporal PR gate (pr-check = alias of review check)
diffCompare two columnar snapshots (digest + diff_snapshots)
migration hintsPackage roadmap JSON (--export-migration-hints)
KantraMigration-rule findings during discover (--with-kantra)
MRO / OverridesCross-language method resolution → Overrides edges; polymorphic call retarget
installBundle agent skills / optional policy into IDEs
serveForeground HTTP dashboard + semantic HTTP API for one repository

Markdown / docs: discover indexes .md / .mdx by default (headings, links, frontmatter). Use find / relations on module nodes and references edges; function semantic search stays separate. See guide.


Languages

Tier-1 deep-analysis languages use custom tree-sitter plugins with grammar-verified crates/rgctl-lang-*/{id}-ast-coverage.json manifests, single-pass extract_all (ScopeStack + KindDispatchTable + parse_with_pool), and CFG/PDG support. Set RGCTL_AST_COVERAGE_STRICT=1 to fail the build on grammar/manifest drift.

Separately, languages.toml registers ~60 language and config/IaC plugins (Tier 1 + generic tree-sitter + regex + formats). Do not equate “Tier 1 deep analysis” with the full plugin catalog count.

The website /docs/languages/ pages are generated from those JSON files at build time — do not maintain parallel hand-written coverage tables. Pointers: languages/README.md · tier-1-language-support.md · CLI command reference.

Current Tier-1 deep-analysis ids include C, C++, C#, Go, Groovy, Java, JavaScript, Kotlin, PHP, Puppet, Python, Ruby, Rust, TypeScript (plus markdown as a doc plugin; ERB and others with coverage JSON as they land).


Where to go next

You want…Go to
Install / verify the binaryInstallation
Feature how-tos on CoolStoreGuides
Full CLI + ecommerce-javaUser Guide
Agent pack (skills)agent-skill
Paste into another repoUSER_AGENTS_TEMPLATE
Language support matrixlanguages/README.md (JSON SSOT → website)
JSON fields / schema_versionjson-api.md
HTTP serve APIHTTP Server and Dashboard
Latest release notesv0.4.17
Contribute / cold profilesAGENTS.md · docs hub — For contributors
Research mapfurther-reading.md