agentleFS
citrolabscitrolabs/ego-lite/AGENTS.md

ego-lite

AGENTS.md17k starsChanged 3 months agoMITView on GitHub

ego-browser is a Node.js CDP browser-automation harness for AI agents. It drives the ego lite browser through globalThis.ego bindings (provided by the closed-source ego lite app), exposes a compact snapshot/ref workflow, and layers reusable site-specific knowledge ("learnings") on top of the browser runtime. This repo contains the open-source harness and the agent skill package — not the browser itself. The ego lite app bundles its own ego-browser binary that embeds this runtime; skills/ego-browser/SKILL.md documents that binary's usage (ego-browser nodejs <<'EOF'…

Trending

Less talk lately.about the whole repository

Dec 2025: 0 mentionsJan 2026: 0 mentionsFeb 2026: 0 mentionsMar 2026: 0 mentionsApr 2026: 0 mentionsMay 2026: 1 mentionJun 2026: 3 mentionsJul 2026: 17 mentionsAug 2026: 14 mentionsSep 2026: 6 mentionsOct 2026: 22 mentionsNov 2026: 1 mention
Dec 2025Jun 2026Nov 2026
Mentions a month of the citrolabs/ego-lite repository that our weekly crawl found. There is no adoption data for this file yet.

Who's talking about citrolabs/ego-lite

The biggest 5 of 64 mentions linking to the repository that our crawl found. Each line is their own headline.

See all 64

Talked about on GitHub, Bluesky and Hacker News (64 times).

On GitHub · 50

45 more on GitHub

On Bluesky · 13

8 more on Bluesky

On Hacker News · 1

  • Where files are headingNew AGENTS.md files have more rules about keeping secrets out of the code, and fewer about checking a change actually works.

    Of the AGENTS.md files we read, the 11,773 first seen in the last six months, against the older ones: the kind of rule that gained most share, and the kind that lost most. About files like this in general, not this one, and an estimate, since a kind is a pattern in the words.

  • In this repository2 other files it gives its agents.

The file

We split this AGENTS.md into the rules it gives an agent

1 rule. About 0 are common, 1 is distinctive, and 0 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.

  • 0

    Very specific

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

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Do not link another runtime, reuse a prior E2E space, or manually take control while the suite is running.

    line 82

≈ “Common” is an estimate: at least 1 in 5 of the 16,595 AGENTS.md 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
AGENTS.md

Repository Guidelines

Project Overview

ego-browser is a Node.js CDP browser-automation harness for AI agents. It drives the ego lite browser through globalThis.ego bindings (provided by the closed-source ego lite app), exposes a compact snapshot/ref workflow, and layers reusable site-specific knowledge ("learnings") on top of the browser runtime.

This repo contains the open-source harness and the agent skill package — not the browser itself. The ego lite app bundles its own ego-browser binary that embeds this runtime; skills/ego-browser/SKILL.md documents that binary's usage (ego-browser nodejs <<'EOF' ... EOF). The repo CLI built here takes the heredoc directly on stdin with no subcommand.

