/duology-features:duo-intelligencefrom duology-features
Integrates Apple's on-device and Private Cloud Compute language models into iPhone Duo apps, handling streaming responses across folds, split-view panes, and outer display summaries.
Ships in duology-features. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
The Foundation Models framework gives an app Apple's on-device language model and, from iOS 27, the larger Private Cloud Compute model, through the same Swift API (Foundation Models). On iPhone Duo the question is where the result goes and what happens when the phone folds mid-answer. This skill answers both.
Load neighbours when the task needs them: duo-continuity (state that survives a fold), duo-layout (size classes, the fold, ArrangementView), duo-postures (book and tabletop layouts), duo-app-intents (let Siri and Shortcuts run the same feature). To start a new notes app with all of this in place, use recipe-notes-ai.
Labels: measured means we ran it on the iPhone Duo simulator (iOS 27.1) on 20 October 2026; see references/evidence.md. Unverified means we could not confirm it. Everything else comes from Apple's pages, linked inline. Full source list: reference/sources.md.
Apple's iPhone Duo pages and the six Duo Tech Talks say nothing about Foundation Models (we searched the transcripts, the HIG page and the developer overview). The Duo advice below applies Apple's general Duo rules to AI features: keep the same features on both displays, let the open phone add one level of detail, keep controls out of the fold (HIG: Designing for iPhone Duo). An AI pane is a supporting pane, like the Podcasts transcript Apple puts beside Now Playing with a split ArrangementView (talk 111463). The model facts come from the Foundation Models docs and WWDC26 sessions 241 and 319.
On device: SystemLanguageModel | Server: PrivateCloudComputeLanguageModel | |
|---|---|---|
| Since | iOS 26.0 | iOS 27.0, plus a managed entitlement |
| Network | Not needed | Needed |
| Context | 4,096 tokens | 32K tokens |
| Limits | None | A daily limit per person; iCloud+ raises it |
| Reasoning | No | light, moderate, deep |
| Images | Yes, iOS 27 (.vision capability) | Yes |
Sources: Adding server-side intelligence with Private Cloud Compute, Managing the context window, Analyzing images with multimodal prompting. Both models conform to the iOS 27 LanguageModel protocol, so LanguageModelSession(model:instructions:) takes either one and the rest of your code stays the same.
.available, yet every on-device request failed. Every request needs a non-AI fallback.AssistantModel per window, created in the window root. A fold resizes the window; the stream must not notice (duo-continuity).@Generable type with a short headline first feeds the closed phone early and the open pane fully, from one request.ArrangementView puts the note and the pane one on each side. Text in a scroll view may cross the fold; Stop, Retry and text fields may not.SystemLanguageModel and sessions are iOS 26.0. PrivateCloudComputeLanguageModel, LanguageModel, Attachment, ContextOptions and LanguageModelError are iOS 27.0. ArrangementView is iOS 27.1. iPhone Duo ships with iOS 27.1, so #available only matters for other iPhones.import FoundationModels
/// Picks the model for one request. Start on device; move to Private Cloud Compute
/// only when the task needs it, the app has the entitlement and the person agreed.
@available(iOS 27.0, *)
enum AssistantModels {
static func choose(needsLargeContext: Bool, cloudAllowed: Bool) -> (any LanguageModel)? {
if needsLargeContext && cloudAllowed {
let cloud = PrivateCloudComputeLanguageModel()
if cloud.isAvailable && !cloud.quotaUsage.isLimitReached { return cloud }
}
let onDevice = SystemLanguageModel.default
return onDevice.isAvailable ? onDevice : nil // nil: show the non-AI fallback
}
/// Words for the fallback when the on-device model can't run.
static var unavailableReason: String? {
switch SystemLanguageModel.default.availability {
case .available: nil
case .unavailable(.deviceNotEligible): "This iPhone can't run Apple Intelligence."
case .unavailable(.appleIntelligenceNotEnabled): "Turn on Apple Intelligence in Settings to get summaries."
case .unavailable(.modelNotReady): "Summaries will work once the model finishes downloading."
case .unavailable: "Summaries aren't available right now."
}
}
}
SystemLanguageModel is Observable in the SDK, so a view that reads availability can follow it as the model downloads (unverified on a device).com.apple.developer.private-cloud-compute entitlement, which Apple grants to eligible apps on request (entitlement, Accessing Private Cloud Compute). Measured: without it, the simulator still reported .available, and a request never returned in 9 minutes. Keep Stop on screen for every request.import FoundationModels
import Observation
@available(iOS 26.0, *)
@Generable
struct NoteDigest {
@Guide(description: "One line of at most eight words, shown on the closed phone")
var headline: String
@Guide(description: "The key points, shown in the side pane", .count(3))
var points: [String]
}
/// One per window, created in the window's root view. The stream lives here,
/// not in a view, so closing or opening the phone never restarts it.
@available(iOS 27.0, *)
@MainActor @Observable
final class AssistantModel {
enum Phase: Equatable { case idle, working, done, failed(String) }
private(set) var digest: NoteDigest.PartiallyGenerated?
private(set) var phase = Phase.idle
private var task: Task<Void, Never>?
@ObservationIgnored private var lastRequest: (note: String, model: any LanguageModel)?
func summarize(_ note: String, with model: any LanguageModel) {
task?.cancel() // one summary at a time; a new one replaces the old
lastRequest = (note, model)
digest = nil
phase = .working
task = Task {
let session = LanguageModelSession(model: model, instructions: "Summarize the note for a busy reader.")
do {
for try await snapshot in session.streamResponse(to: note, generating: NoteDigest.self) {
if Task.isCancelled { return } // stop() or a newer request owns the state now
digest = snapshot.content // partial: fields fill in as they arrive
}
if !Task.isCancelled { phase = .done }
} catch {
// Keep the note usable without AI. A cancelled task must not overwrite a newer one.
if !Task.isCancelled { phase = .failed(error.localizedDescription) }
}
}
}
func retry() {
if let lastRequest { summarize(lastRequest.note, with: lastRequest.model) }
}
func stop() {
task?.cancel()
task = nil
if phase == .working { phase = .idle }
}
}
@Generable properties in the order you declare them (guided generation). Put the closed-phone headline first: it shows before the points are done.isResponding.onAppear or .task below a layout switch. A fold can run it again (duo-continuity).import SwiftUI
// requires: Note, NoteBody (your types); AssistantPane, AssistantSummaryBar (references/assistant-pane.md)
/// Wide (open, book): the note leading, the assistant pane trailing, one on each side of the fold.
/// Otherwise (closed, tabletop, a narrow window): the note with a one-line digest at the bottom;
/// Details shows the same pane in a sheet.
@available(iOS 27.1, *)
struct NoteScreen: View {
let note: Note
let assistant: AssistantModel // owned by the window root
@Environment(\.horizontalSizeClass) private var widthClass
@State private var paneIsBeside = false
@State private var showsPaneSheet = false
var body: some View {
ArrangementView {
NoteBody(note: note) // primary: shown in every pose
} secondary: {
AssistantPane(model: assistant) // shown only when it fits beside
}
.arrangementViewStyle(.split.axes(.horizontal)) // beside, never below
.safeAreaInset(edge: .bottom) {
if !paneIsBeside {
AssistantSummaryBar(model: assistant) { showsPaneSheet = true }
}
}
.onGeometryChange(for: CGSize.self) { $0.size } action: { size in
// The split rule duo-patterns measured: side by side needs regular width and a wide view.
paneIsBeside = widthClass == .regular && size.width > size.height
}
.sheet(isPresented: $showsPaneSheet) { AssistantPane(model: assistant) }
.onChange(of: paneIsBeside) { _, beside in
if beside { showsPaneSheet = false } // the pane is on screen now
}
}
}
NavigationStack, never inside a List, ScrollView or NavigationSplitView (HIG).paneIsBeside mirrors the split rule (duo-patterns, supporting pane). Measure it after the inset, so the bar's height can't flip the result.AssistantPane, AssistantSummaryBar, the window root and a UIKit version: references/assistant-pane.md.What each pose gets (layout by size class and shape, never by pose; see duo-postures):
| Phone | Window | The AI feature |
|---|---|---|
| Closed, portrait or sideways | 466 × 678 or 678 × 466 pt, compact width | The note, and one line at the bottom: the headline, or what the model is doing. Details opens the full pane in a sheet. |
| Open, flat, held wide | 951 × 669 pt | Note leading, pane trailing, half each. |
| Book (partly folded, held wide) | 951 × 669 pt | The same, one on each side of the fold. The pane sits in the trailing region, where controls stay once the phone closes (duo-postures). |
| Tabletop (partly folded, held tall) | 669 × 951 pt | The note, with the one-line bar in the bottom region, near the hands. Details opens the sheet. |
| Split View on the inner display | Half the display | Whatever its width class and shape allow; unverified. |
Window sizes come from device facts. What our probe showed in each pose: references/evidence.md.
Apple lets the open phone add one level of hierarchy, as Mail adds the message beside the list (HIG). The pane is that level. The closed phone keeps the feature; it only shows less of it.
LanguageModelError (iOS 27) for guardrail violations, refusals, context overflow, rate limits and time-outs. iOS 26's LanguageModelSession.GenerationError is deprecated in iOS 27. Its missing-assets case moved to SystemLanguageModel.Error.assetsUnavailable; treat that like .modelNotReady.NSError (domain FoundationModels.LanguageModelError, code -1), so typed catch clauses missed it. Always end with a plain catch that shows the fallback.instructions. The model trusts instructions more than prompts, so that opens the door to prompt injection (safety guide).LanguageModel protocol: fetch its access token securely (Apple suggests OAuth) and keep it in the Keychain (WWDC26 session 241). Its privacy terms are not Apple's; say so.Tool lets the model ask your app for data. Keep tools small and read-only unless the person confirms an action.Attachment(cgImage) in a prompt sends an image (iOS 27). Check capabilities.contains(.vision) first; the on-device model reported it (measured).ContextOptions(reasoningLevel:) works with Private Cloud Compute; the on-device model reported no reasoning capability (measured).duo-pose set book, duo-pose set tabletop from duo-pose-matrix, or Device Hub's buttons): no button of the pane in the fold, and the bar sits in the bottom region in tabletop.contextSize read 0. On 29 October the log showed why: the simulator isn't supported (evidence).catch is untyped and shows the non-AI path.AssistantModel per window, owned by the window root; no request starts in onAppear or .task below a layout switch.@Generable result with the closed-phone headline as its first property.ArrangementView. Closed and tabletop: one line plus a way to the full pane. Same feature on both displays.instructions; people told before text goes to Private Cloud Compute.@available when the app deploys lower.What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
apple-intelligence, foundation-models, iphone-duo, swift, ai-pane
npx claudepluginhub kimeur/duology --plugin duology-features8 skills in this plugin
/duo-app-intentsApp Intents on iPhone Duo: AppIntent, AppEntity with EntityStringQuery, OpenIntent with TargetContentProvidingIntent and onAppIntentExecution (UISceneAppIntent and AppIntentSceneDelegate in UIKit) to show the right item in the right pane or window, handlesExternalEvents to pick the window, intents that work with the phone closed (supportedModes .background, IntentDialog, ProvidesDialog, isVoiceOnly), onscreen awareness when two panes are visible (appEntityIdentifier, appEntityIdentifier(forSelectionType:), NSUserActivity), App Shortcuts (AppShortcutsProvider) and AppIntentsTesting runs on the Duo simulator in each pose. Use when an app adds Siri, Shortcuts, Spotlight or Apple Intelligence actions, when an intent opens the wrong pane or an extra window, or when an intent must work while the phone is closed./duo-cameraCamera capture on iPhone Duo, Apple's foldable. Use when an app takes photos or video, runs a video call or shows a camera preview, and must work closed (outer display), open (inner display), partly folded (book, tabletop), open and turned around (flipped) and through fold and unfold. Covers the virtual front camera (.builtInWideAngleCamera or .builtInUltraWideCamera at .front; shared features only, up to 1080p at 60 fps, no depth), the physical front cameras (.builtInOuterUltraWideCamera, .builtInInnerUltraWideCamera), choosing a camera by the way it faces with AVCaptureDeviceDirectionCoordinator (AVKit) and AVCaptureDeviceDescriptor, mirroring a rear-camera selfie, AVCaptureDevice.RotationCoordinator across displays, the square front sensor and dynamicAspectRatio, a subject preview on the outer display with CameraCaptureAccessory, tabletop hands-free capture, and Split View interruptions. The simulator has no camera: the code typechecks; capture is unverified on a device./duo-gamesBuilds games for iPhone Duo, Apple's foldable. The game fills the closed outer display, the open inner display, book pose and tabletop by changing its aspect ratio instead of letterboxing, as Apple's HIG asks; touch controls stay off the fold; and in tabletop the world sits above the fold with the controls below it, like a handheld console. Use when you build or port a SpriteKit, Metal or SwiftUI game, when a game letterboxes, restarts or loses input on fold or unfold, or when you add touch controls or game controller support. Covers SKScene .resizeFill with a camera that keeps the play area in view, one scene or renderer that survives every fold (measured), MTKView drawableSizeWillChange, a UIWindowScene display link that follows the scene to the other display, TouchZones split at the .division reserved region, GameLayout for tabletop, GCController and the simulator's own Gamepad, GCVirtualController and Touch Controller placement, orientation locks the inner display ignores, and two-player games./duo-mediaVideo and audio playback on iPhone Duo, Apple's foldable. Use when an app plays video or audio and must keep playing through fold, unfold and rotation, when you build a tabletop player (video above the fold, the same controls below) or a book-pose player, an up next queue, Picture in Picture, Now Playing or background audio. Covers one AVPlayer owned above the layout switch (VideoPlayer, AVPlayerViewController, AVPlayerLayer), ArrangementView with .overlay and overlayArrangementZIndex for up next (measured on the simulator in every pose), when to pick .split instead, toolbarVerticalBehavior(.disabled) for a full-screen player, AVPictureInPictureController and canStartPictureInPictureAutomaticallyFromInline, the pinned Picture in Picture video that takes half the screen when folded, MPNowPlayingSession and remote commands, the .playback audio session, and what to test in Device Hub and on a device./duo-readingBuilds reading and document screens for iPhone Duo, Apple's foldable: one page on the closed outer display, two facing pages split at the fold when the phone is open and held wide or folded like a book, and in tabletop the page above the fold with page turns below it. Use when you build an e-reader, a long-form or PDF viewer, notes beside a document, or when a reader loses its place on fold, unfold, rotation or a Dynamic Type change. Covers TextKit 1 pagination (NSLayoutManager, NSTextContainer) that keeps the place as a character offset, PagedReader with FoldGeometry and reservedRegions(kind: .division, options: .includeInactive), notes that move between the trailing region and a sheet, Dynamic Type reflow, text selection that stays inside one page (iOS 27 Text range selection, a UITextView edit menu Add to Notes action, drag), PDFKit two-up centred on the fold, and Apple Pencil, which Apple says comes later in 2026 (what it will support is unverified)./duo-swiftui-27The iOS 27 SwiftUI changes that matter on iPhone Duo, Apple's foldable, where every fold, unfold and rotation resizes the app. Use it when building with Xcode 27.1 breaks a view (@State macro, ContentBuilder, TN3211), when a grid or list that reflows between the outer and inner display needs drag to reorder or swipe actions, or when you adopt the new tab, toolbar, dialog or AsyncImage APIs in a Duo app. Covers the @State macro through a fold and its source breaks, reorderable() and reorderContainer(for:isEnabled:move:) in a 2 or 4 column grid and across the fold, swipeActionsContainer() outside List, Tab(role: .prominent) at the foot of the vertical tab bar, toolbarMinimizationBehavior(_:for:) (the talk's toolbarMinimizeBehavior is not in the SDK), visibilityPriority, ToolbarOverflowMenu, topBarPinnedTrailing, alert and confirmationDialog with item:, AsyncImage HTTP caching and asyncImageURLSession(_:), and resizable iPhone apps. Points to Apple's swiftui-whats-new-27 Xcode skill for the rest.Other plugins' skills for the same job