agentleFS
rakaarwakyrakaarwaky/agents-arwaky/skills/brave-automation/brave-provider-auth/SKILL.md

brave-provider-auth

Skill0 starsChanged 8 days agoMITView on GitHub

Use when authenticating AI providers across Brave profiles.

The file

We split this skill into the rules it gives an agent

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

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈2

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 4

    Very specific

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

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

    Explicit Display: Always launch Brave with DISPLAY=:1 (or current $DISPLAY).

    line 13
  2. Distinctive:

    Handle Email Form Backtrack: If an email/password form appears on the provider page, detect the "Back to sign in options" button and click …

    line 15
  3. Very specific:

    Playwright Event Loop Conflict: When mixing headless dashboard automation and CDP profile automation, reuse the existing sync_playwright() …

    line 22
  4. Very specific:

    No Idle-Sleep Polling: Never sleep for long intervals (sleep 60/120/180) while polling or diagnosing stuck runs.

    line 25
  5. Very specific:

    Handle myaccount.google.com Redirect: If clicking an account in the chooser signs the user into Google but drops OAuth params, …

    line 33
  6. Distinctive:

    Dashboard Modal: Must keep the OmniRoute dashboard browser/modal OPEN during device authorization.

    line 50

≈ “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

Brave Provider Auth Automation

