Skip to content

reindex_project

Backfill Cloudflare Vectorize embeddings for existing contexts in a project.

Overview

The reindex_project tool generates and stores vector embeddings for contexts that were saved before semantic search was enabled, or for contexts whose embeddings failed to write. After reindexing, search_context can route queries through Vectorize for semantic (meaning-based) matching rather than falling back to substring search.

Layer: Core / Layer 4 (Infrastructure)

Purpose: Populate missing Vectorize embeddings for a project's existing contexts


Parameters

ParameterTypeRequiredDescription
projectstringYesProject identifier to reindex

Returns

A summary of the reindex operation:

Reindex complete for "api-service":

Contexts processed: 43
Embeddings written: 41
Skipped (already indexed): 2
Failed: 0

Semantic search is now active for this project.

When to Use

After Migrating from an Older Version

If you deployed Wake Intelligence before v3.2.0 (when semantic search was introduced), your existing contexts have no embeddings. Run reindex_project to backfill them.

After a Vectorize Outage

If Cloudflare Vectorize was unavailable when contexts were saved, those contexts fell back to LIKE-only search. Reindex to restore semantic coverage.

When Search Results Feel Wrong

If search_context returns poor matches for a project, reindexing ensures all contexts have fresh, consistent embeddings.


Examples

Reindex a Single Project

typescript
reindex_project({ project: "authentication-service" })

Reindex After Migration

bash
# After upgrading to v3.2.0+, reindex all your projects
typescript
reindex_project({ project: "project-alpha" });
reindex_project({ project: "project-beta" });
reindex_project({ project: "api-service" });

How Semantic Search Works

When you call save_context, Wake Intelligence fires a Vectorize write in the background (fire-and-forget). This converts the context's summary into a dense vector embedding using Cloudflare Workers AI.

When you call search_context, the system checks whether Vectorize is available:

  • Vectorize available: semantic embedding similarity search (ANN)
  • Vectorize unavailable or empty: falls back to SQL LIKE '%query%'

reindex_project ensures the Vectorize index is populated for contexts that missed the background write.


Performance

  • Processes contexts in batches to stay within Workers AI rate limits
  • Typical time: ~500ms per 10 contexts (embedding generation dominates)
  • Already-indexed contexts are skipped automatically

See Also