Cherri: Building iOS Shortcuts with a Compiler
TL;DR
Cherri compiles
.cherritext files into signed.shortcutbinaries that import directly into iOS Shortcuts. Variable interpolation in URL and header strings crashes the Shortcuts import UI — hardcode everything. Eight shortcuts shipped, five of them complex multi-action flows using Apple Intelligence, ChatGPT, Shazam, and device sensors.
The Cherri Pipeline
Cherri is a Go-based compiler that turns a simple DSL into iOS Shortcut files. The pipeline:
.cherri source --> cherri compile --> sign --> .shortcut binary --> import to iOS
Key commands:
cherri filename.cherri— compiles and signs with default signing (preferred for local dev)cherri --hubsign filename.cherri— signs for RoutineHub distribution (less reliable locally)cherri --import=<icloud-url>— decompiles an existing shortcut from an iCloud share link back to.cherrisource
Default signing consistently worked better than --hubsign for local development. The import flag is powerful for reverse-engineering existing shortcuts to learn patterns.
Safety note: Cherri writes its output to the same directory as the input file. Never pass a directory path as the argument or use -o pointing at a directory — it will overwrite the directory with a binary file.
The Variable Interpolation Crash Bug
This was the session’s biggest discovery. When you interpolate variables into URL strings or HTTP header values across multiple web actions in a single shortcut, the Shortcuts app crashes during import with:
WFAppKitAutocompleteTextView layout exception in AppKit
This is an Apple bug in the Shortcuts import UI, not a Cherri bug. The crash can trigger a crash loop that prevents the Shortcuts app from opening at all.
Fix for the crash loop: Delete ~/Library/Saved Application State/com.apple.shortcuts.savedState
Fix for the root cause: Hardcode all URLs. Never interpolate variables into URL or header strings in web request actions. We confirmed this through binary search testing — isolating actions one by one until the crash trigger was identified.
Apple Intelligence Actions in Shortcuts
Cherri supports the full range of Apple Intelligence actions available in iOS Shortcuts:
askChatGPT— sends a prompt to ChatGPT via the system integrationaskDeviceLLM— runs inference on the device’s local modelaskCloudLLM— uses Apple’s Private Cloud ComputegenerateImage— AI image generationadjustTextTone— rewrites text in a specified tonegenerateKeyPoints— extracts key points from textgenerateTable— structures data into table format
These actions can be chained together in a single shortcut, enabling multi-step AI workflows entirely within the Shortcuts runtime.
What We Built
Eight shortcuts total, escalating in complexity:
- Hello World — simple notification, learned the compile/sign pipeline
- How’s My Cinder — imported and decompiled from iCloud to study patterns
- Magic Market Analysis — replicated from decompiled source
- Surprise Me (synology-garden) — picks a random audiobook from the shortcut-bridge API + ChatGPT summary
- What’s Next Book (synology-garden) — recommends next audiobook based on listening history
- Library Digest (synology-garden) — full library overview with AI-generated insights
7-8. Five parallel-built complex shortcuts:
- Weather Commander — 17 actions across 5 weather categories
- AI Debate Club — 3-round multi-LLM debate between ChatGPT, device LLM, and cloud LLM
- Shazam DJ — music identification + analysis + anime-style album art generation
- Digital Wellness — screen time data + AI behavioral analysis
- Voice Researcher — dictation to research pipeline with flash card generation
All five complex shortcuts were built by parallel agents, compiled, and imported without crashes using the hardcoded-URL pattern.
Practical Takeaways
- Always
cdinto the directory before runningcherri. The compiler writes output to the input file’s directory. - Hardcode URLs. Variable interpolation in web actions is a crash vector. Build the URL in a prior step if you must, but keep the web action string literal.
- Import one shortcut at a time. Batch imports can mask which shortcut causes a crash.
- Clear savedState on crash loops. The Shortcuts app stores UI state that can perpetuate crashes across launches.
- Default signing over hubsign for local development and testing.
cherri --import=is the fastest way to learn Cherri syntax — grab any shortcut from iCloud and decompile it.
Developer Perspective
The Cherri compiler fills a genuine gap. Apple’s Shortcuts app is a visual programming tool with no version control, no code review, no automation. Cherri gives you text files you can commit, diff, and generate programmatically.
The variable interpolation crash is concerning — it means Apple’s own import UI can’t handle a legal combination of its own shortcut actions. The workaround (hardcode everything) is straightforward but shouldn’t be necessary. This is the kind of bug that persists because nobody at Apple is building shortcuts programmatically at scale.
The parallel agent pattern worked well here: five independent shortcuts, five agents, zero conflicts. Each shortcut is a self-contained file with no shared state. That’s the ideal unit of parallelism.