# Agent guide

This guide describes the Verulla agent interfaces currently available.

The CLI defaults to `https://api.verulla.app`; setting `VERULLA_API_URL` or
passing `--api-url` overrides that default.

## Hosts the CLI talks to

- `api.verulla.app`: the Control API, including device-flow configuration and CLI requests.
- `auth.verulla.com`: Verulla ID's OIDC device login opened by `verulla login` (the API provides the device and token endpoints).
- `pypi.org` and `files.pythonhosted.org`: package metadata and wheels fetched by `uvx` for the pinned CLI install. The CLI's local readiness checks use loopback (`127.0.0.1`); they are not remote service hosts.
- `verulla.com`: public starter files and this guide are downloaded here by the install quickstart (not by the CLI).
- Post-deploy HTTP checks: the agent's network must allow outbound HTTPS to `api.verulla.app` and the app host `<slug>.verulla.app` (allowlist pattern `*.verulla.app`). Without both, the deploy may succeed but an agent-side smoke test cannot reach the API or app.

Commands use the production API URL by default. When set,
`VERULLA_API_URL` overrides that default; an explicit `--api-url` takes
precedence over the environment variable.

## Quickstart

For a short first install, signup and deploy sequence, start at
[`/install`](/install). This document is the full guide and safety protocol.

## Deploying an existing app

Add a `verulla.yml` at the directory root. Choose the declared runtime (`fastapi`,
`node`, `static`, or `dockerfile`); list the function source directory and each
route your app should serve. A minimal FastAPI manifest looks like this:

```yaml
version: 1
app: my-app
functions:
  - name: web
    src: ./
    runtime: fastapi
routes:
  - path: /
    function: web
env:
  APP_MODE: production
```

A new free-trial app sets its own fixed limits. Do not include a per-function
`limits:` block in a free-trial manifest: the API rejects the deployment with HTTP
400 and CLI error:

```text
deploy failed (400): invalid manifest: Free-trial apps have fixed limits; user limits are not allowed
```

Fix it by removing `limits:` from the function; the platform supplies free-trial
limits. Paid Pro has a separate, entitlement-checked limits path; it is not
available until Pro activation is enabled in production.

### Free-trial Base database (when enabled)

If the platform has enabled its default-off per-app database feature, Control
creates an isolated PostgreSQL schema and app login for each free-trial app and
injects `VERULLA_DATABASE_URL` into that app at deployment. Do not set this
reserved variable yourself or put a database URL in a manifest. The free-trial
limit is 100 MiB. A platform size check runs every 30 seconds or less; writes
are revoked at or above the limit and restored after the database falls below
it. Expect writes to stop within about 30 seconds of passing the cap; reads,
deletes and truncates remain available to free space. At free-trial expiry database
login is disabled and data is retained. These semantics apply only after the
feature is enabled; until then use an external database.

Put non-secret settings in `env:`. Set sensitive values with the CLI's hidden
prompt, for example `verulla secrets set DB_URL --app my-app` (do not put secret
values in the manifest or command line).
The runtime exposes environment entries to the container and maps saved secrets
from the app Secret into environment variables. `PORT` is reserved and supplied
by Verulla: listen on `0.0.0.0:$PORT`. It defaults to `8080`; a Dockerfile
function can select another port with `port:` (see below). A process listening
on a different port from `PORT` will fail the startup/readiness health checks.
Checklist: keep persistent data out of the app filesystem; the root filesystem
is read-only, with only `/tmp` writable. `/tmp` is an ephemeral `emptyDir` and is
wiped on restart or reschedule. SQLite in `/tmp` is suitable only for throwaway
data; use an external database for durable state and pass its connection string
as an app secret. Do not write SQLite files into the app directory.

Manifest route paths are sent to the KEDA HTTP interceptor as path prefixes. A
`/` route therefore catches `/`, `/static/...`, and `/wines/{id}` at the edge;
your application must still implement those paths (the sample FastAPI app mounts
`/static` itself). Add narrower manifest routes only when they should target a
different function.

### Troubleshooting: deploy succeeded, smoke test cannot connect

