Skip to content

Configure prima through PRIMA_CLI_ variables instead of an init command - #139

Open
DavertMik wants to merge 1 commit into
mainfrom
prima-env-vars
Open

Configure prima through PRIMA_CLI_ variables instead of an init command#139
DavertMik wants to merge 1 commit into
mainfrom
prima-env-vars

Conversation

@DavertMik

Copy link
Copy Markdown
Contributor

Prima is usually run by a coding agent, in a directory with no explorbot project and no reason to gain one. It now takes its configuration from the environment.

PRIMA_CLI_* mirrors and overrides EXPLORBOT_*

Every PRIMA_CLI_ variable mirrors the EXPLORBOT_ one of the same name and wins over it, so prima can be pointed at a different provider, model or URL without disturbing an explorbot setup on the same machine.

The mirror is driven by the EXPLORBOT_ENV_VARS registry rather than a list of its own, so a variable added there is mirrored without touching prima — there is a test asserting exactly that. It runs first thing in the Prima constructor, before config is read.

Verified by hand:

result
PRIMA_CLI_AI_PROVIDER=groq alone groq
+ EXPLORBOT_AI_PROVIDER=openai groq wins
PRIMA_CLI_URL vs EXPLORBOT_URL PRIMA_CLI_ wins
--url flag vs PRIMA_CLI_URL flag wins

Provider API keys are deliberately not mirrored — OPENROUTER_API_KEY and friends are provider-standard names, not explorbot variables.

No init command

Asked for a model it does not have, prima printed explorbot's message, which recommends explorbot init — a command prima does not ship. It now prints where to put the variables instead, and writes nothing:

  • ~/.claude/settings.json env block first, since an agent is who runs prima
  • then bash/zsh export
  • then fish set -gx, checked against real fish because export errors there

Both the config path and the check envelope path were confirmed to carry the message intact.

The message is ASCII on purpose. dedent renders every non-ASCII character as literal \uXXXX text, so an em dash would reach the reader as . There is a test pinning that.

boat/prima/README.md is updated to match — it previously recommended explorbot init --global.

Tests

6 new tests in boat/prima/tests/env.test.ts. 1043 unit and 133 prima tests pass; format and lint clean.

Two things found but not fixed here

dedent mangles non-ASCII across the codebase. dedent`a — b → c` yields a — b → c, and escapeSpecialCharacters: false does not help. 207 non-ASCII characters sit inside dedent blocks across 23 files, mostly prompts: src/ai/pilot.ts (46), src/ai/captain/test-mode.ts (21), src/ai/planner.ts (16), src/ai/rules.ts (14), src/ai/tester.ts (13). Those models are reading where an em dash was meant. Separate change.

test.yml does not run boat/prima/tests/. It runs tests/unit/ and tests/integration/ only, so prima's 133 tests — including these — run solely in publish-prima.yml at release time. A PR can break prima with CI green.

🤖 Generated with Claude Code

@DavertMik
DavertMik force-pushed the prima-env-vars branch 3 times, most recently from 257b634 to ab6fe69 Compare August 23, 2026 19:58
Prima is usually run by a coding agent, in a directory that has no explorbot
project and no reason to gain one. It now takes its configuration from the
environment: every PRIMA_CLI_ variable mirrors the EXPLORBOT_ one of the same
name and wins over it, so prima can be pointed at a different model, vision
model or URL without disturbing an explorbot setup on the same machine.

The mirror is driven by the EXPLORBOT_ENV_VARS registry rather than a list of
its own, so a variable added there is mirrored without touching prima.

A vision model is never derived from the main model, so naming only a main
model leaves screenshot analysis off. --vision-model sets it for one run,
PRIMA_CLI_VISION_MODEL for good.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant