/fabrik:turbopufferfrom fabrik
Guides building vector, BM25 full-text, and hybrid search on turbopuffer, covering namespaces, schemas, consistency, and backpressure debugging.
Ships in fabrik. 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.
None: SKILL.md is the whole skill.
turbopuffer is a search engine (vector, full-text, hybrid, filters) built natively on object storage. Object storage is the only source of truth; NVMe SSD and memory are caches in front of it. That architecture makes it very cheap at rest, fast when warm (vector p50 ~14ms on 10M docs), and slower when cold (p50 ~500-900ms) or writing (p50 ~165ms for a 512KB batch, since every write is an object-storage PUT).
Reach for it when you have: RAG/semantic search, hybrid search (BM25 + vectors), naturally partitioned data (per-tenant namespaces), or large scale at low cost. It is deliberately not a fit for: a free tier (commercial only) or heavy first-stage ranking logic (it does first-stage retrieval; rerank in your own code). Bring your own vectors, or let it embed text for you (see Native embeddings).
There is no local emulator and no open-source version. Tests and development hit the real service (see Testing below).
id (u64, UUID, or string ≤64 bytes), optional vectors, and attributes. Attribute types are consistent per namespace and tracked in a per-namespace schema (auto-inferred by default; declare explicitly for uuid, datetime, vectors beyond vector, FTS, and to disable indexing).// go get github.com/turbopuffer/turbopuffer-go/v2
import (
"github.com/turbopuffer/turbopuffer-go/v2"
"github.com/turbopuffer/turbopuffer-go/v2/option"
)
tpuf := turbopuffer.NewClient(
option.WithAPIKey(os.Getenv("TURBOPUFFER_API_KEY")), // default; can be omitted
option.WithRegion("gcp-europe-west1"), // or TURBOPUFFER_REGION env var
)
ns := tpuf.Namespace("my-namespace")
Reuse one client for connection pooling. Region is part of the base URL (https://<region>.turbopuffer.com); pick the one closest to your backend. Regions span AWS (e.g. aws-eu-central-1, aws-us-east-1) and GCP (e.g. gcp-europe-west1, gcp-us-central1); full list at https://turbopuffer.com/docs/regions.
The client retries connection errors, 408, 409, 429, and 5xx with exponential backoff (4 retries by default; tune with option.WithMaxRetries). Errors unwrap to *turbopuffer.Error via errors.As. Optional scalar params use helpers: turbopuffer.Bool(true), turbopuffer.Int(10), turbopuffer.String("x") — prefer these over param.NewOpt, which needs an extra import the docs snippets forget.
Namespace names must match [A-Za-z0-9-_.]{1,128}. Attribute names can't start with $.
One endpoint does everything: upserts, patches, deletes, and namespace copies, atomically per request.
res, err := ns.Write(ctx, turbopuffer.NamespaceWriteParams{
UpsertRows: []turbopuffer.RowParam{
{"id": 1, "vector": embedding, "text": "walrus narwhal", "public": true},
{"id": 2, "vector": embedding2, "text": "pufferfish clownfish", "public": false},
},
DistanceMetric: turbopuffer.DistanceMetricCosineDistance,
Schema: map[string]turbopuffer.AttributeSchemaParam{
"text": {AttributeSchemaConfig: &turbopuffer.AttributeSchemaConfigParam{Type: "string", FullTextSearch: &turbopuffer.FullTextSearchConfigParam{}}},
"user_ids": turbopuffer.AttributeSchemaParamAttributeSchemaConfig("[]uuid"), // type only
},
})
// res.RowsAffected, res.RowsUpserted, ...
Write params (all optional, combined freely):
UpsertRows / UpsertColumns — insert or fully overwrite documents (row vs columnar format).PatchRows / PatchColumns — partial update of listed attributes only. Patches to missing IDs are silently ignored. Vector attributes cannot be patched.Deletes — delete by ID ([]any{1, 3}).DeleteByFilter / PatchByFilter — filter-driven bulk ops (max 5M / 50k rows per request; rows_remaining in the response tells you to reissue). Read Committed semantics.UpsertCondition / PatchCondition / DeleteCondition — conditional writes (below).DistanceMetric — cosine_distance or euclidean_squared. Required on writes to a namespace with vectors.Schema, Sharding, Encryption, CopyFromNamespace, BranchFromNamespace, DisableBackpressure.Batch aggressively: up to 512 MB per request, batching earns up to a 50% write discount, and per-namespace throughput is ~10k writes/s only when batched. Duplicate IDs in one request are an error (HTTP 400).
Types: string, int, uint, float, bool, uuid, datetime (ISO 8601 strings), array forms ([]string, []uuid, ...), vectors [N]f32 / [N]f16 / [N]i8, multi-vector [][N]f32 (late interaction), sparse {}f16. Only string/int/bool (and arrays of them) are inferred — declare the rest explicitly, or they land as the wrong type permanently. An attribute literally named vector is inferred as a vector.
Per-attribute schema options: Ann (required true for extra vector columns), Filterable (default true; set false on large attributes you never filter — 50% storage discount and faster indexing), FullTextSearch (bool or config object), Regex, Glob, Fuzzy (each enables the matching filter operators; each defaults filterable to false when enabled), SparseKnn, Embed.
Schema is a map[string]turbopuffer.AttributeSchemaParam; wrap options in {AttributeSchemaConfig: &turbopuffer.AttributeSchemaConfigParam{...}} or use turbopuffer.AttributeSchemaParamAttributeSchemaConfig("uuid") for a bare type.
Schema changes in place: filterable, full_text_search, regex, glob, fuzzy, adding/removing embed — via a document-free write with only Schema set, or ns.UpdateSchema. Type changes and attribute deletion require export + re-upsert into a new namespace. A namespace has max 8 vector columns (embedded attributes count), fixed at creation; all documents must include all vector attributes.
Conditions are filters evaluated atomically against the current document (Serializable semantics); NewExprRefNew references the incoming value. Documents that don't exist are written unconditionally.
res, err := ns.Write(ctx, turbopuffer.NamespaceWriteParams{
UpsertRows: []turbopuffer.RowParam{{"id": 1, "vector": v, "updated_at": "2026-07-31T12:00:00Z"}},
UpsertCondition: turbopuffer.NewFilterOr([]turbopuffer.Filter{
turbopuffer.NewFilterLt("updated_at", turbopuffer.NewExprRefNew("updated_at")),
turbopuffer.NewFilterEq("updated_at", nil),
}),
DistanceMetric: turbopuffer.DistanceMetricCosineDistance,
})
Conditional and filter-based writes are billed as a write plus one or two queries.
res, err := ns.Query(ctx, turbopuffer.NamespaceQueryParams{
RankBy: turbopuffer.NewRankByAnn("vector", queryEmbedding),
Limit: turbopuffer.LimitParam{Total: 10},
Filters: turbopuffer.NewFilterEq("public", true),
IncludeAttributes: turbopuffer.IncludeAttributesParam{StringArray: []string{"text"}},
})
for _, row := range res.Rows {
// Row is a map[string]any: row["id"], row["$dist"] (the rank score),
// and the requested attributes like row["text"]
}
NewRankByAnn("vector", []float32{...}) — approximate nearest neighbor.NewRankByKnn(...) — exact search; requires filters, costs 2 concurrency slots.NewRankByTextBM25("text", "query") — full-text relevance.NewRankByAttribute("created_at", "desc") — order by attribute (no $dist; arrays not orderable).NewRankBySparseKnn("sparse", map[string]float64{...}) — sparse vectors.NewRankByTextSum, NewRankByTextMax, NewRankByTextProduct(2, ...) for boosting; NewRankByTextSaturate/NewRankByTextDecay/NewRankByTextDist for popularity and recency signals.Weighted multi-field text search:
RankBy: turbopuffer.NewRankByTextSum([]turbopuffer.RankByText{
turbopuffer.NewRankByTextProduct(2, turbopuffer.NewRankByTextBM25("title", "quick fox")),
turbopuffer.NewRankByTextBM25("content", "quick fox"),
}),
Documents scoring zero are excluded from results. Always set Limit: Limit.Total maxes out at 10,000; Limit.Per diversifies (max N results per attribute value). top_k is only a legacy alias for limit.total — don't use TopK in new code.
Constructors mirror the wire operators (turbopuffer.NewFilter*):
Eq, NotEq, In, NotIn, Lt, Lte, Gt, Gte (+ AnyLt etc. for array elements). Eq(attr, nil) matches missing attributes; Lt/Lte also match null.Contains, NotContains, ContainsAny, NotContainsAny.Glob, IGlob, NotGlob, NotIGlob, Regex (no lookaround/backreferences), Fuzzy (edit-distance options). Anchored patterns (turbo*) use the trigram index; unanchored ones degrade toward full scans.ContainsAllTokens, ContainsAnyToken, ContainsTokenSequence (phrase match).NewFilterAnd([]turbopuffer.Filter{...}), NewFilterOr(...), NewFilterNot(...). Filters on id work fine.AggregateBy (mutually exclusive with RankBy) with NewAggregateByCount() / NewAggregateBySum(attr), optionally grouped:
res, err := ns.Query(ctx, turbopuffer.NamespaceQueryParams{
AggregateBy: map[string]turbopuffer.AggregateBy{"n": turbopuffer.NewAggregateByCount()},
GroupBy: []turbopuffer.GroupBy{turbopuffer.NewGroupByAttr("category")},
})
// res.AggregationGroups
Aggregate/group-by queries scan the namespace and consume 4 concurrency slots — don't put them on hot paths.
There is no export endpoint; paginate the query API by ID:
var lastID any
for {
params := turbopuffer.NamespaceQueryParams{
RankBy: turbopuffer.NewRankByAttribute("id", "asc"),
Limit: turbopuffer.LimitParam{Total: 10_000},
}
if lastID != nil {
params.Filters = turbopuffer.NewFilterGt("id", lastID)
}
res, err := ns.Query(ctx, params)
if err != nil {
return err
}
// process res.Rows ...
if len(res.Rows) < 10_000 {
break
}
lastID = res.Rows[len(res.Rows)-1]["id"]
}
For plain replication (no transformation), prefer ns.CopyFrom — server-side, up to 75% write discount, works across regions, clouds, and orgs.
Enable per attribute (string or []string). The zero-value config gets sensible defaults: word_v4 tokenizer, English, case-insensitive. Tune via FullTextSearchConfigParam: Language (18 languages), Stemming (default false), RemoveStopwords, CaseSensitive, AsciiFolding, MaxTokenLength, tokenizer, and BM25 parameters K1 (default 1.2, term-frequency saturation), B (default 0.75, length normalization), K3 (default 8.0, query-term saturation). The pre_tokenized_array tokenizer takes client-side tokens in a []string attribute — the same tokenizer function must be applied at write and query time.
Search-as-you-type: BM25 and token filters accept a last-token-as-prefix option (Bm25ClauseParams/filter WithParams variants). Result highlighting is available via compute_attributes with NewExprHighlight (beta). FTS changes rebuild in the background; queries serve the old config until the new index is ready.
Run vector and BM25 in one request with MultiQuery (same snapshot, up to 16 subqueries), fused server-side with reciprocal rank fusion:
res, err := ns.MultiQuery(ctx, turbopuffer.NamespaceMultiQueryParams{
Queries: []turbopuffer.NamespaceMultiQueryParamsQuery{
{RankBy: turbopuffer.NewRankByAnn("vector", queryVec), Limit: turbopuffer.LimitParam{Total: 50}},
{RankBy: turbopuffer.NewRankByTextBM25("text", query), Limit: turbopuffer.LimitParam{Total: 50}},
},
RerankBy: turbopuffer.NewRerankByRrf(), // fused list in res.Results[0].Rows
})
Without RerankBy, results come back per-subquery in order. RRF's rank_constant defaults to 60. The recommended pipeline for serious search: LLM query rewriting → multi-query retrieval (~50-100 candidates each) → RRF → external re-ranker (Cohere, Voyage, etc.) → your own second-stage logic. Keep it all in one file (search.go). Evaluate with NDCG and a fixed query set; check ANN quality with ns.Recall(...) (compares ANN against exhaustive ground truth).
turbopuffer can embed a string attribute on write and the query text at query time, so no embedding-provider code is needed. Declare Embed on the attribute; the vector lands in embed_<attr> (set Attribute to reuse an existing column, e.g. vector).
_, err := ns.Write(ctx, turbopuffer.NamespaceWriteParams{
UpsertRows: []turbopuffer.RowParam{{"id": 1, "text": "a cat sleeping on a windowsill"}},
DistanceMetric: turbopuffer.DistanceMetricCosineDistance,
Schema: map[string]turbopuffer.AttributeSchemaParam{
"text": {AttributeSchemaConfig: &turbopuffer.AttributeSchemaConfigParam{
Type: "string",
Embed: turbopuffer.AttributeEmbedConfigParam{Model: "voyage/voyage-4", Dims: turbopuffer.Int(1024)},
}},
},
})
res, err := ns.Query(ctx, turbopuffer.NamespaceQueryParams{
RankBy: turbopuffer.NewRankByAnnExpr("text", turbopuffer.NewExprEmbed("a sleepy pet")), // wire: ["text", "ANN", ["Embed", "a sleepy pet"]]
Limit: turbopuffer.LimitParam{Total: 10},
})
NewExprEmbedWithParams(q, turbopuffer.EmbedParams{Model: turbopuffer.String("voyage/voyage-4")}) — same model as the documents.embed on an existing namespace does not re-embed existing rows.embed can be added or removed, not changed; switching models means re-ingesting.voyage/voyage-4, nvidia/nemotron-3-embed-8b, openai/text-embedding-3-small, cohere/embed-v4.0, qwen/qwen3-embedding-8b, ...).ns.Metadata(...) — schema, approx_row_count, approx_logical_bytes, index status (unindexed_bytes), pinning/branching/sharding state. Billed as a zero-row query.ns.HintCacheWarm(...) — pre-warm the cache when a user opens your search UI, so their first query isn't cold. Free if already warm.tpuf.NamespacesAutoPaging(ctx, turbopuffer.NamespacesParams{Prefix: turbopuffer.String("tenant-")}) — list namespaces (needs an API key with list permission).ns.DeleteAll(...) — delete the namespace and all documents. Irreversible; the name is immediately reusable.ns.BranchFrom(ctx, turbopuffer.NamespaceBranchFromParams{SourceNamespace: "prod"}) — instant copy-on-write clone, constant-time at any size, fully independent afterwards, flat $0.032 per branch plus storage at standard rates. Great for dev environments on production data, test pipelines, and pre-migration snapshots. Shares storage with the source, so it's not a backup. Same region only; the destination must be empty; read_only is inherited, pinning is not (the branch starts unpinned); not yet supported on sharded namespaces.ns.CopyFrom(...) — full server-side copy; the tool for real backups (cross-region/cloud/org via SourceRegion/SourceAPIKey), resharding, and changing the encryption key. Destination must be empty; pinning is not carried over. There are no automated backups — schedule copies yourself if you need them.ns.UpdateMetadata with NamespaceMetadataPatch: turbopuffer.NamespaceMetadataPatchParam{ReadOnly: turbopuffer.Bool(true)} — freeze a namespace (rejects document and schema writes; in-flight writes may still commit). Same call sets pinning (below).Sharding: turbopuffer.ShardingConfigParam{NumShards: n} on the first write, sized at roughly one shard per TB with room to grow (max 256; over-sharding raises tail latency since every query waits on every shard). The count can't change in place; reshard by writing CopyFromNamespace: turbopuffer.CopyFromNamespaceParams{SourceNamespace: "docs"} plus a new Sharding into an empty namespace. No per-shard fee. Strongly consistent queries see one snapshot across shards; eventually consistent ones may differ per shard. Not for multi-tenancy (use namespaces) or QPS (use pinning).By default namespaces share query nodes and cache. Pinning reserves dedicated query nodes + NVMe for one namespace: always warm, predictable latency, and it lifts the 16-concurrent-query cap. It replaces per-query billing with GB-hours: namespace size (GB) × replicas × hours pinned, minimum 128 GB and 10 minutes, billed whether or not queries arrive, and each replica multiplies the cost (billed as soon as it runs, even before it's warm).
Pin only when all hold: namespace > 16 GB, sustained (not bursty) traffic > 10 QPS, and cold queries or concurrency 429s are hurting or they want a predictable bill. Below that, per-query billing is cheaper — use HintCacheWarm for occasional cold starts instead. Estimate the monthly cost (e.g. 500 GB × 2 replicas × 730 h) and confirm with the user before pinning or adding replicas.
_, err := ns.UpdateMetadata(ctx, turbopuffer.NamespaceUpdateMetadataParams{
NamespaceMetadataPatch: turbopuffer.NamespaceMetadataPatchParam{
Pinning: turbopuffer.PinningConfigParam{Replicas: turbopuffer.Int(1)},
},
})
meta, err := ns.Metadata(ctx, turbopuffer.NamespaceMetadataParams{})
// meta.Pinning.Status.ReadyReplicas, .Replicas, .Utilization
Utilization stays above 0.9 or queries return 429. Replicas don't autoscale.{"pinning": null}; the typed params can't express null, so use ns.UpdateMetadata(ctx, turbopuffer.NamespaceUpdateMetadataParams{}, option.WithJSONSet("pinning", nil)). Billing stops on unpin.Tenant isolation: one namespace per tenant. Document-level permissions within a namespace: store allowed user_ids/group_ids as array attributes (declare []uuid explicitly — inferred string is slower and bigger) and filter with Contains from your auth layer. The inverted index makes membership filters cheap even with thousands of IDs. Model public documents as an explicit is_public bool rather than an empty permissions array — an empty array should mean no access, and the explicit flag is both safer and faster.
Hit the real service with a unique namespace per test, deleted afterwards:
func newTestNamespace(t *testing.T) turbopuffer.Namespace {
t.Helper()
tpuf := turbopuffer.NewClient()
ns := tpuf.Namespace("test-" + uuid.NewString())
t.Cleanup(func() {
if _, err := ns.DeleteAll(context.Background(), turbopuffer.NamespaceDeleteAllParams{}); err != nil {
var apierr *turbopuffer.Error
if !errors.As(err, &apierr) || apierr.StatusCode != 404 {
t.Logf("deleting test namespace: %v", err)
}
}
})
return ns
}
For testing against real data, BranchFrom a production namespace and delete the branch afterwards. For a harder boundary, use a separate turbopuffer organization for CI.
DisableBackpressure: turbopuffer.Bool(true), write large batches concurrently (a couple of goroutines per CPU), and query with eventual consistency until indexed — strongly consistent queries error above the backlog limit while backpressure is off. It doesn't combine with patches or conditional writes.ns.Metadata(...): meta.Index.Status is updating (with UnindexedBytes/UnindexedRows shrinking) or up-to-date. If it stops shrinking with no new writes, contact support. Row counts don't update during a backpressure-off backfill.Filterable: false on large attributes you don't filter (raw chunk text, blobs).IncludeAttributes to what you need.[N]i8 > [N]f16 > [N]f32. Models with quantization-aware training (voyage-4 family, embed-v4, qwen3) lose almost nothing at i8.rank_by simple (retrieve 100-1,000 candidates), do clever ranking in your own second stage.Start with ns.Metadata (schema, index status) and rerun the failing query looking at res.Performance: CacheTemperature (hot/warm/cold), ServerTotalMs (includes time queued behind the concurrency limit; compare QueryExecutionMs), ExhaustiveSearchCount (unindexed docs scanned — high means an indexing backlog), plus CacheHitRatio, ApproxNamespaceSize, and EmbeddingMs/EmbeddingTokens for native embeddings.
filterable (FTS/regex/glob/fuzzy default off); Glob/Regex/Fuzzy without the schema flag; BM25 on an attribute without FTS; filter value type doesn't match the schema (uuid, datetime); HTTP 409 because an index is still building.ns.Recall, then try kNN with filters or hybrid); stale reads from eventual consistency.HintCacheWarm, or pin); heavy shapes — IncludeAttributes of everything, unanchored Glob "*x*", huge In lists, complex rank_by, aggregations on large namespaces; high ExhaustiveSearchCount (see Ingestion).HTTP 429 causes:
| Cause | Fix |
|---|---|
| Query concurrency: >16 in flight on an unpinned namespace (17th waits 800ms, then 429; kNN counts 2, aggregations 4) | Faster queries, eventual consistency, warm the cache, cap concurrency client-side, or pin with replicas. The limit is concurrent queries, not QPS: 10ms queries still allow ~1,600 QPS |
| Pinned namespace saturated | Add replicas when Utilization stays above 0.9 |
| Write backpressure: >2 GB unindexed | DisableBackpressure for backfills, or slow down (see Ingestion) |
| Native embedding rate limit | Back off, smaller batches in parallel, or ask turbopuffer to raise it |
The SDK retries 429s automatically.
Per namespace: 500M docs / 1TB unsharded (256 shards × that with sharding); 8 vector columns (fixed at creation; embedded attributes count); 4 embedded attributes; 10,752 max dense dimensions; 1,024 attribute names; 16 concurrent queries (17th waits up to 800ms, then 429 — aggregations count 4×, exact kNN 2×); ~5k QPS (read replicas raise it). Per request: 512 MB writes; limit.total ≤ 10k; 16 subqueries per multi-query; 256 computed attributes; full-text query ≤ 1,024 chars. Per document: 64 MiB total; 8 MiB per attribute value; 4 KiB per filterable value. Full table: https://turbopuffer.com/docs/limits — most limits can be raised on request.
id and $dist by default. Ask for attributes via IncludeAttributes; vectors are omitted unless requested.uint, uuid, datetime, and non-default vectors must be declared in the schema or they're inferred wrong with no in-place fix.DistanceMetric is required on every write to a namespace with vectors, and must not change.Filterable: turbopuffer.Bool(true) if you also filter on them.param.NewOpt(true) without showing the import; use turbopuffer.Bool/Int/String instead.Every docs page is fetchable as clean markdown: https://turbopuffer.com/docs/<page>.md (e.g. /docs/query.md, /docs/write.md, /docs/fts.md), index at https://turbopuffer.com/llms.txt, everything in one file at https://turbopuffer.com/llms-full.txt. The Go SDK surface is best checked with go doc github.com/turbopuffer/turbopuffer-go/v2 (constructors are exhaustive there; the web docs are Python-first). Don't guess constructor or field names — look them up. CMEK, private networking, BYOC, and audit logs are Enterprise/plan-gated features; point the user at the docs and turbopuffer support for those.
What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
turbopuffer, vector-search, full-text-search, hybrid-search, rag
28 skills in this plugin
/ableton-liveGuide for making music in Ableton Live 12 on macOS. Use this skill whenever the user asks how to do something in Ableton Live or "in Live", wants help with a Live Set, project, or session, asks which stock Live device or instrument to use for a sound (Operator, Wavetable, Drift, Meld, Simpler, Sampler, Roar, Echo, Hybrid Reverb, Auto Filter, Drum Rack, Racks, Macros...), needs warping, Session vs Arrangement, clip launching, Follow Actions, MIDI editing, MIDI Tools, scale awareness, grooves, automation, clip envelopes, routing, sidechain, resampling, comping, stem separation, bouncing, freezing, exporting, Push 1/2, Link, MIDI sync, CPU or latency troubleshooting, or keyboard shortcuts. Trigger even when the user doesn't say "Ableton" -- words like "Live Set", ".als", "clip slot", "scene", "Drum Rack", "Simpler", "warp marker", "Session View", "Arrangement View", "Max for Live", or "Push" are enough. Also use it when the user is producing electronic music and asks for a workflow or sound-design recipe that will be executed in Live./accomplishmentsExtract accomplishments from new implementation diary entries into docs/accomplishments.md, written as one-line reflections that blend self-appraisal with Markus's appreciation. Use only when the user invokes /accomplishments or explicitly asks to extract, update, or refresh accomplishments from the diary. Do not run proactively.npx claudepluginhub maragudk/fabrik --plugin fabrikOther plugins' skills for the same job