# `Spectre.Input.Plug`
[🔗](https://github.com/elchemista/spectre/blob/0.4.0/lib/spectre/input/plug.ex#L1)

Behaviour for Spectre input normalization/enrichment stages.

Input plugs run before state, memory, policy, router, checks, prompt rendering,
and action execution see the turn.

Example:

    defmodule MyApp.LocalePlug do
      @behaviour Spectre.Input.Plug

      @impl Spectre.Input.Plug
      def init(opts), do: opts

      @impl Spectre.Input.Plug
      def call(input, _context, _opts) do
        {:cont, Spectre.Input.put_meta(input, :locale, "en")}
      end
    end

# `call`

```elixir
@callback call(Spectre.Input.t(), map(), term()) ::
  {:cont, Spectre.Input.t()} | {:halt, Spectre.Input.t()} | {:error, term()}
```

# `init`

```elixir
@callback init(keyword()) :: term()
```

# `rehearsable?`
*optional* 

```elixir
@callback rehearsable?() :: boolean()
```

Declares that replay may run the plug without host-only turn options.

A rehearsable plug must be deterministic for the same input and initialized
state, must not perform external effects, and must not branch on callback
context or runtime-only options. Governance checkers reject undeclared plugs
instead of issuing evidence for a path they cannot reproduce.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
