Skip to main content
Reference

Dependencies reference

Declares runtime dependencies, services, and packages for container image builds.

Declaration

Add dependencies to the dependencies list in moat.yaml:

dependencies:
  - node@22
  - python@3.11
  - git
  - npm:lodash@4.17.21
  - postgres@17

Run Moat with the workspace containing that configuration:

moat run ./my-project

See the moat.yaml reference for the complete dependencies field specification.

Dependency types

Registry

Registry dependencies defined in Moat’s internal registry. Includes language runtimes, system packages, CLI tools, GitHub binaries, and custom installers.

Syntax: <name> or <name>@<version>

dependencies:
  - node@22        # Runtime with version
  - python         # Runtime with default version
  - git            # System package
  - claude-code    # Custom installer
  - golangci-lint  # GitHub binary

Run moat deps list for the full registry and moat deps info <name> for current defaults and maintained release lines. Explicit patch pins within a maintained line pass through to the upstream image, repository, or installer.

Dynamic

Packages installed from language-specific package managers.

Syntax: <prefix>:<package> or <prefix>:<package>@<version>

dependencies:
  - node
  - npm:lodash@4.17.21
  - python
  - pip:requests@2.31.0
  - go
  - go:github.com/junegunn/fzf@latest

Supported prefixes:

PrefixPackage managerRequired runtime
npm:npmnode
pip:pippython
uv:uv tooluv
go:go installgo
cargo:cargorust

Moat validates that the required runtime is present and returns an error if it is missing.

pip: packages install into the requested Python interpreter, not a virtual environment. Mixed-runtime and custom-base builds install the requested Python through a temporary uv bootstrap; it does not substitute the distribution’s system Python or replace an explicitly pinned uv dependency.

Meta

Bundles that expand to multiple packages during resolution.

Syntax: <bundle-name>

dependencies:
  - go-extras       # gofumpt, govulncheck, goreleaser
  - cli-essentials  # jq, yq, fzf, ripgrep, fd, bat
  - python-dev      # uv, ruff, black, mypy, pytest
  - protobuf              # protoc, protoc-gen-go, protoc-gen-go-grpc, validate, doc
  - protobuf-es           # protoc, protoc-gen-es, protoc-gen-connect-es
  - protobuf-grpc-gateway # grpc-gateway, openapiv2, grpc-gateway-ts

Run moat deps info <name> to see the expanded contents of any meta dependency.

Service

Sidecar containers (databases, caches) that run alongside the agent.

Syntax: <service> or <service>@<version>

dependencies:
  - postgres@17
  - redis@7

Moat starts each service as a sidecar, generates random credentials, waits for readiness, and injects MOAT_{SERVICE}_* environment variables into the agent container.

See Available services below for the full list, and the service dependencies guide for configuration, environment variables, and networking details.

Available dependency categories

CategoryExamplesNotes
Runtimesnode, python, go, rust, bunVersion-pinnable with @version
Package managersuv, yarn, pnpm
Development toolsgit, gh, lazygit, task
Language toolsgolangci-lint, ruff, typescriptGo, Python, Node tool ecosystems
Protobufprotoc, protoc-gen-go, protoc-gen-go-grpc, protoc-gen-esOr use protobuf / protobuf-es meta bundles
CLI toolsjq, yq, ripgrep, fd, bat
AI coding toolsclaude-code, codex-cliOr use moat claude / moat codex. codex-cli is pinned; override with codex-cli@<version>
Workflow toolsgraphite-cliImplied by --grant graphite
Database clientspsql, mysql-client, redis-cli, sqlite3Pair with corresponding service
Cloud toolsaws, gcloud, kubectl, terraform, opentofu, terragrunt, helmterragrunt needs terraform or opentofu
Servicespostgres, mysql, redis, ollamaRun as sidecar containers

Run moat deps list --type <type> to filter by category.

terragrunt is a thin wrapper that delegates every plan/apply/state operation to a Terraform or OpenTofu binary on PATH, so pair it with an engine:

# Terraform-backed (terragrunt finds `terraform` automatically):
dependencies: [terraform, terragrunt]

# OpenTofu-backed — point terragrunt at the `tofu` binary:
dependencies: [opentofu, terragrunt]
env:
  TERRAGRUNT_TFPATH: tofu

opentofu installs the OpenTofu CLI as the tofu command.

Version resolution

