Skip to content

Evidence scenarios

Evidence scenarios

The optional evidence phase runs project commands against the reviewed commit. It records scenario results in the run manifest and adds an Evidence section to the published pull request. Failed, blocked, skipped, and invalid results are advisory. A scope violation that changes the approved tree outside the evidence directory stalls the phase and preserves the changes for inspection.

Configuration

Put evidence after the final review and repair loop, before pr-description and publish. The selection agent uses the task, branch diff, and scenario catalog. A task’s optional ## Evidence section can ask for particular coverage. The agent records reasons in $RUN_DIR/evidence-plan.json for selections and skips. Set engines.evidence to choose a different selection engine.

For a project with an org harness, configure a pre-provisioned alias and point the harness at the output directory from the environment:

export default {
phases: ['implement', 'docs', 'gate', 'review', 'address', 'evidence', 'pr-description', 'publish'],
gate: ['npm test'],
evidence: {
dir: 'docs/evidence',
resources: { org: '$EVIDENCE_ORG_ALIAS' },
timeoutMs: 30 * 60 * 1000,
scenarios: {
'version-cutover': {
description: 'Verify that existing records continue to work after publishing a new version.',
command: { argv: ['node', 'scripts/org/run-cutover-evidence.mjs'] },
},
},
},
};

In this example, run-cutover-evidence.mjs wraps the project’s harness. It chooses the version-cutover scenario, uses the org alias from ALOOP_EVIDENCE_ORG, and writes a directory like $ALOOP_EVIDENCE_OUT/2026-12-03-version-cutover-580d611/ containing summary.json and its artifacts. Capture HEAD and dirty status before writing output. Give each scenario its own new paths so outputs can be committed together.

dir defaults to null, which keeps output in the run directory. A repo-relative directory opts into one commit containing only that directory’s changes. aloop warns when a scenario produces more than 1 MiB of changed files in commit mode. A rejected commit is advisory if scoped cleanup succeeds. Publish accepts the recorded evidence commit on top of the gate-backed approved SHA.

timeoutMs applies per scenario and defaults to the run’s command timeout. 0 disables the timeout. Commands accept the same forms as gate commands, including shell strings, { posix, windows }, and { argv }. They run on the host from the worktree. Projects provide their own resource provisioning and locking when multiple runs share a resource. Write evidence output only under ALOOP_EVIDENCE_OUT.

Environment variableValue
ALOOP_EVIDENCE_SCENARIOSelected catalog name
ALOOP_EVIDENCE_OUTAbsolute evidence output directory
ALOOP_APPROVED_SHAGate-backed review SHA
ALOOP_RUN_DIRAbsolute run directory
ALOOP_WORKTREEAbsolute worktree directory
ALOOP_TASK_FILEAbsolute task-file path, or an empty string
ALOOP_EVIDENCE_<KEY>Resource value, with its configured key uppercased

Resource values expand a leading ~ and references to existing host variables written as $VAR or ${VAR}. Missing variables remain literal. Resource keys must be unique when uppercased. OUT and SCENARIO are reserved.

Summary manifests

Each command writes one or more new summary.json files under the output directory. A command may exit nonzero and still record a valid failed or blocked manifest. No new manifest, malformed JSON, and mismatched SHA or scenario values produce invalid receipts. Multiple manifests contribute the worst recorded outcome, ordered from passed through skipped, blocked, failed, and invalid.

FieldContract v1
schemaVersionOptional integer 1. Omit to use v1.
scenarioExact catalog name supplied in ALOOP_EVIDENCE_SCENARIO.
startedAt, finishedAtISO timestamps with a timezone. Finish is at or after start.
commit40 hexadecimal characters equal to ALOOP_APPROVED_SHA.
dirtyBoolean false.
outcomepassed, failed, blocked, or skipped.
checksArray of objects with a nonempty name, an outcome from the same list, and optional string detail. May be empty.
artifactsOptional array of paths relative to this manifest’s directory.

Additional provider fields are preserved in the saved copies. The first manifest is copied to $RUN_DIR/evidence/<scenario>.summary.json. Additional copies use a numeric suffix. Command output is saved in $RUN_DIR/logs/evidence-<scenario>.log.

Outcomes

The phase manifest entry records one outcome:

  • passed: every selected scenario produced a valid manifest with outcome passed.
  • none-selected: the selector chose no scenario. No commands run.
  • skipped: --no-evidence was given, or the worktree HEAD isn’t the approved review SHA. No commands run.
  • attention: a scenario failed, blocked, or produced an invalid receipt, or the selection plan was invalid.

attention is advisory and doesn’t stop the run. A stalled evidence phase (for example, a scope violation) is different: it stops the run and keeps the changes for inspection.

Running and resuming

  • --dry-run lists the catalog without invoking the selector or commands.
  • --no-evidence records a skip for the invocation. Resume with the flag again to continue skipping evidence.
  • --resume --from evidence selects and executes scenarios again. In an aloop-owned worktree, it first resets a recorded, verified evidence commit to the approved SHA. If the branch already published that prior evidence commit, aloop can replace it using a Git lease for that exact SHA.
  • A normal resume of an interrupted attempt reuses its valid saved selection and runs the scenarios again from the approved SHA.

aloop status and aloop inspect show the overall result and scenario details. aloop watch emits evidence-started, evidence-scenario-finished, and evidence-finished events. See Watching runs.