Skip to content
Sign in

iii-cloud

v0.1.0

Take any project to iii cloud from your harness — sign in, check the cloud plan and run the app here the way the cloud runs it, keep secret values out of the agent's context, merge and deploy pinned to the plan you saw, and follow the deploy to Ready.

license: Apache-2.0clouddeployiii-cloudonboardingreadiness

Install

bash
iii call compose::add worker=iii-cloud@0.1.0

Run in your project with the iii engine running. Exact versions are immutable and digest-pinned.

skill doc

SKILL.md

iii-cloud

iii-cloud gives you what you cannot do alone: a credential for iii cloud that never enters your context, iii cloud's plan for a commit, a local run of the app in the cloud's order, and the person's deploy followed until it is Ready.

The person works with you in chat and on the iii cloud page in the console. Open the page beside the chat with ade::workspace::open and screen: "ext:iii-cloud". iii-cloud/plan-codes lists every problem code. Load iii://iii-cloud/onboarding only when the work starts from nothing (sign-in, import, first worktree).

When to Use

  • The person asks to put a project on iii cloud, or to make it ready for iii cloud.
  • A plan problem, a failed deployment or a "will this work in the cloud?" question.
  • You replaced a literal credential with ${NAME} in the compose file and need its value: ask with iii-cloud::secret, never in the chat. Any other value is asked for by the page.
  • The person asks you to watch a deployment, or how to deploy.
  • The person asks you to roll back, cancel a deployment or retry one (Proposing a rollback, a cancel or a retry).
  • A question about an app already in iii cloud: health, logs, what is live, why a deploy failed or expired, another project on this machine (Reading what runs), or a change only the person or the console makes (Where the person does it, Not possible from here).

Boundaries

  • Secret values never pass through you. Never ask for one in chat, never read a .env, never put one in a command. The page asks for variables' and secrets' values. iii-cloud::secret is only for a literal credential you replaced with ${NAME}: it opens a request on the page, and you only see whether it was saved.
  • An empty string is a value. Before you write ${NAME:-}, read how the app parses that name: if it is parsed as a number or a boolean, or validated, the app starts with "" and exits. Give it the app's own default (${NAME:-8}, ${NAME:-false}), or leave the variable out of the compose file; keep ${NAME:-} only for a name the app reads as an optional string.
  • run.log_tail is the last 40 lines of a run; the whole redacted log of a run comes from iii-cloud::check::read ({id, log: {from_line, lines}}, 400 lines a call); a file the worker kept of a run's changes (run.restored / run.moved) from {id, left: "<path>"} (a value there that came from a variable reads [redacted:NAME]). run.log_path is for the person's screen: do not read paths yourself. Never change a command to print the environment (env, printenv, set) or to write a connection string or a secret to a file or the log; never leave debug commits in the branch.
  • Stage your changes by file (git add <file>, a file, never a folder): never git add -A, git add . or git commit -a; the local run's data is not yours to commit.
  • Never print or store a token or an API key.
  • iii cloud's GitHub App is read-only. Pull requests use the person's own gh login.
  • Only the person deploys, approves a deployment, merges the pull request, rolls back, cancels, retries, or writes variables, secrets or environment settings. They do it on the page. Your job ends when check {run: true} passes on the commit: tell the person to review and deploy on the page (the "Merge and deploy…" button for production, "Deploy <commit> to <env>" for any other environment, or "Confirm deploy" for a deployment that waits). Never call iii-cloud::deploy, never run gh pr merge, never approve, never write variables or settings, not even with raw HTTP or gh, even when asked.
  • Work in the worktree iii-cloud::project::use made, not in the person's checkout.
  • Push only your fix branch (worktree.branch of the brief), with git push --force-with-lease -u origin HEAD from the worktree. Never push a branch an environment deploys from: the person's deploy pushes it.
  • Ready is not proof. The local run does not cover the cloud's build container, production's secret values, its machine size or real traffic. Say so.
  • A key connects one environment. It cannot import, change settings or set variables. Those need browser sign-in, and the person does them.

