> ## 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.

# nika:prompt

> Usage, declared contract and source links for this Nika builtin.

[Builtins catalog](https://docs.nika.sh/reference/builtins.md) / `nika:prompt`

> [card] Core
>
> Tool family from the canonical registry.

> [card] [invoke](https://docs.nika.sh/reference/language/words/invoke.md)
>
> Call this builtin through the invoke verb.

## Read this contract

This reference preserves the specification at the revision linked below. Source examples are **fragments**: their surrounding tasks, inputs and permissions are not supplied here. Consult [engine status](https://docs.nika.sh/reference/status.md) and `nika catalog --tools --json` for the installed implementation; a registry declaration is not a runtime qualification.

## Usage and behavior

```yaml illustration theme={"system"}
# confirm (default mode) — require an answer before deployment
invoke: { tool: "nika:prompt", args: { message: "Approve deploy to production?" } }
# input — collect a free-text value
invoke: { tool: "nika:prompt", args: { mode: input, message: "Paste the OTP:", default: "" } }
# choice — pick one of N (the candidates arrive through with:)
with: { a: "${{ tasks.a.output }}", b: "${{ tasks.b.output }}" }
invoke: { tool: "nika:prompt", args: { mode: choice, message: "Which title?", choices: ["${{ with.a }}", "${{ with.b }}"] } }
```

Interactive human-in-the-loop · blocks until answered. **`mode:` selects what
is collected** (default `confirm`) ·

| `mode` | Returns | Notes |
| - | - | - |
| `confirm` (default) | **boolean** | `true` = confirmed · `false` = refused. A refusal is a VALUE, never an error: gate downstream with `when:`. |
| `input` | **string** | the free text the human typed (may be empty). |
| `choice` | **string** | the chosen element of `choices:` (required · non-empty array). Returns the chosen value (not its index) so it binds directly. |

Non-interactive contract (normative · all modes) · when no human can answer
(CI · daemon) the engine MUST use `default:` when present · and MUST fail
`NIKA-BUILTIN-PROMPT-001` (`validation_error` · non-interactive without a
`default:`) when absent: never hang forever · never silently pick an answer.
`PROMPT-001` names only that unanswerable prompt, the one failure an engine
may turn into a durable pause awaiting an answer. Every configuration error
is a parse error (`NIKA-BUILTIN-PROMPT-002` · `validation_error`), judged
before anyone is asked, attended or not, and never a pause, since no answer
repairs it: a missing `message:`, an unknown `mode:`, an empty `choices:`, and
a `default:` the mode cannot use — a `choice` default that is not an element
of `choices:`, an `input` default that is not a string, a `confirm` default
that is neither a boolean nor a word a person answers a confirm with (`yes` ·
`y` · `no` · `n` · `true` · `false`, case-insensitive, read as that answer;
YAML 1.2 reads an unquoted `yes` as a string).

For a workflow that requires fresh human approval, omit `default:` from the
confirmation prompt and gate the effect on its answer. `default: false` is an
automatic refusal in a non-interactive run; it does not request an answer or
pause for a human. Keep an unattended refusal in the invocation instead of
changing the workflow's human gate; for example, the reference engine accepts
`nika run workflow.nika --answer approval=false` when the prompt task is named
`approval`. See the [human-gated shipping template](https://github.com/supernovae-st/nika-spec/blob/5cd95cd25c0ff453be266794a03666e5e3f2d7a8/templates/human-gated-ship.nika).

## Related concepts

> [card] [Arguments](https://docs.nika.sh/reference/language/words/args.md)
>
> Pass the values required by the tool contract.

> [card] [Permissions](https://docs.nika.sh/concepts/security.md)
>
> Understand authority before granting effects.

> [card] [Errors and recovery](https://docs.nika.sh/reference/error-codes.md)
>
> Read diagnostics and choose a recovery policy.

> [card] [Workflow templates](https://docs.nika.sh/guides/templates.md)
>
> Put the fragment inside a complete workflow.

## Contract provenance

[Read the pinned specification](https://github.com/supernovae-st/nika-spec/blob/5cd95cd25c0ff453be266794a03666e5e3f2d7a8/stdlib/builtins-v0.1.md#L91) · [Canonical registry](https://github.com/supernovae-st/nika-spec/blob/5cd95cd25c0ff453be266794a03666e5e3f2d7a8/canon/builtins.yaml).

Tool identity: `nika:prompt`. Specification revision: `5cd95cd25c0f`.

> [card] [Documentation](https://docs.nika.sh/introduction.md)
>
> Guides, reference contracts and working examples.

> [card] [Language spec](https://github.com/supernovae-st/nika-spec)
>
> the nine-key envelope, Apache-2.0. The contract these docs explain.

> [card] [Engine source](https://github.com/supernovae-st/nika)
>
> Rust, AGPL-3.0-or-later. Every commit public.

> [card] [TypeScript SDK](https://docs.nika.sh/sdk/overview.md)
>
> Use one typed lifecycle locally or against authenticated nika serve HTTP.

> [card] [Editor extension](https://marketplace.visualstudio.com/items?itemName=supernovae.nika)
>
> The editor extension, frozen at 0.120 and not qualified with 0.124: use `nika lsp` and the JSON Schema.

> [card] [Homebrew tap](https://github.com/supernovae-st/homebrew-tap)
>
> `brew install supernovae-st/tap/nika` for the latest tagged CLI release.

> [card] [SuperNovae](https://supernovae.studio)
>
> The Paris studio crafting Nika. 🦋


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.