Expand description
Embedding CLI commands: ctx embed pending and ctx embed rebuild.
Manages the embedding lifecycle:
run_embed_pending— backfill missing or stale embeddingsrun_embed_rebuild— delete and regenerate all embeddingsembed_chunks_inline— embed chunks during sync (non-fatal)
§Staleness Detection
Each chunk’s text is hashed (SHA-256). When the hash in the embeddings
table differs from the chunk’s current hash, the embedding is considered
stale and will be re-generated by embed pending.
§Batching
Embeddings are generated in batches (configurable via embedding.batch_size
or --batch-size flag). Each batch is a single API call to the embedding
provider. Failed batches are logged but don’t abort the entire operation.
Structs§
- Pending
Chunk 🔒 - A chunk that needs embedding (missing or stale).
Functions§
- embed_
chunks_ inline - Embed chunks during sync (inline). Non-fatal on failure.
- find_
pending_ 🔒chunks - Find chunks that are missing embeddings or have stale hashes.
- hash_
text 🔒 - Compute SHA-256 hash of text content (hex-encoded).
- run_
embed_ pending - Backfill embeddings for chunks that are missing or have stale hashes.
- run_
embed_ rebuild - Delete all embeddings and regenerate for all chunks.
- upsert_
embedding 🔒 - Upsert an embedding into both
embeddings(metadata) andchunk_vectors(blob).