Functions

  • iii-cloud::connect — sign in with the browser (the person types a code) or with an API key saved in the vault: {method: "api_key", secret}.
  • iii-cloud::status — the stored state: connection, project, latest check, run, secrets, pull request and deployments. It is big (tens of thousands of characters): never read it to get a hand-off.
  • iii-cloud::project::resolve — read the local folder and find its project and environment in iii cloud.
  • iii-cloud::project::use — select the environment and prepare a worktree. from: "checkout" starts it at the person's own branch merged with the environment's (never for production); source takes another branch of checkout.branches. A fix branch iii-cloud/ready-<env> from an earlier worktree is resumed with its commits; only a name the person has checked out gets -2.
  • iii-cloud::api — read any iii cloud route as the person (GET only). Any other method is PERSON_ONLY: the person makes the change on the page.
  • iii-cloud::check — iii cloud's plan for a commit plus the checks on this machine. run: true also does the local run and waits for it (up to 240 s). manifest checks another worker-compose*.yaml instead of the environment's; on a hand-off its file is the default. push: true pushes your fix branch first. force: true runs again when a passed run of the same commit exists. from_page is the page's own flag for a check the person started: never send it (a check you or a subagent start must not wake the hand-off's agent).
  • iii-cloud::check::get — {id}: one kept check as recorded; nothing runs again.
  • iii-cloud::secret — only for a literal credential you replaced with ${NAME} in the compose file (LITERAL_CREDENTIAL): ask the person on the page for that ONE name's value, or mark it as not needed. Every other value is asked for by the page. Never for a decision, a worker, a group or a setting: those go in the harness::ask card.
  • iii-cloud::values — {manifest?, from?}: every name the compose file reads, whether iii cloud has it, secret or variable, and where a value can come from. Names and flags only. The person sets them in Secrets and variables on the page.
  • iii-cloud::propose — {action: "rollback" | "cancel" | "retry", environment_id, deployment_id}: prepare a rollback, a cancel or a retry for the person to confirm. It only reads and changes nothing; the chat draws a card from its answer and the person confirms there, on the page (Proposing a rollback, a cancel or a retry).
  • iii-cloud::watch — follow a deployment to Ready and bring back the evidence when it fails.
  • iii-cloud::handoff::brief — {handoff_id}: what you need for a hand-off (below).
  • iii-cloud::handoff::progress — {handoff_id, working_on, note?}: tell the page which problems you are working on.
  • iii-cloud::handoff::worktree — {handoff_id}: your own worktree {path, branch, base, created, merged_from, conflict}. conflict says what to merge first.
  • The page's, denied to you or never yours: iii-cloud::handoff, handoff::stop, deploy, api::write, secret::provide, values::save, values::skip, problem::skip, config::import, override::choose, project::create, project::create_environment, on-change (you only observe it), on-config-change, ui-content.

Reading what runs

Questions about an app that is already in iii cloud ("is production healthy?", "show me yesterday's errors", "why did #19 expire?") are answered with iii-cloud::api {method: "GET", path, query?}. Never put ? in path: the filters go in query. The ids come from iii-cloud::status: project.team.id, project.environments (id, name, branch) and, for the other projects on this machine, recent_projects (team_id, cloud_project_id, environment_id). Read another project by its own path; never project::use it to look: that switches the page the person is on.

E is /teams/{team}/environments/{env}; P is /teams/{team}/projects/{project}.

