Skip to main content
The local brain is an OCI Image Layout, so publishing is a copy rather than a conversion, and selective installation falls out of the layout.
One layer per installed module, the snapshot as the config blob. Any OCI tool can copy the result without this SDK.

Pack: no network at all

pack materializes the current snapshot as an OCI artifact inside the local layout, with no registry involved. It is also what persists a travelling index — see the warning at the end of Ingestion.

Two identities per layer, and the pair is the point

Two clients that packed the same blocks with different gzip settings have different layer digests and the same Merkle root. The digest drives transfer; the root drives meaning.

Push

Only the blobs the registry lacks are uploaded, then the manifest. The digest it returns is the same name the registry filed it under — which is what makes org/brain@sha256:… resolvable, the only way to point at a version nobody can move a tag away from.
A push refuses to overwrite a remote whose snapshot is absent from the local history. The protocol defines no merge for divergent brains, so the safe behavior is to refuse and say where the two parted.
Pass force=True only when you mean to replace the remote.

Tags move; digests do not

A tag is a pointer, like a git branch. Pushing to v1 repeatedly moves it. Your local history keeps every version (ten by default, RetentionPolicy.retained_roots), each still verifying. The remote does not — when v1 moves, the previous manifest is untagged, and registries collect untagged manifests. So the discipline is the one you already use for container images:

Plan a pull

One manifest request, no layers:

Pull, selectively

A selective install is a first-class outcome, not a partial failure. Taking the semantic module without the canonical one is a real way to consume a brain, and the manifest records what was left out. Asking for a module you did not install is an error, never an empty module.
What you install carries the digest that was published, and the layers you already hold are reused by digest rather than transferred again.

Publishing without a registry

LocalLayoutRegistry speaks the same RegistryClient protocol against directories on disk — useful for tests, air-gapped transfers, and understanding what a push does:

Supplying your own transport

OrasRegistryClient requires the oci extra. The rest of distribution — packing, layer construction, local layouts — needs nothing beyond the standard library.

Inspecting an artifact

A registry UI can only draw the types it was built to know, so a brain often shows up as an unrecognized artifact. Nothing is broken; read it through the manifest instead:
docker pull on a brain will fail, correctly. It is an OCI artifact, not a container image.