# `AgentWorkshop.Store`
[🔗](https://github.com/joshrotenberg/agent_workshop/blob/main/lib/agent_workshop/store.ex#L1)

Shared key-value store for agent coordination.

A scratchpad that agents and humans can read and write. Useful for
sharing specs, coordination data, accumulated results, and runtime
configuration across agents.

The store is backed by ETS and survives agent resets (it's Workshop-level
state, not per-agent). It does not survive Workshop restarts.

## From IEx

    import AgentWorkshop.Workshop

    put(:spec, "LRU cache with 1000 entries and 5 min TTL")
    get(:spec)
    keys()

## From agents (via MCP tools)

Agents with MCP access can use `workshop_put`, `workshop_get`, `workshop_keys`.

## Namespacing

Keys can be any term. Use tuples for namespacing:

    put({:impl, :notes}, "Chose GenServer over Agent for state")
    put({:spec, :cache}, "LRU with TTL support")
    keys()  # => [{:impl, :notes}, {:spec, :cache}]

# `clear`

```elixir
@spec clear() :: :ok
```

Clear all entries from the store.

# `delete`

```elixir
@spec delete(term()) :: :ok
```

Delete a key from the store.

# `entries`

```elixir
@spec entries() :: [{term(), term()}]
```

List all key-value pairs.

# `get`

```elixir
@spec get(term()) :: term() | nil
```

Get a value from the store. Returns `nil` if not found.

# `get`

```elixir
@spec get(term(), term()) :: term()
```

Get a value with a default if not found.

# `keys`

```elixir
@spec keys() :: [term()]
```

List all keys in the store.

# `put`

```elixir
@spec put(term(), term()) :: :ok
```

Put a value in the store.

## Examples

    Store.put(:spec, "Implement LRU cache")
    Store.put({:impl, :notes}, "Using GenServer")

---

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