First check the agent runner's outbound network policy. It needs HTTPS access to
`api.verulla.app` and the deployed app host under `*.verulla.app`. A blocked app
host prevents the post-deploy HTTP check but does not mean that the build or
deployment failed. Check the deployment receipt/status with
`verulla trial status APP`; do not redeploy only to work around a network
allowlist. Allow the two host patterns, then retry the HTTP check.

## Free-trial agent-to-owner protocol

Use this sequence only in an environment authorized by the person who will own
the app. It is the A1–A3 source-interface protocol; it is not an authorization
to create a public account, deploy a public app, or send an email.

1. Ask the human for the verified **owner email** they will use with Verulla ID
   and a tenant display name. Do not infer, reuse, log, or publish those values.
2. Create the tenant without a browser:

   ```sh
   verulla signup --owner-email OWNER_EMAIL --display-name DISPLAY_NAME
   ```

   The successful response contains a one-time claim URL. Keep it out of chat,
   logs, commits, screenshots, analytics, and public receipts. It is a
   one-time bearer capability, not a status field.

Signup does not require the owner to already have a Verulla ID. The owner email
is the identity used for the claim. When external owner provisioning is enabled,
Control creates a Verulla ID for a new email and sends that address one
initialization/invitation email; if the exact address already exists, this
signup path does not send another email. If sent, the owner—not the agent—must
open the message, authenticate and claim. Creating the ID is independently
configurable. In production today, owner claims are enabled but external
Verulla ID provisioning is off, so signup sends no invitation email; the owner
must sign in with a Verulla ID to claim. An API response with a claim URL is not
proof that an email was delivered.

3. From a copied starter directory containing `verulla.yml`, deploy and wait:

   ```sh
   verulla deploy . --wait
   ```

   On a nonzero result or timeout, inspect `verulla logs APP`; do not invent a
   URL, build log, or successful deploy.
4. After a successful deploy, privately deliver the public URL and claim URL
   to the verified owner through their authorized channel. The owner must open
   the link, authenticate, and complete the claim themselves. Do not claim the
   human’s account, impersonate them, or ask for their credentials.
5. Read the lifecycle receipt and persist the event cursor in the agent's own
   secure state:

   ```sh
   verulla trial status APP
   verulla trial events APP --cursor CURSOR
   ```

   Resume from `CURSOR` after restart. The durable event feed is authoritative,
   not an automated reminder scheduler; agent scheduling is only a convenience.
   Relay appropriate countdown information only to the verified owner and never
   include their email, credentials, or claim URL in that relay.

### Public install

Install the published CLI with the exact supported pin (Python >=3.12):

```sh
uvx --no-cache --isolated --from 'verulla-cli==0.0.8' verulla --help
```

The CLI depends on `verulla-manifest==0.0.4`. The published CLI includes the
signup and deploy interfaces described below. The MCP server is not published
as a package; follow the workspace setup in [`/mcp/README.md`](../mcp/README.md).
Do not advertise `npx verulla`, `uvx verulla-cli`, or an unpinned install.

The published `verulla-cli==0.0.8` provides `verulla pro` for upgrading an app
to paid Pro and `verulla trial status|events` for trial lifecycle inspection.
The prior `verulla live` and `verulla sketch` spellings remain working aliases.

## Agent payments (sandbox only)

Agent payment access is available only when the sandbox Control has
`VERULLA_AGENT_PAYMENTS_ENABLED=true`; it remains off in production. The
commands below are source interfaces for this implementation and are not in
published `verulla-cli==0.0.8`; package release is separate. Use
`verulla mandate status` to inspect the current key-bound mandate and funding
headroom. `verulla pay quote --amount-cents AMOUNT --currency USD` requests a
server-generated wallet-funding quote. Preserve the returned price-confirmation
object, then run `verulla pay execute QUOTE_ID --price-confirmation FILE
--confirm-price-cents AMOUNT --currency USD --idempotency-key UUID`. Reuse the
same idempotency key only for a retry of the identical quote request. The CLI
rejects a cents or currency mismatch before sending the request. `verulla pay status ATTEMPT_ID`
reads the redacted receipt/status. Never retry a pending or unknown attempt as a
new charge; poll status and let reconciliation resolve it. If the owner cancelled
Live or the account, the stable response is `owner_account_cancelled`; only the
owner may reactivate.

