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 |
|
What an error code means and what to do next |
|
The same, as pages |
|
An index of the documentation for language models |
|
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 ( |
|
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) |
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.renderprints 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.reasonis stable and explained bypiceli explain <code>;messageis for people and may change. Some commands add fields:releaserefusals keepblocking[](each item with its owncodeandmessage),inputsaddssource,observe forwards applyaddspreflight.A
MODULE:ATTRtarget whose module raises while importing or evaluating is a refusal like any other (render-target-invalidforrender,pipeline-load-failedfordeployandrelease --spec MODULE:ATTR,access-target-invalidforstatusandaccess,invalid-compositionfor arelease.tomlcomposition);messagenames the exception’s type and text, never a traceback. Report it;PICELI_DEBUG=1adds the traceback on stderr when the owner needs it.An operation that ran but did not succeed exits
1and its result names the code inreason:{"state": "failed", "reason": …}forrelease apply|rollback|resume,release check(check-failed) andartifacts build-spec run,{"state": "diffed", "reason": "release-changes-pending"}forrelease diff --exit-code,"state": "drift"forinputs verify, a receipt withstatefailed/rejectedforartifacts deliver.
Exit code |
Meaning |
What to do |
|---|---|---|
|
Success |
Continue. |
|
The operation ran but did not succeed (not ready, drift, build failed) |
Read the JSON result; do not retry blindly. |
|
Rejected before any change |
Read |
|
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) |
|---|---|---|
|
Refusal |
|
|
Refusal on stderr, |
Refusal on stdout, |
|
Refusal on stderr ( |
Refusal or failure object on stdout, with |
|
Usage errors, tracebacks, or |
Refusal on stdout with a code; |
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]andpiceli 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]andpiceli host wait TARGET REV [--timeout S] --json(0.24.0;TARGETisMODULE:ATTR, a host name with--infra MODULE, or an SSH target): read a Nix host agent’s status file over SSH (no cluster);waitexits 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) orhost-ssh-failed(the session broke after login), with SSH’s message and the host’sHostReportendpoint, 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 itspiceli loginprofile) 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] --jsonandpiceli train-wait RUN [--timeout S] --json(0.26.0): read a merge train’s state directory (never take its lock).trainsshows 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-waitblocks until a run (an id, or a train’s name) ends: exit 0 ok, 1 ejected, failed,train-interruptedortrain-wait-timeout; it prints the run’spiceli.train.summary.v1. Use it instead of polling.train-waitalso takes a queue id (q-…).piceli train-queue NAME --jsonlists 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 Candpiceli logout NAMEonly 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 (duin the registry pod when the kubelet’s figure is the node’s filesystem); changes nothing.piceli registry forwardonly opens a loopback port-forward to it.piceli infra status MODULE:ATTR [--json]: reads what the lastpiceli infracommands recorded for a declaredInfrastructure(servers, addresses, installs, cluster registrations, cost); no OpenTofu, no credential, no network.piceli infra plan MODULE:ATTRrunstofu plan(it refreshes from the provider’s API and writes the configuration into the state directory) and never changes a resource; show its plan andestimateto 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-dirfor a local controller): reads the controller’s health and each branch’s commit, state and pending plan hash; changes nothing. Its JSONsummary.<env>(0.17.0) is the compact view:state,commit,stage(while a step runs:build,prerollout,backup,plan,apply,checks),attempt,next_retry_atandlast_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 printsstate:deployed(exit 0),failedwithstageandcause,superseded(a newer revision replaced it),stoppedortimed-out(exit 1), orapproval-requiredwithplan_hash(exit 3: ask the owner). Controller retries are waited through. Read-only; end an integration round with it instead of pollinggitops statusyourself.piceli gitops enable infra.py --approve HASH --wait [--timeout 15m]andpiceli 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 (JSONwait.failure:env,reason,stage,detail,log_tail); 2: timeout (gitops-wait-timeout). 0.31.0:--machines MODULE[:ATTR]names the module declaring the host’sInfrastructurewhen the composition does not import it (--infrais--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 withgitops-canary-failed(JSONcanary.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]andpiceli gitops compare ENV [A] [B] [--json](0.38.0): the controller’s deployment history, read-only, as the UI’s Deployment history shows it.historylists each environment’s runs, newest first, withwindowandrelease_window(the time a release changed the cluster, the same as itspiceli.releasetelemetry marker);showis one run (--logs: the log tail it kept;--artifacts, 0.83.0: what it built,piceli.gitops-artifacts.v1: per component its digest, imagereference, platform digests and the layer of each file mapping);compareputs 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 itsrelease_window.piceli gitops suspects --host NAME [--since ISO] [--json]andpiceli 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’sstepsgive 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 asrelease status --run).piceli render: imports the model module and reads the spec; never contacts a cluster or reads secret values.piceli render MODULE:pipelinerenders aPipelinewith its target’s namespace and declared nodes, and build images as placeholders; it reads no kubeconfig.--env NAMErenders one environment;--env A --diff-env Bprints 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 DIRwrites one YAML file per object intoDIR(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: addallow_dns=True, and check the rendered policy withpiceli render(a bad CIDR, port or unknown workload isrender-target-invalid; see Describe an app in typed Python).piceli envs --pipeline MODULE:ATTR [--json](orPICELI_PIPELINE): lists every per-branch environment (branch, namespace, commit, build and deploy state, health, age, last push); read-only.piceli env up BRANCH --plan, andpiceli env up|down|seed BRANCHwithout--approve, only plan and print theenv_hash(exit3without--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 asbranch);piceli env up NAMEplans 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 (exit3); nothing is pushed.piceli chart render TARGET --out DIR,piceli chart package TARGET --out DIRandpiceli 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--approveprints the chart’s digest (exit3); 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-nameand--annotation-domainchoose the names its files show). A refusalbundle-unsafe-<rule>lists every violation; fix the model or, with the owner, declareapp.safety_exception(...). See Deliver to a cluster you never access. With--helmit 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--approveprints the chart’s digest (exit3); 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 Vwithout--approve: reads the build receipt and prints the publish plan and its digest (exit3); 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 TYPEwithout--approve: hashes the files and prints the plan and its digest (exit3); it contacts no registry.piceli artifacts fetch-file --from oci://… --digest sha256:… --out PATHdownloads 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:CLUSTERdoes the same for the in-cluster registry with everything derived from the Cluster (it also lists every stored manifest with a read-onlyfindin the registry pod). It changes nothing. See Registry retention.piceli codegen crd FILE(reads the file) andpiceli 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).--outwrites 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 planandpiceli release preview: read the cluster, store a pending plan and secret candidates in the spec’sstate_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 whatplanwould 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--pruneit changes nothing.--prunedeletes only after the owner approved the printedplan_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 everyreleasecommand it takes--spec release.tomlor--spec MODULE:ATTR(a pipeline; see Operating a pipeline’s release).--run ID(an execution id, or with a pipeline therun_idof its deploy result) shows one past execution with the causes recorded when it failed (diagnosis).piceli --version: printspiceli <version>(the JSON form is theversionfield ofpiceli help-json).piceli status TARGET --json: reads the release state, the cluster through the target’s explicit kubeconfig, and probes the declared forwards on127.0.0.1. It says whether the app is up (state) and how to reach it (access.forwards[].url); exit1means not up. See Reach your services from your laptop.piceli inputs recordandpiceli inputs verify: read git;record --outwrites the lock file.piceli artifacts preview,piceli artifacts inspect,piceli artifacts pin,piceli artifacts preview-command,piceli artifacts build-spec previewpiceli 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); exit1with"reason": "forward-unhealthy"when a required forward is down.piceli import live(reads the cluster through an explicit--kubeconfigand--context) andpiceli import yaml(reads local files): generate a typed module;--outwrites 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’sstate_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 theblockingobjects when the release would need adoption or replacement. With--ref SOURCE=REVit 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-onlyGETof the Node) and hashes the declared host tools; nothing runs.piceli deploy MODULE:ATTR --planof an app that declaresApp.pre_rollout(...)also lists theprerolloutstage: 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 withprerollout-mount-missingorprerollout-claim-exclusive(exit2) 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) andpiceli state export --spec … --out FILE(secret material left out; with--include-secretsonly encrypted with a key file the owner provides, never one you create).piceli artifacts build: assembles an OCI layout in--outputwithout running any code.piceli watch [MODULE:ATTR | --state-dir DIR] --json: follow a deploy run from its journal (snapshot,stage,progress,runevents, then aresult; schemadocs/schemas/piceli-watch-event-v1.schema.json); read-only and offline, so run it beside a deploy (another terminal) or after it. Exit0ready or stopped,1failed, interrupted, rolled back or--timeout(watch-timeout),2no 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’sbackupstage) with ids, claims, sizes and digests;--verifyreads every archive back (exit1when 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] --jsonandpiceli 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).doctorexits1withrunner-disk-low,runner-memory-loworrunner-tool-missingbefore a build would fail.piceli cache prune [MODULE:ATTR | --state-dir DIR]without--dry-rundeletes 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 configuredcache_budget=; show the--dry-runlist first otherwise.piceli heavy run [--name N] [--wait S] -- COMMAND...andpiceli heavy status --json: wrap heavy work (builds, test gates, kind clusters) inheavy runso 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), andheavy-lock-timeout(exit2) means the lock stayed held for--wait. SetPICELI_HEAVY_LOCK=1so 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 |
|---|---|---|
|
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 |
|
|
Deploys a branch into its namespace (creates it, labelled), stops the least recently pushed branch environment when |
|
|
Deletes a branch environment: its claims (data), its namespace and the volumes bound to them; never main’s |
|
|
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 |
|
|
Writes the ConfigMap |
|
|
Installs the GitOps controller: namespace |
|
|
Installs the in-cluster registry in |
|
|
Labels the declared nodes ( |
|
|
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 |
|
|
Runs the owner’s OS install command (for example |
|
|
Pins the server’s SSH host keys, reads its k3s kubeconfig and writes a local credential profile (and, with |
|
|
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 ( |
The owner runs them and types each part ( |
|
Creates or updates the Secret |
The owner runs it and types the token ( |
|
Creates or updates the Secret |
The owner runs it with their kubeconfig ( |
|
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 |
|
|
Deletes the controller’s objects (never an environment, the namespace or, without |
|
|
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 ( |
|
Asks the controller to deploy |
The owner’s go-ahead for that commit and environment; for |
|
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 |
|
Asks the controller to deploy an environment (or every one) now at its revision; with |
The owner’s go-ahead; the deploy still needs the environment’s usual approval ( |
|
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; |
|
Creates one Job in |
Approved once: the owner’s approval of |
|
Without |
Without |
|
Deletes manifests, narinfos and NAR files of commits other than the newest |
|
|
Renders a NixHost’s NixOS module (the host agent, its configuration, a service and timer) to stdout or |
Safe. Committing it and rebuilding the host is the owner’s decision; from then on the host follows its ref on its own |
|
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 |
|
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 |
|
|
Deletes a stored local credential ( |
The owner’s go-ahead for that name: without |
|
List every secret a declaration needs: state (present, pending, missing, incomplete, damaged, copy: a generated signing key whose public key goes into |
Read-only; safe to run and retry; never prints a value. |
|
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 |
|
Write the whole local secret store, encrypted with age to at least two recipients, to a file ( |
The owner runs them and chooses the recipients and the files. Never pass an identity as a recipient, never pass |
|
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 ( |
The owner runs them. Printing a public key ( |
|
Empties the development builds’ cargo cache (every free lineage, one, or some crates); the next runs are cold |
When a run reports |
|
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 |
The owner’s go-ahead to serve that cluster from that host (and, with |
|
|
The owner’s go-ahead; the build still goes through the gate, plan and approval. |
|
Cancels a NixRelease’s or environment’s queued or running build (a build host stops at its next stage) |
The owner’s go-ahead |
|
Asks the controller to rebuild every deployed image a build host (or the builder node) built ( |
The owner’s go-ahead after |
|
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 |
|
Clears a docker or native build host’s health events: |
Same as |
|
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 |
|
Deletes a queued or running development run’s Job |
Your own runs only (the id |
|
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) |
|
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 |
|
Removes a train’s leftover worktrees, cargo target directories unused for |
Safe to run, with |
|
Writes one new spec file (an existing one only with |
Safe; review the TODO comments before committing the spec |
|
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; |
The owner names the branches; add |
|
Builds images, pushes them to a registry or node, applies a release |
|
|
Replaces every file of the restore point’s claims (stops their writers, then starts them again) |
|
|
Creates one scratch claim per restored claim (same storage class and size, labelled |
|
|
The |
The combined hash, after the owner reviewed the plan’s |
|
Replaces the release’s state (local directory or the shared state in the namespace) |
|
|
The cluster |
|
|
The cluster |
|
|
The cluster (continues an approved execution) |
The owner’s go-ahead to continue |
|
With |
|
|
Local journal (cancels an execution) |
The owner’s go-ahead |
|
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 |
|
A registry or node |
|
|
A registry (the manifests as an OCI artifact, which something other than Piceli then applies, without Piceli’s plan) |
|
|
A registry (the client chart, which a client then installs with Helm) |
|
|
A registry (the Helm chart, which other people then install with Helm) |
|
|
Runs a build, writes outputs and images |
|
|
A hosted registry: images of every platform, their index, attestations, signatures, the version tag |
|
|
Another registry: one image by digest, its index, every platform, its referrers (SBOM, provenance, signatures), the tag |
|
|
A registry: the files as blobs, one artifact manifest, the tag |
|
|
Store a release signing key ( |
The owner runs |
|
With |
|
|
Runs a pinned tool |
|
|
The local Docker image store |
|
|
Operator state, catalog or files |
The owner’s go-ahead |
|
Long-running local processes and ports |
The owner’s go-ahead |
|
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 |
|
Stops Piceli’s own local processes for the app (a forward or dashboard the owner may still be using in another terminal), or with |
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
3with"reason": "approval-policy-exceeded": nothing ran. Show the owner the plan andpolicy.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,replaceandadoptare never inside a policy, and cluster-scoped objects and drift are outside unless the owner allowed them. Aprune(adeletemarked"prune": true: an object the release owns and no longer declares) is inside unless the policy deniespruneordelete; claims, Secrets and retained objects are never pruned (listed askept_orphaned, with the command deleting each: show it to the owner, never run it yourself).Never add, edit or widen
auto_approveyourself, never split a change to fit undermax_objects, and never combine--approve-if-policywith--adopt,--replace,--rotateor--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¶
Run
piceli release plan --spec release.toml. Keep the JSON from stdout.Show the owner the summary from stderr: every
create,adopt,deleteanddriftline, the changed fields under eachapply(all of them are indiffsin 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 whosesummaryhas onlyno-opchanges nothing.autoscaledlists workloads whosespec.replicasan autoscaler owns: Piceli leaves that field to it (see compatibility), so do not propose editingreplicasfor them.Wait for the owner to approve that plan hash. A plan expires after
approval_window_seconds; if it did, plan again and ask again.Run
piceli release apply --spec release.toml --approve <hash>.Exit
0means the release is ready and its[[checks]]passed. Exit1means it ran but is not ready. Reportreason(check-failed, the failure category, orexecution-not-ready) andexecution.state. Whenrelease_stateischecks-failed, report the failed checks and therollbackobject; an automatic rollback has already run if the spec enables it. Offerpiceli release rollback previous(which needs its own approval) only when no automatic rollback succeeded. Never add--skip-checksunless the owner asked for it (see Check a release and roll back automatically).
Deploying a pipeline¶
Run
piceli deploy MODULE:ATTR --plan --json. The last line is the result withcombined_hashand every stage’s plan.Show the owner the stderr summary: which builds run, which images are delivered and which third-party images are mirrored (
deliver mirror …,stages.deliver.mirrorsin the JSON), the registry’sadopt/replacelines when a live node-loopback registry is taken over (and whether its data is kept,stages.deliver.registry.existing), the release’screate/adopt/replace/apply/deletelines and the checks. While the images are not built or delivered, those lines come fromstages.plan.preview, computed with placeholder images (approvable: false). A build withbuilder: host(stages.build.builds.<name>) runs itstoolson this machine as the owner’s user, outside any container: say so, with thenode_factsit 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’spreview_hashto--approve(refused withpipeline-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"andblockingmeans nothing was built: report each object’ssuggestto the owner. For a pipeline it names the declaration (Pipeline(adopt=["Kind/name"])orPipeline(replace=["Kind/name"]));piceli deploytakes no--adopt/--replace. Never addadopt=orreplace=to the pipeline yourself: the owner chooses (replacedeletes and recreates the object).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.Exit
0means the release is ready and its checks passed. Exit1means a stage ran but did not succeed (reasonnames it; withrollback_on_failed_checksthe result’schecks.rollbacksays what was restored). Exit2withpipeline-plan-changedmeans something changed since the plan: plan and ask again. Exit2withpipeline-preview-changedmeans 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.pipeline-registry-takeover-requiredmeans a registry already runs on the node. Never addadopt=orreplace=to the pipeline yourself: tell the owner which Deployment holds the port and let them choose (adoptkeeps it and its data in place;replacebacks it up, deletes and recreates it). Registry credentials formirror_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:
piceli release status --spec MODULE:ATTRandpiceli release secret show NAME --spec MODULE:ATTR --json(metadata only) need no approval. Never pass--revealunless the owner asked for the value, and never log it.To roll back, run
piceli release rollback previous --spec MODULE:ATTR(exit3, prints the plan hash; the plan’ssourceis the recordedoci-setimage set), show the owner the plan, and after approval run it again with--approve <hash>.plan/diff/applywith a pipeline refuse withpipeline-not-deliveredwhen the current sources were not built and delivered yet: usepiceli deployinstead.pipeline-lockedmeans apiceli deployof the same state directory (with shared state: of the same release, anywhere) is running: wait.
When something fails¶
Read
reasonfrom the JSON.Run
piceli explain <reason> --json. The entry hascause,fixandretry_safe.If
retry_safeistrue, re-run the same command once. Otherwise apply thefix(it names the flag or command) or report it to the owner.An unknown code (
piceli explainexits2withunknown-error-code) should not happen for aconformscommand: report the whole JSON object verbatim.apply-crashloop(pipeline-apply-crashloopfrompiceli deploy): a workload’s new pods cannot start, so the apply stopped at once. Readdiagnosis.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 IDshows the same causes.prerollout-failed,prerollout-timeout,prerollout-not-startable(frompiceli deploy, stageprerollout): a check Job with the new image and the workload’s real Secrets and mounts failed beforeapply, so the running pods are unchanged. Readstages.prerollout.output.checks[]in the run summary (kindconfigorupgrade,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 apre_rolloutdeclaration to get a release through: the owner decides. The check Job is deleted by Piceli; ifpiceliwas killed, Jobs labelledpiceli.io/pre-rolloutexpire after ten minutes and the next run removes them.access-port-conflictwithconflicts[].holderpiceli-forwardorpiceli-server: Piceli’s own process for this app holds the port (often apiceli accessleft running). Ask the owner before running the suggestedpiceli access stop --stale TARGET(forpiceli access ui:piceli access stop --stale --cluster MODULE:ATTR). Withholderother, report the pid; never stop another process.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--replaceyourself. Show the owner theblockingentry; replacing deletes and recreates the object (a Job runs again). Plan with the suggested--replace Kind/nameonly 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 applywas interrupted (timeout, crash, lost connection): runpiceli release status --spec release.toml, thenpiceli 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 rollbackwas interrupted: these are not resumable (resumerefuses withnot-resumable). Run the samerollback(orplan/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 deploywas interrupted (or failed at a stage you then fixed): runpiceli 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. Withstate="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 deliverwas interrupted: run it again with the same arguments. Registry pushes are content addressed and send only missing layers.artifacts build-spec runwas 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 runkubectl get secret -o yamlor similar.Plans, receipts and errors carry digests and pointers, never values; the plan written by
release plan --outis redacted.Pass registry credentials only as a file (
--credentials, mode0600), never on the command line or in logs.External secret sources (
sops,vault,aws-secrets-managerin[secrets.*], orSops/Vault/AwsSecretin a pipeline) are configured by the owner. Never read, create, copy or configure their credentials yourself: no Vault token files orVAULT_TOKEN, no~/.aws, AWS profiles or keys, no age/PGP keys or~/.config/sops, and do not runsops,vaultorawsto look at a value.planreads the sources itself; when it refuses withsecret-source-auth-failed,secret-source-tool-missingorsecret-source-not-found, report the code and ask the owner.secret-source-timeoutandsecret-source-failedare safe to retry once. Do not use--rotateon an external source (refused withsecret-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 bypreviewand recorded in the receipt and the plan hash. Values that look like secret references are refused (smoke-env-secret). Asmoke-output-mismatchexcerpt appears on stderr and in the build log only; report the code and theunmatchedstreams, 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.