freshcrate
Skin:/

Wax

Single-file memory layer for AI agents, sub mili-second RAG on Apple Silicon. Metal Optimized On-Device. No Server. No API. One File. Pure Swift

Why this rank:Strong adoptionRecent releaseHealthy release cadence

Description

Single-file memory layer for AI agents, sub mili-second RAG on Apple Silicon. Metal Optimized On-Device. No Server. No API. One File. Pure Swift

README

Wax Banner

Wax is a high-performance, single-file memory layer for AI agents on Apple platforms.
On-device, private, and portable. No server and no cloud dependency.

SwiftPlatformsLicenseStars English ยท Espaรฑol ยท Franรงais ยท ๆ—ฅๆœฌ่ชž ยท ํ•œ๊ตญ์–ด ยท Portuguรชs ยท ไธญๆ–‡


What is Wax?

Wax is a Swift-native persistence engine for AI agents. It stores documents, embeddings, and structured knowledge in a single portable .wax file.

The goal is simple: keep memory local, keep setup light, and make recall fast enough that it can stay in the loop.

Why Wax?

Feature Wax SQLite (FTS5) Cloud Vector DBs
Search Hybrid (Text + Vector) Text Only* Vector Only*
Latency ~6ms (p95) ~10ms (p95) 150ms - 500ms+
Privacy 100% Local 100% Local Cloud-hosted
Setup Zero Config Low Complex (API Keys)
Architecture Apple Silicon Native Generic Varies

Why a single .wax file?

Most RAG setups end up with a database, a vector store, and a file server. Wax keeps the moving pieces smaller by bundling documents, metadata, and indexes into one binary.

  • Less setup: no Docker stack and no separate database to babysit.
  • Portable: move the file with AirDrop, iCloud, or whatever sync layer you already use.
  • Atomic: backup, copy, or delete one file instead of chasing state across services.

Performance

Wax is tuned for M-series hardware and local recall.

Recall Latency (p95)

Lower is better. Measured in milliseconds.

Wax (Hybrid)  |โ–ˆโ–ˆ 6.1ms
SQLite (Text) |โ–ˆโ–ˆโ–ˆโ–ˆ 12ms
Cloud RAG     |โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆ 150ms+

Cold Open Time (p95)

Lower is better. Measured in milliseconds.

Wax           |โ–ˆโ–ˆโ–ˆ 9.2ms
Traditional   |โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆ 120ms+

Tip

Ingest Throughput: Wax handles 85.9 docs/s with full hybrid indexing on an M3 Max. Full benchmark report: Resources/docs/benchmarks/2026-03-06-performance-results.md


Architecture

Wax uses a frame-based container format and embeds the search engines it needs inside the main file: SQLite FTS5 for text and a Metal-accelerated HNSW index for vectors.

Internal File Layout

โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚                          Dual Header Pages (A/B)                         โ”‚
โ”‚   (Magic, Version, Generation, Pointers to WAL & TOC, Checksums)         โ”‚
โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
โ”‚                          WAL (Write-Ahead Log)                           โ”‚
โ”‚   (Atomic ring buffer for crash-resilient uncommitted mutations)         โ”‚
โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
โ”‚                          Compressed Data Frames                          โ”‚
โ”‚   โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”       โ”‚
โ”‚   โ”‚ Frame 0 (LZ4)    โ”‚  โ”‚ Frame 1 (LZ4)    โ”‚  โ”‚ Frame 2 (LZ4)    โ”‚ ...   โ”‚
โ”‚   โ”‚ [Raw Document]   โ”‚  โ”‚ [Metadata/JSON]  โ”‚  โ”‚ [System Info]    โ”‚       โ”‚
โ”‚   โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜       โ”‚
โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
โ”‚                          Hybrid Search Indices                           โ”‚
โ”‚   โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”     โ”‚
โ”‚   โ”‚ SQLite FTS5 Blob             โ”‚  โ”‚ Metal HNSW Index             โ”‚     โ”‚
โ”‚   โ”‚ (Text Search + EAV Facts)    โ”‚  โ”‚ (Vector Search)              โ”‚     โ”‚
โ”‚   โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜     โ”‚
โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
โ”‚                          TOC (Table of Contents)                         โ”‚
โ”‚   (Index of all frames, parent-child relations, and engine manifests)    โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
  1. Atomic resilience: dual headers and the WAL keep the store consistent even if the process dies mid-write.
  2. Unified retrieval: one query fans out to both the BM25 text index and the HNSW vector index.
  3. Structured knowledge: built-in EAV (Entity-Attribute-Value) storage handles durable facts and long-term reasoning.

