Inspiration

Traders repeat the same mistakes, not because they forget, but because the history that would stop them sits in a journal nobody reads at the wrong moment. Deja solves this: instead of asking the trader to remember, it brings the memories back automatically at the exact moment they are about to risk capital.

What it does

Deja is a trading memory agent. It imports a trader's history into CockroachDB, builds a behavioural Trading DNA profile, and then, the moment you propose a trade, retrieves your similar past decisions and tells you straight: "you have done this 6 times and 4 lost." It shows a prominent Déjà vu detected card with raise, proceed, or cancel, before any order is placed. Every outcome automatically becomes new memory for the next decision.

How we built it

CockroachDB is the system of record. Trade state, outcomes, behavioural events, and Trading DNA all live in one tenant-scoped, append-only CockroachDB cluster. Each thesis is embedded into a VECTOR(1024) and retrieved with a distributed vector nearest-neighbour index, so differently-worded theses about the same setup are recognised as the same decision. The rule engine is deterministic and fail-closed: malformed provider or database output never fabricates a result, and real execution sits behind a broker seam that stays off until real credentials exist. A Next.js front end drives the whole loop.

Challenges we ran into

The hardest part was the retrieval at the right moment. A search box solves nothing; the real query is when a trader is about to act. Getting the semantic vector index populated and live without yet wiring a paid embedding model meant building a working offline embedder. Bringing in a real exchange is gated on credentials, so we built the fail-closed seam first so nothing could silently move money.

Accomplishments that we're proud of

A live, verified end-to-end Déjà vu check: propose a BTC long, and the app retrieves six comparable trades, flags the losing pattern, and offers reduce, proceed, or cancel. All of it runs on CockroachDB as the actual memory layer, with no fabricated data anywhere in the path.

What we learned

The moment of decision is the retrieval point. Building memory that answers a decision is different from building memory that stores data, and having transactional and vector capability in one CockroachDB kept the whole decision coherent instead of bolting on a separate database.

What's next for Deja

Real multi-user login, wiring a live exchange behind the existing broker seam, replacing the offline embedder with a trained embedding model, and alerts that fire on Trading DNA patterns as they form.

Built With

  • cockroachdb
  • distributed
  • drizzle
  • indexing
  • next.js
  • orm
  • pgvector
  • postgresql
  • railway
  • serverless
  • vector
  • zod
Share this project:

Updates

Submission history