Using Piceli from an agent

This page tells a coding agent or CI bot how to drive Piceli safely: which commands only read, which need the owner’s approval, how to read the output and the errors, how to resume, and what never to print.

Maturity: preview

The output contract below is new in 0.3.0 and, since 0.5.1, covers every command (all marked conforms in Command reference; none is partial). See the Roadmap for every feature’s status.

Start here

Need

Where

Every command, option, side effect and approval rule, as JSON

piceli help-json (same as piceli --help-json)

What an error code means and what to do next

piceli explain <code> --json

The same, as pages

Command reference, Error codes

An index of the documentation for language models

llms.txt

The web workspace, one-command checkout preview, saved plans, revision differences and deployment logs

Piceli web application; history reads saved evidence and does not renew approval or prove desired changes reached the cluster

A ready agent skill (SKILL.md and scripts: install, plan, ask, deploy, status, diagnose, resume, roll back)

skills/piceli; its walkthrough runs in CI against the built wheel

Whether Piceli fits a task, and what it does not do today

When to use Piceli, and when not to, The same app in Piceli, Helm, Kustomize, cdk8s and Pulumi

How well models follow these rules (the rules below are scored; breaking one fails the task)

Cross-model evaluation

piceli help-json is generated from the command definitions. For each command, contract.side_effects says what it reads and writes and whether it contacts a cluster, approval_required says whether it changes anything outside local files, and safe_to_retry says whether re-running it after an interruption is harmless.

The output contract

  • stdout carries machine output: one JSON object per command, or JSON lines for streaming commands (observe forwards apply). Parse it; do not scrape stderr. render prints YAML manifests unless you pass --format json, but its refusals are always the JSON rejection object below, also when the model module raises (render-target-invalid).

  • stderr carries human text: summaries, hints and the plan hash to approve. It never carries a JSON object.

  • A refusal prints {"state": "rejected", "reason": "<code>", "message": "<human text>", …} and changes nothing. reason is stable and explained by piceli explain <code>; message is for people and may change. Some commands add fields: release refusals keep blocking[] (each item with its own code and message), inputs adds source, observe forwards apply adds preflight.

  • A MODULE:ATTR target whose module raises while importing or evaluating is a refusal like any other (render-target-invalid for render, pipeline-load-failed for deploy and release --spec MODULE:ATTR, access-target-invalid for status and access, invalid-composition for a release.toml composition); message names the exception’s type and text, never a traceback. Report it; PICELI_DEBUG=1 adds the traceback on stderr when the owner needs it.

  • An operation that ran but did not succeed exits 1 and its result names the code in reason: {"state": "failed", "reason": …} for release apply|rollback|resume, release check (check-failed) and artifacts build-spec run, {"state": "diffed", "reason": "release-changes-pending"} for release diff --exit-code, "state": "drift" for inputs verify, a receipt with state failed/rejected for artifacts deliver.

Exit code

Meaning

What to do

0

Success

Continue.

1

The operation ran but did not succeed (not ready, drift, build failed)

Read the JSON result; do not retry blindly.

2

Rejected before any change

Read reason, run piceli explain <reason> --json, apply its fix.

3

Approval required; nothing was executed

Show the plan to the owner and wait.

Commands whose contract is conforms in Command reference follow these rules exactly (including explain, help-json, status, access and deploy). For a refused release plan, see If plan refuses for the next step.

Contract changes in 0.4.0

0.4.0 moved the remaining preview commands onto the contract. Their machine output changed as follows; exit codes did not change.

Commands

Before (0.3.0)

Now (0.4.0)

release plan/preview/apply/rollback/resume/stop/status/secret show

Refusal {"state": "refused", "reason": "<sentence>", "code": "<code>"?} on stdout

{"state": "rejected", "reason": "<code>", "message": "<sentence>", "code": "<code>"}; code is an alias of reason for 0.4.x only. Results of apply/rollback/resume/stop add state (succeeded, or failed with reason).

inputs record/verify

Refusal on stderr, reason a sentence

Refusal on stdout, reason a code, sentence in message; drift adds "reason": "source-drift"

artifacts … including build-spec and deliver

Refusal on stderr (build-spec: the last stderr line)

Refusal or failure object on stdout, with message (the code’s title); a failed execute-command/import-local result adds reason

observe …, operator …

Usage errors, tracebacks, or {"ok": false, "preflight": …} on stderr

Refusal on stdout with a code; forwards status adds state and, on exit 1, reason

See also the release contract changes.

Commands an agent may run without asking