### 90-second terminal transcript

This no-account, no-browser transcript verifies the published CLI and downloads
the minimal starter from stable public routes. It reaches the A1 command boundary
without creating a tenant or deployment. Run it in a new directory with `uv`
and `curl` installed; the isolated tool directories stay inside that directory.
Network time varies, so treat 90 seconds as a target, not a deployment SLA.

```sh
mkdir -p "$HOME/verulla-sketch-quickstart" && cd "$HOME/verulla-sketch-quickstart"
export UV_TOOL_DIR="$PWD/.verulla-tools"
export UV_TOOL_BIN_DIR="$PWD/.verulla-bin"
uv tool install --no-cache --force verulla-cli==0.0.8
export PATH="$UV_TOOL_BIN_DIR:$PATH"
verulla --help
mkdir starter && cd starter
curl -fsS https://verulla.com/starter/verulla.yml -o verulla.yml
curl -fsS https://verulla.com/starter/main.py -o main.py
curl -fsS https://verulla.com/starter/requirements.txt -o requirements.txt
verulla signup --help
verulla deploy --help
verulla pro --help
verulla trial --help
```

The `signup` and `deploy` help commands are non-mutating. Do not run a real
signup or deployment unless the owner has authorized it and supplied their
verified owner email. Before that step, read the full protocol above and the
starter [README](/starter/).

## MCP server

The MCP server is in `mcp/`. Install the workspace package and configure the
MCP host to start `verulla-mcp` using stdio transport. Set these environment
variables in that host's environment:

- `VERULLA_API_URL`: Verulla control-plane base URL.
- `VERULLA_TOKEN`: bearer token for the Verulla API.

Both variables are required. The server exposes these tools:

- `list_apps`: list apps for the authenticated tenant.
- `app_status(app)`: get deployment status for an app.
- `app_logs(app)`: get latest deployment status and retained build-log tail.
- `sketch_events(app, cursor?, limit?)`: poll durable free-trial lifecycle events.
  Pass the returned `next_cursor` on the next call to resume after a restart.
- `set_secret(key, value, app?)`: set a tenant-wide secret when `app` is omitted,
  or an app-scoped secret when supplied. The tool does not return the secret
  value. API errors are redacted rather than passed through because their body
  could contain the value.
- `delete_app(app, confirm)`: delete an app only when `confirm` exactly matches
  the app name.
- `activate_app(app, confirm?)`: first call without `confirm` to receive a quote
  showing the published price in the wallet currency and spending-limit headroom; repeat with
  `confirm=true` to activate. Activation uses the control plane's idempotent
  `POST /v1/apps/{app}/activate` endpoint and requires the server-side
  `VERULLA_LIVE_ACTIVATION_ENABLED=true` feature flag.
- `owner_claim(app, owner_email)`: issue one first-owner claim for the app's
  tenant and return the one-time claim URL, its expiry, and the public app URL.
- `owner_status(app)`: read the safe claim state and expiry without returning
  the claim URL or owner email.
- `pro_status(app)`: read whether a Pro upgrade is currently available,
  the current 30-day price (`price_cents` and `currency`), spending-limit
  headroom, trial end time, and the documented `next_step` contract.
- `upgrade_to_pro(app, confirm_price_cents, currency, idempotency_key)`:
  activate Pro only after the owner explicitly approves the displayed price.
  Pass the exact price and currency from `pro_status`; a changed quote is
  rejected with `live_price_changed`, never silently charged at a new price.
  Cancelled Pro apps are rejected with `live_reactivation_unsupported` because
  Control may charge a new term at locked pricing; use the CLI's separately
  confirmed reactivation flow. Control returns `live_reactivation_unsupported`
  or `owner_account_cancelled` for agent activation attempts; the owner must
  reactivate this themselves. The quote uses the effective contract, including scheduled changes. The
  Control endpoint does not accept an approved price/version token, so MCP
  cannot make the read/check atomic with activation across a scheduled-price
  boundary; do not initiate an upgrade across that boundary, and reconfirm
  with the owner after it. Control may return `live_activation_unavailable`,
  `live_activation_disabled`, `spend_cap_required`, and wallet errors unchanged.
  Reusing the same idempotency key replays Control's saved receipt, including
  after the app becomes Pro.