Quick Start

Swift

import Wax

// Use a sandbox-safe, writable location (works in apps and CLI tools)
let url = URL.documentsDirectory.appending(path: "agent.wax")

// 1. Open a memory store
let memory = try await Memory(at: url)

// 2. Save a memory
try await memory.save("The user is building a habit tracker in SwiftUI.")

// 3. Search with hybrid recall (text + vector)
let results = try await memory.search("What is the user building?")

if let best = results.items.first {
    print("Found: \(best.text)")
    print("Document ID: \(best.metadata["id"] ?? "unknown")")
    // โ†’ "Found: The user is building a habit tracker in SwiftUI."
}

try await memory.close()
SwiftUI example
import SwiftUI
import Wax

struct ContentView: View {
    @State private var result = "Searchingโ€ฆ"

    var body: some View {
        Text(result)
            .task {
                do {
                    let url = URL.documentsDirectory.appending(path: "agent.wax")
                    let memory = try await Memory(at: url)

                    try await memory.save("The user is building a habit tracker in SwiftUI.")
                    let context = try await memory.search("What is the user building?")

                    result = context.items.first?.text ?? "Nothing found"
                    try await memory.close()
                } catch {
                    result = "Error: \(error.localizedDescription)"
                }
            }
    }
}
CLI tool (main.swift)
import Wax

@main
struct AgentMemory {
    static func main() async throws {
        let url = URL.documentsDirectory.appending(path: "agent.wax")
        let memory = try await Memory(at: url)

        try await memory.save("The user is building a habit tracker in SwiftUI.")

        let results = try await memory.search("What is the user building?")
        if let best = results.items.first {
            print("Found: \(best.text)")
        }

        try await memory.close()
    }
}

Looking to store persistent facts and long-term reasoning? See Structured Memory.

For repeated CLI vector work, Wax CLI now auto-starts and reuses a local broker that owns the long-term store and broker-managed session stores for commands such as remember, recall, and search --mode hybrid.

You can still run the broker directly when you want an explicit long-lived session:

wax-cli daemon --store-path ~/.wax/memory.wax

Send JSON lines such as:

{"id":"1","command":"remember","content":"An automobile needs periodic maintenance."}
{"id":"2","command":"search","query":"car service","mode":"hybrid","topK":3}
{"id":"3","command":"shutdown"}

Simple text-only usage still runs one-shot. If vector search is unavailable, hybrid/vector commands now fail loudly instead of silently dropping to text-only mode.

AI Coding Assistants

If you use an AI coding assistant like Claude Code, Cursor, or Windsurf, there are two good setup paths:

  • Use the Wax MCP server when you want persistent memory, session handoffs, and cross-session search inside the assistant.
  • Use the bundled Wax skill when you want the assistant to write correct Wax framework code directly against the Swift API.

Install the MCP server (Claude Code):

npx -y waxmcp@latest mcp install --scope user

This install flow stages the bundled Wax runtime into a stable local directory and registers the staged wax-mcp binary with Claude Code. npx is only used for install/bootstrap.

Install the skill (Claude Code):

# From within your project directory
claude install-skill https://github.com/christopherkarani/Wax/tree/main/Resources/skills/public/wax

Once installed, your assistant can work against Memory, VideoRAGOrchestrator, PhotoRAGOrchestrator, hybrid search, structured memory, and the MCP server without extra prompt scaffolding.

Or paste this prompt to get started from scratch:

Wax starter prompt (click to expand, then copy)
Use the Wax MCP server for persistent memory in this repo.

