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.
ingrain context security_rules <query> [--assessment <path>] [--limit N] [--json]security_rules
Section titled “security_rules”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.
Scoping a search to your change
Section titled “Scoping a search to your change”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.
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.
The maturity band
Section titled “The maturity band”Every search also returns the maturity band the change is held to, resolved on the platform from your own configuration:
- the strictest maturity target across the buckets covering the change,
- otherwise your organization’s target,
- 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.
| Flag | Description |
|---|---|
--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. |
--json | Emit 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.
Configuration
Section titled “Configuration”context talks to the platform over a sync URL and an API token. Provide them via
either:
- the
INGRAIN_SYNC_URLandINGRAIN_API_TOKENenvironment variables, or - a
[context]section in your user-levelconf.tomlwithsyncUrlandingrainApiTokenfields.
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.