Skip to content

context

ingrain context runs a semantic search against your organization’s recorded security rules. Queries are matched on meaning, not keywords, so phrase them as questions.

Terminal window
ingrain context security_rules <query> [--assessment <path>] [--limit N] [--json]
Terminal window
ingrain context security_rules "how do we authenticate service-to-service calls"

One query per distinct question — run several rather than combining topics into one long query.

The search narrows itself to the rules that govern the code you are about to touch, instead of every rule your organization has — reading that from the assessment the mint recorded for this branch.

Terminal window
ingrain context security_rules "input validation"

Pass --assessment <path> to scope against a different file.

The paths come from the assessment file’s ## Affected paths section, where the security review declares the folders the change is expected to land in. They are a prediction: a design review runs before the code exists, so there is no diff to read, and what the review states is the only description of where the change is going. The repository is read from the git remote of the checkout that owns the assessment file.

Scoping is best-effort. An unwritten section, a file that cannot be read, a checkout with no remote — each falls back to an org-wide search, the same result you get without the flag.

One case behaves differently: if the repository is not registered in your organization, a scoped search matches nothing rather than falling back — registering a repository is how an organization says which rules govern it — and the command tells you when it happens.

Every search also returns the maturity band the change is held to, resolved on the platform from your own configuration:

  1. the strictest maturity target across the buckets covering the change,
  2. otherwise your organization’s target,
  3. otherwise high.

Higher maturity is the stricter setting, so a change spanning a high bucket and a low one is held to high. Step 1 needs an assessment to scope against; with none the band falls through to your organization’s setting. To change the band, set the maturity target on your buckets.

FlagDescription
--assessment <path>Assessment file whose ## Affected paths narrows the search to the code this change touches. Defaults to the assessment ingrain assessment mint last recorded for this branch, so you rarely pass it. With neither, the search is org-wide.
--limit <N>Maximum results to return, 1–50. Defaults to 10.
--jsonEmit raw JSON results to stdout, in place of the human-readable list.

Results go to stdout; every diagnostic — including the empty-result hint — goes to stderr, so --json output can be piped cleanly.

If nothing matches, the command prints a short hint saying why: whether your organization has any security rules ingested yet, or whether the search was narrowed and found nothing inside that narrowing.

context talks to the platform over a sync URL and an API token. Provide them via either:

  • the INGRAIN_SYNC_URL and INGRAIN_API_TOKEN environment variables, or
  • a [context] section in your user-level conf.toml with syncUrl and ingrainApiToken fields.

Run config to find your conf.toml. Set both values before running a search. See the [context] configuration page for the full key reference and validation rules.