# Code Intelligence
URL: /documentation/plugin/code-intelligence



## What it does [#what-it-does]

Strata19 maintains two related local indexes for the bound repository: a code graph of typed
nodes and edges (`calls`, `imports`, `inherits`, `controls_flow_to`, `data_flows_to`,
`depends_on`, `composed-of`, across structural, resolved, and flow layers), and a separate
tree-sitter index that backs file, search, and blast-radius answers. `strata19.get_local_graph_status`
reports both, and the two can disagree — the graph can be fully built while the tree-sitter
index is still partial, or the reverse.

`strata19.compute_change_impact` is the first call once a symbol or file is named: a basic
in/out edge list — what imports the target, what the target imports, and which of those edges
have drifted from spec. `strata19.project_intelligence` is the deeper follow-up once a target is
already in view: test impact, exception impact, git coupling, breaking-change risk, a refactor
plan, React component context, the request-to-persistence path, route and middleware context,
capability coverage, analysis caveats, canonical-symbol search, and proof certificates.
`strata19.query_local_graph` reads graph nodes and edges directly, including resolver confidence
(how much of the graph rests on a guess versus an import-proven edge) and nominal subtyping
(which classes extend or implement a given type).

A symbol or edge returned by these tools is a measured fact from the current index. A risk
ranking, a breaking-change verdict, or a refactor plan is an interpretation built on top of those
facts — the interpretation is only as good as the index it was computed from.

## When to use it [#when-to-use-it]

Use `strata19.compute_change_impact` before risky work, or before any rename or signature
change, to see what actually depends on the target. Use `strata19.project_intelligence` once a
file, symbol, or route is already in view and the question goes deeper than "what depends on
this" — which tests would catch a regression, whether a route is actually guarded, what a
refactor would touch. Use `strata19.query_local_graph` when you need the raw rows behind an
aggregate answer, or a traversal (subtypes, inbound/outbound edges) that a summary tool does not
expose. Check `strata19.get_local_graph_status` first when you are not sure the index is current.

The local graph is not built by the first index. `strata19.query_local_graph` on a project whose graph was
never built starts the build in the background (the same analysis `local_project_manage build_graph`
runs) and answers with `graph.built: false`, `graph.state: "building"` and the run id instead of an
unlabelled empty list; ask again, or watch `strata19.get_local_graph_status`, until it reads `built`. A
project above 5,000 source files, one whose last attempt failed, or one whose index is still building is
not started automatically and the answer says which; `STRATA19_LOCAL_GRAPH_AUTOBUILD=off` turns it off.

Do not call `strata19.compute_change_impact` on a trivial leaf edit nothing imports — there is
nothing to compute. Do not call `strata19.query_local_graph` with `kind` set to
`edgeResolutionSummary`, `unresolvedSites`, or `nominalSubtypes` before confirming
`strata19.get_local_graph_status` reports the graph `build.state` as `built` — those three read a
separate on-disk index (`.strata19/code-intel.db`) that reports `state: "not-indexed"` honestly
rather than returning a fabricated empty result when it was never built.

## How to use it [#how-to-use-it]

<Steps>
  <Step>
    Confirm the index state before trusting a result. A real call against this repository returned:

    ```json title="strata19.get_local_graph_status → (excerpt)"
    {
      "nodeCount": 55256,
      "edgeCount": 143045,
      "edgeCountsByType": {
        "calls": 34884, "imports": 12591, "depends_on": 616,
        "controls_flow_to": 35938, "data_flows_to": 42667, "inherits": 33
      },
      "build": { "state": "built", "filesStamped": 6009, "lastBuiltAt": "2026-08-30 16:33:13" },
      "codeIntelIndex": {
        "partial": true,
        "summary": "Indexing stopped at 7,200 of 41,087 files (17%), 11s ago and nothing is working on it now. What it finished IS saved — the next build resumes from there rather than starting over."
      }
    }
    ```

    The structural graph reports `built` with real counts. The separate `codeIntelIndex` is
    `partial: true` at 17% — exactly the case `strata19.get_local_graph_status`'s own description
    warns about: a `query_local_graph`/`compute_change_impact` call answering "nothing found" right
    now could mean "not indexed yet," not "genuinely absent."
  </Step>

  <Step>
    Call `strata19.compute_change_impact` with the target:

    ```json title="Call"
    { "symbolOrFile": "src/mcp/facade/facade-tools.ts" }
    ```
  </Step>

  <Step>
    Once a target is confirmed interesting, go deeper with `strata19.project_intelligence`:

    ```json title="Call"
    { "action": "breaking_change_risk", "symbolOrFile": "src/mcp/facade/facade-tools.ts" }
    ```
  </Step>

  <Step>
    For raw rows or a traversal a summary tool does not expose, call `strata19.query_local_graph`
    directly rather than re-deriving it from `compute_change_impact`'s output.
  </Step>
</Steps>

## Parameters [#parameters]

<TypeTable
  type="{
  symbolOrFile: {
    description: 'A code_symbols.symbol_name from the indexed repo, or a repo-relative/indexable file path. Must resolve against the currently indexed project or the call reports UNSUPPORTED.',
    type: 'string',
    required: true,
  },
  repoPath: {
    description: 'Absolute path naming which project root to compute against, for hosts that never report their working directory. Omit to use the currently bound project.',
    type: 'string',
  },
}"
/>

`strata19.project_intelligence` takes one required `action` and a set of action-specific fields:

