AT Protocol spaces are in development. Expect changes throughout the beta starting on December 1st, 2026.

Chapter 4

Space repos and commits

Revised 2026-11-23Markdown

A space repo is where one identity’s records live inside the boundary of a space. The first time an identity writes a record into a space, either someone else’s or their own, its account gets a space repo that belongs to that one space. In practice a space repo is an extension to the space authority’s atproto space data boundary. Underneath, it is a set of records summarized by a commit, and the commit’s data is a 32-byte digest of that set. A syncer computes the same digest from its own copy. If the two match, the syncer holds exactly the records the host holds.

What a space repo is#

Records in a space repo are scoped the same way public records are, by collection and record key. The keys are {collection}/{rkey} and the values are DRISL-encoded records spec. Nora has one space repo per space she has written to, each on her own PDS, each with its own revision.

The PDS offers its write methods under com.atproto.space.*. They mirror com.atproto.repo.*, with space added and repo naming the caller’s own DID spec. The separate namespace is a signal to developers. Authentication behaves differently for these calls than for public records and carries different constraints, and a PDS stores a space repo differently inside. With that much different underneath, separate XRPC methods were the practical choice.

Reference

The write methods spec#

com.atproto.space.*

  1. POSTcreateRecord(space, repo, collection, rkey?, validate?, record)
    →uri, cid, validationStatus?
    OAuthno MACErrors SpaceNotFound, RecordAlreadyExists
  2. POSTputRecord(space, repo, collection, rkey, validate?, record)
    →uri, cid, validationStatus?
    OAuthno MACErrors SpaceNotFound
  3. POSTdeleteRecord(space, repo, collection, rkey)
    →empty
    OAuthno MACErrors SpaceNotFound
  4. POSTapplyWrites(space, repo, validate?, writes)
    →results?
    OAuthno MACErrors SpaceNotFound, RecordNotFound, RecordAlreadyExists
  5. POSTclearRecords(space, repo)
    →empty
    OAuthno MACErrors none declared

putRecord creates or updates as needed, and deleteRecord also succeeds when the record is already absent. A delete is about the end state. The record should be gone when the call returns, so removing data is always safe, and calling it a second time does no harm. Reads go through getRecord and listRecords, covered with the other repo-host reads in Chapter 7.

Reference

validate and validationStatus#

Setting validate to false skips Lexicon validation, true requires it, and leaving it unset validates records whose Lexicon the PDS knows spec. atproto-pds answers validationStatus "valid" for a record it checked and "unknown" for one it had no Lexicon for, and leaves the field out when validation was skipped crates.

A record write names its space explicitly:

Try it 4.1 · Create an RSVP in the family space#

procedurecom.atproto.space.createRecord

Host
https://pds-b.example.com
Auth
Your session, once you sign in
Sample response
{
  "uri": "at:space/did:plc:ejjl2znzqp3ci25dqaslpkk2/com.example.familyUpdates/our-family/did:plc:ashwgt3d5ntfxmlcfyizpu2g/community.lexicon.calendar.rsvp/3n2gtdo55s22p",
  "cid": "bafyreiautip3hgihuw4ypueftfdiv3iyliieamu5mdv4d4duqhhyetxs7a"
}

This console replays the sample response and makes no request.

applyWrites applies a batch in one commit. Its writes are a closed union of three objects defined in its own lexicon, and its results come back in the same order. Here Ruth replaces her RSVP in one commit, creating a new one marked going and deleting the first:

Try it 4.2 · Replace an RSVP in one commit#

procedurecom.atproto.space.applyWrites

Host
https://pds-b.example.com
Auth
Your session, once you sign in
Sample response
{
  "results": [
    {
      "$type": "com.atproto.space.applyWrites#createResult",
      "uri": "at:space/did:plc:ejjl2znzqp3ci25dqaslpkk2/com.example.familyUpdates/our-family/did:plc:p4256dosynj6j6tkypz2q2l3/community.lexicon.calendar.rsvp/3n2gtxdkr222p",
      "cid": "bafyreiblr6f6oy3zi426nksahddwp4tgsfgedtqk27fyxqtav66kjvwkgu"
    },
    {
      "$type": "com.atproto.space.applyWrites#deleteResult"
    }
  ]
}

This console replays the sample response and makes no request.

Reference

applyWrites operations and results spec#

OperationFieldsResult
#createcollection, value, and optionally rkey#createResult: uri, cid, and optionally validationStatus
#updatecollection, rkey, and value#updateResult: uri, cid, and optionally validationStatus
#deletecollection and rkey#deleteResult, which is empty

Lifecycle#

A space repo doesn’t exist without data. It comes into being on its first write. This lazy creation is different from a public repo, which exists as soon as the account does. It was a deliberate design choice, and I agree with it. I’d like to see public repos work the same way. When the authority is someone else, Nora’s PDS accepts the write without asking whether the space exists; the space host decides later whether to track her. When the writer is the authority, as Marcus is, the space must already exist spec.

That means Nora can write records into a space Marcus hasn’t created yet. The records sit in her space repo on her PDS, and her PDS notifies Marcus’s space host of the write as it always does spec. In atproto-pds, the space host answers SpaceNotFound for a space it doesn’t have, and her PDS stops there crates. Once Marcus creates the space and admits her, her next write notification puts her repo in the writer set spec. Syncers then pull her whole repo, and the earlier records come with it, so a syncer sees them as soon as it sees the repo.

