agentleFS
DockerKnown publisherdocker/sandbox-kit-spec/skills/create-kit-v3/SKILL.md

create-kit-v3

Skill205 starsChanged 13 days agoApache-2.0View on GitHub

Authors a new Docker sandbox kit against the v3 descriptor — choosing workload or mixin, writing the descriptor and its content recipe, declaring the capabilities it needs, pinning the tool version, and verifying the result with docker buildx, sbx and kit-tck. Use when creating a new kit from scratch, adding a `-mixin` variant, packaging a CLI or agent as a sandbox kit, or asking what a kit descriptor should contain.

  • Reads credentials
  • Installs packages

The file

Show its rules and text

We split this skill into the rules it gives an agent

17 rules. About 0 are common, 5 are distinctive, and 12 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈5

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 12

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Write a workload when you own the environment the agent runs in.

    line 34
  2. Very specific:

    mixin: when you add a tool, a credential or a policy to somebody else's.

    line 35
  3. Very specific:

    Prefer ENV for static environment.

    line 46
  4. Very specific:

    Every key is lowerCamelCase with acronyms title-cased (sourceUrl, apiKey).

    line 112
  5. Very specific:

    Use an optional entry-level name for a short display label and description for its explanation.

    line 119
  6. Very specific:

    When entries merge, the first nonempty label in contribution order wins.

    line 122
  7. Distinctive:

    When a published set re-exports a volume's text input, publication keeps the requests separate until create expands and selects them.

    line 175
  8. Very specific:

    Only explicit storage removal or a documented, visible retention policy ends its lifetime.

    line 186
  9. Very specific:

    Use agent-skill@1 to package a skill as a mixin.

    line 195
  10. Distinctive:

    Add a step that re-reads the installed version and fails on mismatch.

    line 225
  11. Very specific:

    Do not state a name a mixin exists to provide.

    line 262
  12. Distinctive:

    Keep ordinary argument names and build-arg destinations distinct from secret names and IDs.

    line 317
  13. Very specific:

    Do not set it in a published set's kits[].args or an sbxenv.

    line 336
  14. Distinctive:

    Create a named container builder once and select it for exports and publication:

    line 345
  15. Very specific:

    Use a group when skipping a capability also needs to skip its hooks, files, or guidance.

    line 534
  16. Very specific:

    Use ${{ kit.env.HOME }} in capability configuration strings when a path depends on the final container environment.

    line 568
  17. Very specific:

    Treat SANDBOX_ID as opaque.

    line 584

≈ “Common” is an estimate: at least 1 in 5 of the 408,460 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Create a v3 kit

A kit is one OCI image. Its layers are the content and its manifest annotation carries the descriptor: what the kit offers, what it needs from the host as typed capability requests, and what it needs from other kits. An engine that does not read the annotation runs it as an ordinary image.

To migrate an existing v2 spec.yaml kit rather than write a new one, use the migrate-kit-to-v3 skill instead; its FIELD-MAPPING.md is also the best field-by-field reference if you are unsure what a given declaration means.

Decide the kind first

Everything else follows from this.

kind: workloadkind: mixin
Layers area root filesysteman overlay landing on a workload
Per compositionexactly onezero or more
Ownsentrypoint, env, user, workdir, a legacy context profileenv, labels, ports and volumes, which merge; an agent mixin can select an explicit context profile
Must have contentyesno — may be declaration-only

Write a workload when you own the environment the agent runs in. Write a mixin when you add a tool, a credential or a policy to somebody else's. Most new kits should be mixins, and a tool worth shipping as a workload is usually worth shipping as both — that is what the claude/claude-mixin pair in the examples is.

A mixin cannot set ENTRYPOINT, CMD, USER or WORKDIR and have it take effect: the workload anchors the composition and owns those contract fields. The additive fields do merge — env, labels, ports and volumes — so a mixin's ENV reaches the composed image, and PATH is appended rather than replaced.

Prefer ENV for static environment. It is what the agent process sees, and sbx@1 launches the agent under bash via BASH_ENV precisely because profile and rc files do not run for it — so an /etc/profile.d/<kit>-env.sh drop reaches a terminal the user opens and misses the agent itself. Reach for profile.d only when a value is likely to collide, because two mixins setting one variable to different values is a hard composition failure, or when the value genuinely only makes sense in an interactive shell.

Layout

The default authoring form is a companion pair, found by filename stem:

