> ## Documentation Index
> Fetch the complete documentation index at: https://docs.mirage.strukto.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Namespace

> Where a workspace keeps symlinks and file attributes, in memory, on disk or on Redis.

The namespace store keeps what a backend has no place for:

* Symlinks made with `ln -s`.
* Modes, owners and times that `chmod`, `chown` and `touch` set on a backend
  that cannot store them.
* Extended attributes set with `setfattr`.

Every instance of the workspace on the same store sees the same links and
attributes.

| `type` | Keeps them | Keys |
| - | - | - |
| `ram` | In the process's memory, until it exits | |
| `disk` | In files under `root` | `root`, default `~/.mirage/state` |
| `redis` | On Redis, under `key_prefix` and the workspace id | `url`, `key_prefix`, default `mirage:` |

`store.namespace` moves only this store. `store.type` moves it together with
the others, as the [overview](https://docs.mirage.strukto.ai/home/infrastructure/overview.md#one-store-or-several)
shows.

## On disk

**YAML**

```yaml theme={null}
workspace_id: agent
store:
  namespace:
    type: disk
    root: /var/lib/mirage
```

**Python**

```python theme={null}
from mirage import Workspace
from mirage.workspace.store import DiskWorkspaceStateStore, RAMWorkspaceStateStore

store = RAMWorkspaceStateStore(
    namespace=DiskWorkspaceStateStore(root="/var/lib/mirage"),
)
ws = Workspace(mounts, workspace_id="agent", store=store, owns_store=True)
```

**TypeScript**

```typescript theme={null}
import { DiskWorkspaceStateStore, RAMWorkspaceStateStore, Workspace } from '@struktoai/mirage-node'

const store = new RAMWorkspaceStateStore({
  namespace: new DiskWorkspaceStateStore({ root: '/var/lib/mirage' }),
})
const ws = new Workspace(mounts, { workspaceId: 'agent', store, ownsStore: true })
```

## On Redis

**YAML**

```yaml theme={null}
workspace_id: agent
store:
  namespace:
    type: redis
    url: redis://redis.internal:6379/0
```

**Python**

```python theme={null}
from mirage import Workspace
from mirage.workspace.store import RAMWorkspaceStateStore, RedisWorkspaceStateStore

store = RAMWorkspaceStateStore(
    namespace=RedisWorkspaceStateStore(url="redis://redis.internal:6379/0"),
)
ws = Workspace(mounts, workspace_id="agent", store=store, owns_store=True)
```

**TypeScript**

```typescript theme={null}
import { RAMWorkspaceStateStore, RedisWorkspaceStateStore, Workspace } from '@struktoai/mirage-node'

const store = new RAMWorkspaceStateStore({
  namespace: new RedisWorkspaceStateStore({ url: 'redis://redis.internal:6379/0' }),
})
const ws = new Workspace(mounts, { workspaceId: 'agent', store, ownsStore: true })
```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.