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.
ingrain retrieve [--assessment <path>]What it is for
Section titled “What it is for”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.
What comes back
Section titled “What comes back”## 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: aT07staysT07across 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.
Where it writes
Section titled “Where it writes”With no --assessment, this branch’s assessment:
.ingrain-security/assessment-<branch-slug>.mdwhich 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.
A task with nothing recorded
Section titled “A task with nothing recorded”Exits 0, writes no assessment, and says so — the first run on any branch. The review
starts from nothing, which is correct.
Exit codes
Section titled “Exit codes”| Code | Meaning |
|---|---|
0 | Restored, or nothing is recorded yet. |
1 | No credential configured, git cannot identify the checkout, or the response could not be written as a valid assessment. Nothing is written on a failure. |
2 | A bad flag. |
5 | The 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.
Configuration
Section titled “Configuration”The same [context] section record uses:
[context]syncUrl = "https://api.example.com/ingrain-agent-sync"ingrainApiToken = "ingrn_…"or INGRAIN_SYNC_URL / INGRAIN_API_TOKEN.