| `action`                                                                   | Key fields                                                                                          |
| -------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------- |
| `test_impact`, `breaking_change_risk`, `git_coupling`, `component_context` | `symbolOrFile`                                                                                      |
| `exception_impact`                                                         | `file`, `functionName?`, `guardLine?`, `targetLine?`                                                |
| `refactor_plan`                                                            | `symbolOrFile`, `kind?` (`extract-function`, `split-module`, `remove-dead-code`, …), `description?` |
| `route_context`, `middleware_chain`                                        | `file`, `method?`, `pathPattern?`                                                                   |
| `request_to_persistence_path`                                              | `from` (the UI/entry-point symbol)                                                                  |
| `find_canonical_symbol`                                                    | `query?`, `limit?` (capped at 50), `graphBoost?`                                                    |
| `proof_certificate`                                                        | `scope` (`file` or `schema-graph`), `file?`                                                         |
| `capability_coverage`, `analysis_caveats`, `current_project_id`            | none beyond `action`                                                                                |

`strata19.get_local_graph_status` takes no parameters. `strata19.query_local_graph` takes one of
three shapes: a flat `{ kind, filePath | nodeId | edgeType }` query; a versioned grammar query
(`{ schemaVersion: 1, root, predicates?, traversal?, sort?, limit? }`); or `{ catalogId,
catalogVersion? }` for a saved query.

## What you get back [#what-you-get-back]

`strata19.compute_change_impact` returns the blast radius — the dependents and dependencies of
the target — plus any of those edges already known to have drifted from spec.
`strata19.project_intelligence` returns a shape specific to the chosen `action` (a ranked test
list for `test_impact`, a risk verdict for `breaking_change_risk`, and so on).
`strata19.get_local_graph_status` returns the aggregate shown above: `nodeCount`, `edgeCount`,
`edgeCountsByType`, `edgeCountsByLayer`, `freshnessSummary` (rows in state `OVERLAY` /
`INCREMENTAL` / `RECONCILED` / `STALE`), `build` (state, files stamped, last build time), and the
separate `codeIntelIndex` block with its own `partial` flag. `strata19.query_local_graph` returns
the matched nodes or edges directly, or — for `edgeResolutionSummary` — how much of the graph
rests on a proven import versus a guess.

## Limits [#limits]

`strata19.initialize_project`'s own binding response names the boundary precisely for this
repository: Bash, Go, Java, and Kotlin are inventory-only — "files are walked and counted (file
inventory reaches FULL), but no symbols, calls, or cross-file relationships are extracted for
them. Analysis results for these languages will be empty; do not mistake an empty result for a
clean one." Framework-aware extraction (route tables, middleware chains, ORM models, schema
persistence edges) runs for TypeScript only; csharp, go, java, python, ruby, and rust reach file
inventory but no framework-specific extraction.

`strata19.compute_change_impact` reports `UNSUPPORTED` rather than an empty result when the
target does not resolve against the currently indexed project — an unbuilt or stale index is not
the same as "nothing depends on this." `strata19.query_local_graph`'s `nominalSubtypes` is
nominal only: a class that structurally matches an interface with no `implements` clause is
correctly absent from the result. Permanent, structural gaps in the analysis — no ORM edge, no
validates-with edge, route linkage that cannot be traversed, exception flow left uncomposed — are
enumerated by `strata19.get_analysis_caveats`; call it after any tool here reports a `partial`
status.

Speed and scale. A second `verify_implementation` in a new process (a new host session, the
widget, a done-gate check) no longer re-parses every file: the parse results are kept
content-addressed in `.strata19/repo-index-facts.json`, keyed by file hash and by the analyzer
version, so only edited files are parsed again (`STRATA19_REPO_INDEX_FACTS_CACHE=off` turns it
off). Import resolution is recomputed against the current file set each time, so an added or
removed file can never leave a stale edge. Unchanged files are also not read again: the file-hash walk keeps each file's size, modification
and change times, inode and hash in `.strata19/code-intel.db.walk-stat-hashes.json` and reuses the
hash only when all of those are identical and the file had settled when it was hashed
(`STRATA19_WALK_STAT_CACHE=off` turns it off). When no indexed file and no graph-affecting
configuration changed since the recorded index (and, in a git repository, HEAD is the same
commit), a new process, or a caller that just waited for the background build, reuses that index
instead of running the analysis again (`STRATA19_WALK_FINGERPRINT_SKIP=off` turns it off); on a
3,000-file project this took an unchanged call from about 2.5-3.9 s of CPU and 250 MB to about
0.2-0.4 s and 175 MB. A changed file, a new commit or an added file always runs the real
incremental pass. All writes to one project go through a single local
SQLite store and are serialized: measured at roughly three writes per second in total whether one
agent or four are writing (four clients capturing 25 notes each took about 32 seconds), so
concurrent agents queue behind each other rather than scale; reads are not blocked. The pre-build
estimate shown with the first verify is a small-repository model below 2,500 TypeScript/JavaScript
files (about 15 seconds plus 12 ms per file, measured on lightweight repositories) and states the
large-repository rate as an upper bound, because code with a heavy type graph costs more per file.
State is kept per working tree: a linked `git worktree` is a separate project with its own index,
and `initialize_project` says so.

## Related [#related]

* [Findings](/documentation/plugin/findings) — turning a graph observation into a scored finding
* [Verification](/documentation/plugin/verification) — the deterministic gate built on this index
* [Limits](/documentation/reference/limits) — negative-space boundaries across the whole plugin
* [`strata19.compute_change_impact`](/documentation/reference/tools/compute_change_impact)
* [`strata19.project_intelligence`](/documentation/reference/tools/project_intelligence)
* [`strata19.query_local_graph`](/documentation/reference/tools/query_local_graph)
* [`strata19.get_local_graph_status`](/documentation/reference/tools/get_local_graph_status)
