Know a great AI tool or AI news source? Submit it to AiByts

Long-term memory for iOS and macOS chat apps, on-device, in one Swift package

Most chat apps forget you the moment the session ends. The usual fix is a backend with accounts, a vector database, and a privacy policy. If you ship a small iOS or macOS app, that is a lot to take on for "remember that I prefer short answers." I built AiPersona so the memory can live on the…

By Daniel SDev.to AI
Long-term memory for iOS and macOS chat apps, on-device, in one Swift package

AiPersona is a Swift package that enables on-device memory for chat apps, allowing users to retain conversation context without relying on a backend. It provides a local knowledge graph, memory extraction, and retrieval mechanisms for iOS and macOS apps.

What happened

AiPersona is a Swift package that allows chat apps to retain memory on the device. It extracts facts from conversations, stores them in a local knowledge graph, and provides retrieval mechanisms to enhance future interactions. The package supports multiple LLM providers and includes features like hybrid search, fact correction, and memory caching.

Why it matters

AiPersona is significant for developers creating chat apps on iOS and macOS, as it provides a way to retain user memory without relying on a backend. This can improve user experience by allowing the app to remember user preferences and conversation history, which is especially useful for small apps with limited resources.

  • AiPersona enables on-device memory for chat apps without a backend.
  • It uses a local knowledge graph to store and retrieve conversation facts.
  • Memory extraction and retrieval are handled by the package, allowing developers to focus on UI and LLM integration.
  • Facts are stored with timestamps and can be corrected without deletion.
  • The package supports multiple LLM providers and includes hybrid search mechanisms.

The bigger picture

AiPersona enables developers to create chat apps that retain user memory on the device, improving user experience and reducing reliance on backend systems. It allows for more personalized interactions and can be used in a variety of applications, including personal assistants and customer service tools.

AiPersona is a powerful Swift package that enables chat apps to retain memory on the device, improving user experience and reducing reliance on backend systems. It provides a local knowledge graph, memory extraction, and retrieval mechanisms, making it a valuable tool for developers creating chat apps on iOS and macOS.

Technical details

  • AiPersona uses a temporal knowledge graph to store facts with timestamps.
  • Hybrid BM25 plus embedding retrieval is used for memory retrieval.
  • Facts are stored in a SwiftData-backed graph of entities, episodes, and fact edges.
  • The package supports multiple LLM providers including Gemini, OpenAI, and Anthropic.
  • Local embeddings are used for entity resolution, with fallback to deterministic matching for names.
  • The package includes a memory provider, storage, and retrieval system.

FAQ

What is AiPersona?

AiPersona is a Swift package that enables on-device memory for chat apps, allowing users to retain conversation context without relying on a backend.

How does AiPersona store memory?

AiPersona stores memory in a local knowledge graph using SwiftData, with facts stored as bi-temporal edges with valid and invalid timestamps.

What LLM providers does AiPersona support?

AiPersona supports multiple LLM providers including Gemini, OpenAI, and Anthropic, with the ability to switch providers without changing the memory storage.

How does AiPersona handle fact corrections?

AiPersona handles fact corrections by invalidating the closest active fact above a similarity threshold, rather than deleting it, to avoid unintended side effects.

Can AiPersona be used with existing chat apps?

Yes, AiPersona can be integrated into existing chat apps by using its memory provider, storage, and retrieval mechanisms, allowing developers to focus on UI and LLM integration.

This summary and analysis were generated with AI from the original article and may contain errors. Read the original for the full story.

Read the full story

Originally published by Dev.to AI on Oct 4, 2026.

Read on Dev.to AI(opens in a new tab)

Comments

Sign in to join the discussion.

No comments yet — be the first to share your thoughts.