agentleFS
soulmachinesoulmachine/skills/apwcli-pair/SKILL.md

apwcli-pair

Skill3 starsChanged yesterdayMITView on GitHub

Pair apwcli's daemon with Apple Passwords (iCloud Keychain) with nobody at the screen, by reading the macOS 6-digit PIN through Accessibility and submitting it. Use when apwcli says "session is not paired" or "pairing cancelled", after a Mac reboots or logs out, or to pair a fleet Mac over ssh.

The file

We split this skill into the rules it gives an agent

2 rules. About 0 are common, 0 are distinctive, and 2 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈0

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 2

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    When exit 3 persists on an unlocked, granted host, read the PIN another way and submit it by hand: apwcli daemon pair --pin <digits> right …

    line 52
  2. Very specific:

    If Apple moves it, dump the window with osascript -e 'tell application "System Events" to tell process …

    line 62

≈ “Common” is an estimate: at least 1 in 5 of the 364,980 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

apwcli-pair

apwcli's daemon pairs with Apple's password helper once per login session. Pairing shows a 6-digit PIN in a macOS window, "Verification Code", that a person normally reads and types. This script reads it through Accessibility and submits it, so no one needs to be at the screen.

Commands

# on the Mac itself
~/.agents/skills/apwcli-pair/scripts/apwcli-pair

# another fleet Mac, from anywhere
ssh -o BatchMode=yes -o ConnectTimeout=15 <host> 'zsh -lc ~/.agents/skills/apwcli-pair/scripts/apwcli-pair'

A paired host prints already paired and exits 0, so the command is safe to repeat. Check the result with apwcli pw get github.com, not with apwcli daemon status: its pairing line reads "not paired" for a few seconds while a challenge is open even when the session works.

ExitMeaningDo
0paired or already pairedcarry on
1the helper rejected the PINrun it again; a second failure means a stale window, so apwcli daemon restart first
2apwcli error (no daemon, no browser)run apwcli doctor on that host
3no PIN visible within 15 ssee preconditions; then the fallback

Preconditions

  • apwcli installed: the apwcli role of macbook-provision does it (uv tool install apwcli), with Google Chrome present for the daemon's headless browser.
  • The Mac is logged in and unlocked. A locked screen hides windows from Accessibility.
  • The process that runs the script has Accessibility. Over ssh that is /usr/libexec/sshd-keygen-wrapper; in a terminal it is the terminal app. Check before blaming the script (query from ~/.agents/docs/macos-tcc.md):

    sqlite3 -readonly '/Library/Application Support/com.apple.TCC/TCC.db' \
      "select client, auth_value from access where service='kTCCServiceAccessibility' and client like '%sshd%'"

    2 means allowed. Granting it needs a person once; on 2026-10-28 every fleet Mac with apwcli already had it (mac-mini-m6, mac-mini-m2, archs-mac-mini, dev-server-frank-lume, macbook-pro-m3).

Fallback

When exit 3 persists on an unlocked, granted host, read the PIN another way and submit it by hand: apwcli daemon pair --pin <digits> right after the window appears, or ask Frank for the digits. A screenshot over ssh needs Screen Recording for sshd, which only mac-mini-m2 has.

Notes

  • Pairing lasts for the login session. Rerun after a reboot. The daemon needs no restart.
  • The PIN is single-use and is printed only with --verbose.
  • scripts/apwcli-pair --selftest checks the digit parser without touching apwcli.
  • Measured on macOS 26: the PIN is the one static text in group 1 of the window, as "123 456". If Apple moves it, dump the window with osascript -e 'tell application "System Events" to tell process "PasswordManagerBrowserExtensionHelper" to get entire contents of window 1' and fix _PIN_QUERY in scripts/pair.py.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.