Node.js, Python, and Go partial versions resolve to the latest matching release within the specified major or minor line. Other dependencies follow their upstream installer syntax; archive-based CLI installers generally require a full release version.

dependencies:
  - node@26            # Latest matching Node.js 26 release
  - python@3.15.2      # Exact interpreter
  - postgres@18.1      # Exact service image tag
  - pnpm@10.21.0       # Exact package manager

Explicit package-manager pins take precedence over a project’s packageManager field. Apt dependencies accept distribution revision syntax, for example jq@1.6-2.1+deb12u1. Explicit pins override unversioned bundle entries regardless of declaration order; conflicting explicit pins produce an error.

Upstream support policy

Moat rejects known end-of-life release lines for Node.js, Python, Go, PostgreSQL, MySQL, and Redis. Support includes upstream security maintenance. For example, Node.js 20 reached EOL in April 2026; use a maintained line shown by moat deps info node.

Patch versions within maintained lines do not need a catalog update. Unknown newer releases pass through to upstream version resolution, so a stale Moat binary does not block a new release. The upstream image or installer reports nonexistent versions. Projects without published support dates, including Ollama, do not receive an inferred EOL cutoff.

A daily GitHub Actions workflow checks Node.js’s official release schedule and index, lifecycle data from endoflife.date, and records projects without lifecycle policies. It opens or updates a reviewed PR with catalog changes. Defaults advance when their current line reaches EOL; unversioned dependencies in existing binaries also select a maintained successor from their embedded catalog. The successor is the oldest maintained newer line with at least 90 days of support left when available; Go uses the latest maintained toolchain. Other defaults stay pinned. Each Moat binary embeds the catalog and evaluates its EOL dates locally without a network lookup. Upgrade Moat to receive revised dates or new release-line metadata.

Maintainers can refresh the catalog manually:

go run ./internal/deps/cmd/update-support

Version data is cached locally at ~/.moat/cache/versions.json for 24 hours.

Base image selection

Moat selects the base image based on declared runtime dependencies.

DependenciesBase image
node@<version> onlynode:<version>-slim
python@<version> onlypython:<version>-slim
go@<version> onlygolang:<version>
Mixed or nonedebian:bookworm-slim

Mixed runtimes use debian:bookworm-slim and install the requested versions in separate layers. A base_image setting overrides the base image without changing requested runtime versions. Listing python without a version selects Moat’s default interpreter, including on a custom image that already bundles another Python version; pin python@<version> to select that interpreter.

Layer caching

Moat orders Dockerfile instructions to maximize BuildKit cache hits. Layers are ordered from least to most frequently changed:

  1. Base packages (curl, ca-certificates)
  2. User setup (moatuser)
  3. APT packages
  4. Runtimes
  5. GitHub binaries
  6. npm packages
  7. Go packages
  8. Custom dependencies
  9. Dynamic packages

When a dependency changes, only that layer and subsequent layers rebuild. BuildKit layer caching is shared across runs.

For complete project examples showing dependencies with volumes and hooks, see Recipes.

Docker dependencies

Dependencies for running Docker inside containers.

DependencyDescriptionUse when
docker:hostMounts the host Docker socketFast startup; agent is trusted
docker:dindRuns an isolated Docker daemon with BuildKit sidecarIsolation from the host Docker daemon is required
dependencies:
  - docker:host  # or docker:dind

Both modes require Docker runtime. Apple containers do not support Docker socket mounting or privileged mode. See the moat.yaml reference for detailed configuration.

Available services

ServiceDefault versionEnvironment variables injected
postgres17MOAT_POSTGRES_*
mysql8MOAT_MYSQL_*
redis7MOAT_REDIS_*
ollama0.9MOAT_OLLAMA_URL
ministack1.3MOAT_MINISTACK_*

Service dependencies require Docker or Apple container runtime. See the service dependencies guide for environment variable details, networking, and security information.

Hooks

Hook commands run after dependency installation completes. See the moat.yaml hooks reference for field specifications and the lifecycle hooks guide for all hook types.

CLI commands

moat deps list

List all available dependencies in the registry.

$ moat deps list
$ moat deps list --type <type>
FlagDescription
--type <type>Filter by category (e.g., runtime, service, cli)
--jsonOutput as JSON

moat deps info

Show details for a specific dependency, including version, type, and expanded contents for meta dependencies.

$ moat deps info <name>
$ moat deps info go-extras
FlagDescription
--jsonOutput as JSON