Skip to content
Agentmart
Submit a tool

browser-foundation

Use when a Life Manager loop drives a registered Chromium identity, needs TikTok login, message, or authenticated-identity readback, leases CDP tabs or…

Skill by Daisuke134

IndexedMIT★ 8
Write a review

Install

Works with Claude Code, Claude apps, Codex, Cursor, Gemini CLI, GitHub Copilot, VS Code, OpenCode, Goose, Windsurf. Read the repository before you give any tool access to your data.

npx agentmarket install skill/daisuke134-browser-foundation

Asks which of your tools to add it to (Claude Code, Codex, Cursor, VS Code, Windsurf, Gemini CLI, Claude Desktop) and shows the change first. See https://agentmart.dev/cli.

Get the weekly diff

The weekly diff: one email a week with new agent tools, notable updates and grade changes, plus security alerts for tools you follow. Double opt-in, one-click unsubscribe.

We use your email only for this newsletter. Privacy

About

Use when a Life Manager loop drives a registered Chromium identity, needs TikTok login, message, or authenticated-identity readback, leases CDP tabs or contexts, restores sessions, or handles browser resource pressure.

No reviews yet. Installed it? Reviews come from verified installers only. How reviews work

Permissions

What this skill can do and what it asks for, from its SKILL.md. Checked Oct 25, 2026.

Tools
No tools found
Secrets
None asked for
Install scripts
None found
Runs as
Python package

Network hosts it talks to 1

  • codeload.github.com · found in install command

Files it touches

  • ~/.claude/skills/browser-foundation

What's inside

Skill name
browser-foundation
Description
Use when a Life Manager loop drives a registered Chromium identity, needs TikTok login, message, or authenticated-identity readback, leases CDP tabs or contexts, restores sessions, or handles browser resource pressure.
License
MIT
Instructions
139 lines in SKILL.md · view on GitHub

Before installing

  • Ships executable scripts

Agent Skills spec issues

  • name: "browser-foundation" does not match folder "browser"

Files (53)

  • SKILL.md
  • browser-context-lease.sh
  • browser-guard.sh
  • cdp_endpoint.py
  • cdp_persistent_context.py
  • ensure_browser.sh
  • ensure_provision_browser.sh
  • owned-persistent-context
  • recycle_idle_browsers.py
  • resolve_cdp_endpoint.py
  • index.json · scripts/.vcsdd/
  • cdp.py · scripts/
  • cdp_context_lease.py · scripts/
  • cdp_default_tab.py · scripts/
  • cdp_tab_gc.py · scripts/
  • run_with_file_lock.py · scripts/
  • scout.py · scripts/
  • session_vault.py · scripts/
  • session_vault_tick.sh · scripts/
  • target_ownership.py · scripts/
  • test_browser_context_handoff.py · scripts/
  • test_browser_guard_empty_lease.py · scripts/
  • test_cdp.py · scripts/
  • test_cdp_context_lease_acquire_lock.py · scripts/
  • test_cdp_context_lease_gc_lock.py · scripts/
  • test_cdp_context_lease_hangs.py · scripts/
  • test_cdp_context_lease_orphan_census.py · scripts/
  • test_cdp_context_lease_pid_reap.py · scripts/
  • test_cdp_context_lease_provisioning_deadline.py · scripts/
  • test_scout.py · scripts/
  • test_session_vault.py · scripts/
  • test_target_ownership.py · scripts/
  • test_tiktok_identity_readback.py · scripts/
  • test_tiktok_message_transport.py · scripts/
  • test_tiktok_user_search.py · scripts/
  • tiktok_identity_readback.py · scripts/
  • tiktok_message_transport.py · scripts/
  • tiktok_user_search.py · scripts/
  • sweep_tabs.py
  • test_cdp_endpoint.py · tests/
  • test_cdp_persistent_context.py · tests/
  • test_coconala_relogin.py · tests/
  • test_guard_legacy_lease.py · tests/
  • test_recycle_idle_browsers.py · tests/
  • test_resolve_cdp_endpoint.py · tests/
  • test_resolve_stale_devtools_port.py · tests/
  • test_session_vault_covers_gig.py · tests/
  • test_session_vault_covers_line_creators.py · tests/
  • test_session_vault_nested_loop.py · tests/
  • test_session_vault_partition_key.py · tests/
  • test_session_vault_tick_connector_urls.py · tests/
  • test_sweep_tabs.py · tests/
  • with-browser.sh

