Getting it into your agent
One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.
npx agentmods add rules/steipete/agent-rules/safari-automationgit clone --depth 1 https://github.com/steipete/agent-rulesWrote this? Show the measurements
A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.
[](https://agentmods.dev/rules/steipete/agent-rules/safari-automation)<a href="https://agentmods.dev/rules/steipete/agent-rules/safari-automation"><img src="https://agentmods.dev/badge/rules/steipete/agent-rules/safari-automation.svg" alt="Measured on agentmods" height="20"></a>What it costs to keep this loaded
Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5 | $0.00000 | $0.01424 |
| Opus 5 | $0.00000 | $0.00712 |
| Sonnet 5 | $0.00000 | $0.00285 |
| Haiku 4.5 | $0.00000 | $0.00142 |
Grade A, and why
safari-automation scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 5d ago.
A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.
Nothing flagged
None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.
Copies of this mod
1 near-identical copy found in the catalogue:
- safari-automation — 100% identical, 0 lines differ
How it starts
The opening of the file, as written. The whole thing — 203 lines — stays where its author put it; the contents beside it link to each section on GitHub.
Safari Automation Guide
This guide captures hard-won lessons from automating Safari interactions, particularly for web UI automation and testing.
Key Concepts
Managing Safari Windows and Tabs
Objective: Reliably direct Safari to specific URLs in a predictable way, preferably using a single, consistent browser window and tab.
Recommended Approach:
tell application "Safari"
activate
delay 0.2 -- Allow Safari to become the frontmost application
if (count of windows) is 0 then
-- No Safari windows are open, so create a new one.
make new document with properties {URL:"http://example.com"}
else
-- Safari has windows open; use the frontmost one.
tell front window
set targetTab to missing value
try
-- Check if a tab for the target URL is already open
set targetTab to (first tab whose URL starts with "http://example.com")
end try
if targetTab is not missing value then
-- Reuse existing tab: refresh and make active
set URL of targetTab to "http://example.com"
set current tab to targetTab
else
-- No specific tab found: use current active tab
set URL of current tab to "http://example.com"
end if
end tell
end if
delay 1 -- Pause to allow the page to begin loading
end tell
JavaScript Execution in AppleScript
String Escaping Strategies:
-
Using Escaped Quotes:
do JavaScript "document.querySelector('[data-testid=\\'my-button\\']').click();" -
Using character id 39 for Complex Strings:
set sQuote to character id 39 set jsSelector to "[data-testid=" & sQuote & "my-button" & sQuote & "]" set jsCommand to "document.querySelector(" & sQuote & jsSelector & sQuote & ").click();" do JavaScript jsCommand in front document -
XPath for Robust Element Selection:
-- Find button containing specific text set jsCommand to "document.evaluate(\"//button[.//text()='Connect']\", document, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null).singleNodeValue.click();" do JavaScript jsCommand in front document
What this file has done since we first saw it
Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.
- 5d ago First seen · 203 lines · 0 tokens per session scan A bdf28d6069de
safari-automation is a cursor rule published in the GitHub repository steipete/agent-rules (5,694 stars, last pushed 4mo ago), licensed MIT. It costs nothing until one of its globs matches a file; then it loads 1,424 tokens. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.
Other cursor rules, from other repositories
web-scraping
You are an expert in web scraping and data extraction, with a focus on Python libraries and frameworks such as requests, BeautifulSoup, selenium, and advanced tools like jina, firecrawl, agentQL, and multion.
rules
You are an expert Chrome extension developer, proficient in JavaScript/TypeScript, browser extension APIs, and web development.
type-inference
Derive TypeScript types from Zod schemas - no hand-written interfaces for wire shapes.
paperfit
PaperFit project rule for LaTeX visual typesetting optimization.
frontend-architecture
Vite + React SPA architecture - directory layout, providers, bundle splitting. Tailwind styling in tailwind.mdc.
workers-cache
Workers Cache - Cache-Control, gateway exports cache off, RPC vs fetch.