> ## Documentation Index
> Fetch the complete documentation index at: https://gump.build/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Gates

> Gates are checks that run after a step completes.

# Gates

Gates are checks that run after a step completes. They can be deterministic (your project's build tools) or non-deterministic (a workflow validator backed by an agent).

## Declaring gates

```yaml theme={null}
- name: impl
  type: code
  run:
    agent: claude-sonnet
  gate: [compile, test, lint]
```

Gates execute in order. All gates are evaluated even if one fails — the complete error context is available to the agent on retry. This lets the agent see all problems at once.

## Built-in gates

### Shell aliases

These resolve automatically based on your project type, or you can override them in `gump.toml`.

| Gate          | Go                  | Node                     | Rust              |
| ------------- | ------------------- | ------------------------ | ----------------- |
| `compile`     | `go build ./...`    | `npm run build`          | `cargo build`     |
| `test`        | `go test ./...`     | `npm test`               | `cargo test`      |
| `lint`        | `golangci-lint run` | `npm run lint`           | `cargo clippy`    |
| `coverage: N` | `go test -cover`    | `npm test -- --coverage` | `cargo tarpaulin` |

Resolution cascade: heuristic (project markers) → `gump.toml` → inline `bash:` gate.

`compile` and `test` are required — they fail if they can't be resolved. `lint` and `coverage` are optional — skipped with a warning if the tool isn't available.

### Structural gates

| Gate                | What it checks                                                               |
| ------------------- | ---------------------------------------------------------------------------- |
| `schema`            | The split output is valid JSON: array of tasks with `name` and `description` |
| `touched: "glob"`   | At least one file matching the glob was modified in the diff                 |
| `untouched: "glob"` | No file matching the glob was modified in the diff                           |
| `tests_found`       | The test runner finds and recognizes tests to execute                        |
| `coverage: N`       | Test coverage meets or exceeds N% (optional — skipped if tool absent)        |

Globs match on the basename, not the full path. `"*_test.*"` matches `pkg/auth/middleware_test.go`.

### Custom gates

```yaml theme={null}
gate:
  - bash: "make integration-test"
```

Runs any shell command. Exit 0 = pass, non-zero = fail. Stderr is captured as error context for retries.

### Workflow validators

A workflow with `type: validate` (output = bool) can be used as a gate. This is how agent-backed reviews work in v0.0.4:

```yaml theme={null}
gate:
  - compile
  - test
  - validate: validators/arch-review
      diff: "{diff}"
      spec: "{spec}"
      agent: claude-opus
```

The validator workflow executes its own GET → RUN → GATE cycle. Its comments are accessible via `{gate.review.comments}` on retry. See [Workflow Composition](/docs/orchestration/workflow-composition) for details.

## Combining gates

Gates are a list. Use as many as you need:

```yaml theme={null}
gate:
  - compile
  - test
  - "untouched: *_test.*"
  - "coverage: 80"
  - bash: "make smoke"
  - validate: validators/arch-review
      diff: "{diff}"
      agent: claude-opus
```

## Overriding detection

If auto-detection picks the wrong commands, override in `gump.toml`:

```toml theme={null}
[validation]
compile_cmd = "make build-affected"
test_cmd = "make test-unit"
lint_cmd = "golangci-lint run --timeout 5m"
```

Config overrides apply to all workflows in the project.