Architecture & Data Flow

  • package/ego-browser/src/index.ts is the entrypoint with two startup paths:
    • Executed directly as a CLI → runMain() (reads JavaScript from stdin, executes it).
    • Imported as a module (how the app embeds it) → installEgoSdk(globalThis).
  • Both paths expose the same helper surface. public-api-schema.ts is the source of truth for the v2 API shown by help() and the generated reference; helpers.ts combines it with the frozen v1 compatibility surface.
  • src/run.ts executes stdin JavaScript inside an async function with the helpers injected as parameters.
  • src/browser-runtime.ts owns CDP transport over ego.sendCDPMessage, session attach/caching (2s TTL, auto re-attach on session loss), the buffered event queue (10k cap), and JS dialog tracking.
  • src/cdp-eval.ts provides cdp() and js() (string-expression evaluation; top-level return is auto-wrapped in an IIFE).
  • src/element-resolver.ts resolves all target forms — @N refs, loc=css: / loc=role: / loc=href: locators, xpath=, raw CSS — and classifies failures as transient (retryable) or permanent.
  • src/page-ref-registry.ts + src/page-ledger.ts: v2 Page refs (@21, not @e21) are SDK-assigned ids bound to one frame/document/backend node. Their mappings and invalidation persist across rounds; partial snapshots merge by node identity and full snapshots replace the active set. Missing refs require a fresh snapshot. src/ref-map.ts + src/ref-state.ts retain the v1 native-ref refresh behavior.
  • src/driver/ — nav (tabs, navigation), pointer (click/scroll/drag), keyboard, observe (snapshot/screenshot), waits, files (upload), element-ops (objectId handles), load.
  • src/learning/ — discovery, validation, and execution of site skills from skills/ego-browser/learnings/<site>/manifest.json (runSiteTool, runSiteBrowserTool, learnContext).
  • src/state.ts is the shared mutable runtime state singleton; src/env.ts resolves the agent workspace (EGO_BROWSER_AGENT_WORKSPACE, falling back to the skill dir bundled next to the build output, then the repo's skills/ego-browser).
  • src/help-runtime.ts parses the built bundle's JSDoc with acorn at runtime to power help() — JSDoc on exported helpers is therefore user-facing documentation.

Data flow: stdin JS → runMain() → helperContext() helpers → browser runtime/CDP → snapshot or DOM/AX resolution → optional site tools → cliLog(...).

Task Spaces

Task spaces are isolated browsing contexts with an ownership model (agent / user):

  • New scripts use taskSpace(nameOrId) and operate through the returned TaskSpace and labeled Page objects.
  • task.pages() returns managed Page handles; task.tabs() returns the full managed and unmanaged tab inventory.
  • Control handoff uses task.handOff() and takeOverTaskSpace(spaceId).
  • The old global helpers remain available only for v1 script compatibility.

Key Directories

  • package/ego-browser/src/ — runtime, helpers, resolver, drivers, learning subsystem.
  • package/ego-browser/src/**/*.test.mjs — tests are colocated with the code (there is no separate test/ directory).
  • package/ego-browser/scripts/ — build.mjs (esbuild per-file → dist/src, rollup bundle → dist/out/index.js, copies skills/ego-browser → dist/out/ego-browser), validate-site-skills.ts, and the real-browser E2E runner.
  • skills/ego-browser/ — agent skill package: SKILL.md (canonical agent-facing usage guide), references/install.md, scripts/install.sh.
  • skills/ego-browser/learnings/ — reusable per-site experience packs (manifest.json + notes/ + tools/ + browser-tools/).

Development Commands

Run from package/ego-browser/:

  • npm test — build, typecheck, then node --test over src/**/*.test.mjs.
  • npm run e2e — self-contained real-browser E2E suite using the current checkout through --sdk-path.
  • npm run validate:site-skills — validate learned site skills.
  • node dist/out/index.js <<'JS' ... JS — run the built CLI from this checkout (requires an ego runtime for real browser work; -h is also supported).

Code Conventions & Common Patterns

  • ESM only ("type": "module"); Node 22+.
  • Public helpers are camelCase, verb-first for async actions (ensureSession, runSiteTool).
  • V2 TaskSpace and Page time parameters are milliseconds. The v1 compatibility helpers keep their original units.
  • Helpers are injected into the script scope, not imported by agent scripts.
  • New v2 APIs go through public-api-schema.ts; keep runtime validation, generated reference, architecture, and SKILL.md in sync.
  • Snapshot refs (@N) are short-lived; re-snapshot after navigation or DOM changes and prefer stable loc=... values for reuse.
  • Element-resolution failures should use ElementResolutionError with an honest transient/permanent kind — wait loops rely on it.
  • The code prefers the small shared state singleton (src/state.ts) over threading connection state through call sites.
  • Site skills must stay site-shaped and verifiable: stable URLs, durable selectors, no pixel coordinates, no secrets.

Testing & QA

  • Framework: Node's built-in runner (node --test), assertions via node:assert/strict.
  • Tests run against the build output (dist/src/...) — npm test builds first.
  • Behavior-focused tests inject overrides (__testing.setOverrides) or a FakeEgo double (see src/helpers.test.mjs and src/page-model.test.mjs).
  • Cover session handling, locator resolution, helper behavior, and site-skill validation when changing runtime code; run npm run validate:site-skills for learning changes.
  • npm run e2e is the self-contained real-browser gate. It builds the current checkout, passes the resulting absolute bundle through --sdk-path, starts a local fixture server, uses a unique temporary task space, and cleans it up. Do not link another runtime, reuse a prior E2E space, or manually take control while the suite is running.

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.