Public
TCall - Glyph-based session search engine
apiglyphminhashsearchsqlite
Val Town is a collaborative website to build and scale JavaScript apps.
Deploy APIs, crons, & store data – all from the browser, and deployed in milliseconds.

TCall

A tiny search engine over ephemeral sessions, powered by Glyph MinHash fingerprints and backed by SQLite.

Live API: https://tcall.val.run/

How it works

  • Create a session with any name. Sessions expire after 5 minutes of inactivity; touching a live session (preserve/recall/create) extends it.
  • Preserve aggregates a set of observations into a single Glyph collection glyph (period-min hash). Only that serialized glyph is stored — the raw observations are never written to the database.
  • Recall rehydrates every preserved observation glyph, builds an in-memory index, searches it with a glyph of the query, and returns the raw context text for the top-limit hits.
Rendering mermaid diagram...

Data model

TableColumnsPurpose
sessionsname, last_activityExpiry (5 min inactivity)
observationsid, session, glyph, contextSerialized collection glyph + raw context keyed to it

Endpoints

All endpoints take JSON and return JSON.

POST /session/create

{ "name": "meeting-notes" }

200: { ok, session, expiresInSeconds, expiresAt }

POST /session/preserve

{ "session": "meeting-notes", "observations": [ "the new pricing is $49 per seat for the pro tier", "annual plans get a 20% discount" ], "context": "Pricing decision: pro tier $49/seat, 20% off annual plans." }

observations are fingerprinted and discarded; only context is stored, keyed to the aggregated glyph. → 200: { ok, id }

POST /session/recall

{ "session": "meeting-notes", "query": "what did we decide about pricing?", "limit": 3 }

200: { ok, query, total, results: [{ id, similarity, context }] }

Notes

  • A session that is inactive for 5 minutes is wiped (observations deleted) and must be recreated. Sticky sessions (e.g. test-notes) are exempt and never expire.
  • Recall uses an exact scan (index.New({ mode: "direct" })); the default Softmax collection aggregator compares poorly against raw query glyphs, so TCall uses CollectionAggregatorMin.
  • Endpoint files: main.ts · lib.ts