<kit>/
  <kit>.yaml           # the descriptor; first line `# syntax=docker/sandbox-kit:3`
  <kit>.dockerfile     # the content recipe (omit for a declaration-only mixin)
  README.md

No dockerfile: field is needed — the stem convention finds it. Three other forms exist (an inline build: block, a # kit: comment descriptor inside a Dockerfile, and a kind: set list of other kits); see SPEC-v3 §3, and examples/gh-comment for the comment descriptor.

Descriptor skeleton

# syntax=docker/sandbox-kit:3
schemaVersion: "3"
kind: mixin
displayName: GitHub CLI
description: gh, installed from the official release tarball
sourceUrl: https://github.com/cli/cli
licenses: [MIT]

# One value drives the install, the provide, the published version and the tag.
version: "${{ kit.args.version }}"

args:
  context_delivery:
    default: progressive
    enum: [progressive, inline]
    description: How the agent reads this Kit's guidance
  version:
    default: "2.98.0"
    pattern: '^[0-9]+\.[0-9]+\.[0-9]+$'
    description: GitHub CLI release to install
    buildArg: GH_VERSION

provides: ["gh@${{ kit.args.version }}"]
# No requires: this overlay ships a release tarball and needs nothing from the
# workload. Add entries only for what the composed runtime must already have —
# see below, and note the comment under `requires` about refusing to compose.

capabilities:
  - type: com.docker.sandbox/network-policy@1
    config:
      runtime:
        allow: [github.com, api.github.com]

  - type: com.docker.sandbox/agent-context@2
    config:
      delivery: ${{ kit.args.context_delivery }}
      content: Use gh for GitHub operations.

Every key is lowerCamelCase with acronyms title-cased (sourceUrl, apiKey). Decoding is strict: an unrecognized key anywhere is an error, which is deliberate — a misspelled key silently ignored would be a policy silently absent.

Capabilities

Use an optional entry-level name for a short display label and description for its explanation. Names may contain spaces and need not be unique; they do not change identity, permissions, or merge keys. When entries merge, the first nonempty label in contribution order wins. This label is separate from config fields such as apiKey.name.

A capability is a typed request the host answers. optional: true means the kit degrades without it; the default is required, which fails resolution closed. Read the page for each type you emit — each is normative for its config and for what a runtime must do. The ones you will reach for, and the rule most often got wrong:

TypeUse it forEasy to get wrong
network-policy@1egress by hostIt is phase-scoped: an absent phase grants nothing. Hosts your install hooks reach go in install, hosts the running agent (or a startup hook) reaches go in runtime, hosts both reach go in both.
network-policy@2egress bounded by HTTP method and pathSame phases, plus entries that grant only matching requests. Pick @2 when a host should carry one API and not the rest; stay on @1 when host alone is the grant. Exclusive with @1 — declaring both is an error, and a bounded allow entry must name its hosts literally. gh and hello use @2. Verify the bound you rely on: declare the tightest correct policy, but confirm against your target runtime which parts it enforces before treating one as a security boundary — a refusal is a 403 from the boundary, which an origin can also return, so test a case the origin would allow.
credential@1one service's authEntries are required by default — add optional: true unless the kit genuinely cannot run unauthenticated. phase accepts a single phase or [install, runtime] with shared configuration. Every inject[].domain must appear in every listed phase's allow list, matched exactly: a *.example.com wildcard does not satisfy api.example.com.
ssh-agent@1git over SSH, SSH commit signingSet unrestricted: false to bound it. sign: [git] is all commit signing needs; authenticate: [git@github.com] is a login to one server. An entry with unrestricted: true (the default) signs anything with every key the user's agent holds — declare that only when a client cannot bind sessions (OpenSSH can), and prefer credential@1 with HTTPS when a token will do. optional: true unless the kit cannot work without it: many users have no agent running. A hook that uses it declares SSH_AUTH_SOCK in env:, and only hooks of the granted phase get it. authenticate grants a signature, not a connection: the server must also be reachable under the network policy. phase accepts a single phase or [install, runtime] with shared rules. Commit signing needs git config too (gpg.format=ssh, gpg.ssh.defaultKeyCommand="ssh-add -L").
lifecycle@1install/startup hooks, staged filesHook environments are deny-by-default. Declare every variable in env:, including ones only a child process reads — curl, pip and npm need HTTP_PROXY/HTTPS_PROXY, and docker needs DOCKER_HOST.
volume@1persistent pathsDeclare needed capacity with size; omission leaves it unspecified and conflicts with another Kit's explicit request. Retained volume settings cannot change on re-create or a later create under the same name.
host-mount@1host-shared caches, datasets, or artifactsDeclare only the absolute, canonical in-container path and optional octal mode. The runtime owns the host location. Data is shared across sandboxes of the declaring Kit, survives sandbox removal, and is visible to the host user. Use an optional group to couple cache setup with the mount; see examples/shared-cache.
agent-context@2inline instructions the agent readsUse content: for every body; contentFile is rejected. Profile destinations and precedence match @1. Mixin delivery defaults to progressive (per-Kit files indexed from every profile); delivery: inline loads that body directly in every profile. Workload guidance always stays in the root profiles. Expose the choice through an ordinary create-phase arg with enum [progressive, inline] and default progressive; explicit empty delivery is invalid. Delivery does not route bodies between profiles. Kit args and final kit.env references expand normally; shell variables remain literal. Do not mix selected @1 and @2 requests. Rebuild every member of a migrated set. The serialized descriptor warns above 64 KiB and fails above 512 KiB after expansion and composition.
agent-context@1legacy progressive instructions the agent readsA workload can supply the legacy workspace-sibling filename. An agent workload or mixin supplies filename plus an absolute directory at its discovery location; this overrides the legacy fallback. Different explicit destinations each get a profile, so agent mixins stack. Tool mixins contribute bodies alone. Use contentFile: for a static body, but inline content: when the body interpolates an arg — a staged body is never arg-expanded.
open-url@1opening documentation, dashboards, or authentication URLs in the host browserConfig-less host interaction grant. The runtime supplies xdg-open and BROWSER; HTTP/HTTPS only. Browser traffic is outside sandbox network policy. Remote hosts open on the provider machine, not the CLI client. Use optional only if printing the URL is an acceptable fallback.
clipboard@1agents that paste from or copy to the host clipboardActivation alone is a normal clipboard: every media type, both directions, through runtime-supplied wl-paste, xclip, xsel, pbpaste, wl-copy, pbcopy, clip.exe. Do not ship your own clipboard shims. Narrow to what the agent uses with per-direction media-type lists (read: [image/*], write: [text/*]); an empty list turns a direction off, and both off is invalid. Unfiltered read exposes everything the user copies, passwords included, so filter when screenshots are all the agent needs. Filters from different Kits union. Use optional when the agent works without a clipboard.
auto-restart@1services that resume after host or runtime recoveryConfig-less and not permission surface. Requests from any Kit apply to the whole sandbox. Explicitly stopped sandboxes stay stopped. Declare long-running@1 too when the service must outlive client sessions. Does not request restart after an in-guest crash.
long-running@1workloads or service mixins that outlive client sessionsConfig-less; a request from any Kit applies to the whole sandbox. A background hook or published port does not prevent session auto-stop. Required by default; use optional: true only if auto-stop is tolerable. This does not request restart after failure.
docker-auth@1host-only Docker registry loginNonempty exact DNS registries; verified registry challenges delegate authentication. Clients use placeholder credentials; real login credentials and issued tokens remain outside the sandbox. No egress or Docker daemon grant.
git-identity@1commits attributed to the runtime-provided userConfig-less; requests only user.name and user.email, not a configuration-source mount. Requires permission; optional when missing identity is tolerable. Signing/authentication are separate grants.
sbx@1"launch this as an agent"Workload-only, config-less — and enforced: a mixin declaring it fails validation.
agent-skill@1one bundled skillpath names the image directory containing SKILL.md and supporting files. The basename is the discovery name unless config.name overrides it; the entry-level name remains only a display label.
agent-skills@1where an agent discovers skillsDeclare on the agent workload or agent mixin. The runtime links or otherwise exposes every selected agent-skill@1 bundle here, and includes host-shared skills when available and enabled. Missing host skills never block startup; mode defaults to off and bounds host-store access only. Select readonly or readwrite to request host sharing.
acp@1how to run an ACP agentDeclare on the Kit that supplies the launch command, workload or mixin. agent is its unversioned provides name; another composed Kit may provide it. command is a complete non-TTY stdio command, never an argv tail. env overlays the session environment; positive protocolVersion defaults to 1 and names the protocol major version, not a package release. Use optional: true for older hosts. Different configs for one normalized agent conflict.
agent-sessions@2the headless verbs a harness drives (run one prompt, continue, resume, list)Argv tails appended to the launch argv. Every verb runs one prompt headlessly, so prompt, continue and resume must each reference {{.Prompt}}, and resume also {{.SessionID}}; check the agent's headless flag reaches continue and resume, which without it often open the TUI. @1, whose continue and resume carry no prompt, stays valid for Kits already published; author @2, and never both in one descriptor. Most agent Kits declare both this and agent-interactive-sessions@1; an agent with no interactive mode declares only this. Verify every flag against the tool's real CLI — never invent one.
agent-interactive-sessions@1the TUI verbs a human-facing host launches (seeded prompt, continue, resume, session picker, list)The sibling of agent-sessions@2 for an agent whose CLI has an interactive mode; an agent that also has a headless mode declares both, and one with only a TUI declares just this. Presence is meaning: a present key is supported, an absent key is not, and for continue, newSession and sessionPicker [] is the launch argv alone (prompt and resume carry their placeholders, so they are never empty). newSession is the exception: omit it when a bare launch opens the TUI, because it then defaults to lifecycle@1's interactive launch; if you state both newSession and interactive they must be the same argv, an explicit [] included. list is the same command as in agent-sessions@2. Declare only verbs you verified.
host-port@1one host loopback TCP or UDP servicehost is required (1–65535); container defaults to host (also when zero); transport is tcp (default when empty) or udp. family selects host loopback: ipv4 (default), ipv6, or dual when either reaches the same service; it is part of the grant. The sandbox endpoint stays IPv4 loopback. A mapping conflicts with port@1 on the same sandbox port and transport. This grants raw access to a host service, not general egress or a published guest port.
dockerd@1a Docker Engine (Docker-in-Docker)Singleton; any kind may declare it. Omit config to have the runtime start the engine; autoStart: false leaves starting it, waiting for GET /_ping to return 200, and the socket's permissions to the Kit's own root startup hook, with the same elevation and store (and no wider surface). When Kits disagree, the merged entry starts it, so that hook must tolerate an engine already running. Engine settings go in the image's /etc/docker/daemon.json, which the runtime-started engine reads. It counts as privileged@1 plus storage at /var/lib/docker on the permission surface, so declaring privileged@1 beside it is redundant, not refused. By default the runtime starts the dockerd on the composed image config's PATH before startup hooks and owns /var/lib/docker: a volume@1 or host-mount@1 at or under it is refused. It does not install the engine; a mixin relying on the workload's keeps requires: ["deb/docker-ce"]. Use the com.docker.sandboxes.start-docker label only as a transition, beside an optional dockerd@1, for runtimes that predate it. builder is the example.
kvm@1hardware-accelerated virtual machines inside the sandboxConfig-less singleton; any kind may declare it. The runtime supplies usable /dev/kvm and /dev/vhost-vsock for the image user and enables nested virtualization where needed before startup. Declare it required when the tool cannot work without it. Hardware and policy can refuse it. It grants no container elevation, FUSE, engine, storage, credentials, or network access; install the VM tool separately. Neither privileged@1 nor dockerd@1 substitutes for it.
gpu@1GPUs for the workloadSingleton; driver is required and names the GPU interface the image's stack is built for: nvidia.com/gpu for CUDA (the runtime supplies the kernel modules, matched user-mode libraries, and nvidia-smi; use a glibc base), mesa3d.org/venus for Vulkan through Mesa Venus (the image brings Mesa). devices is all (the default, at least one) or a count; never a host device index. Declare it only when the workload uses a GPU, and mark it optional only when it also runs without one. GPU no longer goes in resources@1.
port@1, resources@1, privileged@1inbound ports, limits, elevationDo not declare on speculation; privileged@1 is the largest widening available. For an engine inside the sandbox, declare dockerd@1 instead.
fuse@1/dev/fuse and CAP_SYS_ADMIN in the bounding setConfig-less singleton. Declare it only when the Kit's tools mount FUSE filesystems (sshfs, rclone, s3fs, gcsfuse). A non-root mount needs the setuid fusermount3 in the image (the Debian/Ubuntu fuse3 package). It is independent of privileged@1: neither implies the other, and a privileged sandbox may still filter /dev/fuse.

Host sharing is a separate grant from volume@1, including when the in-container path stays the same. Do not supply a host path or assume a Linux bind mount: runtimes may use VM filesystem sharing. Host-shared directories may have weaker filesystem semantics than private volumes. Concurrent writers coordinate access themselves. The initial mode does not reset existing directory permissions on later creates. Two host mounts at one path, or a host mount and a volume there, conflict. Matching volume requests across Kits merge on the cleaned destination; different sizes, modes, or backing kinds conflict. Sizes compare by byte value (suffixes use powers of 1024), modes by octal value, and omitted tmpfs is false. Argument-backed sizes and modes remain strings, including byte sizes such as 1024 and unpadded octal modes such as 755. An unspecified size or mode differs from an explicit value. Duplicate destinations within one declaration block are rejected. When a published set re-exports a volume's text input, publication keeps the requests separate until create expands and selects them; matching concrete settings then merge. Do not pin a create-phase size merely to avoid comparing its placeholder during publication.

Block-volume data belongs to the owner scope, sandbox name, and cleaned path, independently of the Kits that requested it. Stop/start, restart, Kit updates, and delete followed by create under the same name retain it. Removing a declaration leaves its storage retained and unmounted; restoring the path reattaches contents and permissions. Incompatible retained settings refuse create or re-create before changing storage. Only explicit storage removal or a documented, visible retention policy ends its lifetime. New paths start empty before hooks. Enforced block size is dedicated capacity additive to the root disk; runtimes disclose advisory sizes and their infrastructure-loss durability guarantee. Tmpfs is empty after stop, re-create, or delete; suspend may preserve it with memory. Host mounts retain their separate Kit-scoped sharing contract.

Bundled skills

Use agent-skill@1 to package a skill as a mixin; see examples/review-skill. Ship the whole directory under a Kit-specific prefix such as /usr/share/example-skills/review, and declare that absolute source path. A source path must be literal after publishing; use a build-phase argument if it varies. Supporting scripts and references retain their relative paths. An optional config.name overrides the source basename at discovery destinations; it does not rename or rewrite the source.

Agent Kits declare agent-skills@1 at their discovery paths. The runtime links or otherwise exposes every selected agent-skill@1 bundle at each path, even when the host store is missing, empty, or disabled. The same declaration permits host sharing when mode explicitly selects readonly or readwrite, bounded by host policy. An omitted mode defaults to off, so discovery alone grants no host access. No second directory declaration is needed. Runtime assembly of these sources is implementation-specific. Different source paths claiming one effective name conflict at composition, and an existing destination entry makes a skill request unsatisfiable. Without any selected destination, a required skill request fails; optional requests are skipped and recorded. Registration does not execute scripts.

Versions, provides and requires

Pin the tool, and say so once. Declare a build-phase version arg, wire it through to the installer, and reference it from both provides and the top-level version: — publishing expands all of it, so one value drives the install, the matchable capability, org.opencontainers.image.version and the published tag.

A pinned provide is a claim about content, so make the build enforce it. Add a step that re-reads the installed version and fails on mismatch. Pinning the provide without pinning the install is worse than floating: it asserts a version the content may not have.

An unversioned provide is not a resting place. It resolves by falling through: an explicit @version wins, else a version-shaped consumption reference, else the descriptor's version: — and :latest is not version-shaped. So an unversioned provide under version: "1.0.0" publishes <tool>@1.0.0, the kit's release number wearing the tool's name, which a lower-bound constraint will not match. With no version: at all it does not publish: RequireVersionedProvides fails the build. Pin the version, or drop the provide — a kit with no provides publishes fine, and offering nothing matchable is honest when the kit cannot know what it installed.

A workload states the tools its base ships with providesFrom. You do not know what version of Python the base image carries, and deb/python-3.14 is a name that moves at the next minor and that no Alpine base will ever provide. Name the command and let publishing find the version:

kind: workload
providesFrom:
  python: /usr/bin/python3
  ssh: /usr/bin/ssh

Publishing looks up the installed package that owns each file and states python@3.14.10, ssh@10.0 in provides; the field itself is not published (§9.7). It reads dpkg's and apk's file lists, so it is workload-only, and it fails the build for a path that is absent, a directory, or owned by no package — a binary your recipe downloaded still takes the build-phase version arg above. Check a path before you list it:

docker run --rm <base> sh -c 'grep -lx /usr/bin/python3 /var/lib/dpkg/info/*.list'

Do not state a name a mixin exists to provide. One name has one provider (§5.3), so a workload that states gh stops composing with the gh kit.

requires is a closed-set check: a name nothing in the composition provides makes your kit refuse to compose anywhere, which is worse than saying nothing. It constrains the composed runtime set, not your builder — a mixin that only touches apt inside a build stage needs no deb/apt, and adding one there rejects every Alpine or distroless workload that could otherwise have run the shipped binary perfectly well.

Two things follow, and both cut against the instinct to list whatever a lifecycle hook shells out to:

Never require the platform floor. §12 lets kit content assume bash and sh, curl, git, a populated CA store, and the agent user at uid 1000. A hook running curl or git has declared nothing by doing so. Worse, requires: ["deb/curl"] refuses every workload without a dpkg database — an Alpine or Wolfi base publishes apk/ names — so the entry rules out bases that were always going to satisfy it.

A conditional dependency cannot be expressed here, so do not try. There is no either/or in requires: an entry is a hard precondition on every composition. A hook that reaches for apt-get only when the tool it installs is missing works fine on a base that already ships the tool, and requires: ["deb/apt"] converts "degrades on some bases" into "refuses on them". Let the hook probe and fail with an actionable message, and say in a comment that the silence is deliberate — otherwise the next reader adds the entry back.

The test is not "what do my hooks run" but "what must already be present, on every base, for this kit to work at all". Usually that is nothing.

Where a requirement is real, deb/ names are the right vocabulary and invented ones are wrong: publishing derives a deb/<pkg> provide from a workload's dpkg database, so requires: ["deb/apt"], ["deb/jq"] or ["deb/docker-ce"] resolve against any Debian-based workload. On a multi-platform workload the derived set is the intersection — §9.6 emits a package only where every published platform agrees on its normalized name and version — so check each arch, not just your own (docker run --rm --platform linux/arm64 <base> dpkg-query -W -f='${Version} ${Status}\n' <pkg>), and never author a deb/ provide — the frontend refuses it.

Content recipes

Recipe patterns for both kinds, including the ownership rules an overlay must satisfy, are in RECIPES.md. Read it before writing a mixin: overlay ownership is the single most common way a working-looking kit is broken.

Build secrets

Declare private build credentials with args.<name>.buildSecret: <ID>. The ID follows the argument-name grammar and is unique within the kit. The declaration excludes env, buildArg, default, required: true, enum, and pattern; never interpolate it with ${{ kit.args.* }}. Keep ordinary argument names and build-arg destinations distinct from secret names and IDs.

The recipe uses RUN --mount=type=secret,id=<ID>,required=true and reads /run/secrets/<ID>. Supply it with Docker's standard interface:

docker buildx build -f <kit>.yaml \
  --secret id=<ID>,env=<HOST_TOKEN_VARIABLE> .

A src=<FILE> secret source also works. Keep the source outside the build context. Never pass secret bytes or store references through --build-arg; this frontend rejects the declared secret name and ID on that channel. The recipe's required mount checks availability only when its step executes. Token rotation does not invalidate BuildKit's cache; use --no-cache when a fresh authenticated download is needed.

The declaration remains in a published kit but creates no runtime input. Do not set it in a published set's kits[].args or an sbxenv. Host-store bindings through sbx --kit-arg require separate runtime support and are not implemented by this spec/frontend change.

This extends the unfinished schema-3 grammar in place; older readers reject buildSecret. Use a matching frontend and runtime reader.

Build, run, verify

Create a named container builder once and select it for exports and publication:

docker buildx create --name kit-builder --driver docker-container --bootstrap

The docker driver with the classic image store can drop manifest annotations during publication, leaving an image that is no longer a Kit. OCI export support also depends on the driver and image store. A container builder avoids that store round trip; validate the exported artifact as well as the source.

# 1. validate — the descriptor is checked before any content is built, so this
#    fails in a second on a bad field. cacheonly drops the EXPORT, not the
#    build: once the descriptor is valid the whole recipe still solves.
cd <kit> && docker buildx build --builder kit-builder . \
  -f <kit>.yaml --output type=cacheonly

# 2. build, exporting a layout so kit-tck can judge it without a registry
docker buildx build --builder kit-builder . -f <kit>.yaml -t <kit>:<version> \
  --output type=oci,dest=/tmp/<kit>-layout,tar=false

# 3. conformance — NB the tag alone, not <kit>:<version>
kit-tck validate --layout /tmp/<kit>-layout <version>

# 4. run it, no registry needed
sbx run ./<kit> .                          # a workload
sbx run ./<workload> --kit ./<kit> .       # a mixin, composed
sbx kit inspect ./<kit>                    # resolved declarations, no workload sandbox

Recipe-based local source builds use host Docker Buildx when Docker is available, otherwise the shared builder sandbox. The host builder needs OCI export support. Select the named builder with BUILDX_BUILDER=kit-builder sbx kit inspect ./<kit>, or use SBX_KIT_BUILDER=sandbox to require the sandbox backend. SBX_KIT_BUILDER=host requires the host backend. Declaration-only mixins need neither. Sandbox builder status, history, and removal describe only that backend; removing it does not clear host-builder caches.

Inside a sandbox the kit is self-describing: /usr/share/sandbox/kit/<kit>/kit.yaml is the published descriptor, kit.dockerfile the recipe, and /var/log/sbx-kit-startup.log the startup hook output.

A build is not proof the kit works. For a mixin especially, compose the built overlay onto a bare base and run the tool. An overlay shipping a dangling symlink — which happens whenever an installer relocates a launcher but not its payload and the build-stage test -x passes because the payload is still there — draws a kit-tck warning in step 3, but only the composition proves whether the base supplies the target. Details and the ownership audit are in RECIPES.md.

Publish

Publishing is the build. A kit is an OCI artifact and the frontend has already written its annotations, staged sources and config, so the thing in the registry is the kit — there is no pack step, no sidecar artifact and no kit push subcommand to look for. Add --push to the build that produced the kit you verified:

docker buildx build --builder kit-builder . -f <kit>.yaml \
  --platform linux/amd64,linux/arm64 --provenance=mode=min --push \
  -t <registry>/<kit>:<version> -t <registry>/<kit>:latest \
  --metadata-file /tmp/<kit>-push.json
kit-tck validate <registry>/<kit>:<version>

Validate after pushing: build-time checks cannot see annotations lost by an exporter or registry. Explicit --provenance=mode=min also makes single-platform index annotation predictable; Buildx's default provenance can produce an index without Kit annotations. Index annotations are an optimization; consumers fall back to the platform manifest when the index omits them (§9.3). An OCI layout's outer index.json is a catalog, separate from any image index it references.

Push both platforms in one invocation. One build writes the index consumers resolve through; two single-platform builds pushed to the same tag replace each other, leaving a tag that serves whichever ran last and silently fails for everyone on the other architecture.

Tag the version and latest together. <version> is the descriptor's expanded version:, so where a version arg drives the install it also names the tag, and the tag says exactly what the image contains.

Where several kits share one repository, the version belongs in the tag. A repository per kit is the simple case; a repository holding a family of them distinguishes kits by tag, which leaves <kit>:<version> nowhere to put the version. Join them and keep the bare name as the moving tag:

docker buildx build --builder kit-builder . -f <kit>.yaml \
  --platform linux/amd64,linux/arm64 --provenance=mode=min --push \
  -t <registry>/<kits-repo>:<kit>-<version> \
  -t <registry>/<kits-repo>:<kit>

Publishing only the bare name leaves consumers no way to ask for a particular build, or to notice they were moved onto a different one. Reference the immutable tag from anything that has to keep working — and note that a version-shaped tag is also one of the inputs that answers an unversioned provides entry, which <kit>-<version> is not. That is a reason to state version: in the descriptor rather than leaning on how you tagged.

Signing is optional and orthogonal. A signature is stored as its own object in the repository rather than as part of the image, so it changes neither the kit's digest nor its annotations, and a signed kit's kit-tck verdict is the one it already had:

digest=$(jq -r '."containerimage.digest"' /tmp/<kit>-push.json)
cosign sign --yes <registry>/<kit>@"$digest"

Sign the digest, never the tag. --metadata-file reports the digest the push actually produced; a tag is mutable, so a signature naming one attests to whatever it happened to point at.

For a multi-platform build that digest is the index's, and signing it signs the index alone — the per-platform manifests beneath it carry no signature of their own, so a consumer verifying a platform digest directly finds nothing. Add --recursive to sign each discrete image as well, or say plainly that only the index is signed and expect verification to name the index.

In CI, keyless signing avoids managing a key at all: grant the job id-token: write and cosign takes its identity from the OIDC token. The matching verification names the identity rather than a public key, and for GitHub Actions that identity is the workflow, not the repository:

cosign verify <registry>/<kit>@"$digest" \
  --certificate-identity 'https://github.com/<org>/<repo>/.github/workflows/publish.yml@refs/tags/<tag>' \
  --certificate-oidc-issuer https://token.actions.githubusercontent.com

Name the whole identity, not a prefix of it. An identity regexp like ^https://github\.com/<org>/ accepts a certificate from any workflow in any repository in the organization, so any job anywhere in the org with id-token: write can mint something that passes — and verification then proves only that the signature came from somebody in your org, which is not the question being asked. The signature is only evidence of provenance when the identity pins the repository, the workflow file and the ref. Where a tag varies, keep the rest exact and vary only that part:

  --certificate-identity-regexp '^https://github\.com/<org>/<repo>/\.github/workflows/publish\.yml@refs/tags/'

Tooling

  • docker buildx — nothing to install for the frontend; BuildKit pulls docker/sandbox-kit:3 from the # syntax= line.
  • sbx — install the stable CLI from Docker Docs / sbx-releases; current releases support Kits v3 in local and cloud mode. Note sbx kit validate does not accept a v3 source kit; sbx kit inspect does.
  • kit-tck — go install github.com/docker/sandbox-kit-spec/v3/cmd/kit-tck@latest.
  • cosign — only if you sign. Nothing in the kit grammar requires it and no consumer needs it to run a kit.

Reference

  • SPEC-v3.md — the grammar. §3 authoring forms, §5 provides/requires, §6 args, §7 capabilities, §9.6 derived provides, §9.7 provides stated from a path.
  • capability pages — normative per type.
  • examples — gh for a self-contained tool mixin, hello for the smallest workload, claude and claude-mixin for one agent in both shapes, motd for the single-file inline form, team for a set.
  • Where the docs and the Go implementation in spec/ disagree, the code wins.

Coupled optional features

Capability versions are exact requests. Schema 3 has no alternatives field or highest-version selection. Prefer one required version when the Kit needs that contract. Two optional versions or groups remain independent; runtime policy can accept one exact version across the composition, but accepting both still invokes their composition rules. For agent-context, selecting both versions fails. A required @1 cannot be answered by supporting @2. Publish separate Kits or sets when users need mutually exclusive bundles, and choose one before composition.

Use a group when skipping a capability also needs to skip its hooks, files, or guidance. Put optional: true on the group, never on its members (even optional: false is invalid). Groups are nonempty and cannot nest; required and one-member groups are valid. See examples/optional-cache/optional-cache.yaml.

The selection API includes every member or none, before composition. A runtime supplies decisions on expanded entries; the API owns atomic selection and ordering. Validate all member configs even in skipped groups. Selected entries must still satisfy cross-entry rules, and a composition conflict is an error rather than a reason to skip another group. Singleton arity is per declaration block; lifecycle lists from selected blocks concatenate, and duplicate file paths are errors.

Published sets may carry declarationBlocks on ordinary items or one-member group wrappers. Preserve these descriptor-local IDs when reading a published descriptor: they keep duplicate checks within an original block after expansion, without coupling optional selection. A publisher remaps them per contribution occurrence, retains all IDs on reconciled concrete requests, and never derives them from diagnostic source metadata. Hand-authored Kits normally omit this field.

Selection lasts for one sandbox installation, including restarts. Recreation selects afresh. A failing selected hook is an execution failure, not optional unavailability. Skipping a group does not remove old files from reused volumes, omit image layers, or suppress argument environment exports. Group names are display labels, not merge keys.

Groups extend the unfinished schema-3 grammar in place. Descriptors using them require a reader implementing this extension; older strict readers reject them.

Final environment references

Use ${{ kit.env.HOME }} in capability configuration strings when a path depends on the final container environment. Image defaults compose first, argument env exports replace them, and runtime environment overrides win last. Expansion happens before validation and selection, including inside groups. Missing names fail; empty values remain empty. This is structural string substitution, not shell evaluation: $HOME, ${HOME}, and ~/ are unchanged. Do not use environment references in mapping keys or Kit metadata, and do not pass Kit placeholders inside argument or environment values. Persist the expanded descriptor for restart.

Workspace and sandbox identity

A workload declaring sbx@1 receives runtime-owned WORKSPACE_DIR, SANDBOX_NAME, SANDBOX_ID, and IS_SANDBOX=1. Do not bake these into an image, export them from Kit arguments, or set them in shell profiles: the runtime's values win over image, argument, and process overrides. Treat SANDBOX_ID as opaque; it identifies the sandbox across restarts and container replacement, not a backing container or VM.

WORKSPACE_DIR is an absolute sandbox path when a workspace is assigned, including internal and cloned workspaces; it does not imply a host mount or finished preparation. It is unset with no workspace, and then a ${{ kit.env.WORKSPACE_DIR }} reference fails at create. A process cwd does not change the assigned workspace. Hooks list each of these inputs they consume in env; none is in lifecycle's automatic baseline.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.