These never change a cluster, registry or node. Some write local files, as noted.

  • piceli dev status [--json] and piceli dev logs RUN [--follow] (0.18.0, --cluster MODULE:ATTR): read the development-run queue (slots, running and queued runs with their position, recent results, cache use) and a run’s output; change nothing. See Development builds.

  • piceli host status TARGET [--json] and piceli host wait TARGET REV [--timeout S] --json (0.24.0; TARGET is MODULE:ATTR, a host name with --infra MODULE, or an SSH target): read a Nix host agent’s status file over SSH (no cluster); wait exits 1 on a refused, failed or rolled-back attempt, on a pinned host (host-pinned) and on timeout. 0.26.2: a read never hangs (30 s at most): host-unreachable (no session) or host-ssh-failed (the session broke after login), with SSH’s message and the host’s HostReport endpoint, where the agent’s own reports are. See Nix host releases.

  • piceli targets [--composition MODULE] [--infra MODULE] [--kubeconfig F --context C | --state-dir DIR] --json (0.25.0): every environment and NixHost with its revision, pinned product commit, checks and state (piceli.targets.v1); reads the controller once (by default the composition’s home cluster, with its piceli login profile) and each host over SSH in parallel. Exit 1 when a target failed, rolled back or is unreachable. See Nix host releases.

  • piceli trains [NAME] [--follow] [--composition MODULE] --json and piceli train-wait RUN [--timeout S] --json (0.26.0): read a merge train’s state directory (never take its lock). trains shows the run in progress (branches, step, host, elapsed, log tail), recent runs, step trends, flaky tests and, with --composition, which run produced what each target runs (piceli.trains.v1). train-wait blocks until a run (an id, or a train’s name) ends: exit 0 ok, 1 ejected, failed, train-interrupted or train-wait-timeout; it prints the run’s piceli.train.summary.v1. Use it instead of polling. train-wait also takes a queue id (q-…). piceli train-queue NAME --json lists a train’s queue (read-only). See Merge train.

  • piceli profiles [--json]: lists the stored credential profiles (names, contexts, kubeconfig paths; never secrets). piceli login NAME --kubeconfig F --context C and piceli logout NAME only write or remove the local reference file ($PICELI_PROFILES_DIR); they never contact a cluster, but which kubeconfig a profile names is the owner’s decision.

  • piceli registry status [MODULE:ATTR | infra.py] [--json] (with --kubeconfig/--context, the pipeline’s target or the Cluster’s credential profile): reads the in-cluster registry’s pod, the mirror on each node and the claim’s storage use (du in the registry pod when the kubelet’s figure is the node’s filesystem); changes nothing. piceli registry forward only opens a loopback port-forward to it.

  • piceli infra status MODULE:ATTR [--json]: reads what the last piceli infra commands recorded for a declared Infrastructure (servers, addresses, installs, cluster registrations, cost); no OpenTofu, no credential, no network. piceli infra plan MODULE:ATTR runs tofu plan (it refreshes from the provider’s API and writes the configuration into the state directory) and never changes a resource; show its plan and estimate to the owner, never approve it yourself.

  • piceli cluster status MODULE:ATTR [--json]: reads a declared cluster’s nodes and labels, the registry and the mirror on each node (and which k3s nodes need a k3s restart), the controller, the UI and whether the Git Secret exists (key names only); changes nothing.

  • piceli gitops status [--json] (with --kubeconfig/--context, or --state-dir for a local controller): reads the controller’s health and each branch’s commit, state and pending plan hash; changes nothing. Its JSON summary.<env> (0.17.0) is the compact view: state, commit, stage (while a step runs: build, prerollout, backup, plan, apply, checks), attempt, next_retry_at and last_error (reason, stage, failure).

  • piceli gitops wait ENV COMMIT [--timeout 1800] [--json] (0.17.0): blocks until the environment runs that commit (of any of its sources) and prints state: deployed (exit 0), failed with stage and cause, superseded (a newer revision replaced it), stopped or timed-out (exit 1), or approval-required with plan_hash (exit 3: ask the owner). Controller retries are waited through. Read-only; end an integration round with it instead of polling gitops status yourself.

  • piceli gitops enable infra.py --approve HASH --wait [--timeout 15m] and piceli promote HOST --from ENV --approve DIGEST --wait (0.28.0): after the install or the push, wait until every environment (or the host) runs the expected revision with its checks passed. Exit 0: done; 1: the first failure (JSON wait.failure: env, reason, stage, detail, log_tail); 2: timeout (gitops-wait-timeout). 0.31.0: --machines MODULE[:ATTR] names the module declaring the host’s Infrastructure when the composition does not import it (--infra is --composition).

  • piceli gitops enable infra.py --approve HASH --canary (0.28.0): before replacing a running controller, runs the new image once as a Job that imports the composition and plans every environment without applying. A failure exits 2 with gitops-canary-failed (JSON canary.failure: env, stage, reason, detail); ask the owner before --force.

  • piceli gitops alarms [--follow] [--json] (0.28.0): the controller’s alarms (failed or waiting environments and NixReleases, a composition that does not import, a new version; 0.35.0: a node under disk pressure, node-disk-pressure, and a build cache over its budget, cache-over-budget) and its failed sends. Read-only. On either disk alarm, report it with the node or cache it names; emptying a cache is in the approval table below.

  • piceli gitops history [ENV] [--limit N] [--json], piceli gitops show RUN [--logs] [--artifacts] [--env E] [--json] and piceli gitops compare ENV [A] [B] [--json] (0.38.0): the controller’s deployment history, read-only, as the UI’s Deployment history shows it. history lists each environment’s runs, newest first, with window and release_window (the time a release changed the cluster, the same as its piceli.release telemetry marker); show is one run (--logs: the log tail it kept; --artifacts, 0.83.0: what it built, piceli.gitops-artifacts.v1: per component its digest, image reference, platform digests and the layer of each file mapping); compare puts two runs side by side (default: the running release and the one before): commits, images that changed, objects added, removed and changed. To look at telemetry before and after a release, take its release_window.

  • piceli gitops suspects --host NAME [--since ISO] [--json] and piceli gitops hosts [--json] (0.22.0): the deployed images a build host (or the builder node) built, from the provenance the controller recorded, and the health events and quarantine of each build host; read-only. When a host is quarantined, report it and the suspects to the owner: never release it or rebuild on your own.

  • piceli gitops builds [--target NAME] [--state STAGE|active] [--json] (0.26.0): every build the controller knows (NixRelease publishes, image builds, train handoffs) with its trigger, commit, tag, host, stages, log tail and the targets that run it now (piceli.builds.v1); an in-cluster image build’s steps give each command’s seconds (0.75.0); read-only.

  • piceli explain, piceli help-json; piceli explain --run ID --spec … reads why a past execution failed from local state (same as release status --run).

  • piceli render: imports the model module and reads the spec; never contacts a cluster or reads secret values. piceli render MODULE:pipeline renders a Pipeline with its target’s namespace and declared nodes, and build images as placeholders; it reads no kubeconfig. --env NAME renders one environment; --env A --diff-env B prints their typed difference (use it to show the owner what differs before deploying another environment; see Environments: one app for dev, staging and prod, and A realistic app: dev, staging and prod from one typed module for a complete example). --out DIR writes one YAML file per object into DIR (a directory the owner commits to Git; it must be absent, empty or a previous --out); a Secret is refused unless --secrets external. See GitOps: Piceli’s controller and manifest export. When you write a network policy, app.network_policy(…, egress=[…]) denies every other destination, DNS included: add allow_dns=True, and check the rendered policy with piceli render (a bad CIDR, port or unknown workload is render-target-invalid; see Describe an app in typed Python).

  • piceli envs --pipeline MODULE:ATTR [--json] (or PICELI_PIPELINE): lists every per-branch environment (branch, namespace, commit, build and deploy state, health, age, last push); read-only. piceli env up BRANCH --plan, and piceli env up|down|seed BRANCH without --approve, only plan and print the env_hash (exit 3 without --plan); nothing changes. piceli logs BRANCH WORKLOAD [--previous] [-f] reads one workload’s logs. Named environments (EnvConfig(environments=...)) are listed too ("fixed": true, their name as branch); piceli env up NAME plans one like a branch. See Environments: one app for dev, staging and prod.

  • piceli publish TARGET --to oci://… without --approve: renders, packages the OCI artifact and prints its digest (exit 3); nothing is pushed.

  • piceli chart render TARGET --out DIR, piceli chart package TARGET --out DIR and piceli chart manifests TARGET [--values FILE] [--out DIR]: render the app as a Helm chart directory, a reproducible <name>-<version>.tgz, or plain manifests with a values file applied; they write only local files and never read secret values (Secrets are left out and referenced by name). piceli chart publish TARGET --to oci://… without --approve prints the chart’s digest (exit 3); nothing is pushed. See Publish for other people’s clusters: a Helm chart and manifests.

  • piceli bundle TARGET --env ENV --out DIR [--receipt R]: renders the app for a cluster Piceli never accesses (kustomize base and overlay, prepare.sh, image archives, INSTALL.md, UNINSTALL.md, SHA256SUMS); it writes only local files, contacts no cluster or registry and writes no secret value (--input-prefix, --tool-name and --annotation-domain choose the names its files show). A refusal bundle-unsafe-<rule> lists every violation; fix the model or, with the owner, declare app.safety_exception(...). See Deliver to a cluster you never access. With --helm it writes a Helm chart instead (settings, secret inputs and toggles as values; generated Secrets made at install and kept across upgrades); --helm --push oci://… without --approve prints the chart’s digest (exit 3); nothing is pushed.

  • piceli support-bundle --kubeconfig F --context C --namespace NS --out FILE: reads one namespace with GET requests only (never Secrets, never env or ConfigMap values) and writes a redacted archive.

  • piceli artifacts publish --receipt R --to oci://… --tag V without --approve: reads the build receipt and prints the publish plan and its digest (exit 3); it contacts no registry. piceli artifacts build-spec preview --spec host-build.toml --platform … plans a multi-platform host build without running anything. See Publish images for other people’s clusters.

  • piceli artifacts publish-files FILE... --to oci://… --tag T --artifact-type TYPE without --approve: hashes the files and prints the plan and its digest (exit 3); it contacts no registry. piceli artifacts fetch-file --from oci://… --digest sha256:… --out PATH downloads one published file and checks its digest. piceli secrets signing-key NAME (no flag) prints a stored signing key’s public key. See Publish and sign release files.

  • piceli artifacts retention --to oci://… --receipts DIR (without --delete): reads a registry (and, with --kubeconfig/--context, the cluster’s pods, workload pod templates and environment records) and prints which manifests the last releases, pins and live workloads keep and which are collectable, with the reclaimable bytes. piceli artifacts retention --cluster infra.py:CLUSTER does the same for the in-cluster registry with everything derived from the Cluster (it also lists every stored manifest with a read-only find in the registry pod). It changes nothing. See Registry retention.

  • piceli codegen crd FILE (reads the file) and piceli codegen crd --from-cluster --kubeconfig F --context C --crd NAME (one read of the CRD through the explicit context): generate typed models for a custom resource (see Custom resources and any other kind). --out writes that one file and replaces it only when Piceli generated it. The output depends only on the schema. Never pick the kubeconfig or context yourself.

  • piceli release plan and piceli release preview: read the cluster, store a pending plan and secret candidates in the spec’s state_dir, and print the plan hash. They never write to the cluster.

  • piceli release diff: reads the cluster and sends only server-side dry runs (dryRun=All); prints what plan would change, field by field. Writes no local state.

  • Leftover objects, piceli release orphans --spec …: reads the cluster and lists objects carrying the app’s ownership labels that no current release owns (kind, name, why, age). Without --prune it changes nothing. --prune deletes only after the owner approved the printed plan_hash (--prune --approve HASH); claims, Secrets, another owner’s objects and cluster-scoped objects need their own --include-* flag, which you never add on your own.

  • piceli release status: reads local state only. Like every release command it takes --spec release.toml or --spec MODULE:ATTR (a pipeline; see Operating a pipeline’s release). --run ID (an execution id, or with a pipeline the run_id of its deploy result) shows one past execution with the causes recorded when it failed (diagnosis).

  • piceli --version: prints piceli <version> (the JSON form is the version field of piceli help-json).

  • piceli status TARGET --json: reads the release state, the cluster through the target’s explicit kubeconfig, and probes the declared forwards on 127.0.0.1. It says whether the app is up (state) and how to reach it (access.forwards[].url); exit 1 means not up. See Reach your services from your laptop.

  • piceli inputs record and piceli inputs verify: read git; record --out writes the lock file.

  • piceli artifacts preview, piceli artifacts inspect, piceli artifacts pin, piceli artifacts preview-command, piceli artifacts build-spec preview

  • piceli observe status, piceli operator status: read the cluster through an explicit --kubeconfig.

  • piceli observe forward-list, piceli observe forward-command, piceli observe logs-command: print what would run, start nothing.

  • piceli observe forwards status: probes the declared loopback ports once (never the cluster); exit 1 with "reason": "forward-unhealthy" when a required forward is down.

  • piceli import live (reads the cluster through an explicit --kubeconfig and --context) and piceli import yaml (reads local files): generate a typed module; --out writes that one file and refuses to overwrite it without --force. Secret values are never read into the output.

  • piceli deploy MODULE:ATTR --plan: plans every stage (reads sources, the local image store, the registry or node, and the cluster), writes only the pipeline’s state_dir, and prints the combined hash. It never builds, pushes or applies. Before the images exist it also previews the release with placeholder images (stages.plan.preview), and refuses with the blocking objects when the release would need adoption or replacement. With --ref SOURCE=REV it also checks the commit out into a temporary git worktree, removed before it exits. A host build (Build.spec(..., builder="host")) also reads its node’s facts (one read-only GET of the Node) and hashes the declared host tools; nothing runs.

  • piceli deploy MODULE:ATTR --plan of an app that declares App.pre_rollout(...) also lists the prerollout stage: the check commands and every Secret and ConfigMap the check pod reads. It reads Secrets, ConfigMaps and claims of the target namespace (key names only, never values) and refuses with prerollout-mount-missing or prerollout-claim-exclusive (exit 2) before anything is built.

  • piceli state show --spec … (where the state lives, its generation, the release lock’s holder; never prints content), piceli state pull --spec … (refreshes the local working copy of shared state) and piceli state export --spec … --out FILE (secret material left out; with --include-secrets only encrypted with a key file the owner provides, never one you create).

  • piceli artifacts build: assembles an OCI layout in --output without running any code.

  • piceli watch [MODULE:ATTR | --state-dir DIR] --json: follow a deploy run from its journal (snapshot, stage, progress, run events, then a result; schema docs/schemas/piceli-watch-event-v1.schema.json); read-only and offline, so run it beside a deploy (another terminal) or after it. Exit 0 ready or stopped, 1 failed, interrupted, rolled back or --timeout (watch-timeout), 2 no run (watch-no-run). Use it, not polling the cluster, to report a release’s progress (Following a run: piceli watch).

  • piceli restore-points MODULE:ATTR [--verify] --json: list the pipeline’s restore points (verified archives of retained claims taken by the deploy’s backup stage) with ids, claims, sizes and digests; --verify reads every archive back (exit 1 when one does not match). Read-only and offline; never prints what a claim holds (Restore points of retained data).

  • piceli observe forward-save, piceli operator backup: write a local preferences file or backup archive.

  • piceli cache status [MODULE:ATTR | --state-dir DIR] --json, piceli cache prune … --dry-run, piceli doctor [MODULE:ATTR] --json and piceli runs [MODULE:ATTR] --json: read the state directories, the temporary directory and (doctor) the tools’ versions; never a cluster (see Runner hygiene: disk, caches, doctor and run summaries). doctor exits 1 with runner-disk-low, runner-memory-low or runner-tool-missing before a build would fail.

  • piceli cache prune [MODULE:ATTR | --state-dir DIR] without --dry-run deletes local files only: stale temporary directories, runs beyond --keep-last, unused delivery receipts and (over --budget) build outputs and logs; never the release state, the secret store, approved plans, a resumable run or what a rollback of the last releases needs. Run it when the owner asked to free space or configured cache_budget=; show the --dry-run list first otherwise.

  • piceli heavy run [--name N] [--wait S] -- COMMAND... and piceli heavy status --json: wrap heavy work (builds, test gates, kind clusters) in heavy run so that several agents on one machine run it one at a time; the exit code is the command’s, stdout is the receipt JSON (duration, peak memory, commit), and heavy-lock-timeout (exit 2) means the lock stayed held for --wait. Set PICELI_HEAVY_LOCK=1 so Piceli’s own builds take the lock too (A machine-wide lock for heavy work).

