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…
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 repository30 other files it gives its agents.
- .deepsec/AGENTS.mdAGENTS.md
- docs/AGENTS.mdAGENTS.md
- .opencode/AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- docs/CLAUDE.mdCLAUDE.md
- address-reviewSkill
- cli-developmentSkill
- erroreSkill
- external-electron-appsSkill
- fix-merge-conflictsSkill
- generate-specSkill
- generate-spec-v2Skill
- get-pr-reviewsSkill
- glimpse-changesSkill
- implement-specSkill
- improve-codebase-architectureSkill
- libretto-readonlySkill
- librettoSkill
- promptingSkill
- push-everythingSkill
- pushSkill
- reviewSkill
- spec-reviewSkill
- summarizeSkill
- technical-writingSkill
- turborepoSkill
- update-docsSkill
- writing-testsSkill
- libretto-readonlySkill
- librettoSkill
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
- Very specific: line 31
Prefer pnpm -s <script> (or pnpm --silent ...) for routine scripted commands when you want less pnpm noise in logs.
- Very specific: line 33
Do not pipe test commands through grep, tail, or other filters.
- Very specific: line 34
Use pnpm -s cli to build and run the local development version of libretto.
- Very specific: line 39
Use .js extensions in import paths (ESM resolution requires it).
- Very specific: line 40
Do not add barrel files (index.ts re-exports).
- Distinctive: line 41
Do not add new dependencies without asking.
- Distinctive: line 42
Do not remove or comment out code to "clean up" without asking — it may be there for a reason.
- Very specific: line 43
When code prints user-facing Libretto CLI commands, use the native libretto command in examples and guidance.
- Distinctive: line 53
Prefer small, focused functions over large ones.
- Distinctive: line 60
Never use a metaphor, simile or other figure of speech which you are used to seeing in print.
- Distinctive: line 61
Never use a long word where a short one will do.
- Distinctive: line 62
If it is possible to cut a word out, always cut it out.
- Distinctive: line 63
Never use the passive where you can use the active.
- Distinctive: line 64
Never use a foreign phrase, a scientific word or a jargon word if you can think of an everyday English equivalent.
- Very specific: line 97
NEVER hand-edit mirrored files in .agents/skills/ or .claude/skills/.
- Very specific: line 98
NEVER run pnpm build just to type-check.
- Distinctive: line 99
NEVER use git add -A or git add .
≈ “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.
Files
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
- CLI source:
apps/website— marketing site (Vite / vite-plus)docs/— user-facing Mintlify documentation sitepackages/libretto/docs/— internal package documentation for implementation notes and maintainer referencesbenchmarks/— benchmark suite (imports frompackages/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>(orpnpm --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 clito build and run the local development version of libretto.
Code Quality
- TypeScript strict mode is enabled. Do not use
any— use proper types orunknown. - Use
.jsextensions in import paths (ESM resolution requires it). - Do not add barrel files (
index.tsre-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
librettocommand 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 theerroreskill. Keep existing public thrown-error contracts unless the task explicitly changes them.
Testing
- VERY IMPORTANT: read
docs/tests-guide.mdbefore 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.
- Never use a metaphor, simile or other figure of speech which you are used to seeing in print.
- Never use a long word where a short one will do.
- If it is possible to cut a word out, always cut it out.
- Never use the passive where you can use the active.
- Never use a foreign phrase, a scientific word or a jargon word if you can think of an everyday English equivalent.
- 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 theversionfield inpackages/libretto/package.json. Usepnpm prepare-release— that script opens a release PR, and CI publishes to npm under thelatestdist-tag on merge. - For experimental pre-releases, make temporary edits to
packages/libretto/package.json: set a pre-release version and replace everyworkspace:orcatalog:dependency with its published range. Runpnpm 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 inpackages/libretto/skills/and runpnpm sync:mirrors. - NEVER run
pnpm buildjust to type-check. Usepnpm type-checkinstead. - NEVER use
git add -Aorgit add .— only stage the files you changed.
Skill Mirrors
- Edit
packages/libretto/README.template.mddirectly for README changes, then runpnpm sync:mirrors. - Edit
packages/libretto/skills/libretto/SKILL.mddirectly. packages/libretto/skills/librettois the source of truth for Libretto skill files.
Cloud sandbox instructions
- Browser runs are headless here (no display). Pass
--headlesstolibretto open/run, or they default to headed and hang. - The Notion CLI (
ntn) is installed by.agents/setup. When an authenticated command is needed, runNOTION_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 displayedntn login pollcommand withNOTION_KEYRING=0so the credential is stored in the agent's file-backed Notion config instead of an unavailable Linux keyring. Treat the resultingauth.jsonas a secret and never commit it.NOTION_API_TOKENremains available for unattended authentication. - The Vercel CLI (
vercel) is installed by.agents/setup. PreferVERCEL_TOKENfor unattended auth. For interactive login, runvercel loginand complete the flow the CLI prints.
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.

