Skip to main content
Smart queries count files that match a natural-language description of a code characteristic. Use them when you want a file-count signal for security smells, environment-variable usage, missing error handling, or similar characteristics before you have an exact ast-grep rule or JSSG metric. Prefer a different source when you need: Smart is an Insights query source over indexed repository snapshots. It is not a grep search and does not return line matches or code snippets.
1

Choose Smart as the query source

In a timeseries, single-number, or table widget, open the query source selector and choose Smart.
2

Describe the characteristic

Enter a prompt such as “Find files that read or depend on environment variables”, or start from Examples (security issue finder, environment variable usage, missing error handling).
3

Optionally run interpret

Click Run to draft match rules, probability, globs, and group-by from your prompt. Run does not execute analysis. If you edit the prompt while interpret is running, Codemod discards the draft result.
4

Tune probability and match rules

Set Probability to Low (60%), Medium (85%, default), or High (90%). Only files at or above that confidence count as matches. Optionally add Match rules for “Count as a match when” and “Do not match when”.
5

Select repositories and breakdowns

Choose repositories, optional include and exclude globs, and group-by dimensions. Save the widget. Smart widgets show Analyzing code with progress such as N of M checks while file judgments run.
Codemod Wish can help add or edit widgets on a dashboard. Smart queries follow the live dashboard schema (type: "smart"). There is no separate CLI or MCP command for Smart queries.

Behavior to expect

  • Analysis can continue in the background if a widget times out. Refresh the widget to pick up progress; completed file judgments stay cached.
  • Files that are too large to analyze are skipped and reported as partial results.
  • Changing the prompt or match rules invalidates cached judgments. Changing Probability, globs, or group-by reuses existing judgments for the same matcher.

Example recipes

  • Security breakdown — prompt for insecure patterns, group by the OWASP 2025 semantic category in a table widget.
  • Environment usage — prompt for environment-variable reads, group by file path.
  • Error-handling trend — prompt for operations that can fail without handling, use a timeseries widget over your dashboard time range.