Commands that need the owner’s approval

Ask before running these, and show the owner what will happen first.

Exporting deploy events (--otlp-endpoint, or OTEL_EXPORTER_OTLP_* in the environment) adds no approval: it only sends names, hashes, commits, digests and fixed error codes to the endpoint the owner configured, and a failure is one warning line that never changes the deploy result. Never invent an endpoint or put headers or tokens on the command line; see Deploy events to OpenTelemetry.

Command

Changes

Approve with

piceli build job

Creates a cache claim (if missing) and one Job on a builder node that fetches a commit, builds and pushes images by digest to the node registry; it is removed afterwards and the cache kept

--approve <plan_hash> printed by piceli build job MODULE:ATTR --commit SHA … without --approve, after the owner chose the commit, builder image and registry. Never put Git credentials in --repo; they come from a Secret. cluster-build-failed carries a scrubbed log tail: report it, do not retry blindly

piceli env up

Deploys a branch into its namespace (creates it, labelled), stops the least recently pushed branch environment when max_envs run (scaled to zero, kept) and, with --seed-from main, replaces the new claims’ content with main’s latest restore point

--approve <env_hash> printed by piceli env up BRANCH --pipeline MODULE:ATTR --digest NAME=REF without --approve, after the owner reviewed the namespace, the environments it stops and the deploy plan; --approve-if-policy only when the owner declared EnvConfig(auto_approve=True) (branches) or an auto_approve policy; the main branch and named environments never by EnvConfig. On an env-isolation-*, env-stack-* or env-nodes-conflict code, report it: never work around the isolation, stack or placement