Workflow rules:
- At session start, call `handoff_latest` first to load prior context, then call `session_start` once and keep the returned `session_id`.
- Use `remember` to store decisions, discoveries, and short factual notes. If the memory is session-scoped, pass `session_id` as a top-level argument. Do not put `session_id` inside `metadata`.
- Use `recall` for assembled context and `search` for raw ranked hits.
- Prefer `mode: "hybrid"` when semantic retrieval helps. Use `mode: "text"` when I want a fast or deterministic lexical lookup.
- Do not manage `SESSION_STORE`, `--store-path`, or `flush` in normal agent flows. The broker owns long-term memory and virtual session stores.
- Use `handoff` near the end of the session with `content`, optional `project`, and `pending_tasks`, then call `session_end`.
- Use `corpus_search` only when you need cross-session retrieval across broker-managed session history with provenance metadata.
- Use structured memory tools (`entity_upsert`, `fact_assert`, `fact_retract`, `facts_query`, `entity_resolve`) for stable entities and facts, not transient debugging notes.

Behavior expectations:
- Read existing handoffs and recall results before asking me to restate prior context.
- Keep memory writes concise, factual, and scoped to the task.
- When a cross-session result looks relevant, cite the provenance metadata so we know which session store it came from.

Installation

Swift Package Manager

dependencies: [
    .package(url: "https://github.com/christopherkarani/Wax.git", from: "0.1.8")
]

Ecosystem Tools

๐Ÿค– MCP Server

Wax provides a first-class Model Context Protocol (MCP) server. Connect your local memory to Claude Code or any MCP-compatible agent.

npx -y waxmcp@latest mcp install --scope user

The published installer stages the bundled runtime into a stable local directory and registers wax-mcp directly, so steady-state MCP sessions do not launch through raw npx. For the recommended Claude Code prompt and setup flow, see Resources/docs/wax-mcp-setup.md.

๐Ÿ” WaxRepo

A semantic search TUI for your git history. Index any repository and find code or commits using natural language.

# From within any git repo
wax-repo index
wax-repo search "where did we implement the WAL?"

License

Wax is released under the Apache License 2.0. See LICENSE for details.

Built for developers who believe user data belongs on the user's device

Release History

