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

# capture

> Contract, placement, related fields and source examples for this Nika YAML field.

[Language reference](/reference/language/overview) / `capture`

## Meaning and placement

### exec

Which stream becomes the task's output · `stdout` (default) · `stderr` · `combined` · `structured` = `&#123; stdout, stderr, exit_code &#125;`. This is the SOURCE; `decode:` is how that string becomes a value.

| Property        | Declaration                                     |
| --------------- | ----------------------------------------------- |
| Requirement     | Optional in this object                         |
| Schema location | `/$defs/exec/properties/capture`                |
| type            | "string"                                        |
| enum            | \["stdout", "stderr", "combined", "structured"] |

**In the same object:** [command](/reference/language/words/command) · [cwd](/reference/language/words/cwd) · [decode](/reference/language/words/decode) · [env](/reference/language/words/env) · [shell](/reference/language/words/shell) · [stdin](/reference/language/words/stdin)

[Schema source (use the pointer above)](https://github.com/supernovae-st/nika-spec/blob/c5ebbb7b862b68bc6cf7235efba61173b844afc6/schemas/workflow.schema.json)

## In a source template

Excerpt from `templates/human-gated-ship.nika.yaml`, source lines 109–118. This is a fragment, not a runnable workflow.

```yaml illustration theme={"system"}
    # A COMMAND gate · a test suite, a CLI probe · argv form, never a shell.
    exec:
      command: ["echo", "ok"]        # SLOT: gate 2 · the program must be in permits.exec
      capture: structured
    on_error:
      # Golden rehearsal · `nika test` refuses exec (NIKA-SEC-001 · the mock
      # plane simulates the model, not effects). Catch-all ON PURPOSE — never
      # `on_codes: [NIKA-SEC-001]`: that code is also a real blocklist stop,
      # and a narrow forgiveness would swallow a security refusal. The shape
      # matches `capture: structured` so the gates expression reads it.
```

### Templates containing this field

| Template                               | Source                                                                                                                                         |
| -------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------- |
| `templates/human-gated-ship.nika.yaml` | [Line 112](https://github.com/supernovae-st/nika-spec/blob/c5ebbb7b862b68bc6cf7235efba61173b844afc6/templates/human-gated-ship.nika.yaml#L112) |

These are literal key occurrences in the source files, not an execution or conformance claim. [How to instantiate a template](/guides/templates).

## Contract and implementation

This page projects the named specification revision. Check [released engine status](/reference/status) and [the validation workflow](/guides/agent-authoring) before running a file. An optional field is not evidence that every engine supports every value.

Canonical identity: `language:word:capture`. Spec revision: [`c5ebbb7b862b`](https://github.com/supernovae-st/nika-spec/tree/c5ebbb7b862b68bc6cf7235efba61173b844afc6).

[How documentation stays connected](/reference/knowledge-system).