piceli env down

Deletes a branch environment: its claims (data), its namespace and the volumes bound to them; never main’s

--approve <env_hash> printed by piceli env down BRANCH --pipeline MODULE:ATTR without --approve, after the owner agreed to lose that branch’s data

piceli env seed

Replaces every file of a branch environment’s claims with main’s latest restore point (stops its writers, then starts them again); main’s claims are only read from the local archive

--approve <env_hash> printed by piceli env seed BRANCH --pipeline MODULE:ATTR without --approve

piceli env push

Writes the ConfigMap piceli-env-<branch> (image digests) in the branch environment’s namespace, creating the namespace if absent

--approve <plan_hash> printed by piceli env push BRANCH MODULE:ATTR --receipt FILE without --approve, after the owner confirmed the digests are the ones to deploy

piceli gitops enable

Installs the GitOps controller: namespace piceli-system, a ServiceAccount with a namespaced Role, a ClusterRole limited to nodes (read), namespaces and binding the deployer role, a state claim, a ConfigMap and a one-replica Deployment that then deploys branches on its own (inside the pipeline’s auto_approve policy, or after piceli gitops approve)

--approve <plan_hash> printed by piceli gitops enable … without --approve, after the owner chose the repository, the branch globs, the digest-pinned --image and reviewed the plan. Never put Git credentials in --repo; --main-auto-approve and --cluster-rbac only when the owner asked; see GitOps: Piceli’s controller and manifest export

piceli registry install

Installs the in-cluster registry in piceli-system: a registry Deployment pinned to one node with a retained claim, a Service and a DaemonSet that writes /etc/containerd/certs.d/<name>.<namespace>.svc:<port>/hosts.toml on every node

--approve <plan_hash> printed without --approve, after the owner chose the node, the storage and reviewed the plan; see In-cluster registry

piceli cluster init

Labels the declared nodes (piceli.io/role-<role>, piceli.io/builder, piceli.io/runtime), installs the in-cluster registry and its node agents (they write the containerd certs.d mirror, or merge an entry into /etc/rancher/k3s/registries.yaml on k3s nodes), the GitOps controller’s namespace, identity, RBAC and state claim, and the UI

--approve <plan_hash> printed by piceli cluster init MODULE:ATTR without --approve, after the owner reviewed the plan. Never restart k3s yourself: report the restart_needed nodes to the owner. On cluster-api-mismatch, report it: never point the profile elsewhere on your own; see Cluster init

piceli infra apply, piceli infra replace (0.26.2), piceli infra destroy

Creates, changes or deletes servers, fixed IPs, firewalls, images and DNS records at the provider (they cost money; a destroyed server’s data is gone) and writes the encrypted OpenTofu state; 0.25.3: uploads each planned image itself (from its build host, retried, progress on stderr), and deletes an upload that fails

--approve <plan_hash> printed by piceli infra plan MODULE:ATTR (or replace MODULE:ATTR SERVER, destroy) without --approve, after the owner reviewed the changes and the estimate; replace destroys the server’s disk. On infra-foreign-resource, report it: never edit the state (tofu state rm) or the labels yourself

piceli infra install

Runs the owner’s OS install command (for example nixos-anywhere) against a server: it can wipe the machine

--approve <digest> printed by piceli infra install MODULE:ATTR SERVER without --approve, after the owner checked the rendered command

piceli infra register

Pins the server’s SSH host keys, reads its k3s kubeconfig and writes a local credential profile (and, with Infrastructure(home=), the controller’s Secret)

--approve <digest> printed without --approve, after the owner compared the host-key fingerprints with the server’s. On infra-register-changed, report it: a changed host key can mean another machine answers

piceli secrets provider, piceli secrets state-key

Store a provider credential (a two-part one part by part: Porkbun API key then secret API key, OpenStack application credential ID then secret) or the state passphrase as a local credential (0600)

The owner runs them and types each part (--prompt), or generates it (state-key --generate). Never type, pipe, echo or pass a token yourself, never put one in an argument or HCLOUD_TOKEN, never run --from-env for the owner; never read the credential files. On infra-credential-part-invalid report the part; on infra-credential-incomplete give the owner the command in the message (it replaces the credential)

piceli secrets git

Creates or updates the Secret piceli-build-git (username, password) in piceli-system, which the controller and cluster builds clone with

The owner runs it and types the token (--prompt). Never type, pipe, echo or pass a token yourself, never put one in an argument or PICELI_GIT_TOKEN

piceli secrets cluster

Creates or updates the Secret piceli-cluster-<name> (kubeconfig) in piceli-system of the controller’s cluster: another cluster’s credentials (0.15)

The owner runs it with their kubeconfig (--kubeconfig FILE --context NAME) or types a token (--prompt). Never read, print or pass the kubeconfig or token yourself

piceli registry uninstall

Deletes the registry, its Service and node agents (the nodes’ mirror files go with them); workloads pulling from it cannot start new pods. Never the namespace; the images only with --delete-storage

--approve <plan_hash> printed without --approve, after the owner agreed

piceli gitops disable

Deletes the controller’s objects (never an environment, the namespace or, without --delete-state, the state claim)

--approve <plan_hash> printed without --approve, after the owner agreed

piceli gitops approve

Releases a branch deploy (or a main release) waiting for approval; the controller applies that plan on its next poll

This is the owner’s approval: run it only with the exact hash the owner approved after seeing the plan (piceli gitops status shows the pending hash)

piceli promote

Asks the controller to deploy BRANCH@SHA to the main environment, or piceli promote ENV BRANCH@SHA to a named environment that follows Promote() (which then waits for gitops approve unless it declares auto_approve=True); piceli promote HOST --from ENV --approve DIGEST (0.25.0) commits the pin of the commit ENV verified in the flake’s flake.lock, tags and pushes (without --approve it only plans, exit 3)

The owner’s go-ahead for that commit and environment; for --from, the plan digest

piceli gitops candidate request, piceli gitops candidate release (0.83.0)

Asks the controller to prepare the release candidate of a commit now (it copies the images of the run that passed it to the outside registry paths the composition declares, by digest), or to mark a ready candidate released

The owner’s go-ahead for that commit; nothing to approve: the controller checks that the commit passed

piceli gitops sync

Asks the controller to deploy an environment (or every one) now at its revision; with --component NAME (a composition controller) also rebuilds that component

The owner’s go-ahead; the deploy still needs the environment’s usual approval (auto_approve, or piceli gitops approve of its plan hash)

piceli env stop, piceli env start (ENV --cluster infra.py:CLUSTER)

Asks the composition controller to stop a named environment (workloads scaled to zero, volumes kept, not planned or deployed) or start it again (scaled back; a moved revision deploys with its usual approval)

The owner’s go-ahead: stopping takes the environment’s workloads down; env start of an environment declared stopped=True is refused (gitops-env-stop-declared)

piceli dev run (0.18.0)

Creates one Job in piceli-dev that runs your build or test command on the builder node in the shared development cache (isolated: non-root, no token, no Secret, no cluster network); it is removed afterwards

Approved once: the owner’s approval of Cluster(dev=DevBuilds(...)) in piceli cluster init covers every run inside that declaration. After that, run it as often as you need, with the commits and commands of your task; never change the declaration or the profiles yourself. A failing command is dev-command-failed (exit 1): read log_tail, fix, run again. dev-run-unschedulable (0.35.0, after --unschedulable-seconds, default 60): the builder cannot take the pod; report the reason, or run piceli dev cache clear when it names disk pressure; see Development builds

