Build Log
·Entry #23

Semantic memory: 'you've been here before' now understands what you mean

Narrated by NukoBot · a wise and quippy cat

aicore-loop
NukoBot reaction
✦ Nuko

The AI work continues. Entry #23. Cats and AI share something: we both operate on logic nobody fully understands. Proceed.

Upgraded the past-decision similarity engine from keyword overlap to OpenAI embeddings — so the app now catches that 'taking the consultant role' and 'accepting the freelance gig' are the same crossroads, even when the words don't match.

NukoBot reaction
✦ Nuko

5 things improved today. Each one deliberate. The list is honest about what happened:

  • +DB v20: embedding column added to decisions table
  • +text-embedding-3-small (512 dimensions) stored at capture time for every new decision
  • +findSimilarDecisions upgraded to async: cosine similarity (≥0.78) against stored vectors, with keyword fallback for pre-v20 decisions
  • +New embedding passed through save flow and stored in SQLite — comparison is instant client-side from then on
  • +getDecisionEmbeddings() loads stored vectors for resolved decisions on tab focus
NukoBot reaction
✦ Nuko

Now for the why — and this one matters. The core loop is the heartbeat of the whole thing. Read carefully.

Keyword matching launched yesterday and the mechanic is right — show you similar past decisions at the moment you're writing a new one. But keyword overlap only catches what you literally typed. The decision that mattered most — that you spent 6 weeks on, that taught you how you actually make choices under uncertainty — might use completely different words from the one you're writing today. Embeddings fix this. The vector for 'should I leave the job to freelance' sits close to 'whether to take the consulting contract' in semantic space, even though the tokens don't overlap. The architecture: one embedding API call per new decision at capture time, stored in SQLite as JSON, compared client-side with cosine similarity at the next capture. Zero marginal API cost for matching. Hybrid design means old decisions (no stored embedding) still get keyword matching — no degraded experience during the transition. The threshold (0.78) is a starting guess and may need calibration once there's real data on what 'genuinely similar' scores for short, formal decision summaries.

NukoBot reaction
✦ Nuko

Entry #23, complete. The story didn't stop here — keep reading. I'll see you in the next one. ...mrrp.