iterate.com / kernel

git clone https://git.iterate.com/repos/kernel

cloudflare sign-in: a kept sign-in does not ask for the card's scope

A kept sign-in holds a refresh token and lives until it is signed out of,
and whoever can read its file has the grant for that long (the friend
deploy keeps one in a mind's sandbox). The card's scope is for a person
at the terminal, where the step for a card can be shown at all: only the
one-hour sign-in asks for it.

Via: /agents/claude/installer-cloudflare-card-prompt-mwynk7y7-d3de92
Session: claude 3eb581c8-1b51-4686-8d1d-b642d0822a42 on beelink
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014UJeUkb5YT4HuZzZEVabHj

Jonas Templestein, 2026-11-27 07:30 UTC · 5c96ec48fd251db5d08513f6dda0119ec8821af7 · parent 84b9305

2 files changed

M core/lib/src/cli/README.md
@@ -112,7 +112,8 @@
    - The sign-in asks for what one deploy of the stack needs and for nothing more (never "Account
      API Token Provisioning"): `STACK_SCOPES` in [cloudflare-access.ts](cloudflare-access.ts) says
      which resource needs each scope. One scope more is asked for and not needed: AI Gateway's
-     read (`CARD_SCOPE`), which says whether the account has a payment card.
+     read (`CARD_SCOPE`), which says whether the account has a payment card. A kept sign-in
+     (`iterate cloudflare sign-in`) does not ask for it.
 2. **The account.** One that you selected on Cloudflare's page, or a new one in your name
    (`--new-account`): one Cloudflare login can own several accounts (up to five extra), giving the
    mind a clean, separate place. An approval covers only the accounts selected on that page, so for
M core/lib/src/cli/cloudflare-access.ts
@@ -110,9 +110,10 @@
 
 /** A SCOPE THAT `iterate deploy` ASKS FOR AND DOES NOT NEED: AI Gateway's read, by which
  *  Cloudflare says whether the account has a payment card on file (`paymentCardOf` in
- *  deploy.ts). It is in no list of needed scopes: a sign-in that did not grant it, a kept sign-in
- *  from before it and an API token without it deploy as before, and the command then does not
- *  know about the card. */
+ *  deploy.ts). It is in no list of needed scopes: a sign-in that did not grant it and an API
+ *  token without it deploy as before, and the command then does not know about the card. ONLY
+ *  THE ONE-HOUR SIGN-IN OF A PERSON AT THE TERMINAL ASKS FOR IT: a kept sign-in
+ *  (`keptSignInOf`) never does. */
 export const CARD_SCOPE = "aig.read";
 
 /** WHAT `iterate recover` ASKS FOR: the reads that find the mind (its zone with the zone's
@@ -610,12 +611,13 @@
 
 /** `iterate cloudflare sign-in`: a sign-in with the deploy's scopes and `offline_access`, by the
  *  same client and page as the deploy's. A grant that lacks a scope, or comes with no refresh
- *  token, could not deploy with nobody there: it is revoked and nothing is kept. `CARD_SCOPE` is
- *  asked for and not needed: the file's `scopes` stay the deploy's own. */
+ *  token, could not deploy with nobody there: it is revoked and nothing is kept. IT ASKS FOR NO
+ *  SCOPE THAT A DEPLOY DOES NOT NEED (`CARD_SCOPE`): this grant lives until it is signed out of,
+ *  and whoever can read its file has it for that long. */
 export async function keptSignInOf(
   show: (page: { url: URL; code: string; minutes: number }) => void | Promise<void>,
 ): Promise<KeptSignIn> {
-  const answer = await deviceSignIn([...DEPLOY_SCOPES, CARD_SCOPE, "offline_access"], show);
+  const answer = await deviceSignIn([...DEPLOY_SCOPES, "offline_access"], show);
   const lacks = scopesLacking(DEPLOY_SCOPES, answer.scope);
   const refreshToken = answer.refresh_token;
   if (lacks.length > 0 || !refreshToken) {