# Blotter operations

Run all first-party operations from the composed, runnable edition checkout
with `rer`. To get a runnable checkout, run `npx -y @runeditrun/rer dev just-every/run-blotter` (set up only: `npx -y @runeditrun/rer setup just-every/run-blotter`; without Node: `curl -fsSL https://runeditrun.com/install.sh | sh -s -- dev just-every/run-blotter`). Inside that checkout, `rer dev` alone launches it for review. The detailed flags and effects are in
`RUN-LOCALLY.md` and `SEED-COMMAND-CONTRACT.md`.

```sh
rer install
rer setup --owner-email you@example.com
rer dev
```

Use the setup prompt instead of the owner-email flag when entering the real
mailbox. Open the printed `RER_OPEN` link to sign in as the owner. Development
and demo mail is silently suppressed. Stop `dev` with
`rer dev --stop` or Ctrl-C, and stop `preview` with
`rer preview --stop` before build or verification.

```sh
rer verify
rer reset --yes
rer export --output exports/installation.rer
rer import --input exports/installation.rer --yes
rer deploy
rer describe
```

Use `rer describe` to inspect the checkout's actual
capabilities. `rer check --profile first-party` validates the
declared command contract; it does not run application journeys or contact a
provider.

## Local data and recovery

Setup and development use explicit owner identity and real local migrations.
Dev and preview use the same owner and canonical `.wrangler/state`. Local dev
sign-in uses the checkout’s private key; keep `RER_OPEN` private. Private
settings are kept in `.dev.vars` with mode 0600 and are not copied into build output.

Local export creates a private archive with an integrity receipt and explicit
exclusions. Blotter's archive policy is `src/blotter/archive-policy.mjs`: every
practice table (clients, templates, jobs, requests, files, reminders, time,
exports, proposals, imports, audit) is included; agent keys, client upload links,
owner/auth, outbox, bookkeeping, private settings and transient runtime state are
excluded. Blotter has no background jobs. Import validates and restores atomically
into an empty destination; confirmed reset preserves export archives. Run setup
after restore to establish a fresh owner. Each first-party seed verifies local
export/import/export equivalence across its supported resources. Remote transfer
is available only when the adapter declares complete resource coverage.

Preserve ambiguous state and applied migration history. Never place a remote
credential, owner secret or local resource ID in source. A schema change needs
a forward migration and verified transition/recovery.

## Deployment

`rer deploy --dry-run` validates the real owner-account
deployment declaration and builds locally without provider requests. Real
deployment requires privately supplied `CLOUDFLARE_ACCOUNT_ID` and
`CLOUDFLARE_API_TOKEN` and the declared owner/session/setup secrets.
`VAULT_KEY` is optional. With `MAIL_PROVIDER=none`, no sender or mail key is
needed, and the owner uses `rer signin` with the deployment's Cloudflare
credentials. To enable mail, supply a provider, its verified `MAIL_FROM`
and a private `MAIL_API_KEY`. Follow the owner-account deploy-kit
instructions under `node_modules/@runeditrun/rer/modules/deploy-kit`; account scope,
resource ownership, migrations, receipt and health checks are defined there.
Local validation does not prove hosted acceptance, provider delivery or remote
health.

## Hosted installation package

The source policy in `packaging.json` packages Blotter's real Worker build,
its DB binding and the unchanged SQL files in `./migrations/core/`.
Run `pnpm run build`, then `pnpm delivery:spec` after an intentional policy or
migration addition. Commit `management/integration/deployment-spec.json` with
that source change. `pnpm check:deployment-spec` checks freshness against the
real build and is part of the hosted verification operation.

The exported producer creates the artifact with
`node scripts/delivery/base/cli.mjs artifact --config packaging.json`.
A fresh package also emits the digest-bound setup manifest, project descriptor
and dispatch-only Managed workflow. Generated package and artifact directories
are disposable build output.

Hosted mail supports RER managed mail, Resend, SendGrid and Cloudflare Email
Sending. Assisted installations select their provider and supply its sender and
private API key through setup; Cloudflare also needs the account ID. Managed
installations receive their provider, sender, HTTPS relay URL and private
installation key from RER. Local development suppresses mail. Retain private
configuration outside source, and follow [Backup and restore](docs/backup-and-restore.md)
for practice recovery, the vault key and the latest erasure journal.
