Skip to content

retrieve

retrieve is the inverse of record: it pulls the analysis your organization’s platform holds for this repository and branch, and writes it back as an assessment file the review can carry on from.

Terminal window
ingrain retrieve [--assessment <path>]

Locally you rarely need it — the review resumes from the file already on your disk. It exists for the run that has no disk to resume from.

In CI the workspace is destroyed when the job ends, and .ingrain-security/ is git-ignored, so nothing survives between pushes. Without retrieve, every push re-analyses the change from scratch and posts findings that contradict the ones already on the pull request.

  • ## Task — the title, the stage the analysis reached, and its description.
  • ## Threats — every threat with the decision made at the threat gate. Tags are preserved: a T07 stays T07 across runs, so a finding stays the same finding after a re-score moves its rank.
  • ## Risk score — the plan-level residual risk.
  • ## Org rules — each rule the rule gate decided on, with its decision and, for an accepted one, the rule’s text exactly as it was gated. A rule edited since is not updated: the verification pass judges against what was accepted.
  • ## Implementation guidance — each entry with the drivers it names.
  • ## Affected paths — the folders the analysis was built for.

Two sections are rebuilt rather than pulled. Verdicts come back empty — a verification pass writes its own. ## Triage is derived from what arrived: an analysis with content reads Verdict: major, one with none reads minor, and Surfaces is left blank.

With no --assessment, this branch’s assessment:

.ingrain-security/assessment-<branch-slug>.md

which is where the review looks for it. It creates .ingrain-security/ either way, with the .gitignore that keeps your analysis out of a git add -A. If .ingrain-security is a symlink, the command refuses to write into it — remove the symlink and recreate it as a real directory.

It also records the run’s state beside the assessment for later commands (assert-synced) to pick up.

Exits 0, writes no assessment, and says so — the first run on any branch. The review starts from nothing, which is correct.

CodeMeaning
0Restored, or nothing is recorded yet.
1No credential configured, git cannot identify the checkout, or the response could not be written as a valid assessment. Nothing is written on a failure.
2A bad flag.
5The platform did not answer — the connection failed, or it returned a 5xx.

5 is separate so a job can tell an outage from a sync that did not land. A refusal — the platform rejected the upload, or this CLI is too old — is a 1: the platform answered.

The same [context] section record uses:

[context]
syncUrl = "https://api.example.com/ingrain-agent-sync"
ingrainApiToken = "ingrn_…"

or INGRAIN_SYNC_URL / INGRAIN_API_TOKEN.