Skip to content

adm1nsys/Safari-Ai-Extension

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Safari AI Apple Intelligence Extension Mac OS 27, iOS 27, iPad OS 27

A working example of a Safari Web Extension generated by Apple Intelligence — created entirely from a natural-language prompt using Safari's new "Describe an Extension" feature, then edited by hand.

This repo is meant less as a product and more as a reference and guide for developers: if you've thought "I want to build my own AI-generated Safari extension," this shows what one looks like, where the system stores it, how to get at the source, how to edit it, and how to make it run across devices.

The extension itself is a small YouTube tweak — change the country code next to the logo, recolor the logo, add a glassmorphism header, and show like/dislike stats. The features are just there to demonstrate that a real, non-trivial extension can be built and edited this way.

⚠️ Requires OS 27 or later. This only works on macOS 27, iOS 27, and iPadOS 27 (and newer). The "Describe an Extension" feature and the storage location it relies on do not exist on earlier versions. Everything here targets the developer betas — paths and behavior may change before public release.


What is an AI-generated extension?

Safari 27 can generate a complete Web Extension from a text prompt. You describe what you want, an on-device model writes the manifest.json, content.js, and popup files, and Safari installs the result immediately — no Xcode, no manual file wrangling.

The catch for developers: Apple presents this as a "no code, no files" experience, so the generated source isn't sitting in an obvious folder, and it doesn't appear in Safari's normal extension databases. Below is how to actually find, extract, and edit it.


Where these extensions are stored

Finding the source took some digging, because the usual approaches all miss:

  1. Ordinary file search fails. find / grep for content.js, manifest.json, or the extension's name across ~/Library returns nothing useful — the generated files aren't stored as plain unpacked files where you'd expect.

  2. The Safari extension databases are a red herring. Inside ~/Library/Containers/com.apple.Safari/Data/Library/Safari/ there are two SQLite databases:

    • CloudExtensions.db — the iCloud-synced list of normal (App Store / bundled) extensions. AI-generated ones are not here.
    • SandboxExtensions.db — sandbox records of files Safari was granted access to, unrelated to the extensions themselves.

    AI extensions live in a separate store.

  3. The actual location:

    ~/Library/Containers/com.apple.Safari/Data/Library/Safari/MagicExtensions/
    

    Each AI-generated extension gets a folder here containing the editable manifest.json, content.js, popup.html, popup.css, popup.js, and the original prompt used to generate it. Editing files here works — changes take effect in Safari.

Debugging tip: if you're hunting for this yourself on a future OS where the path has moved, run sudo fs_usage -w -f filesys Safari while creating or editing an extension. It prints every file Safari touches in real time, which is how the storage directory surfaces.


Extracting the source (including the prompt) via the feedback form

There's a second, no-terminal way to pull a clean copy of an extension's source — through the built-in feedback form.

When you review a generated extension, Safari offers feedback buttons — "Looks good" and "Not quite right" (localized; e.g. in German they read "Sieht gut aus" and "Nicht ganz richtig"). Submitting feedback makes the system assemble the full source of the extension — all files plus the generation prompt — into a temporary draft folder so it can be attached to the report.

Those files appear here:

/Users/<YourUser>/Library/Containers/com.apple.Feedback.DraftingExtension/Data/tmp/TemporaryItems/NSIRD_DraftingExtension-macOS_XXXXXX/Drafts/FB/

(<YourUser> is your macOS username; the NSIRD_… and numeric segments are generated per draft.) Copy the files out of that folder before dismissing the report — it's a temporary staging area. This is a convenient way to grab a complete, readable snapshot of an extension, prompt included, without touching the container directly.


Editing the extension

You have two complementary ways to iterate:

  • Keep using the AI assistant. Because it's a real generated extension, you can go back to "Describe an Extension" and refine it in natural language — the assistant edits the existing extension rather than starting over. Good for quick, broad changes.
  • Edit the files directly. The output is a standard Safari Web Extension (manifest.json + content script + popup). Open the folder in MagicExtensions/ and edit like any web extension, then reload in Safari. Better for precise control, or when the model gets something subtly wrong.

In practice, generating a first version with AI and then hand-tuning the files is the most effective workflow — which is exactly how this example was built.


Cross-platform & installing everywhere

These extensions are cross-platform — the same standard Web Extension format runs on macOS, iOS, and iPadOS 27+.

To move an extension to another device, place its folder into that device's:

/Users/<YourUser>/Library/Containers/com.apple.Safari/Data/Library/Safari/MagicExtensions/

🚧 Note — verify this yourself. Copying the folder into MagicExtensions/ is the known storage location, but Safari may also register extensions through an internal database or signature, so a manual drop-in isn't guaranteed to activate on a fresh machine. Likewise, iCloud sync to iOS/iPadOS isn't confirmed for this store (the database that syncs normal extensions, CloudExtensions.db, doesn't appear to cover MagicExtensions). Treat cross-device install as experimental and test on your own hardware. If you confirm the behavior, please open an issue with your OS versions and result.


The example extension (files)

File Role
manifest.json Config, matched sites, and the original AI prompt under browser_specific_settings.safari.prompt
content.js Runs on YouTube pages and applies the settings
popup.html / popup.css / popup.js The settings panel; saves options to browser.storage.local

Functionally it changes the YouTube country code, recolors the logo (solid/gradient/custom SVG), toggles like/dislike stats, sets the search placeholder, and adds a glassmorphism header. Details aside, the point is that all of this was reachable through an AI-generated extension you can read and edit.


Disclaimer

  • Based on developer beta software (OS 27); file locations and behavior may change.
  • Editing files inside Safari's container is unsupported by Apple and done at your own risk — back up a folder before modifying it.
  • Not affiliated with or endorsed by Apple or YouTube.

License

MIT — see LICENSE.