Setting up the cf CLI for personal agents

Log
Published
Session
8 Oct 2026, 12:35 to 15:07 UTC
Project
chat-personal
Agent
Claude Code
Model
claude-opus-5-5
Tags

Value

3.1

■■■□ of 4

Time

28m

active

Elapsed

2h 32m

wall-clock span

Commits

0

from this session

Cost

$6.85

model spend

Tokens

55k

uncached in, plus out

Tool calls

102

by the agent

Outcomes

11

6 left open

Summary

Written by the summariser

Install the Cloudflare cf CLI on gfmbp and MBP16 so Personal coding agents can use it, with a method that keeps it updated.

Rob wanted the Cloudflare cf CLI installed on his Macs for his personal coding agents, with a way to keep it current. He chose a scoped-token approach, and when the agent asked again about minting the token from the global key, he approved a full-access token. The agent built an installer, a wrapper that adds the token only in Personal sessions, a daily background updater and a Personal-only agent rule, all in the rob/agents repo. The launcher tests passed, but the full test gate showed 12 failures in test_agents_reconcile that also fail on clean main, so they were logged as a separate task. The work was pushed and checked live on gfmbp, where Personal sessions authenticate and Work sessions report not logged in. On MBP16 only the wrapper and updater were installed, and the final rule-publishing run exited with an error, so that state is unconfirmed.

What came out of it

  • cf installed on gfmbp via a wrapper at ~/.local/bin/cf, with versioned releases under ~/.local/lib/cf-cli/ and a current link switched on update
  • Daily background update built into the wrapper; codex-update-all refreshes cf on gfmbp
  • Full-access token cf-cli-agents-personal minted and stored at chat-personal credentials/cloudflare/cf-cli/api-token; the wrapper injects it only in Personal context and never overrides a token the user set
  • Personal-only agent rule cloudflare-cf-cli.md added for Claude and Codex homes, telling agents to use cf and not to run npm i -g cf
  • rob/agents commit [commit] pushed to origin
  • chat-personal cloudflare/AGENTS.md updated: cf is the first choice, MCP the fallback, and the new token listed
  • Live checks on gfmbp: in Personal, cf auth whoami shows account rob and cf zones list and cf cli search work; in Work, it reports Not logged in
  • MBP16: old global cf@1.0.0-beta.5 uninstalled; wrapper and updater installed from a clean copy of origin/main
  • Launcher tests pass (43), including a new check on who receives the token
  • HRN-0295 created to track the 12 test_agents_reconcile failures on clean main
  • Leftover test install ~/.local/share/cf-cli removed from gfmbp at Rob's request

I wanted the Cloudflare cf CLI on my Macs so my personal coding agents could use it, and I wanted it to keep itself current. I took the scoped-token route. When the agent asked whether to mint the token from the global key, I approved a full-access token instead.

Where it landed

On gfmbp, cf now sits behind a small wrapper. Each release gets its own folder, and a current link switches over in one step, so a command already running isn't broken by an update. The wrapper runs a background update once a day, and codex-update-all refreshes it too.

The wrapper adds a Personal-only token and never overrides one I've set myself. In Work sessions it reports "Not logged in", which is the split I wanted. A Personal-only agent rule tells agents to use cf and never to run npm i -g cf, because a global copy would bypass the wrapper and lose the token.

I checked this live on gfmbp. In Personal, cf auth whoami shows my account, and cf zones list and cf cli search both work. I also removed the leftover test install from earlier.

MBP16 has the wrapper, the updater and the rule, installed from a clean copy of origin/main. Its old global beta install is gone. Its last reconciler run exited with an error, so the rule's presence in the Personal homes is reported but not confirmed.

Still open

  • Twelve test_agents_reconcile tests already fail on clean main. They're tracked as HRN-0295 and not fixed here.
  • An unpushed MBP16 commit also creates HRN-0295, so one of the two tasks needs recreating by hand.
  • MBP16's full install-launchers didn't run, because its ~/.agents checkout holds another session's uncommitted work. Until it does, the wrapper's own daily update covers it.
  • CodeRabbit was blocked by auto mode, so a local reviewer ran instead. One robustness point, updater timeouts, relies on npm's own network timeouts, since macOS has no timeout command.
  • I used the global key once for a read-only /user lookup before asking. That goes against the Cloudflare guidance the agent cited, so it's worth noting here.

Left open

  • 12 test_agents_reconcile tests still fail on clean main (tracked as HRN-0295); not fixed here
  • Task ID collision: an unpushed MBP16 commit [commit] also creates HRN-0295, so one of the two tasks needs recreating by hand
  • MBP16 full install-launchers was not run because its ~/.agents checkout has another session's uncommitted work; cf's refresh through codex-update-all there waits for that run. The wrapper's own daily update covers it meanwhile
  • The last reconciler run on MBP16 exited nonzero with dirty state, so the rule's presence in MBP16's Personal homes is reported but not confirmed
  • CodeRabbit review was blocked by auto mode, so a local reviewer was used instead; one of its six robustness points (updater timeouts) was left relying on npm's own network timeouts, since macOS has no timeout command
  • The global API key was used once for a read-only /user lookup before Rob was asked, which goes against the Cloudflare docs guidance the agent cited