Automation recipes and operational rules for connecting third-party AI providers to the local OmniRoute gateway (http://127.0.0.1:7777) across isolated Brave profiles (profile.csv).

Core Rules

  1. Explicit Display: Always launch Brave with DISPLAY=:1 (or current $DISPLAY). Background/daemon terminal processes default to empty DISPLAY and fail to acquire X11/CDP locks.
  2. Never Passkey: On modern AI provider login surfaces (like Kilo Code / app.kilo.ai), the UI defaults to passkey prompts ("Waiting for your passkey…"). Always target "Continue with Google" or "or see other sign-in methods". Never click generic "sign in" or "continue" buttons that trigger passkeys.
  3. Handle Email Form Backtrack: If an email/password form appears on the provider page, detect the "Back to sign in options" button and click it to recover the "Continue with Google" option.
  4. Session Cookie Injection: Load session cookies from ~/.local/share/baa/session/{profile}_cookies.json into the Brave CDP context before navigating. This preserves Google authentication and avoids fresh-login security challenges.
  5. Keep Dashboard Modal Open: For device-auth flows (like Kilo Code), keep the OmniRoute dashboard browser/modal open during authorization so its backend poller can receive the token and write to storage.sqlite.
  6. Multilingual Consent: Handle Google OAuth consent buttons in both English ("Continue", "Allow") and Indonesian ("Lanjutkan", "Setuju"). Always compile matching regexes without anchors (^...$) because Google buttons often enclose newlines or inner spans (\nLanjutkan\n).
  7. Human-in-the-Loop for Security Challenges:
    • Google reCAPTCHA / "Confirm you're not a robot" and phone 2FA (challenge/dp) cannot and must not be solved via blind click scripts.
    • Yield execution to the user with an interactive runner (kc_interactive.py), announce the specific challenge clearly, and poll for DB updates.
  8. Playwright Event Loop Conflict: When mixing headless dashboard automation and CDP profile automation, reuse the existing sync_playwright() instance rather than calling .start() multiple times on the same thread. Ensure playwright install chromium has run in the environment.
  9. Inspect before scripting: Before writing click logic for a new provider, open the auth page in a visible Brave window and enumerate get_by_role("link") and get_by_role("button") separately. OAuth "Continue with X" elements are often <a> links, not buttons — a button locator matches zero elements and the loop spins without action. Confirm the element role matches the locator role before automating.
  10. Strict mode violations: get_by_role with a name regex can match multiple elements (e.g. two "Connect" buttons in a dialog). Always use .first.click() to avoid strict mode violation errors that abort the entire run.
  11. No Idle-Sleep Polling: Never sleep for long intervals (sleep 60/120/180) while polling or diagnosing stuck runs. Inspect process state and logs actively, detect page DOM changes immediately, and enforce hard timeouts per stage.
  12. CDP Port & Process Tree Cleanup: Terminating only the parent Brave process leaves zygote and renderer children holding the debugging port. Always issue pkill -9 -f "remote-debugging-port={PORT}" and verify port release via HTTP probe (/json/version) before starting the next profile.

Google OAuth & Account Chooser Recipes

  • Account Selection: On Google account chooser pages (v3/signin/accountchooser), select the target account via page.locator(f'[data-identifier="{email}"]').first.click(force=True). Generic text or [role=link] clicks fail because Google binds internal handlers to data-identifier containers.
  • Check Consent Screen Before Chooser Fallbacks: Always evaluate for the OAuth consent screen (accounts.google.com/signin/oauth/id or v3/consent) BEFORE evaluating account chooser logic. On consent screens data-identifier is absent; running chooser checks first causes the automation to falsely assume the account is missing and trigger fallback navigations that abort the OAuth flow.
  • Signed Out Chooser Fallback: If the account card displays "Signed out", do not navigate to /signin/v2/identifier (Google redirects back to the chooser). Click "Use another account" / "Gunakan akun lain" to access the form, then fill input[name="identifier"] (type is text, not email) and input[type="password"] using credentials from profile.csv.
  • Handle myaccount.google.com Redirect: If clicking an account in the chooser signs the user into Google but drops OAuth params, redirecting to myaccount.google.com, immediately re-navigate to the original auth_url. The active session will auto-proceed through the OAuth flow.

Provider Patterns

Cline (api.cline.bot)

  • Type: OAuth redirect + callback-paste flow.
  • AuthKit page: Cline uses AuthKit (authkit.cline.bot), NOT the same UI as Kilo Code. "Continue with Google" is a <a> link, not a <button> — use page.get_by_role("link", name=re.compile(r"continue with google", re.IGNORECASE)). Clicking a button locator silently matches nothing and the script loops forever.
  • Dashboard flow: Dashboard Connect button → consent dialog ("I understand, continue") → dialog with auth URL input → extract URL → open in Brave → after Google login, redirect chain goes authkit.cline.bot → accounts.google.com → api.cline.bot/api/v1/auth/callback → localhost:7777/callback?code=...&state=... → capture the final callback URL → paste it back into the dashboard dialog's second input and click Connect.
  • Callback URL capture: Poll page.url for localhost:7777/callback or (code= AND localhost). Do not stop at api.cline.bot — that is an intermediate redirect, not the final callback.
  • Google consent: Same multilingual consent patterns as other providers (Continue/Allow/Lanjutkan/Setuju/Izinkan).
  • Challenge handling: Same as other providers — if Google shows reCAPTCHA/2FA/password, switch to interactive runner and wait for manual resolution.
  • Success verification: Query ~/.omniroute/storage.sqlite for SELECT email FROM provider_connections WHERE provider='cline' AND is_active=1.

Provider Patterns

Kilo Code (app.kilo.ai)

  • Type: Device auth flow (/device-auth?code=XXXX-XXXX).
  • Dashboard Modal: Must keep the OmniRoute dashboard browser/modal OPEN during device authorization; closing it early breaks backend token polling.
  • Session Cookie Injection: Load session cookies from ~/.local/share/baa/session/{profile}_cookies.json into the Brave CDP context before navigating to avoid unexpected re-authentication.
  • Initial page: Defaults to passkey wait. Action: click button[name*="Continue with Google"] (if email form appears, click "Back to sign in options" first).
  • Google OAuth: Selects profile in account chooser. Fills password from profile.csv if prompted.
  • Multilingual Consent: Clicks consent button supporting both English ("Continue", "Allow") and Indonesian ("Lanjutkan", "Setuju").
  • Challenge state: Google may prompt with signin/challenge/recaptcha or signin/challenge/dp (phone 2FA). Pause automation with interactive runner and notify user.
  • Success: Clicks "Authorize" on Kilo Code device page, then verifies registration in ~/.omniroute/storage.sqlite.

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.