chromium-profile-provisioning
Skill0 starsChanged 57 days agoMITView on GitHub
Create or inspect Brave/Chromium profile dirs and prefs. Not driving pages.
- Reads credentials
- Installs packages
In this repository156 other files it gives its agents.
- AGENTS.mdAGENTS.md
- aes-agentSkill
- aes-capabilitiesSkill
- aes-contractSkill
- aes-docsSkill
- aes-lint-arwakySkill
- aes-migrationSkill
- aes-rootSkill
- aes-surfaceSkill
- aes-taxonomySkill
- aes-testing-suiteSkill
- aes-utilitySkill
- omnirouteSkill
- xai-apiSkill
- android-emulator-linux-gpsSkill
- flatpak-chromium-automationSkill
- qwen-web-arwaky-devSkill
- qwen-webSkill
- agent-tool-collectionSkill
- coding-agent-delegationSkill
- computer-useSkill
- hermes-agentSkill
- hermes-home-cleanupSkill
- hermes-messaging-gatewaysSkill
- merge-reconcilerSkill
- codegraphSkill
- cleanup-consolidateSkill
- codacy-analysis-cliSkill
- codacy-cloud-cliSkill
- codacy-code-reviewSkill
- codebase-inspectionSkill
- coderabbit-reviewSkill
- configure-codacy-cloudSkill
- configure-codacySkill
- fix-bypassSkill
- fix-markdown-inline-htmlSkill
- harness-source-auditSkill
- no-mistakesSkill
- ponytail-auditSkill
- ponytail-debtSkill
- ponytail-gainSkill
- ponytail-helpSkill
- ponytail-reviewSkill
- ponytailSkill
- report-linter-false-positiveSkill
- setup-coverageSkill
- architecture-diagramSkill
- ascii-artSkill
- ascii-videoSkill
- baoyu-infographicSkill
- comfyuiSkill
- excalidrawSkill
- humanizerSkill
- manim-videoSkill
- no-ai-slopSkill
- p5jsSkill
- popular-web-designsSkill
- pretextSkill
- sketchSkill
- songwriting-and-ai-musicSkill
- The first 60 shown.
The file
We split this skill into the rules it gives an agent
9 rules. About 0 are common, 1 is distinctive, and 8 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈1
Distinctive · estimate
This author's own choices. Worth a look.
8
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 29
Before assuming an env var or flag creates browser profiles, grep its READERS: BWC_PROFILE_*-style names are often just credential labels …
- Very specific: line 43
Always export an env override for the user-data dir (<APP>_BRAVE_USER_DATA_DIR style, absolute-path required).
- Distinctive: line 61
Verify the refusal itself against the real running browser (exit != 0, then assert nothing new appeared in the tree) instead of testing …
- Very specific: line 69
Create the dir 0700 and seed Preferences 0600 with profile.{name, avatar_index (match existing profiles, e.g.
- Very specific: line 73
Add info_cache[<dir>] (name, active_time unix float, metrics_bucket_index = current metrics.next_bucket_index), append the dir to …
- Very specific: line 94
When one NAME|user|pass|url env var feeds two subsystems (vault items AND browser profiles), parse it in exactly one module and alias the …
- Very specific: line 103
Never load such a file with set -a.
- Very specific: line 120
When the package computes paths at import time, ALL test modules must share one sandbox established in tests/conftest.py (imported before …
- Very specific: line 135
If npm prefix -g is a node outside PATH (e.g.
≈ “Common” is an estimate: at least 1 in 5 of the 213,897 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.
Files
Provisioning Chromium/Brave browser profiles
What "a profile exists" actually means
A profile is real only when BOTH agree:
- a directory (e.g.
Profile 9) under the user-data dir, - its registration in
Local State→profile.info_cache(plusprofiles_orderfor the picker andmetrics.next_bucket_indexso the per-profile metrics bucket stays unique).
Launching with --profile-directory=<new> auto-creates the directory, but the
info_cache entry lands only later, so discovery that reads Local State
stays blind to it. If the tool must see/create profiles deterministically, it
has to write the registry itself.
Before assuming an env var or flag creates browser profiles, grep its READERS:
BWC_PROFILE_*-style names are often just credential labels for another system
(e.g. vault items) and the browser-profile list flows the other way, read-only
from Local State.
User-data dir locations (probe in order, first Local State hit wins)
- Linux native:
$XDG_CONFIG_HOME/BraveSoftware/Brave-Browser - Flatpak:
~/.var/app/com.brave.Browser/config/BraveSoftware/Brave-Browser - Snap:
~/.snap/brave/.config/BraveSoftware/Brave-Browser - macOS:
~/Library/Application Support/BraveSoftware/Brave-Browser - Windows:
%LOCALAPPDATA%\BraveSoftware\Brave-Browser\User Data(note the extraUser Datalevel)
Always export an env override for the user-data dir (<APP>_BRAVE_USER_DATA_DIR
style, absolute-path required). It is what makes the destructive path testable
against a fake tree and lets multi-install machines pin one browser.
Hard gate: edit only a provably-closed browser
A running Chromium rewrites Local State (and Preferences) when it exits —
registry edits made underneath it are silently lost, and you may read it
mid-write. Detect via the SingletonSocket AF_UNIX listener at the user-data dir root
(Chromium unlinks it on clean shutdown): connect succeeds -> running ->
refuse; ECONNREFUSED or absent -> closed, safe. Do NOT decide liveness from
the SingletonLock symlink's pid (<hostname>-<pid>) via os.kill: under
flatpak the recorded pid is sandbox-internal (often 1-3) and os.kill on it
raises EPERM, which reads as "alive" forever and wedges the guard on a dead
browser. A pid <= 3 is never the browser. Foreign hostname, unreadable socket,
or Windows (Lockfile is an exclusive handle, not a symlink) -> UNKNOWN ->
refuse too, unless the caller passes an explicit --yes/assume_not_running
escape hatch.
Verify the refusal itself against the real running browser (exit != 0, then
assert nothing new appeared in the tree) instead of testing only the happy path.
Creating a profile (browser closed)
- Back up
Local State(Local State.bwc-backup-<timestamp>) before the first rewrite of a run; keep repeat-runs idempotent (second call = "exists", no second write). - Create the dir 0700 and seed
Preferences0600 withprofile.{name, avatar_index (match existing profiles, e.g. 26), creation_time (Chrome epoch: (unix_ts + 11644473600) * 1e6 microseconds), exit_type "Normal", managed false}. - Add
info_cache[<dir>](name,active_timeunix float,metrics_bucket_index= currentmetrics.next_bucket_index), append the dir toprofiles_order, incrementnext_bucket_indexandprofiles_created. - Serialize
Local Stateas compact JSON (separators=(',',':')) at 0600.
Correctness traps:
- Match existing profiles CASE-INSENSITIVELY (
profile 1vs registeredProfile 1) — Chromium does, and creating a sibling causes picker chaos. - Resolve names against BOTH the
info_cachefolder key and itsnameattribute (the display name Brave's menu shows, e.g. keyDefault/ displayarwaky90). A user-written name equal to a display name must map to the existing folder; folder-only matching clones an empty twin under a name the user believes is taken. - Validate the name before any filesystem/CLI use: reject
/,\,.., and leading-(the dir name gets re-injected as a browser flag). - Count a dir as a profile only when it holds a
Preferencesfile — the user-data dir is littered with non-profile dirs (Crashpad, extension IDs).
Single source of truth for the env format
When one NAME|user|pass|url env var feeds two subsystems (vault items AND
browser profiles), parse it in exactly one module and alias the old helper to
it — two hand-rolled parsers drift the moment the format changes.
The trailing url field is vault-side only: it becomes the item's
login.uris[].uri autofill match (Google accounts: https://accounts.google.com
— Bitwarden's default base-domain match then covers mail/drive subdomains).
Profile creation ignores it.
Never load such a file with set -a; source .env — the | separators are shell
pipes and the lines explode. Parse it with python-dotenv (dotenv_values /
load_dotenv) instead.
Testing without touching the live browser
- Point the user-data-dir override at an
mkdtempfake tree; synthesize "running" by binding andlisten()ing a unix socket at theSingletonSocketpath (that is what the guard probes), and "closed" by closing it. A staleSingletonLockpointing at an unrelated pid (evenhostname-2) must read as closed. - Assert permissions (0700 dir / 0600 prefs + Local State), backup contents (must be the PRE-edit state), dry-run writes zero bytes, and bootstrap from a never-existed dir.
- Type-check the new module at the repo's strictness (
mypy --strict), and separate your errors from legacy debt with a baseline:git stash -u, re-run,git stash pop, compare counts. - When the package computes paths at import time, ALL test modules must share
one sandbox established in
tests/conftest.py(imported before any test module). A per-module env-setup block loses to collection order: the first importing module wins and the others' isolation assertions fail against the live$HOMEpaths.
Bitwarden CLI (bw) companion setup
The vault half of the flow needs bw, which the browser automation does not
bundle:
- Install PINNED:
npm install -g @bitwarden/cli@<latest-release>— version 2026.4.0 is flagged malicious by npm threat intelligence, so an unpinned resolve can land on it; checknpm view @bitwarden/cli versionsand pick the newest non-flagged release. - If
npm prefix -gis a node outside PATH (e.g. editor-bundled node), the binary installs invisible tocommand -v bw. Symlink it:ln -sf "$(npm prefix -g)/bin/bw" ~/.local/bin/bw. - Non-interactive login without exposing the password in argv:
bw login <email> --passwordenv BWC_PASSWORD(export the var first).
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
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.

