ChappieSDK product handles auth, transport, streaming, and host-tool execution. When you need conversations to survive app launches — so users can return to a thread they started yesterday — add the optional ChappieSDKRuntime product. It layers durable thread storage and normalized turn events on top of ChappieClient, keeping the base package lean for apps that have no persistence requirements.
Add ChappieSDKRuntime to Your Target
ChappieSDKRuntime is a separate product in the same Swift package. Link it only to app targets that need persistent storage; never add it to framework or library targets that might be distributed independently.
Open Package Dependencies
In Xcode, go to File → Add Package Dependencies… and enter the Chappie SDK repository URL:
Add ChappieSDKRuntime to your app target
When Xcode shows the product list, tick ChappieSDKRuntime in addition to ChappieSDK. Both products must be linked to the same app target.In a Then add both products to your target’s
Package.swift manifest, the dependency looks like this:dependencies array:Basic Setup
After importing both modules, create a store, attach it to a runtime, and start sending messages. The runtime records every turn automatically — no extra calls required.runtime.send(_:) behaves like client.send(_:) but persists the full turn to the store before returning. listThreads() returns the active (non-archived) threads sorted by recency. store.usage() reports how many bytes the store is currently using against the configured cap.
Choosing a Store
Chappie ships two store implementations. Pick the one that matches your app’s needs.ChappieFileThreadStore
Persists complete thread JSON to the app’s support directory. Transcripts survive app launches, device restarts, and upgrades. Use this for any production conversation surface.
ChappieInMemoryThreadStore
Keeps threads in memory only. Threads vanish when the process exits. Use this for unit tests, UI tests, and short-lived sessions where disk I/O would add noise.
Both stores apply identical retention defaults and expose the same
ChappieThreadStore protocol. You can swap between them or provide a fully custom implementation without changing any other code.Default Retention Policy
Both stores apply the same retention defaults out of the box. You do not need to configure anything for the defaults to take effect.| Parameter | Default value |
|---|---|
| Total stored transcript cap | 256 MiB |
| Archive inactive threads after | 30 days |
| Delete archived threads after | A further 60 days |
Customizing Retention
Pass aChappieThreadStoreRetentionPolicy to tighten or relax the defaults. All time values are in seconds.
.unlimited preset:
File Protection on iOS
ChappieFileThreadStore defaults to NSFileProtectionComplete on iOS. This means transcript files are encrypted at rest and inaccessible while the device is locked. That is the right default for most apps.
If your app needs to read or write transcripts while the device is locked — for example, a background extension that logs assistant turns during a background task — switch to .completeUntilFirstUserAuthentication:
Archived Threads
Threads that have been inactive for longer thanarchiveInactiveAfter move to an archived state. Archived threads are hidden from listThreads() by default so your chat list UI stays clean.
You can still access archived threads in two ways:
Backup Exclusion
Transcript directories and JSON files are excluded from iCloud backups by default. This keeps potentially sensitive conversation history off iCloud Drive and avoids bloating the user’s backup quota. You cannot opt back into iCloud backup through the publicChappieFileThreadStoreStoragePolicy API.
Privacy and Transcript Content
A custom store that conforms toChappieThreadStore is the right extension point when you need field-level control over what gets written to disk. The runtime calls the same protocol methods regardless of which concrete store you provide.