Cherri: Building iOS Shortcuts with a Compiler

iOS Shortcuts web

TL;DR

Cherri compiles .cherri text files into signed .shortcut binaries 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 .cherri source

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 integration
  • askDeviceLLM — runs inference on the device’s local model
  • askCloudLLM — uses Apple’s Private Cloud Compute
  • generateImage — AI image generation
  • adjustTextTone — rewrites text in a specified tone
  • generateKeyPoints — extracts key points from text
  • generateTable — 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:

  1. Hello World — simple notification, learned the compile/sign pipeline
  2. How’s My Cinder — imported and decompiled from iCloud to study patterns
  3. Magic Market Analysis — replicated from decompiled source
  4. Surprise Me (synology-garden) — picks a random audiobook from the shortcut-bridge API + ChatGPT summary
  5. What’s Next Book (synology-garden) — recommends next audiobook based on listening history
  6. 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 cd into the directory before running cherri. 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.