crewship seed
Replaces the oldprisma/seed.ts script. Creates a demo environment — admin user, workspace, connected crews, agents with system prompts, credentials, integrations, routines, Pages, and executable issues — entirely through the REST API so business logic (validation, encryption, audit logging) is exercised end-to-end.
The content is one fictional small business — Harbor Goods — told as four connected business stories, each run by one crew with local sample data and no third-party accounts: Sales (a customer inquiry waiting 26 hours), Finance (an overdue invoice among matched payments), Marketing (a contact-form submission that never arrived) and Shipping (a late parcel inside its claim window). Each story ships a TODO Issue, a Page and three routines — a deterministic check, an optional AI draft and a resolution that waits for a human before it saves anything. Crewship Lab adds real workspace telemetry and a bounded live container monitor. Every story can be run again and checked with crewship seed verify. The legacy external-source demo packs are no longer installed (see the demo packs guide), and synthetic model-regression routines stay out of the product demo (--with-evals).
demo@crewship.ai) itself. On an existing database, it requires authentication (run crewship login first) and a selected workspace.
The server target must be explicit; seed does not infer it from .env.local,
the working directory or an active default profile. Export a provider credential
or pass a supported Codex login before running a functional demo. Use
--offline-demo for an explicit control-plane fixture without model execution.
The server may still build crew images automatically when their configuration
is created; this option suppresses seed’s explicit provisioning requests and
automatic model runs, rather than disabling the server’s image build queue.
Bootstrap credentials are stored in a profile for the target server; unrelated
default selections are preserved.
Flags
Seed Codex agents with a ChatGPT login
SetSEED_CODEX_AUTH_FILE to the absolute path of a Codex auth.json created
by codex login. Keep the file outside the checkout with mode 0600. To leave
.env.local untouched, pass the path for one CLI invocation — as an env
prefix or as the --codex-auth-file flag, which overrides the variable:
./dev.sh seed runs, put only the path in .env.local, never
the JSON or one of its tokens. ./dev.sh seed loads .env.local and passes
the path to the CLI:
PROVIDER_LOGIN in subscription mode, grants it to the nine
seeded agents, configures those agents for CODEX_CLI, and uses an OpenAI
login requirement and Codex model override in the model-backed routines.
Crewship renders a per-agent auth.json with a placeholder refresh token at
run time; the original refresh token stays in the server’s credential store.
Without SEED_CODEX_AUTH_FILE, the original Anthropic seed behavior applies.
An existing routine with the same slug is retained on re-seed, so use a fresh
demo workspace when changing its provider. An existing seeded agent is updated
to Codex when the path is set. The path must be readable by the user running
the seed; it is never sent to Crewship, only the file content is sent through
the authenticated credential API.
Examples
Business story issues
The Sales, Finance, Marketing and Shipping projects each hold one prepared Issue, bound to its story’s check routine and starting TODO. The intended loop is check → understand the finding → optionally draft → decide → inspect the receipt: the check publishes real script output to the story’s Page and comments on the Issue;Draft with AI is optional and
separately visible; resolving waits for a human, and an approved completion
saves a local outbox receipt and moves the Issue to DONE. Keeping a case open
leaves it TODO.
The Crewship Lab project adds Inspect live crew CPU and memory: the
collector reads real container CPU and memory per crew through a
workspace-scoped sidecar read, and unavailable measurements stay unknown. Its
live monitor Page samples real container memory every five seconds for at most
15 minutes and stops on request.
No story contacts a real customer, carrier or provider: Finance completion
records a reminder, not a payment; Shipping completion records claim evidence,
not a paid refund; Marketing simulates local delivery only.
The demo’s Inbox items have different sources: a story check completion
writes a
message to the triggering user, the Sales, Finance and Shipping
resolutions park a waitpoint approval, and scripts/demo/run.sh chat-reply-inbox verifies a fourth path: an agent’s saved Chat reply becomes
a message under Agent replies when the recipient is not watching that chat
live. A missing integration does not currently create a dedicated
integration-kind Inbox item; the demo must not present one as real.
First run on a fresh dev DB
~/.crewship/cli-config.yaml, so any follow-up command picks up the demo session.
Reset and reseed
seed --nuke is an alias for crewship nuke all — the full teardown: DB entities plus inbox items, escalations, and each crew’s docker container(s)+volumes. Cached devcontainer images are preserved, so the reseed reuses them instead of forcing a rebuild. Use the nuke subcommands directly when you want to clear just one thing (e.g. crewship nuke inbox --kind failed_run to drop failed-run spam without touching data).
Wipes the active workspace’s contents first, then seeds. Two guards:
- Auth before nuke — the auth step runs before
--nuke, so a typo in--serveror a stale token fails before anything is deleted (it can’t trash a different workspace). - Typed-slug confirmation —
--nukeprints a blast-radius summary (workspace, server, crew/agent counts) and requires you to type the workspace slug exactly before it proceeds. This is the guard against an accidental wipe of the intended workspace.
--yes to skip the prompt:
--nuke refuses to run unless --yes is given — it never wipes unattended on a guessed confirmation.
CI-friendly run that waits
pnpm test:e2e after this lands.
Skip the issue phase for a faster crew-only seed
--skip-issues halves wall-clock time for crew-development work.
Backup self-test (CI guardrail)
--wait-provision. Picks the first crew that successfully started provisioning, runs a backup/restore round-trip via the admin self-test endpoint, and fails the command if the canary doesn’t verify. Use as a CI guard for the backup pipeline.
crewship seed verify
Runs the four local business stories end to end against the live workspace and checks what they produced: delivered files, check routines, Page provenance, Issue assignment and Inbox notifications. No AI credential is needed — the verifier drives the same scripts and the same public API as the Pages. This is the acceptance test for the seed: a story is only worth shipping if it can be run again tomorrow and be shown to be right.
For each story the default mode reports one row per step:
With
--complete-demo, each story additionally resolves and approves the local
demo action, then verifies the resolution outcome, the outcome and
resolved-records Page panels, the Issue moving to DONE, and the local
evidence: shared/demo/business/outbox/<story>.json must match its story and
Issue, carry the proposed text and the local demo only delivery label, and
include the source finding it was built from.
Exit status is 1 when any check fails; with --strict, when any is skipped
too. --format json (or yaml / ndjson, the same object) prints the rows
under checks plus the passed / failed / skipped / strict totals for
a script to read; the progress lines stay on stderr.
COUNTS: reconciliation, cited-path fact-checks).
Its independent read takes the first of SEED_GITHUB_TOKEN, GH_TOKEN,
GITHUB_TOKEN set in the verifier’s own environment; only SEED_GITHUB_TOKEN
satisfies a pack’s env gate.
Seed phases (in order)
The async-by-default model means a plain
crewship seed returns quickly (~seconds for the API mutations) while crew containers warm up in the background. Pair with crewship crew provision status <slug> to check on individual crews.
What the seeded chat surface shows
A fresh workspace is meant to demonstrate the chat features, not ship them switched off, so every one of the nine default agents arrives pre-configured with the same three suggested questions, worded for its role — what the role does in this demo, the sample records and the next action, and what happened in the latest routine run:Investigate a missing inquiry is the seeded ask form:
the submission ID, the expected destination, what happened, and an optional
screenshot — four fields across three field types, including the photo
upload, on the agent whose story is a contact form that lost a delivery.
Preview it without a browser:
crewship agent update <slug> --suggested-prompts/--ask-forms, or the agent’s config tab.
The definitions live in cmd/crewship/seeddata/builtin/agents.yaml and
cmd/crewship/seeddata/askforms/*.json; the seed’s own tests validate every
form against internal/askforms before it can ship, so an invalid one is a red
go test rather than a 400 mid-seed.
POST /api/v1/agents does not model suggested_prompts or ask_forms — a
create carrying them returns 201 and drops them. The seed therefore issues one
follow-up PATCH per agent that has either, which is also how the manifest
importer handles it (crewship apply). The PATCH runs on a re-seed too, so an
existing demo workspace picks the values up on the next crewship seed.Common errors
bootstrap request failed (is the server running at http://localhost:8080?)— the server didn’t answer. Start it withcrewship startand retry.- **
DB already initialized. not logged in — run \crewship login` first** — the database has a user but the CLI has no token. Log in (or usecrewship admin reset-password` if you’ve lost UI access). --test-backup requested, but no crew successfully started provisioning— every crew failed to trigger provisioning. The seed wasn’t going to be useful anyway; the explicit error is so CI doesn’t go green on a broken pipeline.demo file delivery: …— fatal. The story scripts and fixtures must land on the crews’ shared volumes before provisioning (while the host can still write the tree); a demo without them has only broken buttons.demo routines: …/demo seed incomplete: N starter routines failed— fatal. A routine definition that cannot be saved leaves broken Page actions behind, so the seed aborts instead of finishing around it.
See also
crewship init— minimal admin-only bootstrap if you don’t want demo data.crewship setup— interactive template picker for a single-crew workspace.crewship crew—crewship crew provision status <slug>for checking background builds.crewship apply— declarative manifest as a longer-term alternative to seed.
crewship seed team-chat
Add the same Chat demonstration to an existing workspace without running the full crew/routine seed or changing its owner:create_only provisioning in its OpenAPI schema.
Account setup uses owner provisioning and its setup token, without signup or
email delivery. Existing accounts without locally owned state are rejected;
changed roles or passwords are never overwritten. Owner profile and permissions
remain unchanged. A rerun preserves personalized demo names/avatars and uses
stable message IDs, avoiding duplicate messages or DMs.
The private state directory is isolated by server and workspace, with mode 0700
and an atomically written 0600 JSON file. It contains generated passwords; keep
it outside Git. JSON output includes only account IDs, roles, room IDs and the
protected file path. Concurrent seeds fail on an exclusive state lock. After an
interrupted process, inspect the reported lock before removing it. A lost initial
provision or channel-creation response fails closed rather than claiming an
unrelated account/room. Successfully configured accounts are recovered only by
normal login; missing workspace membership can then be restored without a
password reset.
./dev.sh seed includes this Chat pack by default. The direct crewship seed
command keeps the flag opt-in; legacy --with-users remains the separate four-
account RBAC fixture.
Fresh account setup and login respect the server’s auth rate limit. On 429,
only these auth requests retry, using the server’s Retry-After (up to one minute
per wait, at most three attempts). A normal six-person seed can therefore pause
for about a minute. Cancellation stops the wait. Other writes are not silently
replayed.