So far you’ve used Pi to build and deploy web apps, edit files and videos, run AI models, and automate your browser. You can also use Pi to build native macOS apps with Swift and Xcode. In this exercise, you’ll build a small menu bar app from scratch that reads and summarizes your own Pi usage — sessions, token counts, and which models you’ve been using — straight from the JSONL files Pi already saves to your machine. A skill teaches Pi the native patterns it needs along the way.
Prerequisites
This exercise is macOS only. Building a native Mac app needs a Mac and Apple’s developer tools.
There are two separate things people often confuse:
- Command Line Tools give you
git,clang, and the Swift compiler. Pi will install them for you from your session withxcode-select --install. - Full Xcode is the large app from the Mac App Store that includes
xcodebuildand the macOS SDK. You need it to build an actual.app. Command Line Tools alone are not enough for this project.
Pi will check what you have with xcodebuild -version and walk you through installing Xcode if it’s missing.
The skill
You’ll install macos-app-skills, a collection of agent skills for building native macOS apps in SwiftUI and AppKit:
npx skills add fayazara/macos-app-skills -g -y
The -g flag installs the skill globally (for all your projects) and -y skips the interactive prompts, so it installs in one shot. It bundles skills for building from the command line (build), native macOS patterns for web developers (macos-patterns), settings windows, Sparkle auto-updates, notch overlays, and release pipelines. These encode the hard-won patterns that AI agents usually get wrong, so Pi builds and edits the app correctly instead of guessing.
Run /reload after installing so it loads.
Your own data source
Every Pi session you’ve had so far is saved as a JSONL file under ~/.pi/agent/sessions/, organized by working directory. Each file contains a stream of entries — user messages, assistant responses, tool calls — and assistant responses include token usage and cost data per turn. That’s a real, personal dataset sitting on your machine already, which makes it a good fit for a small native app: no API, no server, no fake data.
How the build works
A native Mac app isn’t a web project: there’s no dev server and no npm run dev. “Running it” means compiling an actual .app and launching it. Pi uses the build skill to compile the project with xcodebuild from your session, then opens the result.
A few things are worth knowing before you start, so the output makes sense:
xcodebuildis Xcode’s command-line build tool. The first build is slower than later ones, since Xcode has to resolve the project’s dependencies before it can compile.- Code signing is macOS’s way of stamping an app with a developer identity. For a fresh local project, Pi either sets up your own signing team or turns signing off for a local build. A build failure here is expected and recoverable, not a dead end.
- Sandboxing normally restricts which files an app can read. Since this app needs to read
~/.pi/agent/sessions/, Pi will either disable the sandbox for this learning project or add the right entitlement. - It’s a menu bar app. There’s no window when it launches. You’ll find its icon in the menu bar at the top of the screen and click it to open the popover.
What you’ll do
- Set up Apple’s developer tools by installing Xcode and the Command Line Tools, with Pi checking what you already have.
- Install the
macos-app-skillsskill, then run/reloadso it loads. - Scaffold a new SwiftUI menu bar app project.
- Have Pi read and summarize your own
~/.pi/agent/sessions/data before writing any code. - Build a first version showing session counts, token usage, and model breakdown.
- Run the app and find its icon in your menu bar.
- Make a small improvement, like a per-model cost breakdown or a refresh button, then rebuild to see it.
Go further
Once the basics click, you can point Pi at a completely different native app idea of your own — it doesn’t have to be a menu bar app or read local data at all. You can also explore macos-app-skills’s other bundled skills — Sparkle auto-updates, settings windows, notch overlays — if you want to take your stats app further and eventually ship it to other people.