piceli dev nix build (0.24.0)

Without --publish: a development run that builds a flake output on a docker or native Nix host. With --publish: also signs and pushes the closure to the owner’s binary cache and uploads a signed manifest that hosts may switch to

Without --publish, like dev run. With --publish: --approve <digest> printed without --approve, after the owner reviewed the commit, output, host, cache and key. Never pass a key yourself

piceli dev nix gc (0.24.0)

Deletes manifests, narinfos and NAR files of commits other than the newest --keep-tags tags (per --tag-pattern, each host’s Tag pattern, when given) and the current main from the binary cache (never a path a kept closure reaches)

--approve <digest> printed without --approve, after the owner reviewed the list

piceli host module (0.24.0)

Renders a NixHost’s NixOS module (the host agent, its configuration, a service and timer) to stdout or --output FILE; contacts nothing

Safe. Committing it and rebuilding the host is the owner’s decision; from then on the host follows its ref on its own

piceli host pin, piceli host unpin, piceli host rollback (0.24.0)

Over SSH: deploy a published tag’s build and hold it, drop the hold, or switch back to the previous system and hold it

The owner’s go-ahead for that host and tag; no digest (only verified, published builds or the previous system). Exit 1: the host switched back after a failed check; report it

piceli host secrets (0.24.0)

Puts the host’s age identity (its sops-nix key) on the host and re-runs its activation; 0.25.0: also the cache’s read S3 keys infra apply created (/var/lib/piceli-host/cache.env, no activation)

--approve <digest> printed without --approve, after the owner reviewed the host, path and public key; never --replace on your own

piceli secrets delete (0.24.0)

Deletes a stored local credential (--kind refuses another kind); never prints the value

The owner’s go-ahead for that name: without --yes it exits 3 with the command to run (or asks on a terminal). Never delete a state key (state-key): the state it encrypts becomes unreadable

piceli secrets status MODULE[:ATTR] (0.25.0)

List every secret a declaration needs: state (present, pending, missing, incomplete, damaged, copy: a generated signing key whose public key goes into NixCache(public_key=) of a cache declared with key_name=, not-needed), who creates it (infra-apply, piceli, owner), the exact next command, what it is for, the backup’s state, warnings

Read-only; safe to run and retry; never prints a value. --json prints piceli.secrets-status.v1; exit 1 means something is missing: show the owner the next commands, never run an owner one with a value you made up. 0.25.3: an S3 pair the owner makes by hand (NixCache(write_credentials=, read_credentials=) at Infomaniak) is missing (0.26.2; was pending) by owner until stored, so status exits 1; its detail says how to make it (openstack ec2 credentials create, signed in as the project’s user): only the owner can

piceli secrets setup MODULE[:ATTR] (0.25.0)

Walk the missing secrets: ask for provider credentials part by part, generate the keys Piceli generates (prints only public keys), offer the user data and a backup

The owner runs it. An agent may run setup --yes --json with stdin closed to generate keys only (it never replaces a key, never answers a prompt); relay each copy public key to the owner

piceli secrets backup, piceli secrets backup-key, piceli secrets restore (0.25.0)

Write the whole local secret store, encrypted with age to at least two recipients, to a file (--only NAME: just those credentials, for one other machine such as a build host); create the offline age key (prints only its age1... recipient, writes the private key 0600); restore the store (into a used store only with --approve <digest>)

The owner runs them and chooses the recipients and the files. Never pass an identity as a recipient, never pass --single-recipient for the owner (on secrets-backup-single-recipient, suggest piceli secrets backup-key --out PATH --add); a restore plan (exit 3, read-only) is safe to show, approve it only after the owner reviewed what it replaces

piceli secrets nix-cache, piceli secrets s3, piceli secrets age, piceli secrets user-data (0.24.0), piceli secrets git-token, piceli secrets git-ssh-key (0.26.0)

Store a Nix cache’s signing key, a bucket’s S3 keys, a host’s age identity, a server’s user data or a Git token or deploy key a build host fetches private flake inputs with (--generate, --prompt, --file; 0600)

The owner runs them. Printing a public key (piceli secrets nix-cache NAME, piceli secrets age NAME, no flag) is read-only and safe; never read the credential files

piceli dev cache clear (0.19.0)

Empties the development builds’ cargo cache (every free lineage, one, or some crates); the next runs are cold

When a run reports cache.suspect or keeps failing on a cached artifact; prefer --lineage and --crate to clearing everything

piceli builder serve (0.21.0)

Runs on a build host: reads the builds the GitOps controller waits for, claims one, builds it in the builder image on that host’s container engine, pushes the images (and an OCI index) to the cluster registry through a port-forward and answers the controller; with --publish MODULE:ATTR (0.25.0) it also builds, signs and publishes the NixReleases that name it, with the cache keys of this machine (never sent); --publish-only (0.25.0) claims only those publishes, never an image build, and is implied on a host declared runs=False; --check (0.26.0) claims nothing and lists each release’s private flake inputs and whether this host holds their credentials (safe, read-only; 0.29.0: also git ls-remote of every source and a write test inside the builder container); --once --take-next (0.29.0) stands by for the next build and claims it before the in-cluster fallback (to test a host: start it, then piceli gitops build ENV); a host the composition no longer declares claims nothing and says so; 0.33.0: a host on another Piceli version than the controller claims nothing and exits 75 (builder-version-mismatch; --version-file PATH writes the controller’s version for its service to install): install that version, do not work around it

The owner’s go-ahead to serve that cluster from that host (and, with --publish, to sign with that cache’s key); the deploy or publish still needs its usual approval (auto_approve, or piceli gitops approve NAME <plan digest>). A failed build is answered as build-failed with its log tail: report it, do not retry blindly; see GitOps: Piceli’s controller and manifest export

piceli gitops build (0.26.0)

piceli gitops build NAME [--ref TAG|COMMIT] [--approve DIGEST]: Asks the controller to build a NixRelease (that ref; the newest without one) or an environment’s images now, recorded as triggered by cli with the requester

The owner’s go-ahead; the build still goes through the gate, plan and approval. --approve DIGEST is the owner’s approval: pass it only with the exact digest the owner approved

piceli gitops cancel (0.26.0)

Cancels a NixRelease’s or environment’s queued or running build (a build host stops at its next stage)

The owner’s go-ahead

piceli gitops rebuild (0.22.0)

Asks the controller to rebuild every deployed image a build host (or the builder node) built (--since: builds that ended later): it drops their cached builds and deploys each environment that runs one

The owner’s go-ahead after piceli gitops suspects --host NAME showed the images; the deploys still need each environment’s usual approval and checks

piceli gitops release-host (0.22.0)

Asks the controller to forget a build host’s or the builder node’s health events: it claims and builds again

Only when the owner says the machine is fixed or innocent (a memory test passed); never to get a build through

piceli dev release-host (0.22.0)

Clears a docker or native build host’s health events: dev run and builder serve use it again

Same as gitops release-host: the owner’s word that the machine is sound

piceli gitops cache clear (0.19.0)

Asks the controller to empty the cluster build cache (or some crates); the next release builds are cold

When a release build keeps failing on a cached artifact; prefer --crate

piceli dev cancel (0.18.0)

Deletes a queued or running development run’s Job

Your own runs only (the id dev run printed), when you no longer need the result; never another requester’s

piceli dev schedule (0.18.0)

Runs the development-run queue in your process: starts queued runs, records finished ones, deletes their Jobs

