mix harness.onboard (client_utils v0.1.35)
View SourceTake the working copy this runs in from checkout to ready.
mix harness.onboard [PATH] [--check] [--relay-model-turns] [--deploy-key KEY]Writes the settings an agent session needs — the harness id its MCP mount addresses with, and the test partition its databases are named after — sets the git config the copy needs, and then names the databases it still wants without creating any of them.
--deploy-key, and why a copy needs one
A deploy key reaches exactly one project — deliberately, so a harness on one
project does not inherit everything its owner can do — while one harness serves
every checkout it has a subtree for. A daemon holding a single key from its
environment can therefore only join one project: a second project's copy
connects its socket, has every join refused, and every hook in it answers
"channel down, server answering 200" while the harness's own /health says
connected, because that is about the socket.
So the key is recorded in the copy's own .cms_harness.json, beside the
identity it authenticates and where the harness already walks up to find it.
Git ignores that file and it is written 0600.
Taken from --deploy-key, or from CMS_DEPLOY_KEY when the flag is absent.
Get it from <server>/app/projects/<project-id>/edit — Generate fills the
field, Save is what stores the hash, so a key copied without saving matches
nothing.
Omitting it is fine and never blanks a key already recorded. A sprite, whose daemon holds its one project's key in the environment, needs nothing here.
--relay-model-turns is opt-in, and defaults off
Passing --relay-model-turns also writes ANTHROPIC_BASE_URL, routing every
model turn through the harness's Anthropic proxy instead of straight to
Anthropic. That proxy only understands /v1/messages — no other route it
forwards — so setting this on an interactive session silently makes anything
else the Claude Code client needs unavailable, /remote-control included,
with no error anywhere to say why. Leave it off unless something specific
reads the recorded turns (an observability UI, a sprite).
Why this lives here
A generated application depends on client_utils and not on CodeMySpec, so this
is the only place a single command can onboard both. CodeMySpec's own
mix cms.harness.onboard calls the same code with its own filesystem adapter
and adds what only it needs — minting an id against the server, and addressing
the agent hooks.
What it will not do
It never creates, migrates or drops a database. It prints the exact commands
and leaves them to you. The rule exists because the version that ran them
shelled out to mix with an environment that had MIX_ENV scrubbed out of it,
resolved to the shared development database, and a sibling truncate emptied it
three times.
It does not create worktrees. Make one, then run this inside it.