> ## Documentation Index
> Fetch the complete documentation index at: https://forgekit-docs-mintlify-7cd64f48.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Substrate commands

> The pre-action gate and its individually-callable stages: substrate, preflight, route, impact, scope, context, anchor, diagnose, imagine, and lean.

The Substrate group is the pre-action gate. `forge substrate` composes the rest into one
verdict; each stage is also callable on its own. See
[The pre-action gate](/concepts/pre-action-gate) for the pipeline.

## `forge substrate`

One pre-action gate: assumptions, route, impact, scope, memory, verify.

```bash theme={null}
forge substrate "<task>"
forge substrate "<task>" --json
```

If it returns `okToProceed:false`, ask the returned `assumption.questions` before editing.

## `forge preflight`

Assumption check — what a task names that the repo doesn't define.

```bash theme={null}
forge preflight "<task>"
```

## `forge route`

Recommend the cheapest capable model for a task.

```bash theme={null}
forge route "<task>"
forge route gateway        # emit LiteLLM gateway config
```

## `forge impact`

Predict the blast radius for a symbol or file from the atlas graph.

```bash theme={null}
forge impact <symbol-or-file>
```

## `forge scope`

Decompose files into independent clusters — plus coupled files you didn't name.

```bash theme={null}
forge scope <files...>
```

## `forge context`

Budgeted context assembly + completeness gate — what an edit NEEDS known.

```bash theme={null}
forge context "<task>"
```

Assembles a budgeted context via set-cover over the predicted edit set, applies a
compression ladder, and reports the computed missing set.

## `forge anchor`

Goal-drift check — are your actual (git) changes still on the stated goal?

```bash theme={null}
forge anchor set "<goal>"   # persist the goal across sessions
forge anchor show
forge anchor clear
```

## `forge diagnose`

Doom-loop check — record a failure; the same signature 3× mints a diagnosis + escalation.

```bash theme={null}
forge diagnose "<failure>"
```

## `forge imagine`

Consequence simulation — predicted breaks + the minimal dry-run test suite for a task.

```bash theme={null}
forge imagine "<task>"
forge imagine "<task>" --run   # execute the minimal suite sandboxed
```

## `forge lean`

Scope-minimality (M5) — measure the diff's footprint vs what the task asked for.

```bash theme={null}
forge lean
```

<Note>
  The `route`, `impact`, `scope`, `context`, `anchor`, and `lean` stages all run inside
  `forge substrate`. Call them individually when you want just one signal.
</Note>