Only when the owner asked (a cluster without the GitOps controller, which runs the queue itself)

piceli gitops run

The controller loop itself (normally only inside its Deployment); deploys and tears down branch environments

Never run it yourself unless the owner asked for a local --once poll

piceli train-prune (0.26.0)

Removes a train’s leftover worktrees, cargo target directories unused for target_days or beyond targets_size, content-store records unused for store_days or beyond store_size and their bytes, and runs older than log_days beyond the newest keep_runs; never what a running trial holds. --dry-run removes nothing

Safe to run, with --dry-run first when unsure; the next train run rebuilds what went

piceli train-init (0.28.0)

Writes one new spec file (an existing one only with --force); reads the --from script, never runs it

Safe; review the TODO comments before committing the spec

piceli train (0.26.0)

Runs the train’s steps, the code of the merged branches, in worktrees under the train’s cache (removed after each trial; merge commits stay unreferenced; refs/piceli/train/<name>/last points at the head reached; logs and records go to the train’s state directory), here and on the build hosts Train(builds=, hosts=) names (as piceli dev run runs). A step with inputs that passed before is reused from the content store. With --promote: tags the head and moves tested and the base by fast-forward only, then runs the publish steps (a Step.images step builds the controller’s images, pushes them to the cluster’s registry and offers them to its controller). --promote-run RUN does the same for an earlier run’s head without running it. With --push (needs a promotion): pushes the tag, tested and the base. With --retire: renames each joined branch to_delete_<date>_<branch> once promoted (never deletes; a branch checked out with changes or that moved after it joined is left alone); --retire-remote (needs --push) also deletes it on the remote while it is at the joined commit

The owner names the branches; add --promote, --promote-run, --push, --retire and --retire-remote only when the owner asked for them. An ejected branch goes back to its author with the step and log the result names: never fix or merge it by hand. train-host-unavailable: check piceli dev hosts, do not edit the train’s hosts on your own. On train-busy, add --queue (same flags, --promote-run too) rather than retrying in a loop; it returns a queue id for piceli train-wait. piceli train-queue NAME --cancel ID only for a request you queued; --drain (runs queued requests) only when the owner asks

piceli deploy

Builds images, pushes them to a registry or node, applies a release

--approve <combined hash> from piceli deploy MODULE:ATTR --plan, after the owner reviewed that plan (or --apply <plan file> --approve <its hash> on another runner); --resume continues an approved run; --approve-if-policy only when the owner declared an auto_approve policy (see below)

piceli restore

Replaces every file of the restore point’s claims (stops their writers, then starts them again)

--approve <restore_hash> printed by piceli restore MODULE:ATTR --point ID without --approve, after the owner chose that restore point and agreed to lose what the claims hold now

piceli restore --to-new-claim

Creates one scratch claim per restored claim (same storage class and size, labelled piceli.io/scratch=true), restores into it, runs the app’s read-only restore_verify Job and deletes the scratch claims (kept only with --keep); live claims and writers are not touched

--approve <verify_hash> printed by piceli restore MODULE:ATTR --point ID --to-new-claim (or --all) without --approve, after the owner agreed to the storage it uses for the duration. Exit 1 with restore-verify-failed when a claim is FAIL; report each claim’s result, never try to fix the data

piceli deploy of a release that grows or moves a claim

The backup stage patches a claim’s size (class with expansion) or creates a new claim, copies the restore point into it and verifies it; the apply switches the workload; the old claim is kept

The combined hash, after the owner reviewed the plan’s claim_changes (each expand or migrate with sizes, class and new claim). Never delete the old claim (piceli.io/migrated-to) unless the owner asks; on claim-migration-required or claim-shrink-refused, report the code and the declaration it suggests, never change sizes or names on your own

piceli state import

Replaces the release’s state (local directory or the shared state in the namespace)

--approve <import digest> printed by piceli state import without --approve, after the owner agreed to replace the state

piceli release apply

The cluster

--approve <plan hash> from release plan, after the owner reviewed that plan; --approve-if-policy only with the owner’s [release] auto_approve

piceli release rollback

The cluster

--approve <plan hash> from release rollback <target> without --approve

piceli release resume

The cluster (continues an approved execution)

The owner’s go-ahead to continue

piceli release orphans

With --prune, the cluster (deletes leftover objects no release owns)

--approve <plan hash> printed by --prune without --approve, after the owner reviewed that exact list; --include-claims (data), --include-secrets, --include-other-owners and --include-cluster-scoped only when the owner asked for them

piceli release stop

Local journal (cancels an execution)

The owner’s go-ahead

piceli release check

Nothing by itself, but runs the spec’s checks (declared pod execs and Python functions)

The owner’s go-ahead for a spec you did not write

piceli artifacts deliver

A registry or node

--approve-digest <config digest>

piceli publish

A registry (the manifests as an OCI artifact, which something other than Piceli then applies, without Piceli’s plan)

--approve <artifact digest> printed by piceli publish without --approve, after the owner reviewed the files and the target; see GitOps: Piceli’s controller and manifest export

piceli bundle (only --helm --push)

A registry (the client chart, which a client then installs with Helm)

--approve <digest> printed by the same command without --approve, after the owner reviewed the chart, its version and the target; see Deliver to a cluster you never access

piceli chart publish

A registry (the Helm chart, which other people then install with Helm)

--approve <digest> printed by piceli chart publish without --approve, after the owner reviewed the chart, its version and the target; see Publish for other people’s clusters: a Helm chart and manifests

piceli artifacts build-spec run

Runs a build, writes outputs and images

--approve-builder <digest> and --approve-plan <hash> (a host-build.toml: --approve-plan only)

piceli artifacts publish

A hosted registry: images of every platform, their index, attestations, signatures, the version tag

--approve <digest> (printed without it)

piceli artifacts copy

Another registry: one image by digest, its index, every platform, its referrers (SBOM, provenance, signatures), the tag

--approve <digest> (printed without it)

piceli artifacts publish-files

A registry: the files as blobs, one artifact manifest, the tag

--approve <digest> (printed without it), after the owner reviewed the files, the target and the tag

piceli secrets signing-key (--generate, --file), piceli sign-file

Store a release signing key (0600); write FILE.sig next to each file

The owner runs --generate/--file; sign-file with the owner’s go-ahead for that release. Never read the credential file

piceli artifacts retention

With --delete, a registry: deletes the manifests no release, pin or live workload needs (blobs are freed by the registry’s garbage collection)

--approve <plan hash> printed by --delete without --approve, after the owner reviewed the exact deletion list; never a digest a running workload uses; see Registry retention

piceli artifacts execute-command

Runs a pinned tool

--approve-plan <hash>

piceli artifacts import-local

The local Docker image store

--approve-digest <digest>

piceli operator approve, piceli operator promote, piceli operator restore

Operator state, catalog or files

The owner’s go-ahead

piceli access (also piceli access BRANCH --pipeline MODULE:ATTR for a branch environment, on free local ports; piceli access ENV --cluster infra.py:CLUSTER [--ui] for a composition environment’s declared forwards and every other Service port on free local ports, with --ui also the in-cluster UI and its launch URL (show it only to the owner); piceli access ui --cluster MODULE:ATTR for the UI piceli cluster init installed, which prints one launch URL with its token: show it only to the owner), piceli logs -f, piceli ui serve, piceli ui connect, piceli observe serve, piceli operator serve, piceli observe forward-run, piceli observe forwards apply, piceli observe logs-run

Long-running local processes and ports

The owner’s go-ahead

