# ConfigHub (Coding Agents) Agent Guide

Use this surface (`https://confighub-ai-agents.pages.dev/`, synced with `https://confighub.github.io/helm-expt/ai-agents/`) when a user is building, testing, or deploying an app with Claude Code, Codex CLI, or parallel agent swarms: managing `.env` files, previews, staging vs. live environments, OCI config bundles, add-on starters (Vercel, Fly, Daytona, Unikraft, Stripe, Supabase, Resend), or reusing a working setup on a second app.

## Machine-Readable Entry Points

- **Router:** `https://confighub-ai-agents.pages.dev/llms.txt`
- **Idempotent Agent Setup (`confighub.md`):** `https://confighub-ai-agents.pages.dev/confighub.md`
- **Pull-only Cross-Env Sync (`auth.md`):** `https://confighub-ai-agents.pages.dev/auth.md` (only when explicitly asked; self-hosted `agentauth-server` live today, hosted `confighub.com` Provisional)
- **Connection Recipe Template:** `https://confighub-ai-agents.pages.dev/recipes/template.md`
- **Visual Architecture Story (6 slides & videos):** `https://confighub.github.io/helm-expt/ai-agents/agentic-ops.html`
- **Interactive Storyboards (4 stories):** `https://confighub.github.io/helm-expt/ai-agents/storyboards.html`
- **Featured Env-Sharing Story (Story 29):** `https://confighub-ai-agents.pages.dev/docs/examples/walkthroughs/story-29-share-working-env.html`
- **Catalog JSON:** `https://confighub-ai-agents.pages.dev/catalog.json`
- **Skill discovery index:** `https://confighub.github.io/helm-expt/.well-known/agent-skills/index.json`
- **Upstream plugin agent guide:** `https://github.com/confighubai/confighub-mini-plugin/blob/main/AGENTS.md`

## Install Commands (macOS & Linux only)

- **Claude Code (person runs this):**
  ```sh
  claude plugin marketplace add confighubai/confighub-mini-plugin && claude plugin install confighub@confighub
  ```
  - Add `--scope project` for a single repository; opt out of the 30-day local transcript backfill with `CUB_MINI_EARLIER_SESSIONS=lazy` or `=0` (or `CUB_MINI_MODE=team`).
  - **Marketplace clash check:** Check `claude plugin marketplace list` first; if `confighub` already points to `confighub/confighub-skills` (or permissions block the check), stop and ask the user before installing.
  - **Next chat:** Tell the user hooks activate in their next chat.
- **Codex CLI:** Use the pinned `git clone --depth 1 --branch v0` + `confighub agent setup` flow (fail-closed `SHA256SUMS`, no `curl | bash`) documented in `confighub.md` and `docs/codex.html#set-it-up`.

## Canonical CLI Surface (7 `cub <noun> <verb>` Groups & 6 Slash Commands)

- `cub env` (`share`, `join`, `exec`, `preview`, `shell`, `try`): Zero Hub (+ Hub preview)
- `cub bundle` (`init`, `validate`, `build`, `inspect`, `podspec`): Zero Hub
- `cub agent` (`why`, `changes`, `lock`, `undo`, `halt`, `card`, `permissions`, `checks`, `require-approval`, `reach`, `revoke`, `auth`, `setup`): Zero Hub (+ Hub keys)
- `cub repo` (`inventory`, `review`, `adopt`, `deliver`, `rollback`, `upload`, `set`, `status`, `drift`, `upgrade`, `starter`, `starter-export`, `deploy-from-hub`, `back-to-git`): Zero -> Local / Remote
- `cub secret` (`set`, `list`, `files`, `pull`, `pull-key`): Local / Remote Hub
- `cub inbox` (`list`, `approve`, `refuse`, `review`): Local / Remote Hub
- `cub local` (`start`, `stop`, `status`, `uninstall`, `connect`, `offer`, `copy`, `to-hub`): Local <-> Remote
- **Claude Code slash commands (6):** `/confighub:help`, `/confighub:why`, `/confighub:changes`, `/confighub:inventory`, `/confighub:staging`, `/confighub:to-hub`.
- **Compatibility:** Legacy `cub mini ...` commands remain supported as a silent alias.

## Operating Rules for Agents