See [`mcp/README.md`](../mcp/README.md) for the MCP package setup.

## Free-trial owner hand-off

After deploying the owner's app, ask the human owner for the email address they
will verify at `auth.verulla.com`, then run:

```sh
verulla owner claim APP --email OWNER_EMAIL
verulla owner status APP
```

`owner claim` returns the app URL, one claim URL, and its expiry. The URL is a
bearer capability: deliver it only to the intended owner over a private,
authorized channel. Do not put it in logs, prompts, viewer receipts, polling
events, analytics, or public messages. The CLI and MCP hand-off response omit
the API key and owner email; do not copy the email into ordinary receipts.
Claim URLs are shown only by the successful issuance response and cannot be
recovered by `owner status`. If you need a replacement, issue another claim;
the previous pending link is revoked and will no longer work. The owner must
open the link, sign in, and complete the verified-email claim flow themselves;
the agent must not claim the human's account.

MCP provides the matching `owner_claim(app, owner_email)` and `owner_status(app)`
tools. These commands require an API key authorized for owner claiming; the
backend may return its unavailable response while the owner-claim feature is
disabled. A claim is not evidence that email was delivered: do not promise an
email unless the configured delivery path has been independently verified.

<a id="keep-your-app-online"></a>
<a id="keep-your-app-online-pro"></a>
<a id="keep-your-app-online-live"></a>
## Keep your app online

A new app starts with a free 72-hour trial. When the trial expires, the app goes
offline; its data is kept for 14 days after it ends. Move the app to Pro, the
paid plan that keeps it online, before or after expiry with `verulla pro <app>`
(for example, `verulla pro my-app`; the angle-bracket form is a placeholder and
is not typed literally). The command displays the published 30-day Pro price in
your wallet currency and asks for confirmation before activation. Pro costs
**US$5 / C$7 per app per 30 days**.

Before upgrading, make sure the wallet has enough funds and the account has a
monthly spending limit:

1. Top up in the wallet currency, for example `verulla topup 1500 --currency
   USD` (or `CAD`). Complete payment for the top-up before continuing.
2. The account owner sets a monthly spending limit in the Verulla account
   console at <https://account.verulla.com/>. An authorized owner using an API
   key can set a US$50 monthly limit with:

   ```sh
   curl -X PUT "$VERULLA_API_URL/v1/wallet/cap" \
     -H "Authorization: Bearer $VERULLA_TOKEN" \
     -H "Content-Type: application/json" \
     -d '{"spend_cap_cents":5000}'
   ```

   The limit amount is in the wallet's currency. There is no CLI command to set
   the cap; `verulla spend` only displays current spend and headroom.
3. Run `verulla pro APP` and confirm the displayed price. The command uses the
   wallet currency and reports the current spending-limit headroom.

If the command returns an error, follow its stable code:

- `insufficient_wallet_funds`: top up the wallet with `verulla topup
  AMOUNT_CENTS --currency USD|CAD`, complete payment, and retry.
- `spend_cap_required`: ask the account owner to set a monthly spending limit
  in the account console, then retry.
- `spend_cap_exceeded`: ask the account owner to raise the monthly limit in
  the account console, then retry.
- `live_activation_disabled`: Pro upgrades are not available right now. Your
  app's data is kept for 14 days after the free trial ends; retry later. Do not
  change feature flags.

