Maya builds a small app on her laptop: a Vite or Next.js app, or a Python app with a Procfile. Its settings are in .env. She wants her coding agent to try changes in staging and see them in the running app, while production changes wait for her. Here the app is a few lines of Python that shows one setting, BANNER, on a page, so you need nothing but Python. The guide to an app you already have covers the same commands for a Node app.
You need: Claude Code with the ConfigHub plugin, and an app that runs on your laptop with its settings in .env or .env.local.
| By hand | Ask your agent | |
|---|---|---|
| Connect the app | /confighub:staging in the app's folder | You type it yourself. |
| Change staging and see it | cub repo set shop BANNER=autumn --variant staging --change-desc "WHY", then cub env preview --staging | "Try the autumn banner in staging, and show me the app running with it." |
| See production before you approve | cub env preview --production | "Make the banner say winter in production. I'll approve it." |
| Approve, and see it again | cub inbox approve shop, then cub env preview --production | You approve it yourself. |
Your app runs the way it already does, with each copy's settings passed in. Your files are not changed.
Without ConfigHub: your agent edits .env and restarts the dev server, so staging and production are the same file, and nothing waits for you.
The rest of this page is the full version: every command with what it prints, how to stop what runs, what an agent leaves to you, and how this was tested.
Claude Code with the ConfigHub plugin, an unpacked confighub mini package 0.11.1-mini.31 or later, Python 3 and curl, on macOS or Linux. No account. A hub is ConfigHub running on your computer. It keeps a staging and a production copy of the app's settings, each change with its reason.
CUB_CONFIG gives this walkthrough a cub configuration of its own, so your own settings are not touched.
export MINI=/absolute/path/to/unpacked-confighub-mini
export PATH="$MINI/bin:$PATH" CUB_CONFIG="$HOME/.confighub-walkthrough"
unset CUB_CONTEXT
"$MINI/bin/confighub-mini-app" mini install-plugin "$CUB_CONFIG" >/dev/nullBANNER from its environment first and from .env second, as Vite, Next.js and python-dotenv do. It keeps a secret in .env too, which never goes into the hub. The Procfile says how it runs.
mkdir -p ~/walkthrough/shop && cd ~/walkthrough/shop
printf 'BANNER=summer\nSECRET_KEY=change-me-locally\n' > .env
printf 'web: python3 app.py\n' > Procfile
cat > app.py <<'EOF'
import os, http.server
env = dict(l.strip().split("=", 1) for l in open(".env") if "=" in l)
banner = os.environ.get("BANNER") or env.get("BANNER")
class Page(http.server.BaseHTTPRequestHandler):
def do_GET(self):
self.send_response(200); self.end_headers(); self.wfile.write(f"banner={banner}\n".encode())
http.server.HTTPServer(("127.0.0.1", int(os.environ.get("PORT", "8000"))), Page).serve_forever()
EOF/confighub:staging gives the app a staging and a production copy of its settings in a hub on this computer. The secret stays in .env. The last line says how to see each copy in the running app.
claude -p "/confighub:staging"shop now has a staging and a production copy of its settings, in a hub on this machine. Your files are unchanged.
Staging takes your agent's changes at once. Your agent can only propose changes to production; they wait for you.
…cub repo set shop BANNER=autumn --variant staging --change-desc "Try the autumn banner"Saved in shop-staging, with the reason: Try the autumn banner. A later version of what shop-staging is made from will not overwrite this value.cub env preview --staging names the command before it runs it, here the web: line of the Procfile, and passes staging's settings as environment variables. It prints the address. Open it, or read it with curl.
cub env preview --staging | tee staging.txt
sleep 2; curl -fsS "$(sed -nE 's/^Staging is running at ([^,]+),.*/\1/p' staging.txt)"Running python3 app.py, the web line of the Procfile, with staging's 2 settings as environment variables; your files are not changed.
banner=autumncub repo set shop BANNER=winter --variant live --change-desc "Winter banner"
cub inbox listcub env preview --production runs the app on this computer with what was approved for production. A change that still waits is not in it. Production itself is unchanged.
cub env preview --production -- python3 app.py | tee production.txt
sleep 2; curl -fsS "$(sed -nE 's/^Your app is running at ([^ ]+) on this machine.*/\1/p' production.txt)"banner=summercub inbox approve shop shows the change and asks; answer y.
cub inbox approve shop BANNER: summer → winter
Applied the reviewed change to shop-live.cub env preview --production --stop
cub env preview --production -- python3 app.py | tee production.txt
sleep 2; curl -fsS "$(sed -nE 's/^Your app is running at ([^ ]+) on this machine.*/\1/p' production.txt)"banner=wintercub env preview --status.
cub env preview --staging --stop
cub env preview --production --stop
rm staging.txt production.txtThe app run with staging's settings is stopped.
Your app run on this machine with production's settings is stopped. Production itself is unchanged.cub local uninstall --name mini --delete-data removes the hub and everything in it; then delete ~/walkthrough and ~/.confighub-walkthrough. The app's files were never changed.
The app on your laptop runs with staging's settings or with production's approved ones, whichever you ask for, and your .env is as you wrote it. Each change has its reason in the hub, and production changed only when you said yes.
For an AI agent doing this for a person.
/confighub:staging; you cannot. After it, work in a fresh session, on the key it gives you.cub repo set APP KEY=VALUE --variant staging --change-desc "WHY", then run cub env preview --staging and give the person the address it prints.--variant live, and hand the person cub inbox approve APP for their own terminal. They can run cub env preview --production before and after..env to make a change, and never print a secret's value.cub env preview --staging --stop.Try the autumn banner in staging, and show me the app running with it.
This proves: an app that runs on the laptop is connected without a change to its files; the agent's staging change is seen in the running app; a production change waits, the person sees production before and after approving it, and the app's own files and secret stay as they were.
What ran. This path ran in our release check for confighub mini 0.11.1-mini.31, on a real local hub on a Mac, with three apps: one shaped like a Vite app, one shaped like a Next.js app with its settings only in .env.local, and a Python app with a Procfile. The vite and next commands were small stand-ins that read the environment first and the file second, as the real ones do. The check confirmed that the agent's key changed staging and the page served its value, that production's run served the value before the approval and the approved value after it, that a fresh session found and stopped both runs, that each app's files were byte for byte unchanged, and that no secret appeared in any output. Real Vite, Next.js and Flask were not run, and no real agent session asked for the run: the agent's commands ran on its key from a script.