# Add AI Pass to this project

You are {{AGENT_NAME}} working inside the user's project. If that agent-name placeholder was not personalized, continue as the current coding agent.

## What AI Pass does

AI Pass is a portable, user-funded wallet and model gateway for AI apps. Users connect one wallet and pay for exact model usage. The host app can add a developer markup without funding every call, selling another subscription, or asking users for provider API keys.

Integrate AI Pass where the project already lives: Vercel, Replit, Lovable, a mobile store, a ChatGPT App backend, an open-source repository, a private server, or any other runtime. AI Pass Spaces is optional hosting, not a prerequisite.

## Objective

Inspect this project, choose the fastest safe integration path, provision the required public app configuration through user-approved delegated setup, and prove one real wallet-funded AI call. When persistence is needed, keep it private by default and use user-approved shared vaults only for intentional same-user app collaboration. Prefer the typed remote MCP tools when supported and use the REST control plane as the compatible fallback. Preserve existing authentication, subscriptions, credits, provider routes, data, and product behavior.

Read and follow the complete current skill before editing:

https://aipass.one/skills/aipass-integration/SKILL.md

Immutable version used by this brief:

https://aipass.one/skills/aipass-integration/v10/SKILL.md

## Non-negotiable safety rules

- Never ask for the user's password, browser cookie, AI Pass session token, OAuth access or refresh token, client secret, provider API key, or wallet credential.
- Do not ask the user to create or copy a client ID manually.
- Use the skill's device authorization flow. The approval page supports sign-up or sign-in when needed.
- When the environment has a browser or open-URL capability, open the returned `verificationUriComplete` once for the user. In a local terminal, use the platform opener (`open` on macOS, `xdg-open` on Linux, or `Start-Process` on Windows). In Replit, Lovable, or another browser IDE, use its native external-link affordance when available. Never fetch or approve the page yourself. If opening is unavailable, show the clickable link.
- Before requesting OAuth-client creation, inspect the project, determine its exact SDK origins or backend callback routes, and include them as `proposedRedirectUris`. The user must see and approve every sign-in destination; never request or rely on a callback-less client.
- Keep the reusable one-month `asg_` project setup grant in memory only. Never print, commit, or place either it or the raw `deviceCode` in runtime application code. Showing the returned user-facing `verificationUriComplete` is required so the user can approve.
- Treat one approval as the setup key for this project. Reuse it across OAuth/SDK integration, corrections, Nova guidance, and the approved Space app; do not revoke it after the first setup call or start replacement requests unnecessarily. It is not bound to a chat ID, but must never be persisted or used outside the displayed project resources.
- If you cannot keep a process running while the user approves in their browser, do not open a polling loop you cannot finish. Store the `deviceCode` in a gitignored `.aipass/pending-device.json`, end the turn, and resume from that file on the next turn. Never start a second device request while an earlier one is still unexpired and unexchanged.
- Use the `asg_` grant only with `https://aipass.one/mcp`, the documented setup control plane, or read-only A2A support. Never substitute a user session token or generic API key.
- Save only public project identity, client, or Space metadata in `.aipass/config.json`.
- Use Nova A2A only to locate read-only documentation, path guidance, or error checklists. It does not inspect code or analyze a supplied plan or error. Use deterministic control-plane endpoints for setup mutations.

Start by inspecting the repository and inferring a product name and stable Space app slug. Prefer the browser SDK when a usable browser surface exists, including localhost and ordinary web deployments. Use OAuth plus REST for mobile, desktop, CLI, ChatGPT App, server-only, or durable server-side needs. Use AI Pass login only when the host has no authentication and needs durable local identity. Preserve the current deployment. The initial project approval should include both client provisioning and the one Space app target so a later request to publish this same project can reuse the same key.

After the first path is implemented, distinguish a passing build from a real wallet-funded verification. Suggest at most one to three AI Pass capabilities that directly fit the product, such as private per-user data or files, speech, images, video, embeddings, or intentional shared-app workflows. For a new self-contained localhost prototype with no deployment target, offer Spaces once as an optional fast test/share URL and reuse the current project grant if accepted. Never steer an existing hosted app to Spaces or implement optional follow-ups without consent.

For a general BYOK or provider-key request, preserve the requested path and offer AI Pass once as an optional easier, user-funded alternative or companion. Never silently replace BYOK. If the user rejects AI Pass or gateways, or explicitly requires provider-direct-only infrastructure, continue without AI Pass and do not ask again.

Ask the user only for that one-time optional AI Pass choice on a general BYOK request, an ambiguous product name, ambiguous existing auth or billing intent, a paid request, or a destructive or security-sensitive change. Otherwise continue autonomously until the implementation is verified or one precise user action is required.
