agentleFS
alibabaalibaba/page-agent/AGENTS.md

page-agent

AGENTS.md29k starsChanged 5 months agoMITView on GitHub

This is a monorepo with npm workspaces: Internal packages: Source-first monorepo: library package.json exports point to src/*.ts during development. At publish time, scripts/pre-publish.js promotes publishConfig fields to top-level (swapping to dist/), and scripts/post-publish.js restores the originals. workspaces in package.json must be in topological order. All communication is async and isolated:

Trending

Less talk lately.about the whole repository

Dec 2025: 1 mentionJan 2026: 1 mentionFeb 2026: 0 mentionsMar 2026: 19 mentionsApr 2026: 4 mentionsMay 2026: 7 mentionsJun 2026: 9 mentionsJul 2026: 14 mentionsAug 2026: 1 mentionSep 2026: 3 mentionsOct 2026: 6 mentionsNov 2026: 2 mentions
Dec 2025Jun 2026Nov 2026
Mentions a month of the alibaba/page-agent repository that our weekly crawl found. There is no adoption data for this file yet.

Who's talking about alibaba/page-agent

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

See all 67

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

On GitHub · 45

40 more on GitHub

On Bluesky · 19

14 more on Bluesky
  • 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 repository6 other files it gives its agents.

The file

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

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

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈6

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 2

    Very specific

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

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    All communication is async and isolated:

    line 59
  2. Distinctive:

    If tool needs DOM ops, add method to PageController first

    line 120
  3. Very specific:

    Add implementation in packages/page-controller/src/actions.ts

    line 125
  4. Distinctive:

    Test value: Do not add redundant tests or directly translate implementation code into assertions.

    line 131
  5. Very specific:

    Adding tests to a new package: create vitest.config.ts in the package and add a "test": "vitest run" script.

    line 135
  6. Distinctive:

    Every change you make should not only implement the desired functionality but also improve the quality of the codebase

    line 149
  7. Distinctive:

    All code and comments must be in English.

    line 150
  8. Distinctive:

    Do not try to hide errors or risks.

    line 151

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

Instructions for Coding Assistants

Project Overview

This is a monorepo with npm workspaces:

  • Page Agent (packages/page-agent/) - Main entry with built-in UI Panel, published as page-agent on npm
  • Extension (packages/extension/) - Browser extension (WXT + React)
  • Website (packages/website/) - React docs and landing page. When working on website, follow packages/website/AGENTS.md

Internal packages:

  • Core (packages/core/) - PageAgentCore without UI (npm: @page-agent/core)
  • LLMs (packages/llms/) - LLM client with reflection-before-action mental model
  • Page Controller (packages/page-controller/) - DOM operations and visual feedback (SimulatorMask), independent of LLM
  • UI (packages/ui/) - Panel and i18n. Decoupled from PageAgent

Development Commands

npm start                      # Start website dev server
npm run build                  # Build all packages
npm run build:libs             # Build all libraries
npm run build:ext              # Build and zip the extension package
npm run typecheck              # Typecheck all packages
npm run test                   # Run unit tests across all workspaces
npm run lint                   # ESLint

Architecture

Monorepo Structure

Source-first monorepo: library package.json exports point to src/*.ts during development. At publish time, scripts/pre-publish.js promotes publishConfig fields to top-level (swapping to dist/), and scripts/post-publish.js restores the originals.

packages/
├── core/                    # npm: "@page-agent/core" ⭐ Core agent logic (headless)
├── page-agent/              # npm: "page-agent" entry class (with UI + controller + demo builds)
├── website/                 # @page-agent/website (private)
├── llms/                    # @page-agent/llms
├── extension/               # Browser extension
├── page-controller/         # @page-agent/page-controller
└── ui/                      # @page-agent/ui

workspaces in package.json must be in topological order.

Module Boundaries

  • Page Agent: Main entry with UI. Extends PageAgentCore and adds Panel. Imports from @page-agent/core, @page-agent/ui
  • Core: PageAgentCore without UI. Imports from @page-agent/llms, @page-agent/page-controller
  • LLMs: LLM client with MacroToolInput contract. No dependency on page-agent
  • UI: Panel and i18n. Decoupled from PageAgent via PanelAgentAdapter interface
  • Page Controller: DOM operations with optional visual feedback (SimulatorMask). No LLM dependency. Enable mask via enableMask: true config

PageController ↔ PageAgent Communication

All communication is async and isolated:

// PageAgent delegates DOM operations to PageController
await this.pageController.updateTree()
await this.pageController.clickElement(index)
await this.pageController.inputText(index, text)
await this.pageController.scroll({ down: true, numPages: 1 })

// PageController exposes state via async methods
const simplifiedHTML = await this.pageController.getSimplifiedHTML()
const pageInfo = await this.pageController.getPageInfo()

DOM Pipeline

  1. DOM Extraction: Live DOM → FlatDomTree via page-controller/src/dom/dom_tree/
  2. Dehydration: DOM tree → simplified text for LLM
  3. LLM Processing: AI returns action plans (page-agent)
  4. Indexed Operations: PageAgent calls PageController by element index

Key Files Reference

Page Agent (packages/page-agent/)

FileDescription
src/PageAgent.ts⭐ Main class with UI, extends PageAgentCore
src/demo.tsIIFE demo entry (auto-init with demo API)

Core (packages/core/)

FileDescription
src/PageAgentCore.ts⭐ Core agent class without UI
src/tools/Tool definitions calling PageController
src/config/Configuration types and constants
src/prompts/System prompt templates

LLMs (packages/llms/)

FileDescription
src/index.ts⭐ LLM class with retry logic
src/types.tsMacroToolInput, AgentBrain, LLMConfig
src/OpenAIClient.tsOpenAI-compatible client

Page Controller (packages/page-controller/)

FileDescription
src/PageController.ts⭐ Main controller class with optional mask support
src/SimulatorMask.tsVisual overlay blocking user interaction during automation
src/actions.tsElement interactions (click, input, scroll)
src/dom/dom_tree/index.jsCore DOM extraction engine

Adding New Features

New Agent Tool

  1. Implement in packages/core/src/tools/index.ts
  2. If tool needs DOM ops, add method to PageController first
  3. Tool calls this.pageController.methodName() for DOM interactions

New PageController Action

  1. Add implementation in packages/page-controller/src/actions.ts
  2. Expose via async method in PageController.ts
  3. Export from packages/page-controller/src/index.ts

Testing

  • Test value: Do not add redundant tests or directly translate implementation code into assertions. Test meaningful behavior and realistic failure modes.
  • Framework: Vitest (unit tests only for now; future E2E goes to packages/e2e/ with Playwright)
  • Location: co-located, src/foo.test.ts next to src/foo.ts
  • Coverage today: packages/llms only — other packages will follow incrementally
  • Adding tests to a new package: create vitest.config.ts in the package and add a "test": "vitest run" script. Root npm test and node scripts/ci.js pick it up through npm workspaces.
  • Live tests (hit real external APIs, slow/costly): name them *.live.test.ts, exclude them from the package's test script, and expose them via a test:live script. Root npm run test:live runs all of them; they never run in npm test or CI. Template: packages/llms.
  • Template: See @page-agent/llms
npm test                            # all packages with a test script
npm test -w @page-agent/llms        # single package
cd packages/llms && npx vitest      # watch mode in one package

Code Standards

  • Explicit typing for exported/public APIs
  • ESLint relaxes some unsafe rules for rapid iteration
  • Every change you make should not only implement the desired functionality but also improve the quality of the codebase
  • All code and comments must be in English.
  • Do not try to hide errors or risks. They are valuable feedbacks for developers and users. Make them visible and actionable.
  • Traceability and predictability is more important than success rate.

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.