agentleFS
cashew-labscashew-labs/libretto/AGENTS.md

libretto

AGENTS.md904 starsChanged 3 months agoMITView on GitHub

Libretto is an open-source toolkit for building robust web integrations. It gives coding agents a live browser and a token-efficient CLI to inspect pages, capture network traffic, record user actions, and replay them as automation scripts. This is a pnpm monorepo. Root (runs across all packages): Writing rules, from Orwell, 1946. These govern prose: docs, PR text, messages. Never touch code or technical terms; swap in everyday words only where precision survives. Review every prose output against these rules before…

The file

Show its rules and text

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

17 rules. About 0 are common, 9 are distinctive, and 8 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈9

    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
  • could be automatic: a setting could enforce it
  1. Very specific:

    Prefer pnpm -s <script> (or pnpm --silent ...) for routine scripted commands when you want less pnpm noise in logs.

    line 31
  2. Very specific:

    Do not pipe test commands through grep, tail, or other filters.

    line 33
  3. Very specific:

    Use pnpm -s cli to build and run the local development version of libretto.

    line 34
  4. Very specific:

    Use .js extensions in import paths (ESM resolution requires it).

    line 39
  5. Very specific:

    Do not add barrel files (index.ts re-exports).

    line 40
  6. Distinctive:

    Do not add new dependencies without asking.

    line 41
  7. Distinctive:

    Do not remove or comment out code to "clean up" without asking — it may be there for a reason.

    line 42
  8. Very specific:

    When code prints user-facing Libretto CLI commands, use the native libretto command in examples and guidance.

    line 43
  9. Distinctive:

    Prefer small, focused functions over large ones.

    line 53
  10. Distinctive:

    Never use a metaphor, simile or other figure of speech which you are used to seeing in print.

    line 60
  11. Distinctive:

    Never use a long word where a short one will do.

    line 61
  12. Distinctive:

    If it is possible to cut a word out, always cut it out.

    line 62
  13. Distinctive:

    Never use the passive where you can use the active.

    line 63
  14. Distinctive:

    Never use a foreign phrase, a scientific word or a jargon word if you can think of an everyday English equivalent.

    line 64
  15. Very specific:

    NEVER hand-edit mirrored files in .agents/skills/ or .claude/skills/.

    line 97
  16. Very specific:

    NEVER run pnpm build just to type-check.

    line 98
  17. Distinctive:

    NEVER use git add -A or git add .

    line 99

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

Agent Guidelines

Background Context

Libretto is an open-source toolkit for building robust web integrations. It gives coding agents a live browser and a token-efficient CLI to inspect pages, capture network traffic, record user actions, and replay them as automation scripts.

Package Structure

