---
question: "Can one module read another module's document collections?"
kind: overview
---

# Documents

The document service stores mutable JSON-like records by collection, with declared fields, versions and cursor queries. It is the kernel service `services.document`. Each module gets its own namespace: the collections it creates are invisible to other modules. ABI keeps agent memory and job runs there too.

Super admins can browse namespaces, collections and documents in Nexus, under System › Data › Documents. Queries with filters are Python only.

:::note Not Nexus Documents
The Documents screen of a workspace edits rich-text documents, which are kept in Git. It does not read this service.
:::

<!-- matrix -->

## Backends

`services.document` in `config.yaml` picks one adapter:

| Adapter | Storage | Used by |
|---|---|---|
| `sqlite` | A SQLite file (`path`, default `storage/documents.sqlite`) | `config.yaml` of a new project (`abi dev up`), and the engine default |
| `postgresql` | A PostgreSQL database (`dsn`, tables in schema `abi_document`) | `config.local.yaml` (Docker stack) |
| `nats_rpc` | Another engine's document service, over NATS | Engines that share one store |

The keys of each adapter are in the [Configuration Reference](/capabilities/get-started/configuration#document-and-dataset).

## Key concepts

- **Namespace.** The module's id (`module_id` on its `ABIModule`, for example `my_project.research`). The SDK binds it to `self.engine.services.document`: you never pass it, and a request for another namespace is refused.
- **Collection.** Declared with `await documents.ensure_collection(CollectionSpec(...))` before the first write. A module can have as many as it needs. Declarations add fields; they never change a field's type.
- **Fields.** Declared fields have a type (`string`, `int`, `float`, `bool`, `datetime`, `bytes`, `json`) and can be indexed or unique. Undeclared keys are stored as well. Datetimes must be timezone-aware.
- **Versions.** Every document has a `version`, 1 on create, plus one per write. `if_version` makes a write or a delete conditional on it.
- **Queries.** `find` takes `(field, operator, value)` predicates combined with AND, an optional order and a cursor. Fields are top-level keys.
- **Who else uses it.** A module's agents keep their conversation checkpoints in its namespace. The engine keeps job run records, the activity log and the agents of the marketplace modules in namespaces of its own.
- **Dependency.** A module declares `"document"` in `ModuleDependencies(services=...)`. Without it, `self.engine.services.document` raises `ValueError("Module did not declare service dependency: document")`.
- **Async.** Every call is a coroutine over NATS: `await` it.