Question GET What to read
What serves it, which deploys E/deployments current: true serves; status, status_detail ("Replaced by #19"), commit, triggered_by; numbers are project-wide
One deployment E/deployments/{id} stages (name, status, times), error
Are the workers up E/health status, workers[] (ready, restarts, crashloop), events[] (restarts, engine restarts)
Machines E/machines groups[] (workers, size, replicas), limits
Did it scale E/machines/scale-events events[] (at, group, from, to, reason), newest first
Logs E/logs query: level (this and above: debug, info, warn, error), source (build, provisioning, release, engine, worker), worker, deployment_id, since/until (ISO), q (text), trace_id or span_id (one request's lines), cursor; 1,000 lines a page
How noisy, over time E/logs/histogram buckets[] of error/warn/info per step_seconds (7 days)
Why the branch can't deploy E/plan can_deploy; plan.issues[] with severity: block, location (file, line), context.message; plan.source (branch, commit, compose file)
What the branch has E/commits the branch's latest commits
Database, state, storage E/resources kind, alias, status, tier, used_by (the workers)
Its address E and E/domains the environment; domains[] (hostname, status)
What changed in its configuration E/config/versions, then E/config/versions/{number}/diff versions[] (number, status good/failed/pending, deployment_id, applied_by, applied_at, restarts), newest first; the diff's changes[] (worker, key, before, after) against the version before, or query: {against}
Variables E/variables names, type (variable, secret, builtin), status; a secret's value is never there
Who did what P/activity entries[] (type, summary, actor, environment_id, at), newest first
The project's environments P/environments id, name, production, branch, manifest
Deleted projects /teams/{team}/deletions what can be restored, until when
Who is on the team, who can deploy /teams/{team}/members members[] (user, role), invitations[], roles[], and matrix[] (each action with what each role may do)

A failed deployment: iii-cloud::watch brings the evidence, and E/logs with its deployment_id the lines. iii cloud's own diagnosis (GET …/deployments/{id}/diagnoses, diagnosis.diagnosis.result of kind likely_cause) is a lead, not proof: check it against the log before you say it. Null means none yet; ASSISTANT_NOT_AVAILABLE means the team's assistant is off. Say what the data says, with times and numbers; never guess a cause the logs don't show. Give times in the person's local time (the machine's time zone), not UTC. A route that answers BROWSER_SESSION_ONLY is the console's only: say so, with the console link, and don't call it again.

"It's down" or "it errors". In this order, and stop when one explains it:

  1. E/health: workers not ready, restarts, crashloop, and the events.
  2. E/logs/histogram: when the errors started.
  3. E/logs with level: warn from just before that time (or since the live deployment's created_at): the first lines that went wrong.
  4. E/deployments and E/config/versions: did a deploy or a configuration change land when it started? If so, say which, and that the person can "Roll back" to the deploy before it (Where the person does it).

"What is on dev and not in production?" The current: true deployment of each environment gives the commit each serves. E/commits of the environment that is ahead lists its branch's commits: the ones above the other's commit are the difference. When the other environment serves nothing yet, compare with the head of its branch (its own E/commits) and list the commits anyway. When the list doesn't reach it, git log <behind>..<ahead> in the person's folder answers.

Where the person does it

Every change is the person's. Name the place:

They want to Where
Deploy The environment's Next card: "Deploy <commit> to <env>"; production: "Merge and deploy…" on the Deploy screen
Approve a held deployment "Review it" on the Next card, then "Confirm deploy"
Cancel a deployment You call iii-cloud::propose {action: "cancel"}; the card's "Review and cancel" opens the deployment's screen with the dialog. Also "Cancel deployment #N" there ("Watch" in the list)
Roll back You call iii-cloud::propose {action: "rollback"}; the card's "Review and roll back" opens the dialog. Also "Roll back" in the environment's Deployments list, on the deploy that was live before
Retry a failed deployment You call iii-cloud::propose {action: "retry"}; the card's "Review and retry" opens the dialog. Also "Retry #N" on the environment's Next card
Set a variable or a secret "Secrets and variables", under the environment's deployments
Open another project or environment Home (the first crumb of the path) or the project selector at the top of the sidebar
Add a project "Add a project" on Home; never call iii-cloud::project::create
Add an environment "New environment" in the sidebar (Owners and Admins, signed in with the browser), with its compose file and branch; never call iii-cloud::project::create_environment: it is the person's choice and denied to you

Proposing a rollback, a cancel or a retry

When the person asks to roll back, cancel a deployment or retry one, read what is there (E/deployments, E/health) to name the right deployment, then call iii-cloud::propose {action, environment_id, deployment_id}. It only reads (GET) and changes nothing in iii cloud; the chat shows a card with what comes back and what stays, and the person confirms with "Review and roll back" (or "cancel", "retry"). You never do.

  • Say the confirmation is waiting on the card. Never say it was done: you don't know until the person confirms, and api::write stays denied to you.
  • A refusal has a code and a message for the person (ALREADY_LIVE, NOT_A_ROLLBACK_TARGET, NOT_RUNNING, NOT_RETRYABLE): repeat it, name what is true instead, and don't try another way.
  • Retry only when the failure is not the code's (a timed-out image pull, a provider outage, a flaky resource). If the code or the config caused it, a retry fails the same way: the way out is to fix it (a hand-off), not to propose a retry.
  • Roll back to a deployment that was live (ready or replaced), never the one serving now. Cancel only a deployment that runs or is held.

Not possible from here

These are in iii cloud's console, not on the page and not through you. Say so and always give the environment's own link, never the console's home: from iii-cloud::status, connection.cloud_url + / + project.team.slug + / + project.cloud_project.slug + / + the environment's name (for example https://cloud.iii.dev/acme/shop-2/dev).

  • Restart, stop or resize machines, and scaling. The page restarts only the groups a changed variable needs, as the person.
  • Add or check a domain.
  • Delete an environment or a project; restore a deleted one.
  • Team members and roles, billing.
  • Connect to the managed Postgres from this machine: it is reachable only inside iii cloud (shared-rw.postgres.svc), and its 1-hour login comes only from the console. Never ask for its URL or password.

Databases

Never ask the person for a database URL. iii cloud provides a managed Postgres, with pgvector. When the app reads DATABASE_URL (or any database URL) from the environment:

  1. Add the database worker (package://database, latest version) to the production compose file, with a database resource of alias primary.
  2. Set DATABASE_URL: ${DATABASE_PRIMARY_URL} in the app's container. Another alias <alias> gives DATABASE_<ALIAS>_URL.
  3. Do not call iii-cloud::secret for it: it refuses with DATABASE_FROM_CLOUD. Only when the person wants an outside database, call it with external: true.

iii cloud creates the Postgres when the person confirms the deploy; the local run starts its own with pgvector. DATABASE_NOT_MANAGED is this rule.

Hand-off from the page

The page posts a chat message with the marker line iii-cloud hand-off <id8> and Details: iii-cloud::handoff::brief · skill iii://iii-cloud. Your first call is iii-cloud::handoff::brief {handoff_id}, never status.

The brief holds kind (ready, deploy_fix, import or pull_request), worktree {path, branch}, base {branch, sha} (the environment's branch when the worktree was made; earlier tries are not your work), manifest, other_compose_files, pushes_directly, checkout_path, agent_problems (yours) and person_problems (the person's; each with id, code, owner, severity, title, detail, file, line, fix), run_failure {stage, code, message, log_tail} (null unless your latest run failed), deploy (the failed deployment's stage, code, hint and log tail) and next_step.

A message that starts iii-cloud hand-off <id8> · continue comes from the page, not from the person: your turn ended with agent-owned problems left. Answer it by fixing, not by summarizing.

Several compose files

Each iii cloud environment has one manifest. Only that file is checked, run and deployed: read it in the brief and fix problems there. When the person picked another worker-compose*.yaml on the page, the brief names it and your check calls with handoff_id use it. The environment switches to it only when the person confirms the deploy. Never change the environment's compose file yourself.

For shared changes (the SDK version, worker versions, a new worker such as database), also apply them to other_compose_files when they clearly describe the same app, for example a dev file. Say so in the pull request body. Never change a file of another app.

Fix loop

  1. iii-cloud::handoff::brief {handoff_id}.
  2. Work only in worktree.path. When it is the person's folder (its path is checkout_path, or its branch is not iii-cloud/ready-*), call iii-cloud::handoff::worktree {handoff_id} first and use the path it answers. Its branch starts at the base: never reset it onto another branch, never gh pr reopen, never cherry-pick commits you did not make, never edit a vendored binary (fix the compose file). OLD_ATTEMPT_COMMITS: follow its fix.
  3. ONE shell::exec that prints what the brief does not carry: the compose file, the manifests of the workers it names, and git status --short. Not one call per file.
  4. Post a plan in chat: 2 to 4 lines, the groups in order, quick compose and config fixes first, app code last.
  5. Per group: iii-cloud::handoff::progress {handoff_id, working_on: [<problem ids>], note} first. Fix the whole group, commit, push, then iii-cloud::check {handoff_id} once for the group (fast, no run). The cloud plans exactly the pushed commit, so its answer is the truth: never guess a field or commit a "try X" change; read the message and fix what it names.
  6. App code (SDK_TOO_OLD, a migration to a new SDK API) and compose work together: start ONE subagent with harness::spawn for the app code (profile cloud-ready, same worktree, a brief listing the files it owns: src/**, package.json, the lockfile, Dockerfile, and "commit only your files, don't touch compose files"). Tell the person it can take a while. You fix the compose files meanwhile; wake on its finish with harness::observe.
  7. Only for production (an assisted environment has no pull request): before the first push, gh pr list --head <fix branch> --state all. CLOSED or MERGED: make a NEW pull request at the end. OPEN from an earlier try: say so in one line; your push updates it.
  8. When the plan is clean, iii-cloud::check {handoff_id, run: true}. It waits for the local run (up to 240 s). A run of the same environment with the same inputs (commit, compose file, values, settings) already going: it attaches to that run. Any other run of this workspace: it replaces it, and that one ends RUN_REPLACED. A passed run of the same inputs is reused (run.reused); force: true runs again. If the answer has run.waiting_on, the local run is still going but no new worker has connected for a minute. waiting_on.containers are the ones it waits for, and run.log_tail has their last lines. Read the log, fix the cause, commit and check again: the new commit replaces the run. Do not wait for it to fail; it keeps waiting up to the compose file's startup_timeout, as the cloud does.
  9. A run that outlives the call: wake on it, never sleep. Filter on that run's id and terminal, with an expiry near the run's own timeout (run_timeout_s, 900 s by default):
{"function_id": "iii-cloud::on-change",
 "filters": {"input.kind": {"$eq": "run"}, "input.id": {"$eq": "<run id>"},
             "input.terminal": {"$eq": true}},
 "lifecycle": {"expires_in_ms": 900000}}
  1. Done when check.ready is true and check {run: true} passed for the current commit. Then it depends on the environment. Production (pushes_directly false): from the worktree, gh pr create --head <fix branch> --base <env branch> with a plain body (problems fixed, other compose files touched, no secrets), iii-cloud::status {refresh: true} so the page shows it, and tell the person the link and the "Merge and deploy…" button. Any other environment (pushes_directly true): no pull request, never gh pr create; it gets an assisted deploy. Tell the person to deploy on the page ("Deploy <commit> to <env>"); the page sends the checked commit to the environment's own branch. Its first assisted deploy creates iii-cloud/<env> and never pushes the default branch.
  2. A follow-up with the hand-off marker while you work: finish the current group, then do it.

Ask the person only for person items that are not values. A secret never goes through chat. Give each tool call a description: a plain sentence of what you do now. The page shows it live.

How a turn ends

Only three ways:

  • Ready: check.ready and a passed run on the current commit.
  • ONE harness::ask that lists every blocking person-owned item (a WEB_* choice, a decision; never a variable or secret), the recommended option first. Read the code first and say what each default does. A decision that picks where or how you fix goes in the first card, before any edit. When the person answers, continue in the same turn.
  • An armed wake (harness::observe) on a run, a child agent or a deployment.
  • Only values are missing: say in one sentence that the page waits for values on its values row. Never list them.

Never a plain text that says what is left. With agent-owned problems left, keep working.

Names and shapes agents get wrong

  • shell::exec {command, args, cwd}: command is the program alone, args a string array, cwd inside the worktree. No cd, no arguments in command. When rg is missing, use grep. Example: {command: "git", args: ["status", "--short"], cwd: "<worktree>"}.
  • There is no ide::exec. Asking the person is harness::ask, with ::.
  • Stay inside the worktree. WRONG_WORKTREE: you left it; go back.
  • Pass handoff_id exactly as handoff::brief returns it.
  • SIGN_IN_REQUIRED: tell the person to sign in on the page. NO_COMMITS: commit first.

Errors

A call fails with a coded error:

  • NOT_CONNECTED, NO_PROJECT, NOT_READY, PLAN_CHANGED, MAIN_MOVED, PR_HEAD_CHANGED, SOURCE_CHANGED, PR_NOT_MERGEABLE: the state is old or missing; fix it and call again.
  • PERSON_ONLY: the person changes it on the page.
  • BROWSER_SESSION_ONLY: only iii cloud's console does it; give the person the console link (Not possible from here).
  • NOT_SAVED: a secret went nowhere (an API key without cloud write, or a tracked .env). Tell the person to set it in the console.
  • PUSH_REFUSED: check {push: true} pushes only your fix branch, or GitHub refused. MERGE_CONFLICT: the person's commits conflict with the environment's branch, so use {from: "checkout"} left the worktree at the environment's head: in the worktree, git merge <their branch>, resolve the files the message lists, commit, check again. MERGE_IN_PROGRESS: finish the merge (commit). WORKTREE_PATH_TAKEN: the fix branch is checked out elsewhere; tell the person.
  • RUN_PANIC, RUN_REPLACED, WORKER_RESTARTED, and the stage codes of a failed local run: iii-cloud/plan-codes.
  • WORKTREE_FAILED: read the message. IDEMPOTENCY_KEY_REUSED: use a new key. DEVICE_CODE_EXPIRED: connect again. ACCOUNT_BLOCKED: tell the person.

When secret::provide answers local: "skipped", nothing was written to the .env: git tracks it, or the cloud took the value and the compose file does not read ${NAME}. Tell the person to set the value another way.

Observing events

Observe iii-cloud::on-change to be woken when something finishes, instead of polling. Use it when a call outlives its answer: a run, a secret the person is typing, a sign-in, a deployment on its way to Ready. Filter on input.kind (run, deploy, secret, connection), input.terminal and, for one run or deployment, input.id. The event shape: get function info on iii-cloud::on-change.

A deployment replaced by iii-cloud's own confirmed deployment is not the end. When someone else's deployment replaces yours, the event is terminal with outcome: "replaced" and replaced_by: observe that id. A needs_action event carries the push's deployment id, not yours, so filter on input.record.status instead of input.id: tell the person to confirm it on the page ("Confirm deploy"). It works only when the deployment's plan matches the ready check.

Search the registry

Find workers, kits and executables, or jump to a page.