The API app status and the `sketch.reminder_6h`, `sketch.reminder_1h`, and
`sketch.expired` events include a `next_step` object. Its `available` value
reflects whether Pro upgrades are currently enabled. See
[`verulla pro`](#keep-your-app-online) for the exact command and prerequisites.

## Paid Pro activation

Run `verulla pro APP` to see the published 30-day price and current
spending-limit headroom in the wallet currency, then confirm before activation.
`verulla pro APP --yes` skips interactive confirmation. The CLI sends an
idempotency key to `POST /v1/apps/{app}/activate`; insufficient wallet funds and
spending-cap errors include next steps. If activation is temporarily disabled,
the command explains that and retains the app data for 14 days after the trial
ends. App status includes plan (`tier_id`), `paid_through`, `renewal_date`, and
`pricing_version`.

## Persistent app storage

Declare a paid persistent disk in `verulla.yml`:

```yaml
storage:
  path: /data
  size: 1Gi
```

The add-on is US$2.00 / CA$2.80 per GB-month, prorated by the exact seconds each PVC existed in the UTC billing month (a resize is prorated by the capacity in effect during each interval; final cents are rounded half-up once per PVC). A 1Gi PVC is billed at the 1 GB minimum for its lifetime; 3Gi bills 3 GB. No PVC means no charge. Tenant PVC requests are capped at 20Gi on free-trial apps and 100Gi on Pro/+Domain, including all apps. The path must be an absolute, normalized path outside system and platform-reserved paths; size is `1Gi` through `100Gi`. Storage is per routed function and is mounted read-write at the declared path. It uses replicated `openebs-jiva` storage, is limited to one replica with a Recreate rollout, and survives redeploys and scale-to-zero. The app's normal deletion lifecycle removes its PVCs; expired free-trial apps remain retained/offline until their lifecycle deletion, after which the disk is deleted. Storage is not backed up by Verulla. The container root filesystem remains read-only: write only under `/tmp` or the declared storage path. The billing rollout flag is default-off until storage billing is activated.

## Wallet, currency, pricing and usage

Read `GET /v1/wallet` and `GET /v1/wallet/spend` for balances, ledger and
spending-limit headroom. Both responses include `currency`; ledger entries,
usage (`GET /v1/usage`), top-up intents and cap updates also identify their
currency. Money remains integer minor units. Existing `*_usd_cents` fields in
`GET /pricing.json` keep their USD meaning; CAD prices and rates are additive
fields and the `currencies` map contains each currency's minimum and rates.

Create a top-up with `POST /v1/wallet/topups`, for example
`{"amount_cents":1500,"currency":"CAD"}`. Omit `currency` only for a legacy
USD request. The first funded top-up fixes the wallet currency; every later
top-up must match it. A mismatch returns HTTP 409 with a machine-readable
`detail.code` (`wallet_currency_mismatch`) and a message explaining that
currency is immutable after funding. Do not total or convert USD and CAD.

The CLI provides `verulla wallet`, `verulla spend`, `verulla usage [app]`,
`verulla usage --month YYYY-MM` (legacy calendar-month view), `verulla pricing`, and `verulla topup AMOUNT_CENTS --currency USD|CAD`.
`verulla usage` reads the gated Pro term usage contract, including per-dimension
allowances and percentages, projected term-end cost, explicit wallet currency,
and calendar-month spend-limit headroom. The calendar-month compatibility route
remains `GET /v1/usage`; the gated term contract is `GET /v1/usage/term?app=APP`
(omit `app` for all Pro apps). It is available when
`VERULLA_USAGE_TERM_METERS_ENABLED` is enabled on the control plane. The account
console additionally requires its default-off
`VERULLA_ACCOUNT_CONSOLE_USAGE_METERS` gate before it requests or renders those
meters. The MCP tools `wallet_summary`, `spend_summary`, `usage_summary`, `usage(app?)`, `pricing`, and `create_topup`
expose the same API contract. CAD wallets and currency-aware operations are
available: the production release sets `VERULLA_MULTI_CURRENCY_ENABLED="true"`.

## Additional Pro features not yet available in production

- Pro term usage meters: `VERULLA_USAGE_TERM_METERS_ENABLED` is not enabled in
  the production release. The CLI's term-meter view is gated; the legacy
  calendar-month `GET /v1/usage` remains distinct.
- Customer-management API operations: the production release does not enable
  customer management (`customer_management_enabled`); customer CLI/MCP
  commands are unavailable until enabled.
- A published MCP install: `verulla-mcp` is a workspace package, not a package
  published for `uvx`/PyPI. Use the repository workspace instructions in
  [`mcp/README.md`](../mcp/README.md).

## Authentication policy and customer management

Use `verulla auth show APP` to read an app's policy and its current version.
Update it with `verulla auth set APP policy.json`. Without `--version`, the CLI
warns and fetches the latest policy version before sending a version-checked
update. For stale-update rejection against the version you reviewed, pass the
version shown by `auth show` explicitly: `verulla auth set APP policy.json
--version N`. The policy shape and allowed values are
published at [`/AuthPolicy.schema.json`](../app/static/AuthPolicy.schema.json).
Policy changes require `auth:write`; reads require `auth:read`.

Customer tools use the separate `auth:customers` scope:

- `verulla customers list APP [--search TEXT] [--limit N] [--offset N]`
- `verulla customers lock APP CUSTOMER_ID` / `unlock APP CUSTOMER_ID`
- `verulla customers delete APP CUSTOMER_ID` (asks for confirmation; `--yes` skips it)
- `verulla customers export APP --output customers.csv` (contains customer PII)
- `verulla customers invite APP EMAIL`

MCP provides `auth_show`, `auth_set`, `customers_list`, `customers_lock`,
`customers_unlock`, `customers_delete`, `customers_export`, and
`customers_invite`. The customer-management backend is not enabled in production,
so these customer operations are unavailable there. Invite delivery can remain
logging-only until the email provider is configured. Google sign-in remains
Coming soon.

## Hosted Verulla ID login

An app's host selects its Verulla ID realm. The hosted pages are served on that
app's host:

- `GET /_verulla/id/login` shows the sign-in form; its form submits to
  `POST /_verulla/id/login`.
- `GET /_verulla/id/signup` shows account creation; its form submits to
  `POST /_verulla/id/signup`.
- Successful login and signup set the HttpOnly `verulla_id_session` cookie and
  redirect to the requested `next` path (or `/`).
- `POST /_verulla/id/logout` clears that cookie and redirects to `/`. It
  requires a same-origin request.
- `GET /_verulla/id/v1/session` checks the session cookie. It returns
  `{"authenticated": false}` when absent or invalid, and when valid returns
  `authenticated`, `sub`, and `email`.

Logout clears the browser cookie; it does not revoke an already issued JWT.
That token remains valid to a verifier until its expiry.

Tenant functions receive these platform-managed variables when hosted ID is enabled:

- `VERULLA_ID_ISSUER`: the public issuer URL for the app's realm.
- `VERULLA_ID_INTERNAL_URL`: the in-cluster control-plane issuer path, reachable without opening tenant internet egress.
- `VERULLA_ID_HOST`: the app's public hostname, used as the `Host` header so the control plane resolves the correct realm.
- `VERULLA_ID_ACCEPTED_ISSUERS`: optional JSON array of public issuer URLs for approved platform/custom hosts; omitted while custom domains are disabled.
- `VERULLA_ID_AUDIENCE`: the app audience used when verifying identity tokens.

The sample app's `GET /whoami` checks the session by calling
`${VERULLA_ID_INTERNAL_URL}/v1/session`, forwarding the `verulla_id_session`
cookie and the incoming `Host` only when it is in
`VERULLA_ID_ACCEPTED_ISSUERS`. That JSON issuer list contains the platform and
currently serving custom-host issuers when custom domains are enabled; the
binding is omitted when the default-off `custom_domains_enabled` flag is off.
Unknown hosts are rejected without forwarding the cookie. Session cookies are
host-only, so after moving between the platform and custom host, customers sign
in again on the destination host; the app's user pool, audience, and signing
keys remain shared, while each host issues tokens under its distinct issuer.
The sample returns the user's `sub` and `email` when authenticated, or an
unauthenticated result with a login path otherwise. If the internal URL is
unavailable, clients may fall back to the approved host's matching public
`/v1/session` endpoint; do not weaken tenant egress policies to make
the public endpoint reachable. Surface upstream failures rather than treating
them as anonymous sessions without diagnostic information.

## Dockerfile app listen port

For `runtime: dockerfile`, set `port:` on that function when its container listens
on a port other than 8080. The value must be 1–65535; if omitted, Verulla uses
8080. Verulla injects the selected value as `PORT` and uses it for the container
port, Service target, and startup/readiness probes. The application must bind to
that port and be reachable inside the container. When `EXPOSE` is present in the
Dockerfile, it must include the effective port; a mismatch fails before build
and reports the suggested `port:` value. An omitted `EXPOSE` is allowed.

```yaml
functions:
  - name: web
    runtime: dockerfile
    port: 8000
```

## Deploy and wait for the free-trial hand-off

`verulla deploy` submits a deployment and returns immediately. Use `--wait` when the agent must confirm that the deployed app's runtime health is ready before handing the URL to the owner:

```sh
verulla deploy ./my-app --wait
```

The CLI polls the created deployment ID through the authenticated deployment endpoint, so another deployment cannot satisfy this wait accidentally. Waiting is bounded to 600 seconds by default. Set `--wait-timeout SECONDS` (1–3600) when needed. On success, the CLI prints the public URL, exact expiry returned by the free-trial lifecycle API, owner-claim status, the free 72-hour/no-custom-domain limits, and the next status command. If runtime health fails, the CLI exits nonzero and reports the available crash cause with a port hint; inspect retained build output with `verulla logs APP` when needed. Runtime/pod logs are not available; a missing build-log tail is reported rather than replaced with a fabricated log link. A timeout also exits nonzero and leaves the deployment available for status inspection.

Share the public URL with the verified owner; do not claim the owner's account for them. Run `verulla trial status APP` to inspect the current expiry and claim status. `--wait` relies on the authenticated deployment-status and free-trial status APIs.

## Custom domains and DNS-01 certificates

For a paid Pro app, claim a custom hostname with `verulla domains add APP HOST`.
The command and API return the exact records to publish. For every hostname in a primary/`www` pair:

- For a hostname below the zone apex (such as `www.example.com`), add a CNAME
  pointing to `domains.verulla.app` so traffic reaches Verulla. For a zone
  apex (such as `example.com`), add a provider-flattened ALIAS/ANAME record—or
  enable CNAME flattening—pointing to `domains.verulla.app`; ordinary CNAME
  records are not valid at a zone apex.
- Add the returned TXT value at `_verulla-challenge.H` to prove you control the
  hostname. Keep it until verification succeeds.
- Add the returned CNAME at `_acme-challenge.H` pointing to the unique
  `<stable-id>.acme.verulla.app` target. This delegates certificate validation
  to Verulla; keep it in place so cert-manager can renew the certificate.

Do not substitute one record for another: the host CNAME or provider-flattened
apex record routes web traffic, the TXT record proves domain ownership, and
the `_acme-challenge` CNAME delegates ACME DNS-01 validation. Check current instructions with `verulla domains status
APP`; request/retry validation with `verulla domains verify APP HOST`. The API
returns the same values in `dns_instructions`, including the record type, name,
target/value, and purpose. Certificate activation waits until the expected
challenge CNAME resolves to the stable target stored for that domain.

## Deployment logs

Run `verulla logs APP` to display the latest deployment's app name,
deployment ID, status, error, and retained build-log tail. The command also
accepts an optional function argument, reserved for runtime logs; runtime/pod
logs are not available yet. The API endpoint is
`GET /v1/apps/{app}/logs` and requires API authentication. It returns the latest
deployment status and retained build-log tail, not runtime logs.

## Free-trial countdown events

Poll `GET /v1/apps/{app}/events` (CLI: `verulla trial events APP`, MCP:
`sketch_events`) with the returned `next_cursor` to resume after a restart.
Events are tenant-scoped and contain redacted lifecycle milestone details; the
milestone types are `sketch.reminder_48h`, `sketch.reminder_24h`,
`sketch.reminder_6h`, `sketch.reminder_1h`, and `sketch.expired` (T0). The
T+14 `sketch.retention_ended` milestone is deliberately not part of this T3
feed. Persist the latest cursor with your agent's own state
and poll again after reconnecting. Agents may schedule owner reminders as a
convenience, but this event feed is not the scheduler or source of truth: the
platform durably records milestones even while agents are offline. Relay only
appropriate event information to the owner; never expose internal credentials
or claim links.
