How I Bridged CLI AI Agents to Apple's Walled Garden

May 24, 2026 · 6 min read

Every time I work with a CLI AI tool — opencode, Claude Code, Copilot CLI — the same wall shows up.

These tools are genuinely useful inside the terminal. They edit files, run commands, search codebases. But outside, they’re blind. They can’t see your tasks, check your calendar, read your notes, or look at your email. The apps that actually run your day – that is mostly apps built by Apple – are in Apple’s walled garden with no public APIs.

I built a bridge into Reminders to prove the concept. The same pattern works for Notes, Calendar, Mail, Contacts, and any other Apple app that exposes local data. CLI AI agents can talk to the apps you already use every day.

The Apple Walled Garden Problem

If you’re an Apple user, your data lives in Apple’s apps. Reminders for tasks. Calendar for events. Notes for ideas. Mail for communication. Contacts for people.

These apps are well integrated, highly usable, and completely locked down. Apple doesn’t expose public APIs. There’s no GET /reminders/today endpoint. No POST /calendar/event. The obvious approach – send your data to an AI platform via their cloud API – works against what these apps were built for: keeping data local and private.

That’s the constraint. You have great tools that don’t talk to anything outside the ecosystem. Now you also have powerful AI tools that can’t see anything inside it. A simple bridge between them changes what those AI agents can actually do for you.

The Bridge: SQLite + AppleScript

Every one of Apple’s built-in apps stores data locally in SQLite databases and responds to AppleScript. That gives us two paths:

  • SQLite – read fast. Local, instant queries against the same database the app uses. These are read-only because the databases are encrypted and direct writes can corrupt them.
  • AppleScript – write safely. It’s the OS’s sanctioned way to write data. Slower than a direct database insert, but it respects all the integrity constraints the app depends on.

A hybrid approach, not a beautiful one, but it works.

Reminders: The Proof of Concept

Reminders was the first app I bridged because task management is useful in a coding workflow. The SQLite database lives at:

~/Library/Group Containers/group.com.apple.reminders/Container_v1/Stores/Data-*.sqlite

The schema is clean enough to query directly. A simple SQL join gets today’s tasks:

SELECT r.ZTITLE, l.ZNAME, r.ZDUEDATE, r.ZFLAGGED
FROM ZREMCDREMINDER r
JOIN ZREMCDBASELIST l ON r.ZLIST = l.Z_PK
WHERE r.ZMARKEDFORDELETION = 0
  AND r.ZCOMPLETED = 0
  AND r.ZDUEDATE BETWEEN today_start AND today_end
ORDER BY r.ZPRIORITY DESC, r.ZDUEDATE ASC

Writes go through AppleScript:

script = f'tell application "Reminders"\n    make new reminder in list "{list_name}" with properties {{name:"{title}"}}\nend tell'
subprocess.run(["osascript", "-e", script], capture_output=True, text=True, timeout=30)

The wrapper is a Python script that exposes structured commands. Each one returns JSON so the CLI agent can parse and present it naturally:

python3 reminders_helper.py today
python3 reminders_helper.py overdue
python3 reminders_helper.py lists
python3 reminders_helper.py search "databases"
python3 reminders_helper.py create "follow up on PR" "Reminders"
python3 reminders_helper.py complete "Update Runner VM docs"

Here’s what that actually looks like in a session:

Me: “What do I have on my task list today?”

Agent:

Today's tasks:
  • Update Runner VM documentation
  • Review blog post for Reminders integration
  • Fix SHA256 checksum bug in update-runners.sh

Me: “Create a reminder to follow up on the Forgejo migration article”

Agent:

Created: follow up on the Forgejo migration article

A few seconds. No context switching, no opening apps, no manual typing.

The Same Pattern, Every Apple App

Reminders was just the first one. The same SQLite read + AppleScript write pattern applies to most of the apps you probably use every day.

Calendar

Your schedule lives in ~/Library/Calendar/Calendar.sqlitedb. Read today’s events with a single query. Create, update, and delete events through AppleScript. The agent suddenly knows your meeting schedule when it’s helping you plan work.

Notes

Notes stores content in ~/Library/Group Containers/group.com.apple.notes/Documents/. You can search across all notes, read specific note content, or append new notes. When you’re in the middle of planning something, the agent can pull context from your existing notes instead of making you switch windows.

Mail

Mail’s database is at ~/Library/Mail/ – complex schema, but the recent inbox, unread counts, and message searches are straightforward. AppleScript handles sending replies or flagging messages. The agent can summarize your inbox or find that email from last week without you touching Mail.app.

Contacts

~/Library/Application Support/AddressBook/ has the complete address book. Queries give you contact details, groups, notes. No API – just read the local database. When the agent is helping draft outreach or organizing projects, having contact data available matters.

Shortcuts / Reminders

The Reminders skill already covers this, but the same AppleScript bridge extends to Shortcuts automations. A skill can trigger existing shortcuts, creating deeper automation between your CLI tools and the Apple ecosystem.

The Skill Architecture

Each app gets its own skill – a Python helper script and a Markdown instructions file.

skills/
  reminders/
    SKILL.md              # Instructions for the agent
    scripts/
      reminders_helper.py # Main entry point
  calendar/
    SKILL.md
    scripts/
      calendar_helper.py
  notes/
    SKILL.md
    scripts/
      notes_helper.py

The SKILL.md tells the agent what commands exist and when to call them. The Python script runs queries or AppleScript, returns structured JSON. That’s it – the whole bridge.

How It Works With Any CLI AI Tool

None of this is specific to one AI tool.

opencode uses skills – Markdown files that describe available actions alongside scripts. Claude Code has the same skill system. Copilot CLI uses extensions. Any CLI agent that can run commands and read structured output can use this pattern.

The mechanism is universal: a local script exposes data and actions through the command line, the agent’s instructions tell it when and how to call the script, the output is structured enough for the agent to reason about.

Why This Matters

Most CLI AI tutorials focus on making the agent faster at coding. But the more interesting use case is giving the agent context about your actual life. Your tasks. Your schedule. Your notes. Your email. Your contacts.

The data already exists. It just lives inside apps that don’t talk to anything else. Once you bridge that gap – locally, privately, with scripts anyone can write – the agent suddenly understands what you’re working on and what you need to do next.

That’s more useful than any code completion feature. Because the agent knows more about your context, not just how to type faster.

The Takeaway

If you’re using a CLI AI tool and you want it to understand your world, the pattern is simple. Apple’s apps are locked down, but their local databases and AppleScript bridges give you a way in. Write a script that exposes the data as structured JSON. Give the agent instructions for when to call it. The data never leaves your machine.

Reminders proved this works. Calendar, Notes, Mail, Contacts – same pattern, same privacy guarantees. The walled garden has doors, you just need to know where they are.

Next

Derek Armstrong - Staff Software Engineer and Solutions Architect
Authors
Staff Software Engineer | Solutions Architect
Staff Software Engineer, AI Systems Engineer, and Solutions Architect with 10+ years of experience designing and shipping production systems at enterprise scale. I lead teams building payment platforms processing billions in annual volume, architect cloud-native infrastructure, and integrate AI/ML capabilities into mission-critical systems. Passionate about turning complex technical challenges into reliable, scalable solutions — and about mentoring the engineers who will carry that work forward.