VersionChangesUrgencyDate
0.1.23## What's Changed * Expose public retrieval controls and built-in embedders by @objectiveous in https://github.com/christopherkarani/Wax/pull/69 * Add OpenClaw memory adapter and MiniLM fix by @christopherkarani in https://github.com/christopherkarani/Wax/pull/66 * Bug hunt by @christopherkarani in https://github.com/christopherkarani/Wax/pull/71 * Clean public repository surface by @christopherkarani in https://github.com/christopherkarani/Wax/pull/72 ## New Contributors * @objectiveousHigh5/18/2026
0.1.22Latest release: 0.1.22High5/8/2026
waxmcp-v0.1.19## Summary - improve MCP startup, lock handling, corpus search, and CLI daemon reliability - prepare waxmcp / wax-mcp version 0.1.19 - add Wax Teams product and MVP planning docs ## Verification - swift build --product wax-cli --skip-update --disable-automatic-resolution - swift build --product wax-mcp --traits default,MCPServer --skip-update --disable-automatic-resolution - swift test --filter WaxCLIMemoryTests --skip-update --disable-automatic-resolution - packaged wax-cli vector-health passeMedium3/26/2026
0.1.19**Full Changelog**: https://github.com/christopherkarani/Wax/compare/0.1.18...0.1.19Low3/20/2026
0.1.18Release 0.1.18Low3/19/2026
0.1.17## What's Changed * Fix force-unwrapped time-range validation in FTS5SearchEngine and add regression test by @christopherkarani in https://github.com/christopherkarani/Wax/pull/43 * Improve MiniLM embedding error propagation APIs by @christopherkarani in https://github.com/christopherkarani/Wax/pull/46 * Claude/production readiness audit dh5 j3 by @christopherkarani in https://github.com/christopherkarani/Wax/pull/48 * Remove unsafe force-unwraps, tighten BinaryDecoder casting, add audit repLow3/14/2026
waxmcp-v0.1.16Follow-up release including latest commits on feat/wax-v2-improvements through ea59ac89.Low3/6/2026
waxmcp-v0.1.15max mxp releaseLow3/5/2026
0.1.9## What's Changed * chore: update .gitignore to exclude local agent/IDE config by @christopherkarani in https://github.com/christopherkarani/Wax/pull/40 * docs: add architecture visualization and rename binaries to wax-cli/wโ€ฆ by @christopherkarani in https://github.com/christopherkarani/Wax/pull/41 **Full Changelog**: https://github.com/christopherkarani/Wax/compare/0.1.8...0.1.9Low3/3/2026
waxmcp-v0.1.11Wax MCP release v0.1.11.Low2/27/2026
0.1.8## What's Changed * Add Claude Code GitHub Workflow by @christopherkarani in https://github.com/christopherkarani/Wax/pull/19 * Fix VideoRAG integration test determinism and thumbnail budget assertโ€ฆ by @christopherkarani in https://github.com/christopherkarani/Wax/pull/20 * clean by @christopherkarani in https://github.com/christopherkarani/Wax/pull/21 * Mcp feature by @christopherkarani in https://github.com/christopherkarani/Wax/pull/23 * Add swift-testing dependency for test targets by @Low2/25/2026
0.1.7## What's Changed * refactor: use opaque `some` types instead of existential `any` in function parameters by @christopherkarani in https://github.com/christopherkarani/Wax/pull/17 * Investigate WAL compaction gains by @christopherkarani in https://github.com/christopherkarani/Wax/pull/18 **Full Changelog**: https://github.com/christopherkarani/Wax/compare/0.1.6...0.1.7Low2/17/2026
0.1.6## What's Changed * Fix2 by @christopherkarani in https://github.com/christopherkarani/Wax/pull/14 * Fix13 by @christopherkarani in https://github.com/christopherkarani/Wax/pull/15 * Issue0214 by @christopherkarani in https://github.com/christopherkarani/Wax/pull/16 **Full Changelog**: https://github.com/christopherkarani/Wax/compare/0.1.5...0.1.6Low2/14/2026
0.1.5## What's Changed * modi by @christopherkarani in https://github.com/christopherkarani/Wax/pull/12 * Fix2 by @christopherkarani in https://github.com/christopherkarani/Wax/pull/13 **Full Changelog**: https://github.com/christopherkarani/Wax/compare/0.1.4...0.1.5Low2/12/2026
0.1.4Release 0.1.4Low2/10/2026
0.1.3Release 0.1.3Low2/3/2026
0.1.2## What's Changed * Feature/hierarchical surrogates by @christopherkarani in https://github.com/christopherkarani/Wax/pull/5 **Full Changelog**: https://github.com/christopherkarani/Wax/compare/0.1.1...0.1.2Low1/31/2026
0.1.1## What's Changed * Feature/metal vector search by @christopherkarani in https://github.com/christopherkarani/Wax/pull/1 * coreml by @christopherkarani in https://github.com/christopherkarani/Wax/pull/2 * feat: Add hierarchical surrogates with intelligent tier selection by @christopherkarani in https://github.com/christopherkarani/Wax/pull/3 * fix by @christopherkarani in https://github.com/christopherkarani/Wax/pull/4 ## New Contributors * @christopherkarani made their first contributioLow1/31/2026
0.1.0**Full Changelog**: https://github.com/christopherkarani/Wax/commits/0.1.0Low1/21/2026

Dependencies & License Audit

Loading dependencies...

Similar Packages

kagglerun๐Ÿš€ Run Python on Kaggle's free GPUs directly from your terminal without the need for a browser, streamlining your data science workflow.master@2026-05-31
cupertinoA local Apple Documentation crawler and MCP server. Written in Swift.v1.3.0
pipulateLocal First AI SEO Software on Nix, FastHTML & HTMXmain@2026-06-06
opentabsBrowser automation clicks buttons. OpenTabs calls APIs.main@2026-06-06
agentifyConvert OpenAPI specs into nine standard AI agent interfaces to integrate your API with various agent frameworks efficiently.main@2026-06-05

More in MCP Servers

AstrBotAgentic IM Chatbot infrastructure that integrates lots of IM platforms, LLMs, plugins and AI feature, and can be your openclaw alternative. โœจ
agentscopeBuild and run agents you can see, understand and trust.
claude-plugins-officialOfficial, Anthropic-managed directory of high quality Claude Code Plugins.
langchain4jLangChain4j is an open-source Java library that simplifies the integration of LLMs into Java applications through a unified API, providing access to popular LLMs and vector databases. It makes impleme