The Cloudflare serving layer of the fleet's vector memory — embeds the fleet's
corpora (ai-writings, memory notes, repo READMEs) into the fleet-twin
Vectorize index and answers semantic queries.
- URL: https://fleet-twin.casey-digennaro.workers.dev
- Index:
fleet-twin(Vectorize, 768d, cosine) - Model:
@cf/baai/bge-base-en-v1.5(Workers AI, free tier) - State: KV
TWIN_STATE(idempotency keys + vector/source tallies) - Secret:
INGEST_TOKEN(bearer gate on /ingest; local copy in.ingest-token)
| Method | Path | Auth | Body / Params | Returns |
|---|---|---|---|---|
| GET | /health |
— | — | {ok, name, model, dimensions, time} |
| GET | /stats |
— | — | {vectors, sources{...}, model, dimensions} |
| POST | /ingest |
Bearer | {docs:[{id, text, metadata{source,type,date}}]} (≤96 docs) |
{ingested, newDocs, updatedDocs, vectorDelta, vectors, ids} |
| POST | /admin/reset-stats |
Bearer | — | {ok, reset:["count","sources"]} |
| POST | /query |
— | {text, topK?, type?, source?} |
{query, topK, results:[{id, docId, score, metadata}]} |
- Idempotent by id: re-ingesting upserts in place, never double-counts.
- Delta-aware tallies: re-ingesting a doc with a different chunk count or
source adjusts
count/sourcesby the delta (post 2026-08-25 fix). - Chunking: docs >2k chars split on paragraph boundaries → vectors
${id}#N. The loader's ~800-token chunks usually re-split into ~1.4 vectors, so the vector count is ~1.4× the chunk-doc count — not duplication. - CORS: reflects Origin for
*.pages.dev+http://localhost(:port)only. - Filters: metadata indexes exist on
typeandsource(required for Vectorize filtering — vectors upserted before a metadata index exists must be re-upserted to be filterable). - DELETE-free by design: no delete endpoint. Admin cleanup only via
wrangler vectorize delete-vectors.
GET /stats reads KV tallies (count, sources), NOT the live index — the
Vectorize binding cannot report its own size. The tallies are maintained by
/ingest and are only as honest as the doc:<id> idempotency keys.
- Purge the index with wrangler → always
POST /admin/reset-stats(Bearer) before reloading, or tallies will stack on stale history. - Clearing
doc:*KV keys makes the next load count everything as new again — that is howunknown:14112andvectors:156788once accumulated (pre-fix loads also omittedmetadata.source, tallying everything as "unknown"). - Ground truth for the index size is always
wrangler vectorize info fleet-twin. - The
/statsfix of 2026-08-25: index enumerated vialist-vectors/get-vectors, 13 test-stray vectors deleted (incl. the lonesource=unknownone), KV tallies rewritten from the exact per-vector census (334 sources, 52324 vectors).
test/roundtrip.sh # hits the deployed worker: ingest 3 docs, query, recall + idempotency + CORS + auth checkswrangler deploy
cat .ingest-token | wrangler secret put INGEST_TOKEN