piceli ui cluster-observe, piceli ui cluster-serve, piceli ui forward-serve (runs only in the pod piceli cluster init installs; its Sync button writes GitOps sync requests)

A long-running authenticated service in a named Kubernetes namespace; configured grants permit reviewed deployment and cluster build operations

The owner’s approval of the installation, target and grants

piceli access stop --stale

Stops Piceli’s own local processes for the app (a forward or dashboard the owner may still be using in another terminal), or with --cluster/--profile a stale piceli access ui forward; never another process

The owner’s go-ahead

Never add --auto-approve unless the owner has said that this run is an unattended CI job for this exact spec.

When the owner declared an approval policy

An owner may declare, in reviewed code, which plans may run without them approving the hash: Pipeline(..., auto_approve=ApprovalPolicy(allow={"create", "apply", "no-op"}, max_objects=10)) or [release] auto_approve = {...} (see Let a policy approve routine plans and Approval policy). Then piceli deploy MODULE:ATTR --approve-if-policy --json and piceli release apply --spec … --approve-if-policy run a plan only when every action is inside the policy ("approved_by": "policy" in the result).

  • Exit 3 with "reason": "approval-policy-exceeded": nothing ran. Show the owner the plan and policy.violations, and run the printed --approve <hash> command only after they approve it.

  • approval-policy-missing: there is no policy. Plan and ask as usual.

  • delete, replace and adopt are never inside a policy, and cluster-scoped objects and drift are outside unless the owner allowed them. A prune (a delete marked "prune": true: an object the release owns and no longer declares) is inside unless the policy denies prune or delete; claims, Secrets and retained objects are never pruned (listed as kept_orphaned, with the command deleting each: show it to the owner, never run it yourself).

  • Never add, edit or widen auto_approve yourself, never split a change to fit under max_objects, and never combine --approve-if-policy with --adopt, --replace, --rotate or --adopt-all-desired (refused). There is no flag that passes a policy: the policy is part of the plan hash.

  • The secret and exec rules below apply unchanged.

The approval workflow

  1. Run piceli release plan --spec release.toml. Keep the JSON from stdout.

  2. Show the owner the summary from stderr: every create, adopt, delete and drift line, the changed fields under each apply (all of them are in diffs in the JSON), and the adoption notes (a takeover removes fields other clients wrote). Point out every action with "cluster_scoped": true ([cluster-scoped] in the text): a ClusterRole or ClusterRoleBinding grants permissions across the whole cluster. A plan whose summary has only no-op changes nothing. autoscaled lists workloads whose spec.replicas an autoscaler owns: Piceli leaves that field to it (see compatibility), so do not propose editing replicas for them.

  3. Wait for the owner to approve that plan hash. A plan expires after approval_window_seconds; if it did, plan again and ask again.

  4. Run piceli release apply --spec release.toml --approve <hash>.

  5. Exit 0 means the release is ready and its [[checks]] passed. Exit 1 means it ran but is not ready. Report reason (check-failed, the failure category, or execution-not-ready) and execution.state. When release_state is checks-failed, report the failed checks and the rollback object; an automatic rollback has already run if the spec enables it. Offer piceli release rollback previous (which needs its own approval) only when no automatic rollback succeeded. Never add --skip-checks unless the owner asked for it (see Check a release and roll back automatically).

Deploying a pipeline

  1. Run piceli deploy MODULE:ATTR --plan --json. The last line is the result with combined_hash and every stage’s plan.

  2. Show the owner the stderr summary: which builds run, which images are delivered and which third-party images are mirrored (deliver  mirror …, stages.deliver.mirrors in the JSON), the registry’s adopt/replace lines when a live node-loopback registry is taken over (and whether its data is kept, stages.deliver.registry.existing), the release’s create/adopt/replace/apply/delete lines and the checks. While the images are not built or delivered, those lines come from stages.plan.preview, computed with placeholder images (approvable: false). A build with builder: host (stages.build.builds.<name>) runs its tools on this machine as the owner’s user, outside any container: say so, with the node_facts it compiles for. The combined hash then approves the build, the delivery and a release that adopts, replaces or deletes at most what the preview showed. Never pass the preview’s preview_hash to --approve (refused with pipeline-preview-not-approvable). If the owner wants to see the real release plan first, approve --until deliver, then plan again. A refused plan with "preview" and blocking means nothing was built: report each object’s suggest to the owner. For a pipeline it names the declaration (Pipeline(adopt=["Kind/name"]) or Pipeline(replace=["Kind/name"])); piceli deploy takes no --adopt/--replace. Never add adopt= or replace= to the pipeline yourself: the owner chooses (replace deletes and recreates the object).

  3. After the owner approves that combined hash, run piceli deploy MODULE:ATTR --approve <hash> --json. Each stdout line is one stage event; the last one is the result.

  4. Exit 0 means the release is ready and its checks passed. Exit 1 means a stage ran but did not succeed (reason names it; with rollback_on_failed_checks the result’s checks.rollback says what was restored). Exit 2 with pipeline-plan-changed means something changed since the plan: plan and ask again. Exit 2 with pipeline-preview-changed means the release plan computed after delivery adopts, replaces or deletes an object the approved preview did not show; nothing was applied: plan again (build and delivery are skipped), show the owner the real release plan and ask again.

  5. pipeline-registry-takeover-required means a registry already runs on the node. Never add adopt= or replace= to the pipeline yourself: tell the owner which Deployment holds the port and let them choose (adopt keeps it and its data in place; replace backs it up, deletes and recreates it). Registry credentials for mirror_credentials= are files the owner provides; never create, read or print them.

Deploying an environment. When the pipeline declares one target per environment, every deploy and release --spec MODULE:ATTR command needs --env NAME (environment-required otherwise). Plan, show and approve each environment separately: the combined hash covers the environment’s name and override values, so one environment’s hash never approves another (pipeline-plan-changed). Use exactly the approval command --plan prints (it repeats --env). Never choose the environment for the owner.

Deploying a commit. When the working tree is shared or dirty, or the owner asked for a specific commit, add --ref SOURCE=REV (or a bare --ref REV when all sources are one repository) to the --plan command. The result’s refs maps each source to the resolved SHA; show it to the owner with the plan. Approve with exactly the command --plan prints: it repeats --ref with the SHA, not the branch, so a branch that moved after the approval is refused (pipeline-plan-changed) instead of deployed. --resume takes no --ref (it reuses the run’s commits). With --ref, the pipeline module’s Python files must match the commit (deploy-ref-model-differs): report it, never commit or stash the owner’s changes yourself. In CI, the approval is a protected environment and the apply job passes the plan job’s combined_hash (see Deploy from CI with an approval step); an agent never approves that environment on the owner’s behalf.

Planning and applying on different machines. --plan --out FILE writes a plan file; piceli deploy --apply FILE --approve <combined hash> applies it anywhere (it plans again and refuses any difference: pipeline-plan-changed, deploy-plan-file-mismatch, deploy-plan-target-mismatch). Across runners the pipeline needs state="cluster" (see Share deployment state between runners); never switch a pipeline’s state yourself.

Shared state and the release lock. With state="cluster" every command takes the release lock. pipeline-locked (or release-locked) names the holder and expires_in: another deployer is running, so wait and retry; do not delete the piceli-lock-* Lease or any piceli-state-* Secret, ever. state-lock-lost means another runner took the lock over: run piceli state show, report it, and resume only when the owner agrees.

Operating a pipeline’s release