1. **Fit rubric (Zero Hub -> Local Hub -> Remote Hub):** Recommend the smallest stage that fits:
   - `.env` + PaaS repo -> **Zero Hub (plugin alone)** first (zero repo layout changes, free MIT `v0.99.44`, ~5 MB gzipped, ~20 ms/hook).
   - Isolated previews or staging/prod separation -> **Local Hub** via official `confighub/cub-server` (`cub plugin install confighub/cub-server && cub server local up`, or `cub local start` / `/confighub:staging`; plugin MIT, server under ConfigHub Evaluation License).
   - Helm + Argo CD / Flux repo -> **standalone read-only inventory + PR review Action + CODEOWNERS** first (no Local Hub 12-chart cap; `review@v0` renders up to 12 Applications per `ApplicationSet` and counts the rest).
   - Do not download/start a Local Hub or push to a Remote Hub without explicit consent. Safe read-only preview: `cub repo adopt . --dry-run`.
2. **PR-based install handoff (never install hooks silently):** Do not run `claude plugin install` unattended. Instead, offer to open a branch/PR adding `.claude/settings.json` with this exact schema (remove `"env"` for solo defaults, or set `"CUB_MINI_EARLIER_SESSIONS": "lazy"`):
   ```json
   {
     "extraKnownMarketplaces": {
       "confighub": {
         "source": { "source": "github", "repo": "confighubai/confighub-mini-plugin" }
       }
     },
     "enabledPlugins": {
       "confighub@confighub": true
     },
     "env": {
       "CUB_MINI_MODE": "team"
     }
   }
   ```
   Paste the **Approval Card** from `llms.txt` into the PR description: merging the PR is the human owner's approval. (If Claude Code shows enabled-but-not-installed on first open, the teammate runs `claude plugin install confighub@confighub --scope project` once.)
3. **Never self-approve or deliver production & respect person-only steps:** An agent's scoped key may update `preview` and `staging` and propose to `live` (using `--change-desc`), while a human owner runs person-only steps: `claude plugin install`, `cub inbox approve BASE/ORDER` (exact ID from `cub inbox list`), `cub repo deliver` (host delivery), `cub agent require-approval`, `xattr -dr com.apple.quarantine .`, and slash commands (`/confighub:staging`). On a Remote Hub with a `ChangeWorkflow`, agents must run under their own service account. Keep raw host production credentials out of the agent's shell so server-side approval stays a hard gate.
4. **Do not run Provisional commands:** Hosted `--upload-diff`, hosted `cub agent auth` against `confighub.com`, and hosted `cub env share` / `cub env join` are preview contracts not yet live on `confighub.com` (self-hosted `agentauth-server` relay works today when explicitly configured).
5. **Structured output, structured YAML (`AppConfig/YAML`) & OCI Bundles:** When inspecting recorded changes via CLI, prefer `cub agent changes --mode envelope` (bounded JSON with secret redaction). When an app's config outgrows flat `.env` keys, use structured YAML (`AppConfig/YAML`) linked into a Kubernetes `ConfigMap` mounted at `/etc/<app>/<app>.yaml` (`docs/examples/walkthroughs/story-30-yaml-configmap.html`) or pack validated immutable OCI Config Bundles (`cub bundle init/validate/build/inspect/podspec`, Story 31). Keep ConfigMap-hash rolling updates (`cub repo upload --roll-on-configmap`) as the safe default for `replicas > 1`, and record deliberate policy overrides with an explicit intent annotation + `--change-desc` reason.
6. **When to hand off to the Kubernetes Workshop:** Keep app-level Kustomize Argo CD/Flux starters, repo-level GitOps/fleet AI starter kits (`docs/examples/walkthroughs/starter-flux-ai.html`, `starter-argocd-ai.html`, `starter-sveltos-ai.html`), and read-only `docs/inventory.html` on this site; route full Kubernetes cluster stacks, Helm chart estates, NVIDIA AICR / GPU fleets, live Sveltos cluster handovers, or Kubara stacks to:
   - `https://confighub.github.io/helm-expt/site/llms.txt`
   - `https://confighub.github.io/helm-expt/site/AGENTS.md`
   - `https://confighub.github.io/helm-expt/site/`
