AI agent skill that researches any topic across Reddit, X, YouTube, HN, Polymarket, and the web - then synthesizes a grounded summary
Bird X cookies on Linux and Mac mini - Plan
Ship path: rewrite PR 1087 in place. Same branch. Do not open a second PR.
Goal: Feed bird a complete auth_token+ct0 from env, agentcookie cookies, or live Chrome login on Linux, a Mac mini (sysctl -n hw.model starts with Macmini), or Darwin agentcookie sink role. Leave a MacBook on main. grok pin-only everywhere. Do not detect Hermes or OpenClaw by install.
R1 extra-host sidecar → bird posts.
R2 macOS extract stays as main.
R3 never write AUTH_TOKEN/CT0 to .env.
R4 never print cookie values.
R5 doctor names real bird source.
R6 unpinned chain bird→xai→xurl→xquik; grok _X_BACKEND_OPT_IN; pin no failover.
R7 MacBook no agentcookie/CDP unless AGENTCOOKIE=on. Linux/Mac mini/sink: agentcookie if CLI present and not AGENTCOOKIE=off.
R8 missing sidecar is not a crash.
R9 no marketplace X plugin.
R10 Linux/Mac-mini Chrome login via CDP Network.getAllCookies, not SQLite.
R11 extra probe: env pair, agentcookie, CDP, extract if FROM_BROWSER set. First complete pair. No half-pair merge.
R12 MacBook FROM_BROWSER unset/off = no CDP.
R13 Darwin Keychain extract still works when FROM_BROWSER=auto or chrome.
R14 CDP extras-only.
R15 diagnose/preflight/doctor plan-only.
R16 Firefox/Safari/Windows/--no-browser-cookies as main.
R17 grok pin-only every OS.
R18 MacBook doctor must not predict bird from agentcookie-on-PATH.
R19 Mac mini: extract before CDP if FROM_BROWSER already opted in.
R20 CDP ports: BROWSER_CDP_URL, 18800 if Chrome, 9222+$DISPLAY. Chrome page target. No MacBook 9222-9232 scan.
R21 MacBook never reads sidecar.
R22 leftover grok + XAI_API_KEY uses xai.
AE8 MacBook hw.model MacBookPro, FROM_BROWSER unset, agentcookie on PATH, fake CDP, grok AUTH_OK, XAI_API_KEY → xai, no CDP, no agentcookie subprocess. AE10 Darwin hw.model=Macmini9,1 sidecar pair FROM_BROWSER unset → bird from agentcookie. MacBook + ~/.hermes still AE8. AE7 Linux no bird cookies, grok AUTH_OK, XAI_API_KEY → xai not grok.
KTD1 spawn agentcookie cookies --domain .x.com --json only when extras apply. Never open cookies-plain.db.
KTD5 do not change _X_BACKEND_ORDER or _X_BACKEND_OPT_IN vs main.
KTD7 CDP extras-only, Chrome page target.
KTD8 first complete pair, no merge.
Mac mini detect: sysctl -n hw.model prefix Macmini; sysctl failure → MacBook.
Darwin agentcookie sink role still gets extras on non-mini Darwin. Source role on a MacBook does not.
Implementation notes (as shipped)
env.x_extras_enabled(config)is the single gate: True whenAGENTCOOKIE=on, or platform is Linux, or a Darwin Mac mini (_mac_model()prefixMacmini), or a Darwin agentcookie sink (agentcookie.role_is_sink, a subprocess-free config-file read; parse failure = not sink). Never consults home dir, PATH, or Hermes/OpenClaw env.env._discover_and_apply_x_credentialsruns inreadmode only: env pair (never overwritten) → agentcookie (extras) → CDP (extras) → mainline browser extract; on a Mac mini with a browser opted in, the extract runs before CDP (R19). Sources apply atomically (no half-pair merge); labelsenv/agentcookie/chrome cdp/browser.chrome_cdpresolvesBROWSER_CDP_URL, else18800(only if/json/versionreports Chrome/Chromium), else9222+$DISPLAY; requires a Chrome page target; rejects a Node inspector. No port scan.env.x_pending_browser_authcounts the agentcookie sidecar as a pending source only on extra hosts, so a MacBook never predicts bird from an agentcookie binary on PATH (R18).- grok, backends, and doctor are unchanged from
main(grok pin-only;_X_BACKEND_ORDER = bird, xai, xurl, xquik;_X_BACKEND_OPT_IN = grok).
Copy this plan to docs/plans/ in the PR. Update the PR title/body: extras on Linux and Mac mini; MacBook last30days unchanged; grok pin-only.
Delta 2026-09-01 — the login recipe (proven live on Grok Bot)
CDP harvest alone was not enough: on a fresh Grok Bot NUX the Auto path only ran setup --allow-browser-cookies, which on Linux tries a sqlite extract, finds nothing, and never opens a login window. Two human logins hours apart proved the working recipe is: the agent launches a throwaway-profile Chrome via the host box-chrome wrapper on the last30days extras port, opens x.com/login, then hands the desktop to the human to type — driving the form itself (computerUse/overlay on the login) plus X rate-limit was the failure mode.
- Port fact:
18800is NOT box-chrome's built-in default. box-chrome usesSAND_CHROME_REMOTE_DEBUG_PORTor9222 + DISPLAY_NUM(on Grok BotDISPLAY=:7→9229).18800is the last30days extras NUX convention: the agent launches the throwaway withSAND_CHROME_REMOTE_DEBUG_PORT=18800sochrome_cdp._BOX_CHROME_PORTfinds it. Fixed thechrome_cdp.pydocstrings/constant comment and SKILL.md that wrongly called 18800 "the box-Chrome default." - Endpoint order unchanged:
BROWSER_CDP_URLexclusive if set, else 18800 if Chrome, else 9222+$DISPLAY; fall through on empty pair; pinBROWSER_CDP_URLafter NUX as the guard against a stale session answering on 18800. No port scan. - SKILL.md recipe added to BOTH the first-run Auto setup (Claude Code Modal Flow and Non-Modal Prose Flow, after "Yes — X cookies") and the "X on Linux / Grok Bot / Mac mini" repair section:
AGENTCOOKIE=offfor the harvest; launch box-chrome throwaway on 18800; do NOT fill/drive the form; hand off to the human; confirm signed in; pinBROWSER_CDP_URL=http://127.0.0.1:18800(neverAUTH_TOKEN/CT0); runsetup --allow-browser-cookies; stop on block/rate-limit. A MacBook skips all of this (Keychain/Firefox/Safari extract). R3 still holds — cookies are never written to.env. - Helper:
skills/last30days/scripts/box_chrome_login.pyprints the exact host-correct launch command (or--execlaunches it), extras-gated, no-op on a MacBook, reads no cookies and prints no cookie values. Tests lock: MacBook never spawns it; extras + box-chrome on PATH documents 18800;candidate_endpointsorder unchanged;FROM_BROWSER=offstill skips CDP. - Greptile constraints preserved: same host/path/partition cookie pairing; refuse
wss:///https://CDP bases.
Delta 2026-09-01b — harvest confirmed; flag delta corrected
A live harvest with exclusive BROWSER_CDP_URL=http://127.0.0.1:9334 returned a complete same-host x.com auth_token+ct0 (path /, unpartitioned); doctor reported bird=ok and the ~/.config/last30days/.env sha256 was unchanged (R3 holds — no cookie values persisted).
The working-vs-failing difference was the launcher, not the user-agent:
- Working (9334): launched via
box-chrome→--class=box-chrome,--enable-unsafe-swiftshader, no--ignore-gpu-blocklist. TheGrokAgentUA token was NOT in argv (this box has/tmp/sand-ua-token-disabled). - Failed (18800 the night before): a raw Chrome with
--class=l30d-pr1087-chrome(NOTbox-chrome), same swiftshader, same absence of the GrokAgent UA.
So: launch via box-chrome (class box-chrome); do NOT launch raw Chrome with a custom --class; do NOT claim the GrokAgent UA is required or was present. The human types the login; the agent never drives the form. Pin BROWSER_CDP_URL to the debug port the Chrome actually listens on (18800 for the convention launch, or the real port such as 9334). 18800 remains the last30days NUX convention, not box-chrome's built-in default. SKILL.md, the helper, and CONFIGURATION.md updated accordingly; a test locks that the helper command goes through box-chrome with no custom --class.