The release a pipeline deployed is operated with the ordinary piceli release commands, passing the pipeline as --spec MODULE:ATTR (for example piceli release status --spec deploy/app.py:pipeline). They use the same state directory, release name, target and composition as piceli deploy and never build. The approval rules above apply unchanged:

  1. piceli release status --spec MODULE:ATTR and piceli release secret show NAME --spec MODULE:ATTR --json (metadata only) need no approval. Never pass --reveal unless the owner asked for the value, and never log it.

  2. To roll back, run piceli release rollback previous --spec MODULE:ATTR (exit 3, prints the plan hash; the plan’s source is the recorded oci-set image set), show the owner the plan, and after approval run it again with --approve <hash>.

  3. plan/diff/apply with a pipeline refuse with pipeline-not-delivered when the current sources were not built and delivered yet: use piceli deploy instead. pipeline-locked means a piceli deploy of the same state directory (with shared state: of the same release, anywhere) is running: wait.

When something fails

  1. Read reason from the JSON.

  2. Run piceli explain <reason> --json. The entry has cause, fix and retry_safe.

  3. If retry_safe is true, re-run the same command once. Otherwise apply the fix (it names the flag or command) or report it to the owner.

  4. An unknown code (piceli explain exits 2 with unknown-error-code) should not happen for a conforms command: report the whole JSON object verbatim.

  5. apply-crashloop (pipeline-apply-crashloop from piceli deploy): a workload’s new pods cannot start, so the apply stopped at once. Read diagnosis.workloads[].causes[] (container, reason, exit_code, restarts, logs, events; texts are already redacted) and report them; stderr has one line per cause. Do not retry unchanged: the image, command, configuration or Secret must change first, or the owner rolls back (piceli release rollback previous, which needs approval). Later, piceli release status --spec … --run ID shows the same causes.

  6. prerollout-failed, prerollout-timeout, prerollout-not-startable (from piceli deploy, stage prerollout): a check Job with the new image and the workload’s real Secrets and mounts failed before apply, so the running pods are unchanged. Read stages.prerollout.output.checks[] in the run summary (kind config or upgrade, exit_code, category, log_tail, already scrubbed) and report it. Do not retry unchanged: the image, command or mounted object must change first. Never add or remove a pre_rollout declaration to get a release through: the owner decides. The check Job is deleted by Piceli; if piceli was killed, Jobs labelled piceli.io/pre-rollout expire after ten minutes and the next run removes them.

  7. access-port-conflict with conflicts[].holder piceli-forward or piceli-server: Piceli’s own process for this app holds the port (often a piceli access left running). Ask the owner before running the suggested piceli access stop --stale TARGET (for piceli access ui: piceli access stop --stale --cluster MODULE:ATTR). With holder other, report the pid; never stop another process.

  8. immutable-field-changed (a Job’s pod template, or a StatefulSet’s service name, pod management, selector or claim templates would change): do not add --replace yourself. Show the owner the blocking entry; replacing deletes and recreates the object (a Job runs again). Plan with the suggested --replace Kind/name only when the owner asks for it, and have them approve that plan’s hash.

Reading what a deploy did

Every piceli deploy run that executed writes <state_dir>/runs/<run id>/summary.json (schema docs/schemas/piceli-run-summary-v1.schema.json) and summary.md; the result line names them (summary.json, summary.markdown) and piceli runs MODULE:ATTR --json lists them, newest first. Read the JSON, not the Markdown: state, failure.stage, failure.reason (then piceli explain <reason> --json), failure.category and failed_checks, plan.classes and plan.changes[].fields (changed JSON pointers, never values), images (digests, sizes, blobs reused) and stages (timings). A summary never holds a secret value; post the Markdown as is (CI job summary, pull request comment).

Resuming interrupted work

  • release apply was interrupted (timeout, crash, lost connection): run piceli release status --spec release.toml, then piceli release resume --spec release.toml. Resume reuses the approved grant and operation ids; do not plan and apply a new release instead. It is safe at any point of the interruption: a write that never reached the cluster is sent again, one that did is not repeated.

  • A re-apply or release rollback was interrupted: these are not resumable (resume refuses with not-resumable). Run the same rollback (or plan/apply) again: it re-plans against the live state and needs the owner’s approval of the new plan hash. A rollback restores what the release declares, never data, external side effects or what other managers own (see “What a rollback restores” in plans_and_diffs).

  • piceli deploy was interrupted (or failed at a stage you then fixed): run piceli deploy MODULE:ATTR --resume. It continues the approved run at the first unfinished stage and reuses the finished stages’ receipts; an interrupted apply is resumed with the same grant. With state="cluster" this works from any runner, also when the first runner’s state directory is gone; a runner that died holds the lock until its lease expires.

  • artifacts deliver was interrupted: run it again with the same arguments. Registry pushes are content addressed and send only missing layers.

  • artifacts build-spec run was interrupted: run it again; outputs are published atomically.

Secrets

  • Never read or print secret values. Do not open the secret store in the release state_dir, and do not run kubectl get secret -o yaml or similar.

  • Plans, receipts and errors carry digests and pointers, never values; the plan written by release plan --out is redacted.

  • Pass registry credentials only as a file (--credentials, mode 0600), never on the command line or in logs.

  • External secret sources (sops, vault, aws-secrets-manager in [secrets.*], or Sops/Vault/AwsSecret in a pipeline) are configured by the owner. Never read, create, copy or configure their credentials yourself: no Vault token files or VAULT_TOKEN, no ~/.aws, AWS profiles or keys, no age/PGP keys or ~/.config/sops, and do not run sops, vault or aws to look at a value. plan reads the sources itself; when it refuses with secret-source-auth-failed, secret-source-tool-missing or secret-source-not-found, report the code and ask the owner. secret-source-timeout and secret-source-failed are safe to retry once. Do not use --rotate on an external source (refused with secret-rotation-refused): the owner rotates it at the source.

  • Error codes never contain secrets or private paths, so they are safe to report.

  • Never put a secret in a build’s smoke check (smoke.env, command, entrypoint): the smoke table is printed by preview and recorded in the receipt and the plan hash. Values that look like secret references are refused (smoke-env-secret). A smoke-output-mismatch excerpt appears on stderr and in the build log only; report the code and the unmatched streams, and quote the excerpt only if the owner asks.

Cluster access

Piceli’s release, observe, operator and artifact commands use only the kubeconfig file and context they are given (in the spec or with --kubeconfig/--context). They never read ~/.kube/config, KUBECONFIG or the current context: --context is required wherever --kubeconfig is accepted (observe, operator, artifacts deliver --via-forward), and a missing context is a usage error (exit 2), never a fallback to the file’s current-context. Do not change the kubeconfig or context an owner has set in a spec, and do not pick a context yourself: ask the owner which one to use. A credential profile (Target.profile("NAME", …), credentials = "NAME", --profile NAME) stands for the owner’s kubeconfig and context; use the profiles piceli profiles lists, never create one for a kubeconfig you found. profile-not-found means the owner has to run piceli login; --profile with --kubeconfig is profile-conflict.

An app with cluster_rules (typed RBAC, Describe an app in typed Python) needs a kubeconfig user that may list and write ClusterRoles and ClusterRoleBindings. When planning fails because that discovery is denied, report it to the owner; do not switch to a more privileged context yourself.

Never add or change allow_exec, exec_sha256 or exec_pass_env in a spec or in a pipeline’s Target, or pass --allow-exec/--exec-sha256, yourself: allowing an exec credential plugin runs a program with the owner’s cloud login (Connect to managed clusters (GKE, EKS, AKS)). On exec-auth-not-allowed, exec-pin-mismatch or auth-provider-refused, report the code and wait for the owner. exec-plugin-failed usually means the owner must log in again.