curie / cli
CLAUDE.md53 starsChanged 3 months agoApache-2.0View on GitHub
The curie CLI: Rust, clap + tokio + reqwest. Speaks only the frozen contracts (the generated curie-aci-protocol crate over HTTP/NDJSON, and the platform API's committed apps/api/openapi.json) and orchestrates a local runner container via Docker. Three command families: skill drives a plugin against a local runner with up, down, status, message, and eval; local wraps the compose stack and local API with up, down, status, comms, message, deploy, and observability; cluster wraps Helm and the deployed release with up, upgrade, status,…
- Reads credentials
In this repository8 other files it gives its agents.
- AGENTS.mdAGENTS.md
- docs/agents.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- packages/CLAUDE.mdCLAUDE.md
- runner/CLAUDE.mdCLAUDE.md
- llms.txtllms.txt
- implementSkill
- update-architecture-atlasSkill
The file
We split this CLAUDE.md into the rules it gives an agent
2 rules. About 0 are common, 0 are distinctive, and 2 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈0
Distinctive · estimate
This author's own choices. Worth a look.
2
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 60
Keep reqwest's feature set minimal (json, stream, multipart) -- adding a feature should come with a reason in the PR, not just convenience.
- Very specific: line 115
No client workspace or TMPDIR needs to exist on the daemon host.
≈ “Common” is an estimate: at least 1 in 5 of the 28,633 CLAUDE.md files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
CLAUDE.md - cli
The curie CLI: Rust, clap + tokio + reqwest. Speaks only the
frozen contracts (the generated curie-aci-protocol crate over HTTP/NDJSON,
and the platform API's committed apps/api/openapi.json) and orchestrates a
local runner container via Docker. Three command families: skill drives a
plugin against a local runner with up, down, status, message, and
eval; local wraps the compose stack and local API with up, down,
status, comms, message, deploy, and observability; cluster wraps
Helm and the deployed release with up, upgrade, status, down, comms, message,
deploy, and observability. Full command reference in
cli/README.md.
Load-bearing invariants
- Under
--json, the agent-facing read and result verbs emit one JSON object to stdout -- never empty stdout (issue #456). That covers the read/query verbs (versions,memory,approvals,observability), the lifecycle result verbs (kill,resume,budget,delete),init(both the plain-name and--from-specbranches, viaInitOutput, issue #485), and every verb's--dry-runplan. Silent empty-stdout-exit-0 is the worst failure mode for an agent consumer: it looks like success but carries no data. The json-vs-human decision lives in exactly one place,Ui::emit(the success-path mirror ofmain.rs's centralized error emit). A new or refactored verb returns aCliOutput-- a typed output object (e.g.VersionsOutput,KillOutput), orDryRunPlan { lines }for a--dry-runplan -- and routes it throughUi::emit; handlers must not call the stdout emitters (payload/payload_plain/kv) directly, since those suppress under--json. The operator verbs (up,down,status,comms),deploy, andskill messagenow return typedCliOutputs on their real-path success too (#485): the operator/deploy verbs route throughUi::emit, andskill messagebuffers the streamed reply into oneSkillMessageOutputunder--json(it still streams live in the human path). The schema-gated ADR-0021 builders (skill status/skill eval,skill check,local message/cluster message,secrets list,guide) now route throughUi::emittoo (#474): each returns a typedCliOutputwhoseto_jsondelegates to its unchanged pure builder, so the committed schemas stay byte-for-byte identical while the json-vs-human decision lives only inUi::emit. The one intentional non-CliOutputemit is the centralized error path inmain.rs(error_jsonunder--json): generic errors useerror.schema.json, whilecluster deploy --all-targetsreconciliation failures usedeploy.schema.json. Errors are not success-path values, so they stay on the error-emit mirror rather than the success-pathCliOutputcontract. - The command manifest is a committed artifact; regenerate it in the same
change as any command-surface edit (console/CLI parity, epic #145). Any
change to a clap
Command/subcommand or an*Actionenum — a renamed verb, a new subcommand, a changed flag — must regeneratecli/command-manifest.jsonand the committedapps/ui/src/generated/commandManifest.ts(pnpm gen:manifestinapps/ui) in the same commit. CI drift-checks the committed TS manifest, and the console'scliCommand()hints are typed against it, so a stale manifest breaks the UI build. Never edit the manifest by hand. - Never hand-write the ACI types.
Cargo.tomldepends oncurie-aci-protocolat../packages/aci-protocol/generated/rust-- that crate is generated from the frozen Pydantic models. If a type you need is missing, that is a contract gap (raise it in an issue/PR first per the root AGENTS.md frozen-contracts rule), not something to redefine locally incli/src. - No new HTTP crates.
reqwest(rustls-tls, no OpenSSL) is the one HTTP client in this binary; do not add a second one for a specific endpoint. Keepreqwest's feature set minimal (json,stream,multipart) -- adding a feature should come with a reason in the PR, not just convenience. - The queue payload is the frozen
QueuedTurncontract, not a hand-mirror.curie skill messagetalks straight to a local runner container's ACI HTTP surface (/v1/event,/v1/steer,/v1/interrupt), bypassing the dispatcher/worker entirely by design (that is the point: zero Slack, zero cluster). Thelocal message/cluster messagedrivers do enqueue onto the real Valkey Stream, and the payload they mint iscurie_aci_protocol::QueuedTurn(promoted intopackages/aci-protocolby issue #7) consumed from the generated crate -- never redefine it locally incli/src.cli/src/queue.rsowns only the Valkey Stream transport of that type (the single-payloadencoding, theEvSIM-synthetic ids, the XADD and the ack-based completion signal). curie initscaffolds the plugin-format shape verbatim. The generated bundle (.claude-plugin/plugin.json,skills/<name>/SKILL.md,.mcp.json) must stay byte-compatible with whatplugin_format.validate_bundleaccepts -- ifpackages/plugin-formatchanges, this scaffold needs updating in the same reviewed change, not independently.initalso drops a rootAGENTS.mdand a.claude/skills/using-curie/SKILL.mdharness primer (body rendered fromguide::primer_markdown()) alongside the bundle; both live outside theplugin_format-validatedskills/tree, so they do not affect validation. The non-interactive spec-file path (curie init --from-spec <path>,scaffold::scaffold_from_spec) produces the SAME plugin-format-verbatim shape and carries the same byte-compat obligation: itsSKILL.mdfrontmatter usesallowed-tools(nevertools) and its.mcp.jsonservers each definecommandorurl(as strings). The spec'sevalsreuse the frozenevals::EvalCasetype directly (not a hand-mirror), so a spec-authored eval suite cannot drift from the shapeskill evalloads. Unknown keys inside an eval case are rejected by both loaders, so an unsupported tier label or a spelling error cannot be silently dropped.EvalSuiteandGraderremain tolerant because only case keys are closed. The spec's own top level fields stay strict (deny_unknown_fieldsonAgentSpec/SkillSpec).- The
evals/cases.jsonseed andskill evalloader hand-mirror the frozen eval-case schema. Thecurie initseed (scaffold::eval_cases) and theskill evalloader (evals::EvalSuite/load_suite) mirror the frozen eval-case schema atapps/worker/schema/eval-cases.schema.jsonand must stay byte-compatible with the worker'sEvalSuite-- the scaffold byte-equality test againstapps/worker/schema/eval-cases.example.jsonis the enforcement. A shape change here lands in the same reviewed change as the Python models, not independently.skill uprecords container state in.curie/runner.json(gitignored by the scaffold) soskill message/skill eval/skill status/skill downcan resolve the running container from the bundle directory alone. Do not add a second state-tracking file for the same purpose.skill uppacks the bundle into a content-addressed snapshot at.curie/snapshots/<digest>/, copies its bytes through the Docker API into a private named volume, and mounts the volume read only for the runner's lifetime. A host edit does not reach a running runner; rerunskill upto load a changed snapshot.skill status --jsonreports the loadedbundle_digest.skill down, replacement, and failed startup release the owned volume and snapshot;evals/cases.jsonis still read live from source.
Docker inputs always cross the Docker API. skill check, runner startup,
model sweeps, and curie try use seeded named volumes even when Docker is
local. DOCKER_PUBLISHED_HOST selects only the address used to reach published
ports, defaulting to localhost; DOCKER_HOST selects the daemon independently.
No client workspace or TMPDIR needs to exist on the daemon host. Hosted
connector secret_files use per-run named volumes seeded from in-memory
credentials, with each file mounted read only at its exact declared destination
through a volume subpath. Files have mode 0400 and UID/GID 65532:65532.
The dev Compose collector config is copied into its image through a small build
context; generated release Compose keeps inline content configs. Docker socket
mounts and kind's /dev/kmsg mount still refer to daemon-host resources.
- The local skill verbs stay fully offline once their local inputs exist; the
local and cluster target verbs are the exception.
init,skill up,skill down,skill status,skill message, andskill evalmust keep working with zero network access beyond the local Docker daemon and the local runner container.skill upstays offline once the runner image is present locally, or when--image <local-tag>names a local image. A release binary's default runner image ref is pulled from GHCR on first run. A bundle that declaresbuild:connectors moves that boundary by exactly one build:skill uprebuilds a missing or staleconnectors.lock.yamlbefore bring-up (ADR 0113 Decision 3), and that is adocker buildof the bundle's own Dockerfiles, which reaches whatever they name -- a base image such aspython:3.12-slim, a# syntax=frontend if one is declared, and whatever the Dockerfile's own steps fetch. So for those bundles the guarantee is offline after the first successful build, while the lock stays current: a lock whosesource_digeststill matches the tree computes no rebuild and issues nodocker build, so the verbs above again touch nothing but the local daemon. A bundle that declares nobuild:connectors is unaffected and keeps the zero-network guarantee as written above.local deployandcluster deployare the bundle shipping verbs that leave the machine: they package the bundle as tar.gz and push to the platform API (find-or-create agent, refuse locally if the bundle declares an approval route the agent does not bind (#2448, advisory, the API is the gate), create version, upload bundle, create deployment) authenticated via--api-key/CURIE_API_KEY. The packer skips a fixed set of names (.curieignore,.curie,.git,.venv,venv,node_modules,__pycache__,.mypy_cache,.pytest_cache) at any depth plus whatever an optional root.curieignorenames (name-only, no globs), and still refuses to pack any symlink that survives those exclusions rather than dereference it.local message,local deploy,cluster message,cluster deploy, and every operator verb (local up,local status,local down,local comms,cluster up,cluster status,cluster down,cluster comms) reach a Valkey, API, or cluster by design. - The operator verbs are a thin wrapper; the chart stays the source of
truth.
cluster up/cluster status/cluster down(src/ops/),cluster comms(src/comms.rs), andlocal <up|down|status>(src/local.rs) shell out tohelm/kubectl/docker composeand never re-derive what a values file already declares. Each verb builds its command lines as a pure function returningOpsCommandvectors that the executor or the--dry-runprinter consumes; keep that split so argv stays unit-testable with no cluster, and give any new verb a matching--dry-run. Artifact resolution is a pure plan viaartifacts::resolve_*plus a separate fetch viaensure_cached; pure argv builders never fetch, and--dry-runnever touches the network. - Credentials are masked, never printed. Secret
helm --setvalues use theCmdArg::SecretSetvariant, while generic--setand--set-stringcredential-shaped values useCmdArg::HelmSetExpression: raw expressions stay unchanged for execution, but every rendered form masks them. Malformed expressions fail safe: an unbalanced brace list renders as a fully masked placeholder. Token flags read from env withhide_env_values; never widen a secret toPlainor otherwise print it. Theupmodel credential (fromCURIE_MODEL_CREDENTIALS) flows through this path.curie cluster comms --slackuses the sameSecretSetmasking forSLACK_APP_TOKENandSLACK_BOT_TOKEN, while--disconnect --dry-runprints only the empty clears. After the Helm upgrade it rolls every Slack token consumer, the channel gateway and dispatcher on connect, viakubectl rollout restart+rollout statusso the Secret-backed tokens go live. local commsshares the same Slack flag surface, but tokens travel through compose env, not argv.curie local comms --slackreadsSLACK_APP_TOKENandSLACK_BOT_TOKEN, passes them through a maskedsecret_envcompose process env channel, and never prints an unmasked token in live or dry run output.--disconnectclears the real Slack wiring, stops the dispatcher, and restores the local stub forlocal message.cluster messagefollows the deployed transport. It manages its own kubectl port-forwards (children killed on exit). With a connected dispatcher, it posts a placeholder and routes the reply to the agent's bound Slack channel. Without a dispatcher, it uses the terminal reply stub and waits for the reply.- A new
Deserializestruct incli/src/api.rsmust be declared incli/api-mirrors.json(as amirrorsentry with its allowlisted field omissions, or anon_mirrorsentry with a one-line reason).curie dev field-parityis the check (#691). - A new
Deserializestruct incli/src/commands/orcli/src/spec.rsthat hand-mirrors the frozenpackages/plugin-formatmanifest shape must be declared incli/plugin-format-mirrors.jsonthe same way (mirrorswith omissions, ornon_mirrorswith a reason) -- this is a SIBLING gate to the one above, not the same one: the source of truth here ispackages/plugin-format/schema/plugin-format.schema.json, notapps/api/openapi.json, since the two contracts are unrelated.curie dev field-parity(cli/scripts/check-field-parity.sh) runs both (#701). Beyond the mechanical field sweep,commands::parse_manifest_gatesadditionally validates a manifest that DECLARES anapprovalPolicyagainst the full frozen schema (commands::validate_against_plugin_format_schema) before trusting the narrowManifestApprovalsread of it -- without that, a manifest invalid in some unrelated modeled field (e.g.commands: 123) would parse into the narrow shape untouched andskill approvalswould report gates as armed for a manifest the runner's ownPluginManifestparse rejects outright (closes ADR-0041's formerly-open known limitation). - A
CliOutput::to_jsonthat hand-projects one of those mirror structs into aserde_json::json!literal must be declared incli/api-mirrors.json'semitsarray (the(output, struct)pair, plus any allowlisted, justified field omissions) -- the second, emit-hop seam #691 named but did not close (the proof case wasVersionsOutput::to_jsondroppingVersion.id, #699).curie dev emit-parityis the check. Narrower than the struct-level gate: it verifies every DECLARED projection stays honest but, unlike that gate'sUndeclaredStructcheck, cannot discover a new projection on its own (seecli/tests/support/emit_parity.rs's module doc for why). Ato_jsonthat instead delegates wholesale to aSerializevalue (serde_json::to_value) or a shared schema-gated builder needs noemitsentry -- it cannot drop a field by hand-picking one in the first place.
Verify
cd cli && cargo fmt --check && cargo clippy --all-targets -- -D warnings && cargo testThe Rust CI job sets CI_REQUIRE_VALKEY_TESTS and starts Valkey, so Valkey-backed
tests execute in CI. Contributors need a reachable Valkey, such as the compose
Valkey, for equivalent local coverage.
Scripted E2E (real runner container, fake model, fully offline by default):
bash cli/scripts/e2e.shRequires the curie-runner image built once from the repo root
(docker build -f runner/Dockerfile -t curie-runner .) and a cargo
toolchain (or $CURIE_BIN pointed at a prebuilt binary, which skips the
cargo build --release). CURIE_E2E_LIVE=1 drops --fake-model and runs
the skill rung against a real model, requiring a credential
(ANTHROPIC_API_KEY, CLAUDE_CODE_OAUTH_TOKEN, or CURIE_CREDENTIALS) in
the environment.
Cold-start parity ladder (issue #690, curie dev e2e-ladder ->
cli/scripts/e2e-ladder.sh) -- an E2E test, same as the scripted E2E above, not
the falsifiability gate below it. It chains three rungs: rung 1 delegates to
e2e.sh, passing it the common examples/weather bundle via
CURIE_E2E_BUNDLE (a standalone e2e.sh run keeps its own --from-spec
scaffold when the var is unset); rung 2 drives local up --minimal ->
local deploy -> local message (reply asserted) -> local down, against
compose.dev.yaml; rung 3 drives cluster deploy -> cluster message
against a pre-installed release, a real round trip with no manual
port-forward. The ladder asserts one bundle identity, one eval suite, and one
model mode across every rung and fails on divergence. A fourth,
separately-named local-release rung (issue #695) repeats rung 2's exact round
trip against compose.release.yaml instead -- the file
compose/generate_release_compose.py derives from compose.dev.yaml and the
artifact a release binary's curie local up actually runs, one half of the
compose.dev.yaml / generated-release-compose parity seam (AGENTS.md). It
generates that file fresh each run, then compose/release_images.py --check
derives the required ghcr.io/curie-eng/curie-* set from that artifact
(including the slack-profile dispatcher local message needs) and fails with
the missing identity and a recovery action if any ref is absent locally --
the generated file has no build directive to fall back on and a release
binary has no checkout to build one from -- then runs the same
local up --minimal -f compose.release.yaml ->
local deploy -> local message (reply asserted) -> local down -f
compose.release.yaml against it. Elsewhere in CI, the compose job already
asserts this generated file parses and renders the right service counts but
never runs a turn through it -- this rung is the missing half, catching the
compose-env-wiring bug class (#545) a config-only check cannot.
CURIE_E2E_TIERS (default skill,local, or all for skill,local,cluster)
selects rungs; local-release is NOT folded into all since it needs those
extra images built first, so name it explicitly (e.g.
skill,local,local-release). CURIE_E2E_LIVE (default fake, 1 for live)
governs every named rung, including rung 1 -- e2e.sh reads the same env var
directly rather than being told by the ladder. Rung 1 also carries a
live-only case, case_live_approval_gate_denies (#2094): it gates Bash
through CURIE_APPROVAL_REQUIRED_TOOLS, runs its own runner on
CURIE_E2E_GATE_PORT (default 7246), and asserts a real SDK dispatch against a
real model denies the call and the turn parks awaiting-approval rather than
running it; it skips under a fake run. The standard pre release gate is:
CURIE_E2E_TIERS=all curie dev e2e-ladderA release candidate also runs the separately named release compose rung:
CURIE_E2E_TIERS=local-release curie dev e2e-ladderCanonical parity example falsifiability convention (issue #1649): a committed example case must go RED when the specific capability it claims to test is removed. This is a capability identity mutation. A null agent control remains useful for catching vacuous graders, but it is not sufficient on its own because it removes the whole agent shape rather than the identity of the capability under test.
An executable control can make the capability unavailable through the real consumer path. The weather evidence has two independent observations. A live control kept WebFetch declared, routed it through an approval gate, and supplied no approval. The turn awaited approval and eval failed before trajectory scoring, proving the capability was unavailable but not exercising the trajectory oracle. Separately, a focused regression completed a turn with WebSearch but no WebFetch and observed the committed trajectory oracle go RED. That regression proves a missing WebFetch request is detected. Trajectory records tool requests before execution, so a denied or failed WebFetch request can still satisfy identity and order. A trajectory green does not prove that fetch was reachable or successful. An approval gate is one valid control, not a universal required mechanism.
The offline null agent control (issue #619) is a gate, NOT an E2E test: it never runs a real agent or makes a model call. Its real path half boots the FAKE model and asserts every committed eval suite goes RED against the null agent:
curie dev eval-falsifiability # bash cli/scripts/eval-falsifiability.shThe grader-level half (the contains: "weather" input-parrot vacuousness control
and the known-good-exemplar positive control) rides cargo test
(cli/tests/eval_falsifiability.rs); together they are the gate. Both run
offline with no credential. Passing this gate proves only the null agent
control. Each parity example still needs separate capability removal evidence.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