SKILL.md (first lines)

# Browser foundation — open your eyes before you work

Every autonomous loop here drives one shared, logged-in Chromium over CDP `:9222`
(profile `~/.cloak/profiles/daily-driver`). That browser is the single point of failure for the
whole business: when it dies, every loop goes blind and keeps "running" while doing nothing.

This actually happened (2026-07-13): Chromium died from memory pressure, the gig loop kept waking up
hourly for twelve hours and accomplished nothing, and the only recovery lived *outside* the loop in a
guard that fired once and gave up.

**Self-healing belongs inside the loop.** Call this at the top of every pass, before any browser step.

## Call this first, every pass

```bash
bash $LIFE_MANAGER_REPO/skills/browser/ensure_browser.sh          # ALIVE | RECOVERED | FAILED
python3 $LIFE_MANAGER_REPO/skills/browser/scripts/cdp_tab_gc.py   # close the tabs the last pass left behind
```

If `ensure_browser.sh` prints `FAILED`, do **not** hang or retry forever — skip the browser steps,
run whatever file-only work the pass can still do, and report the failure honestly.

The shared wrappers now close the common infrastructure gaps automatically. `with-browser.sh`
tries the registered identity's provisioner once and, when that identity is a protected persistent
profile, falls back to its launchd owner before reacquiring the same lease. `cdp_default_tab.py`
retries one typed CDP transport failure after `ensure_browser.sh` and one `ENOSPC` failure after
the allowlisted disk cleanup; ownership is never stolen and a newly-created tab is closed if its
ledger cannot be persisted. Exhaustion is reported as `browser_recovery_exhausted:<type>` with
the failed boundary, not as an unqualified "browser unavailable" message. Do not add a second
browser daemon or a raw-CDP bypass around these paths.

## What each piece is for

| Piece | Problem it solves |
|---|---|
| `ensure_browser.sh` | Chromium is dead → the loop is blind. Relaunches it with capped caches and restores the logins. Idempotent: prints `ALIVE` when it is already up. |
| `scripts/session_vault.py` | A hard kill takes the newest cookies with it → re-login → 2FA → **a human**, which breaks autonomy. Snapshots every cookie **and localStorage** (some SPAs keep the session token there) to `~/.cloak/vault/daily-driver/auth-state.json` (launchd `ai.anicca.session-vault`, every 30 min) and pushes it back in when the browser returns. Also does `keepalive` (extend the server-side session + detect logout) and `totp` (generate a 2FA code so re-login needs no human). |
| `scripts/cdp_tab_gc.py` | Each task opens a tab and nothing closes it. Fifteen-plus live tabs starved memory (load average past 21) and killed Chromium. Keeps one working tab, closes the rest. |
| `scripts/scout.py` | Articles teach theory; the deepest signal is on the actual winning pages. Every improve cycle should LOOK at who is already winning (top sellers, viral clips, best-selling apps) and copy what they do. Fetches winner pages (public via `crwl`, or logged-in via CDP) and returns their content for the loop's model to learn from. `python3 scripts/scout.py '{"urls":[...],"mode":"public\|browser"}'` |

```bash
python3 $LIFE_MANAGER_REPO/skills/browser/scripts/session_vault.py dump      # snapshot logins (cookies + localStorage)
python3 $LIFE_MANAGER_REPO/skills/browser/scripts/session_vault.py restore   # push them back into the browser
python3 $LIFE_MANAGER_REPO/skills/browser/scripts/session_vault.py status    # how many cookies, which origins, how old
python3 $LIFE_MANAGER_REPO/skills/browser/scripts/session_vault.py keepalive https://coconala.com/mypage/dashboard  # warm + detect logout
python3 $LIFE_MANAGER_REPO/skills/browser/scripts/session_vault.py totp @coconala   # fresh 2FA code from stored secret
```

Run `dump` right after any fresh login, so that login is banked forever.

## Staying logged in with ZERO human — the re-login ladder every loop follows

