Container Layers¶
[!WARNING] This documentation was written by an AI agent and might be inaccurate.
Overview¶
terok builds project containers in three logical layers. L0 (dev) and L1 (agent) are project-agnostic and cache well; L2 is project-specific. L0 and L1 are rendered and owned by terok-executor; terok renders the L2 layer (l2.project.Dockerfile.template) and drives the builds.
Layers¶
L0 — Development Base (terok-l0:<base-tag>)¶
- Based on
fedora:44by default (override viaimage.base_image). - Installs common tooling (git, openssh-client, ripgrep, vim, etc.).
- Creates
/workspaceand setsWORKDIRto/workspace. - Creates a
devuser with passwordless sudo and runs containers as that user. - Stages
init-ssh-and-repo.shat/usr/local/binand makes it the defaultCMD. - Environment defaults:
REPO_ROOT=/workspace,GIT_RESET_MODE=none.
Base image families¶
Officially tested base images: ubuntu:24.04, fedora:44, quay.io/podman/stable, nvcr.io/nvidia/nvhpc. The package-manager branch (apt/dnf) is auto-detected from the image name. For images outside the allowlist, set image.family: deb or image.family: rpm explicitly:
L1 — Agent Image (terok-l1-cli:<base-tag>[-<agents>])¶
Built FROM L0.
- Installs the agent CLIs and supporting tools selected from the roster (
terok agents listshows what is available; defaults come fromimage.agents). - The unsuffixed tag (
terok-l1-cli:<base-tag>) is a default alias: it points at whichever L1 was last built with the user's configured default agent selection, so host-wide flows (terok auth <provider>) can rely on it containing every configured agent. Explicit selections get only their suffixed tag.
Vibe installation and upgrades¶
Vibe is installed as dev through uv with GIL-enabled Python 3.14, separate
from system Python. In containers built with this roster, run
uv tool upgrade mistral-vibe without sudo, then restart Vibe. The bulk
sudo update-all-the-things helper targets the same installation.
To replace the older root-owned pipx installation, run
terok project build <project> --refresh-agents and create a new task.
Rebuilding images does not change existing task containers. An in-container
upgrade affects only that container, not the image or other tasks.
The old vibe-readable-colors.dockerinclude example patched Vibe's Python TUI.
Vibe 3 removed that TUI,
so the example has been removed. Use Vibe's /theme command instead.
Vibe's native experimental model catalog is enabled in the image for CLI,
headless, and ACP sessions. The Mistral backend fetches the catalog through
the vault; fetch failures fall back to local model definitions. Set
VIBE_EXPERIMENTAL_ENABLE_MODEL_CATALOG=false to disable it. The old
vibe-model-sync helper is no longer used. Rebuild with --refresh-agents
and create a new task to adopt the image default and updated launcher.
When defining a model manually, specify both max_context_length (total
context window) and max_output_tokens (per-response cap). A large context
window does not imply an equally large allowed completion.
Vibe transcripts retain their native location (~/.vibe/logs/session by
default) in the configured Vibe mount. Native tool/turn hooks capture only
the current task's root-session ID in /home/dev/.terok/vibe-session-id.txt;
automatic resume never selects the newest shared transcript. Without a
captured ID the wrapper warns; vibe --resume remains available for manual
selection. Old unverified pointers are ignored, not imported. Rebuild and
recreate the task container to install the hook helper and ACP adapter.
Initial instructions and agent-history tracking are unchanged.
Agent mounts are host-wide by default. credentials.scope: project in
project.yml isolates both the mounts and credentials per project, while
sharing them across its tasks. There is no credentials.scope: task option;
project.isolation: sealed copies data instead of bind-mounting it and is
not persistent per-task agent-mount configuration.
L2 — Project Image (<project>:l2-cli)¶
Built FROM the L1 image.
- Adds project-specific defaults (
CODE_REPO,GIT_BRANCH) and the user snippet. - Optional dev image (
<project>:l2-dev) builtFROML0 when--devis used.
Build Flow¶
terok project generate <project> renders Dockerfiles into the per-project build directory:
L0.Dockerfile, L1.cli.Dockerfile, L2.Dockerfile.
| Command | Layers Built | When to Use |
|---|---|---|
terok project build <project> |
L2 only | Project config changes |
terok project build <project> --refresh-agents |
L1 + L2 | Bust the agent-install cache |
terok project build <project> --full-rebuild |
L0 + L1 + L2 (no cache) | Refresh base image + system packages |
terok project build <project> --agents <list>\|all |
L1 (if missing) + L2 | One-shot override of which agents bake into L1 |
terok project build <project> --dev |
+ L2-dev image | Manual debugging container |
--refresh-agents rebuilds L1 with a fresh AGENT_CACHE_BUST build-arg (L0 is re-run fully cached); the per-agent install layers below the cache-bust point are re-executed, the system-package layer above it is reused.
--full-rebuild passes --no-cache --pull=always, forcing a fresh base-image pull and re-running system-package installs.
--agents <list>\|all selects which roster entries get baked into L1 for this build only. Defaults come from image.agents in project.yml (or the global config.yml). Different selections produce different L1 tag suffixes (…-claude-codex, …-gh-glab) and coexist in the local image store.
<base-tag> is derived from image.base_image (sanitized), e.g. ubuntu:24.04 becomes ubuntu-24.04. Tags are capped at 120 characters (headroom under the OCI 128 limit); when a selection suffix would exceed the cap, the agent portion is replaced with a digest of the sorted selection.
Runtime Behavior¶
terok task run <project>(default--mode cli) creates a fresh task and runs a container from<project>:l2-cli.--mode toaduses the same L2 image with the Toad browser TUI entry point.- Mounts a per-task workspace to
/workspaceand shared credential directories. - The init script clones or syncs the project repository into
/workspace.
See Shared Directories for mount details.
GPU Support¶
GPU passthrough is opt-in per project (run.gpus in project.yml). The value selects vendors — all (auto-detect), nvidia, amd, intel, or a list — and terok adds the matching Podman flags (CDI when available, the vendor's documented device nodes otherwise). See GPU Passthrough for details.