This is a pnpm monorepo.

  • packages/libretto — the main Libretto package (runtime, CLI, tests)
    • CLI source: packages/libretto/src/cli/
    • Tests: packages/libretto/test/*.spec.ts
  • apps/website — marketing site (Vite / vite-plus)
  • docs/ — user-facing Mintlify documentation site
  • packages/libretto/docs/ — internal package documentation for implementation notes and maintainer references
  • benchmarks/ — benchmark suite (imports from packages/libretto/src/)
  • evals/ — eval suite

Important Commands

Root (runs across all packages):

pnpm -s type-check
pnpm -s test
pnpm -s lint
pnpm -s cli
  • Prefer pnpm -s <script> (or pnpm --silent ...) for routine scripted commands when you want less pnpm noise in logs.
  • Do not pipe test commands through grep, tail, or other filters. The test reporter is minimal and token-efficient by default.
  • Use pnpm -s cli to build and run the local development version of libretto.

Code Quality

  • TypeScript strict mode is enabled. Do not use any — use proper types or unknown.
  • Use .js extensions in import paths (ESM resolution requires it).
  • Do not add barrel files (index.ts re-exports). Import directly from source files within the same package.
  • Do not add new dependencies without asking.
  • Do not remove or comment out code to "clean up" without asking — it may be there for a reason.
  • When code prints user-facing Libretto CLI commands, use the native libretto command in examples and guidance.
  • Errore adoption is incremental. Do not use Errore by default. Use it only when a task or existing code path explicitly opts in; the browser-tools auth-profile work and the libretto daemon startup path (packages/libretto/src/cli/core/daemon/daemon.ts) are currently opted in. Before editing an opted-in path, read the errore skill. Keep existing public thrown-error contracts unless the task explicitly changes them.

Testing

  • VERY IMPORTANT: read docs/tests-guide.md before updating tests at all.

Style

  • Concise, technical prose. No filler or emoji.
  • Prefer small, focused functions over large ones.
  • Name things for what they do, not how they're implemented.

Writing Rules

Writing rules, from Orwell, 1946. These govern prose: docs, PR text, messages. Never touch code or technical terms; swap in everyday words only where precision survives.

  1. Never use a metaphor, simile or other figure of speech which you are used to seeing in print.
  2. Never use a long word where a short one will do.
  3. If it is possible to cut a word out, always cut it out.
  4. Never use the passive where you can use the active.
  5. Never use a foreign phrase, a scientific word or a jargon word if you can think of an everyday English equivalent.
  6. Break any of these rules sooner than say anything outright barbarous.

Review every prose output against these rules before delivering.

Agent-facing error messages

Errors returned to agents (tool { ok: false, error } results, MCP isError content, CLI output an agent reads) must tell the agent what to do next — not just what went wrong.

Bad — dead ends:

Unknown session ID: ses-4f2a
Failed to navigate to https://example.com: net::ERR_NAME_NOT_RESOLVED
Session "ses-4f2a" has no connected browser.

Good — diagnosis plus next step:

Unknown session ID: ses-4f2a. Call browser_open to get a session ID, then pass it to browser_exec.
Could not navigate to https://example.com (net::ERR_NAME_NOT_RESOLVED). The session was closed. Call browser_open again — use a full https:// URL, or omit url and navigate with browser_exec via `await page.goto(...)`.
Session "ses-4f2a" is no longer connected to a browser. Call browser_close if you still have this session ID, then browser_open to start a fresh session.

Reserve throws for host-level misconfiguration (missing API keys, provider down) that the agent cannot fix by changing its tool calls.

In packages/browser-tools, format caught errors with errorMessage() from src/errors.ts — do not duplicate ad-hoc helpers.

FORBIDDEN Actions

  • For stable releases on main: NEVER manually edit the version field in packages/libretto/package.json. Use pnpm prepare-release — that script opens a release PR, and CI publishes to npm under the latest dist-tag on merge.
  • For experimental pre-releases, make temporary edits to packages/libretto/package.json: set a pre-release version and replace every workspace: or catalog: dependency with its published range. Run pnpm publish:experimental, approve npm's browser passkey prompt, then verify the exact version installs in a clean project. Do not commit the temporary manifest edits.
  • NEVER hand-edit mirrored files in .agents/skills/ or .claude/skills/. Edit the source in packages/libretto/skills/ and run pnpm sync:mirrors.
  • NEVER run pnpm build just to type-check. Use pnpm type-check instead.
  • NEVER use git add -A or git add . — only stage the files you changed.

Skill Mirrors

  • Edit packages/libretto/README.template.md directly for README changes, then run pnpm sync:mirrors.
  • Edit packages/libretto/skills/libretto/SKILL.md directly.
  • packages/libretto/skills/libretto is the source of truth for Libretto skill files.

Cloud sandbox instructions

  • Browser runs are headless here (no display). Pass --headless to libretto open/run, or they default to headed and hang.
  • The Notion CLI (ntn) is installed by .agents/setup. When an authenticated command is needed, run NOTION_KEYRING=0 ntn login --no-browser, give the user the displayed verification URL and code, and wait for them to confirm authorization. Then prefix the displayed ntn login poll command with NOTION_KEYRING=0 so the credential is stored in the agent's file-backed Notion config instead of an unavailable Linux keyring. Treat the resulting auth.json as a secret and never commit it. NOTION_API_TOKEN remains available for unattended authentication.
  • The Vercel CLI (vercel) is installed by .agents/setup. Prefer VERCEL_TOKEN for unattended auth. For interactive login, run vercel login and complete the flow the CLI prints.

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.