"Logged out" must never reach a human (a Telegram asking Dais to log in does not scale to hundreds of
accounts). When a page redirects to `/login`, the loop climbs this ladder itself, in order, and only
records a report — it never waits for a person:

```
1. session_vault.py restore            # push the banked cookies + localStorage back
2. session_vault.py keepalive <authed-url>   # still logged out?
3. still out → self-login with the account's OWN credentials:
     email + password (from env)  →  if 2FA asked: session_vault.py totp @<service>
   ★ Every earn account is created with an AI-owned email + app-based 2FA (TOTP secret stored in
     ~/.cloak/vault/daily-driver/totp-secrets.json, chmod 600). NEVER Dais's Google/passkey account —
     passkey and SMS-2FA cannot be finished by a machine. ★
4. only if all of the above fail: append a one-line report and run the file-only path. Do NOT block on a human.
```

The profile itself (`--user-data-dir`, never deleted, caches capped) is what keeps you logged in 99%
of the time; the ladder is for the rare server-side expiry. To cut expiry frequency: keep the profile,
keep a stable fingerprint, and (at scale) pin a sticky proxy per account.

## Rules for browser loops

- **Never launch your own Chromium** and never point at your own `--user-data-dir`. One browser, one
  profile. A second profile means a second set of logins, which means a human logging in twice.
- **Never close a tab you did not open**, and never kill the browser to "reset" it — that throws away
  everyone else's work. Use the tab GC.
- **Close what you open.** Tabs are the leak that kills the browser.
- Caches are capped at launch (`--disk-cache-size`, cache dir under `/tmp`). An uncapped profile grew
  to 1.0GB, 97% of it disposable cache, and filled the disk the loops write their ledgers to.

## Lease your own space — never share a tab with another loop

Loops used to share one tab space, so a `navigate` from clip would destroy the form gig was halfway
through filling, and neither could tell. Take a context instead: CDP `Target.createBrowserContext` is
"Similar to an incognito profile but you can have more than one", and nothing outside your context can
reach into it.

```bash
LEASE=$(AI_BROWSER_HOLDER_PID=$$ python3 $LIFE_MANAGER_REPO/skills/browser/scripts/cdp_context_lease.py acquire gig)   # your own space
WS=$(echo "$LEASE" | python3 -c 'import sys,json;print(json.load(sys.stdin)["ws"])') # drive this tab
# ... do the work over $WS ...
python3 $LIFE_MANAGER_REPO/skills/browser/scripts/cdp_context_lease.py release gig            # tabs die with it
```

A fresh context starts logged out, so `acquire` seeds it from the vault's cookies — verified live:
a leased context reaches `coconala.com/mypage/dashboard` already authenticated. A loop killed with -9
never releases, so run `cdp_context_lease.py gc --idle-min 45` from the healthcheck to reap what it
left holding.

Rules: one context per task, always `release` when done, never touch another task's context.

## TikTok authenticated identity readback

Do not infer authentication from page body text or a public `/@handle` URL. Under the
registered identity lease, use the shared adapter; it verifies the official navigation's
own-profile link, rejects a different signed-in identity, and closes only its owned tab.

```bash
bash skills/browser/with-browser.sh tiktok-anicca-jp -- \
  python3 skills/browser/scripts/tiktok_identity_readback.py \
  --expected-handle @anicca.jp --owner paid-tiktok-readback
```

Exit `0` means the expected identity is authenticated. Exit `2` means logged out,
indeterminate, or a different identity; consume its JSON status as an exact retry blocker.

For fresh candidate discovery, use the shared official user-search reader under the same
registered identity. It returns profile URLs only; the model still decides eligibility from

From Daisuke134/life-manager, MIT.

More from Daisuke134/life-manager

Signals

Stars
8
Forks
2
Open issues
2,737
Last commit (this folder)
Oct 23, 2026 (5 days ago)
Last release
Aug 15, 2026 (2 months ago)

From GitHub (fetched Oct 24, 2026).

Details

License
MIT
First seen
Oct 24, 2026
Last checked
Oct 24, 2026

More from Daisuke134

Cite this page

browser-foundation skill. Agent Mart. https://agentmart.dev/skills/daisuke134-browser-foundation (last updated 2026-10-24)