ConfigHub · Durable config for coding agents
Docs / examples/walkthroughs/story-29-share-working-env.md Source on GitHub →

Share a working app + services with a teammate — without pasting .env in Slack

Alice has shop running locally (Zero Hub — no hub or account required) with staging settings and test services (Stripe test mode, Supabase staging, OpenAI). Bob clones the repo to test a branch—and hits Missing STRIPE_TEST_KEY, OPENAI_API_KEY. Instead of pasting a raw .env into Slack where it lives forever, Alice runs one cub env share command to share a 24-hour, test-only invite backed by a key-to-key handoff: Bob (or Bob's coding agent) boots the app straight into process memory with zero .env written to disk, zero Bob signup, and zero real upstream API keys ever exposed when using a Tier 3 brokered proxy token (ch_proxy_...).

Quick start

You need: the ConfigHub plugin (Zero Hub) and a relay (agentauth-server on your laptop/self-hosted hub, or optionally confighub.com once hosted relays go live — Provisional). Bob needs no ConfigHub account. (cub env share / env-join remain silent compatibility aliases.)

By handAsk your agent
Share env + test servicescub env share shop --variant staging --mode test --proxy openai=OPENAI_API_KEY --max-requests 50 --server "$RELAY" --approve-wait (step 2)"Share my staging env and a 50-request test-mode proxy token for OpenAI so Bob can run this branch without seeing my real key."
Join in memory (Bob)cub env join "$INVITE_URL" --as bob -- npm run dev (step 3)"Boot this app using Alice's staging env invite in process memory—do not write a .env file to disk."
Capture Bob's fixcub env join "$INVITE_URL" --as bob --capture -- npm test (step 4)"Run the test suite with Alice's invite and capture any non-secret config tuning back for Alice to review."
Revoke anytimecurl -X POST -H "X-Owner-Token: $OWNER_TOKEN" "$RELAY/v1/proxy/grants/$GRANT_ID/revoke" (step 5)"Revoke Bob's proxy grant now so his ch_proxy_ token stops working without rotating my OpenAI key."

Without ConfigHub: Alice pastes a raw .env with long-lived API keys into Slack, Bob saves it to disk where it goes stale the next day, and revoking Bob means rotating every upstream key across the whole team.

What owns what (3-layer boundary)

ConfigHub Server is not a secret vault, SOPS replacement, or LLM gateway. Three separate layers each do one job:

Deeper dive

The rest of this page shows the full key-to-key flow (Tier 2 X25519 sealed-box test keys in memory and Tier 3 ch_proxy_... brokered capability tokens with budget caps and zero-rotation revocation), agent rules, and verification checks.

Show the full walkthrough

Human

What you need

The ConfigHub plugin (Zero Hub) and a running agentauth-server relay (on localhost or your team's self-hosted hub; hosted https://confighub.com relays are Provisional and strictly opt-in). Bob needs no account.

Steps

  1. Start a local relay (or point RELAY at your team's self-hosted hub) and prepare Alice's staging env file containing both non-secret settings and a test-mode key (live sk_live_* / prod keys are structurally refused in --mode test):
    export RELAY="http://127.0.0.1:8787"
    mkdir -p ~/share-env-demo/alice ~/share-env-demo/bob
    printf 'EDGE_CACHE_SECONDS=30\nSTRIPE_MODE=test\nOPENAI_API_KEY=sk-test-alice-key\n' > ~/share-env-demo/alice/.env.staging
  2. Alice shares her staging env using a Tier 3 brokered proxy token (--proxy openai=OPENAI_API_KEY --max-requests 50) so Bob never possesses Alice's real upstream key (or pass --include-test-key STRIPE_TEST_KEY for Tier 2 end-to-end X25519 sealed-box handoff where the relay sees only ciphertext):
    cub env share shop --dir ~/share-env-demo/alice \
      --variant staging --mode test --proxy openai=OPENAI_API_KEY --max-requests 50 \
      --server "$RELAY" --approve-wait

    ConfigHub prints an invite card with the one-line command for Bob and the instant-revoke command for Alice:

    ╭─ ConfigHub · Env Invite · shop (staging · test) ───────────────╮
    │ ├── invite  http://127.0.0.1:8787/env/CH-7M3P-4R9K             │
    │ ├── unlocks 2 staging setting(s) + 1 brokered proxy token(s)   │
    │ ├── guard   live keys blocked (--mode test) · revocable anytime│
    │ └── run     cub env join http://.../env/CH-7M3P-4R9K -- npm run dev │
    ╰────────────────────────────────────────────────────────────────╯
  3. Bob clones the repo (no ConfigHub account required) and runs the one-line command. cub env join generates an ephemeral X25519 keypair locally, receives EDGE_CACHE_SECONDS=30, OPENAI_BASE_URL=<relay>/v1/proxy/pg_..., and OPENAI_API_KEY=ch_proxy_... strictly in child process memory (zero .env written to disk):
    cub env join "$INVITE_URL" --as bob -- \
      sh -c 'printf "CACHE=%s BASE=%s KEY=%s\n" "$EDGE_CACHE_SECONDS" "$OPENAI_BASE_URL" "$OPENAI_API_KEY"'
  4. Verify Bob's disk stays clean (ls -la ~/share-env-demo/bob has zero .env files) and Bob's app calls upstream through the brokered proxy using ch_proxy_... (capped at 50 requests, any echoed upstream secret stripped from responses).
    ls -la ~/share-env-demo/bob
  5. When Bob finishes testing, Alice revokes his proxy grant in one call — the next request using ch_proxy_... returns 403 immediately with zero upstream API key rotation across Alice's services:
    curl -fsS -X POST -H "X-Owner-Token: $OWNER_TOKEN" "$RELAY/v1/proxy/grants/$GRANT_ID/revoke"

Undo it

Revoke the proxy grant or invite (DELETE /v1/env-invites/$CODE), stop the local relay if you started one, and delete ~/share-env-demo. Zero credentials were written to Bob's disk and zero upstream keys need rotation.

Agent

When helping Alice share a staging environment or helping Bob boot a cloned repo:

  • Never paste raw .env files or upstream API keys into chat, PRs, or Slack.
  • Always keep --mode test (refusing sk_live_*, rk_live_*, pk_live_*, and prod keys) and prefer Tier 3 --proxy for external friends or agents so the real upstream key never leaves the owner's relay.
  • Keep /auth.md pull-only: only fetch /auth.md when the user asks to connect to a Cloud Hub or relay; never nag for a confighub.com account during local use.
  • Leave approval and revocation to the owner: Alice approves the key fingerprint and owns X-Owner-Token.

Testing

Share Alice's staging env and a test-mode OpenAI proxy token (max 50 requests) to Bob's process memory without writing a .env file to Bob's folder or exposing Alice's real upstream key, then revoke Bob's grant.

This proves: Alice can pass a working app environment plus scoped downstream services to Bob (or Bob's coding agent) in memory with zero .env pasted in Slack, zero recipient signup, zero real upstream API key exposure (ch_proxy_...), and instant revocation with zero upstream key rotation (covered by TestShareEnvAndEnvJoinEndToEndMemoryOnly, TestShareEnvTier3BrokeredProxyTokenEndToEnd, and TestTier3ProxyGrantEndToEndAndRevocation).