# `Spectre.Instance.Ref`
[🔗](https://github.com/elchemista/spectre/blob/0.4.0/lib/spectre/instance/ref.ex#L1)

Logical key for one Agent Instance.

The default Instance granularity is exactly `AgentRef + Subject`. This value
is safe to persist or route and intentionally contains no process location.

# `t`

```elixir
@type t() :: %Spectre.Instance.Ref{
  agent_ref: Spectre.AgentRef.t(),
  key: String.t(),
  schema_version: pos_integer(),
  subject: Spectre.Subject.t()
}
```

# `legacy`

```elixir
@spec legacy(t()) :: {:ok, t()} | {:error, term()}
```

Reconstructs the pre-0.2.3 Instance Ref for an explicit key migration.

It returns an error when the AgentRef no longer carries the compiled source
hints needed to reproduce the legacy address.

# `new`

```elixir
@spec new(Spectre.AgentRef.t() | module(), Spectre.Subject.t() | term(), keyword()) ::
  t()
```

Builds an Instance reference from logical Agent and Subject identities.

# `schema_version`

```elixir
@spec schema_version() :: pos_integer()
```

Returns the current stable Instance Ref schema version.

---

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