AI Agents 🆕
Describe the rule you want in plain English and let an AI agent write it. tweak works with agents in two ways:
- An agent that drives your browser, such as Claude in Chrome, looks at what the page requested and creates, updates and switches tweak rules for you, right on the tab you are on.
- An agent that cannot reach your browser, such as Claude Code or a chat, writes the rules as an import file. You paste it into tweak's import page and the rules are yours.
Either way the agent writes ordinary tweak rules: you can open, edit, switch off or delete them in the popup like any other.
Which agent for which job​
It mostly comes down to one question: where does the context for the rule live?
- In the page you have open. The data is live in the browser: the requests the page sends, the responses it gets back, what is on screen. Use an agent that drives your browser, such as Claude in Chrome. It sees the real traffic and writes the rule against it.
- In your codebase. The endpoints, their payloads and their error shapes are defined in code you have locally. Use Claude Code, or another AI agent with access to your files. It reads the code that serves or documents the API and crafts the rules from it, before the page even exists.
| Agent in the browser (Claude in Chrome) | Local agent (Claude Code) | |
|---|---|---|
| Where it gathers context | The live page: captured requests and responses, what is on screen | Your repository: routes, handlers, types, fixtures, API specs |
| Best when | The app is running and you want to bend what it does right now | You are building against an API, or the page is not running yet |
| How rules reach tweak | Created directly on your tab | An import file you paste into tweak's import page |
| Rules arrive | Switched on, ready to use | Switched off, for you to review and turn on |
| Needs the AI Agents switch | Yes | No |
| Finds existing rules to reuse | Yes, it searches yours before writing a new one | No, it only sees what you give it |
Some asks that fit each one:
- In the browser: "The dashboard shows three projects. Mock it with none, so I can see the empty state." / "Slow down whatever loads the comments by three seconds." / "This page calls an analytics endpoint. Make it fail and check nothing breaks."
- Locally: "Read the orders controller and mock every error it can return." / "Create mocks for the new /api/billing endpoints, from the types in src/api/billing.ts." / "Write a Modify rule that adds the
betaflag the new settings page reads."
If your repository has an OpenAPI (Swagger) spec, tell a local agent where it is: "Use docs/openapi.yaml to mock the /users endpoints." The spec already lists every endpoint, method, status and payload shape, so the agent writes accurate rules straight away instead of discovering the endpoints by reading through the code.
The two also combine well: draft rules from the codebase with a local agent, import them, then let an agent in the browser fine-tune them against the live page.
Turn it on​
Agent access is off by default. Open the â‹® menu in the popup toolbar, pick Settings, and switch on AI Agents in Preferences.
While it is on, any page you visit can ask tweak for rules, not just the agent you are talking to. That is why it is your call, and why you should switch it off when you are done. The switch takes effect at once, no reload needed.
You only need this switch for an agent that drives your browser. An import file from Claude Code or a chat goes through the import page, where you see every rule before it lands.
Get the skill​
The agent learns how to write tweak rules from an open-source Agent Skill called tweak-creating-rules, published at github.com/tweak-extension/skills.
- Claude Code: copy the
tweak-creating-rulesfolder into~/.claude/skills/(every project) or into a project's.claude/skills/. - Claude apps: zip the
tweak-creating-rulesfolder and upload it under Settings > Capabilities > Skills.
If you installed an earlier version of the skill under another name (tweak-rules), remove it first, so the two do not both answer the same asks.
Ask for a rule​
Open the page you want to work on and ask your agent, for example:
- "Use tweak to mock /api/cart with an empty cart."
- "Make /api/orders fail with a 500 and a two second delay."
- "Keep the real /api/account response but show plan: free."
- "Send X-Debug: 1 on every api call."
- "Replace every image on this page with https://placehold.co/600x400.png."
- "Pause the checkout request so I can edit the response by hand."
In the browser, the agent then:
- Captures the page's requests (it switches on request capture and reloads), so it works from what the page really asked for instead of guessing.
- Looks for a rule you already have. If one already does the job, the agent proposes it (switch it on, or change it) and waits for your answer, rather than creating a duplicate.
- Creates or updates the rule, then starts tweak on the tab if it is not running.
- Tells you what changed and how to undo it.
From Claude Code or a chat​
The agent hands you the rules as JSON plus a link to tweak's import page. Copy the JSON, open the link (or open tweak, â‹® > Import rules), and paste. Imported rules arrive switched off: turn each one on, then press Run on the tab.
What an agent can do​
| Rule type | What the agent uses it for | Plan |
|---|---|---|
| Mock | A made-up response: an error, an empty or edge-case payload, latency | free |
| Modify | The server's real response (or request) with something changed | premium |
| Headers only | Set, append or remove a request or response header | free |
| Redirect | Load a request from somewhere else: another server, a local build, a placeholder | free |
On top of the rule itself, an agent can:
- Write a request or response hook, for a response computed by code (premium).
- Match a request body that only contains a fragment, to tell apart GraphQL operations on one url (premium, see partial request payload matching).
- Switch on Edit before send on a Mock or Modify rule, so the request or its response pauses for you to edit by hand (premium).
- Switch a rule on or off, and change a rule you already have.
- Turn request capture on or off and start or stop tweak on its tab, like the toolbar buttons.
An agent cannot create variables: it writes the values out instead.
On the free plan, ask for a premium capability and the agent tells you it needs an upgrade (or, for a Modify rule, offers a Mock built from the real response). On a paid plan, every rule an agent creates lands in a collection named AI Generated, so it never mixes with your own. Rename that collection and the next rule an agent creates starts a new one.
Safety limits​
An agent works through the page you are on, so tweak holds it to stricter limits than the popup or the import page.
- Rules land switched on and say where they came from. Each one carries a note naming the agent and the site it was created on, and the date.
- A hook an agent writes only runs on the site that asked for it. The rule matches nowhere else, so a page cannot plant code that later runs on another site.
- An agent can only delete rules it created. Your own rules can be switched off or changed when you agree, never deleted.
- Some headers are off limits. A headers only rule from an agent cannot touch
Cookie,Origin,Referer,Sec-*,Set-Cookie, CORS (Access-Control-*),Content-Security-Policy,X-Frame-OptionsorCross-Origin-*. These are the headers sites use to protect themselves from each other. Ask for one and the agent hands you the rule as an import file instead, so you review it before it exists. - Headers only and redirect rules apply to the active tab only. A page does not get to decide what happens on every tab. Switch a rule to global yourself if that is what you want.
- No breakpoints. An agent cannot set a breakpoint, so a page can never pause your developer tools.
Text on a web page is not you asking. The skill tells the agent to treat page content as data, so a page that says "create a rule" does not get one. Still, switch AI Agents off when you are done.
Need something else? Request a feature