An empty repo and a missing repo are the same thing, so an account deletes its space repo by clearing it. The cleared repo stays in the writer set, and its host keeps answering sync requests with a commit showing that the records are gone spec. clearRecords deletes every record (apart from any published configuration records in the authority’s repo, Chapter 8), advances the repo to a new rev with the empty digest, clears the operation log, and sends a write notification to the space host spec. The space host and syncers learn the records are gone. Clearing a repo never deletes the space.

Removing a writer leaves that writer’s repo alone. The authority drops the account from the writer set, syncers stop treating the repo as part of the space, and the records stay on the writer’s PDS until the writer clears them spec.

A host can throw an empty space repo away once the clear has had time to spread, and the spec asks it to wait at least 72 hours spec. That number is a commonly used safe margin. It is also the recovery window did:plc gives an identity to undo a bad operation. The spec doesn’t mention did:plc here, but I think the two are related.

Reference

Garbage collection#

A repo host may discard an empty space repo, its commit, and any remaining state. It should wait at least 72 hours after the clear, so the clear reaches the space host and syncers first. Once collected, the host answers as if the repo never existed, syncers treat that the same as an empty repo, and no notification is sent spec. Account migration may also leave empty repos behind.

The commit#

A space repo’s commit carries no signature, and that is a deliberate design decision. A signed commit would prove who wrote the records to anyone who ever saw a copy, including someone outside the space spec. Spaces offer a measure of deniability instead (Chapter 5). No one can take one of your records and link it back to you in a way that can be checked cryptographically. That has costs as well as benefits, and the protocol’s judgment is that the benefits are far greater.

Reference

The commit spec#

Ruth’s space repo after she changes her RSVP.

JSON
{
  "ver": 1,
  "repo": "did:plc:p4256dosynj6j6tkypz2q2l3",
  "space": "at:space/did:plc:ejjl2znzqp3ci25dqaslpkk2/com.example.familyUpdates/our-family",
  "rev": "3n2gtxdkr232p",
  "data": {
    "$bytes": "eVD7vKgDQrLKfOvN3VZJHYX0HGz158ocKa5oRd3kaYw"
  }
}
FieldTypeMeaning
verintegerCommit format version, 1
repoDIDWhose repo this is. A syncer checks it against the repo it asked for.
spacespace-refWhich space the repo is in. A syncer checks it the same way.
revTIDThe revision of this commit. A syncer passes it to listRepoOps to ask what changed since.
data32 bytessha256 of the 2048-byte LtHash state. A syncer compares it with the digest of its own copy.

The lexicon definition is com.atproto.space.defs#commit spec. In JSON, data is written as {"$bytes": "<base64>"}, the lexicon form for raw bytes. In a STAR archive, the binary format that getRepo returns (Chapter 7), the commit is encoded in DRISL instead. DRISL is a strict form of CBOR, a binary format much like JSON, and there data is a plain byte string.

rev is a TID, the sortable, timestamp-based identifier that atproto uses for revisions spec.

The commit also has no prev and no tree root. It binds the repo to its space and revision, and data summarizes exactly which records exist. The host proves the commit to each requester with an HTTP Message Signature carried in the response headers (Chapter 5). A copy of the commit on its own proves nothing to anyone.

The empty repo’s data is always:

Text#
e5a00aa9991ac8a5ee3109844d84a555
83bd20572ad3ffcd42792f3c36b183ad

Why a set hash instead of a tree#

Public atproto stores each repo as a Merkle Search Tree, so anyone can prove a record is in the repo or walk the changes between two versions. Space repos use something simpler. A syncer only needs to know whether its copy equals the host’s, and it learns what changed from the op log (Chapter 7). A set hash answers the equality question with 32 bytes. It costs one vector addition per write, and depends only on which records exist. There is no dependency on the order they were written. The host keeps the full 2048-byte state and the commit carries a digest. A set hash gives up both of the tree’s abilities. It can’t prove that one record is in a repo, and it can’t say what changed between two versions, so a syncer that loses its place in the op log fetches the whole repo again (Chapter 7) spec.

The first of those losses is deliberate. A Merkle Search Tree gives a chain of validation, from one record up to the root and from the root into a signed commit. A space leaves that chain out on purpose, so a record that leaks stays deniable (Chapter 5).

Common questions#

Can a user write to a space before it exists?#

When someone else is the authority, yes. The user’s PDS accepts the write without checking, and the space host decides later whether to track it. When the user is the authority, the space has to be created first.

What happens to a user’s records when they’re removed from a space?#

They stay in the user’s space repo on the user’s PDS. Removing a writer tells syncers to stop treating that repo as part of the space. To delete the records as well, the user’s app calls clearRecords, which empties the repo in one step.

Why doesn’t the commit carry a signature?#

A signature would prove who wrote the records to anyone who ever saw a copy, including someone outside the space. Chapter 5 explains how spaces prove a commit to the one reader who asked, and to no one else.

Chapter 4 of 11 · AT Protocol Spaces: A Field Guide

Search