# Class BSV::Wallet::Engine::Policy <a id="class-BSV-Wallet-Engine-Policy"></a>

**Inherits:** `Object`

Limp-mode + headroom guard collaborator. Stateless: callers own the
<code>bypass:</code> switch (Engine mutates +@bypass_limp_mode+ during
bootstrap windows where headroom guards are intentionally relaxed, e.g. the
import-utxo self-payment).

Extracted from Engine's inline <code>enforce_*</code> helpers in #402 Stage 2.
Threshold is fixed at construction time — Engine reads it from
+Engine.new(limp_threshold:)+ (which itself defaults to
<code>Engine::LIMP_THRESHOLD</code> via the wallet's central config) and
constructs Policy with the resolved value.

## Public Instance Methods
### `guard_balance!(balance:, spending: = 0, bypass: = false)` <a id="method-i-guard_balance-21"></a> <a id="guard_balance!-instance_method"></a>
Raise `LimpModeError` when +balance - spending+ would dip below the configured
threshold, unless <code>bypass:</code> is true. The `spending` default of 0
supports the limp-only check (balance vs threshold, no projection) as a
degenerate case of the projected-headroom check — one method, two callers.

The strict +<+ comparison matches +Engine#limp_mode?+: at the threshold the
wallet is not in limp mode.
- **@raise** [BSV::Wallet::LimpModeError]

### `initialize(threshold:)` <a id="method-i-initialize"></a> <a id="initialize-instance_method"></a>
- **@return** [Policy] a new instance of Policy
