Skip to content

Instantly share code, notes, and snippets.

@pixelfolio
Created June 9, 2026 20:19
Show Gist options
  • Select an option

  • Save pixelfolio/5ed0367a2e0b26bf52524e996654a769 to your computer and use it in GitHub Desktop.

Select an option

Save pixelfolio/5ed0367a2e0b26bf52524e996654a769 to your computer and use it in GitHub Desktop.
Xcode 27's on-disk Apple documentation vector-search SQLite DB

Xcode 27 ships Apple's docs as an on-device vector-search SQLite DB

Xcode 27's Developer Documentation component (Xcode → Settings → Components) is not a bundle of .doccarchives. It's an on-device vector-search SQLite database, the RAG index behind Xcode's AI documentation search. You can read it directly.

Why this is interesting for agentic / AI-assisted coding:

  • It's a local, queryable corpus of the installed Xcode Developer Documentation, so you can ground a coding agent on it with no scraping and no network.
  • It carries the current beta-SDK frameworks (FoundationModels, CoreAI, Evaluations, MediaIntelligence, etc.) as soon as you install the Xcode beta, already chunked and local, so you can ground agents on new-API docs offline.
  • The chunk text is stored as plaintext in attributes.content, so you can run your own retrieval; you do not need Apple's embeddings.

Where

/System/Library/AssetsV2/com_apple_MobileAsset_AppleDeveloperDocumentation/<uuid>.asset/AssetData/documentation-db/index.sql

Each installed Xcode (and each beta) drops its own <uuid>.asset, keyed by MobileAssetProperties.XcodeVersion in the sibling Info.plist. The folder names are UUIDs, so do not sort them lexicographically. List versions and pick the newest:

for d in /System/Library/AssetsV2/com_apple_MobileAsset_AppleDeveloperDocumentation/*.asset; do
  v=$(/usr/libexec/PlistBuddy -c "Print :MobileAssetProperties:XcodeVersion" "$d/Info.plist" 2>/dev/null)
  echo "$v  $d/AssetData/documentation-db/index.sql"
done | sort -V

Format

  • GRDB-managed SQLite, ~1 GB. AssetData/config.json: databaseType: vectorSearch, embeddingModelName: md7v2 (type uem), 512-dim, cosine, 1700-char chunks, FTS disabled.
  • 264,773 chunks across 372 frameworks (Xcode 27.0 / iOS 26.2 snapshot).
  • Key tables:
    • attributes: framework, title, content (the full chunk text, plaintext), type, asset_id (= doc URI)
    • observations: the embedding BLOBs
    • partitions: ANN cluster centroids
    • documents, metadata

Read it

# resolve the newest-XcodeVersion asset (NOT `ls | tail`, which sorts by UUID)
DB=$(for d in /System/Library/AssetsV2/com_apple_MobileAsset_AppleDeveloperDocumentation/*.asset; do
  v=$(/usr/libexec/PlistBuddy -c "Print :MobileAssetProperties:XcodeVersion" "$d/Info.plist" 2>/dev/null)
  [ -n "$v" ] && echo "$v $d/AssetData/documentation-db/index.sql"
done | sort -V | tail -1 | cut -d' ' -f2)

# what frameworks are indexed
sqlite3 "file:$DB?mode=ro" "select framework, count(*) from attributes group by framework order by 2 desc limit 20;"

# read doc text (lexical)
sqlite3 "file:$DB?mode=ro" "select framework, title, content from attributes where content like '%PrivateCloudCompute%' limit 5;"

A small ranked lexical search helper is in appledoc-search.sh in this gist.

Semantic search (bring your own embeddings)

The stored vectors come from Apple's md7v2 / uem model (named in config.json). It appears to be served by the private EmbeddingService.framework (its binary lives in the dyld shared cache, which is why it never shows up in a file grep), though I haven't confirmed that by reverse-engineering. Either way, Apple does not expose a public query-embedding API compatible with these stored vectors, so you can't embed a query into the same space to search them directly.

You don't need to. The chunk text is plaintext in attributes.content, so re-embed it with any sentence-embedding model you control (e.g. mxbai-embed-large / bge-large / nomic-embed-text via Ollama) and put the vectors in pgvector / sqlite-vec / FAISS. In a quick 15-query test over one framework, mxbai-embed-large gave recall@5 = 1.0; pure dense beat lexical handily on natural-language queries.

Caveats

  • It's a beta snapshot tied to the installed Xcode version, refreshed when Xcode updates. Not authoritative for shipping behaviour.
  • Read-only curiosity. Don't write to it.

Related

  • cupertino: an MCP server for Apple docs / Swift Evolution / packages. It indexes the shipping docs (great for agents); this on-disk DB is complementary: it's Apple's own index and carries the beta SDK before cupertino re-fetches.
#!/bin/bash
# Ranked lexical search over Xcode's on-disk Apple documentation vector DB.
# Usage: appledoc-search.sh [-f Framework] [-n N] "query terms"
set -euo pipefail
ROOT="/System/Library/AssetsV2/com_apple_MobileAsset_AppleDeveloperDocumentation"
# Resolve the newest asset by XcodeVersion. Folder names are UUIDs, so `ls | tail` would
# pick a lexicographically-last UUID (e.g. an older Xcode), not the newest version.
# Sort with `sort -V` (version sort) so 27.0 > 26.10 > 26.9 order correctly.
DB=$(for d in "$ROOT"/*.asset; do
f="$d/AssetData/documentation-db/index.sql"; [ -f "$f" ] || continue
v=$(/usr/libexec/PlistBuddy -c "Print :MobileAssetProperties:XcodeVersion" "$d/Info.plist" 2>/dev/null)
[ -n "$v" ] && printf '%s\t%s\n' "$v" "$f"
done | sort -V | tail -1 | cut -f2)
[ -n "$DB" ] || { echo "No Apple Developer Documentation asset found (install it in Xcode > Settings > Components)." >&2; exit 1; }
FW=""; N=8
while [[ "${1:-}" == -* ]]; do case "$1" in
-f) FW="$2"; shift 2;; -n) N="$2"; shift 2;;
*) echo "unknown flag $1" >&2; exit 2;; esac; done
Q="${1:?usage: appledoc-search.sh [-f Framework] [-n N] \"query\"}"
where=""; score=""
for w in $Q; do w=${w//\'/\'\'}
where+=" or content like '%$w%' or title like '%$w%'"
score+=" + (content like '%$w%') + 2*(title like '%$w%')"
done
where=${where# or }; score=${score# + }
fw=""; [ -n "$FW" ] && fw="and framework='${FW//\'/\'\'}'"
sqlite3 -separator ' | ' "file:$DB?mode=ro" \
"select framework, title from attributes where ($where) $fw order by ($score) desc limit $N;"
@Garciat

Garciat commented Jul 16, 2026

Copy link
Copy Markdown

Unrelated but it is annoying that this 2GB+ asset cannot be easily deleted, afaik.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment