# `Jido.Memory.Space`
[🔗](https://github.com/agentjido/jido/blob/v2.3.3/lib/jido/memory/space.ex#L1)

The unit of memory — a named container with typed data and revision tracking.

A Space holds either a map (key-value) or list (ordered items) in its `data`
field. The type is determined by the data itself — pattern matching and guards
(`is_map/1`, `is_list/1`) handle dispatch.

Each space tracks its own revision counter independently, enabling fine-grained
concurrency control.

## Examples

    # Key-value space (world model)
    world = Space.new_kv()
    world = %{world | data: Map.put(world.data, :temperature, 22)}

    # List space (task list)
    tasks = Space.new_list()
    tasks = %{tasks | data: tasks.data ++ [%{id: "t1", text: "Check sensor"}]}

# `t`

```elixir
@type t() :: %Jido.Memory.Space{data: any(), metadata: map(), rev: integer()}
```

# `list?`

```elixir
@spec list?(t()) :: boolean()
```

Returns true if the space holds list data.

# `map?`

```elixir
@spec map?(t()) :: boolean()
```

Returns true if the space holds map data.

# `new`

```elixir
@spec new(map() | keyword()) :: t()
```

Create a new space from attributes.

# `new_kv`

```elixir
@spec new_kv(keyword()) :: t()
```

Create a new key-value (map) space.

# `new_list`

```elixir
@spec new_list(keyword()) :: t()
```

Create a new list space.

# `schema`

```elixir
@spec schema() :: Zoi.schema()
```

Returns the Zoi schema for Space.
