Skip to content

About

Vector twin of the SuperInstance corpus — cloud (Workers+Vectorize) + local (Ollama) query, MCP server, open ecosystem

Resources

Code of conduct

Contributing

Security policy

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

fleet-twin

The fleet's twin — a mirror of the whole fleet in a glass case, each hull holding constellations of memory.

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.

Endpoints

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/sources by 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 type and source (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.

Stats semantics & maintenance (read this before purging)

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 how unknown:14112 and vectors:156788 once accumulated (pre-fix loads also omitted metadata.source, tallying everything as "unknown").
  • Ground truth for the index size is always wrangler vectorize info fleet-twin.
  • The /stats fix of 2026-08-25: index enumerated via list-vectors/ get-vectors, 13 test-stray vectors deleted (incl. the lone source=unknown one), KV tallies rewritten from the exact per-vector census (334 sources, 52324 vectors).

Test

test/roundtrip.sh   # hits the deployed worker: ingest 3 docs, query, recall + idempotency + CORS + auth checks

Deploy

wrangler deploy
cat .ingest-token | wrangler secret put INGEST_TOKEN

About

Vector twin of the SuperInstance corpus — cloud (Workers+Vectorize) + local (Ollama) query, MCP server, open ecosystem

Resources

Code of conduct

Contributing

Security policy

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages