Knowledge Engine

Find the right records
before you ask AI to reason.

Knowledge Engine ranks your records by meaning — not keywords — using local embeddings, an in-memory cache, and a threshold-aware top-K cut, then hands only the closest matches to the AI step that follows.

Semantic Ranking Cache + Threshold Graceful Fallback Where It Runs
Semantic Ranking

Meaning first,
keywords last

Every screen that needs to shortlist its own records — competitor patents, compliance rules, prior art — hands its query text and candidates to one shared function. It never re-implements embedding or scoring logic.

  • Local embeddings — your query and every candidate's text are embedded through your own Ollama instance
  • Cosine similarity ranking — candidates sorted by how close their meaning is to your query, not by word overlap
  • Threshold before top-K — a weak match can never occupy a slot a stronger one deserved
  • One shared engine, reused by every domain that needs it
Open a Similar-Records Screen
totalapp.app / trade-compliance
Query: "encryption hardware module"
SAN-2026-0012 — dual-use crypto92%
SAN-2026-0034 — secure comms78%
SAN-2026-0007 — signal jamming61%
Top 3 of 47 records → sent to AI
Cache + Threshold

Never re-embed
the same record twice

An in-memory cache, keyed by each record's own content, means editing one record invalidates only its own entry — every other record's embedding stays reusable across every domain that shares the engine.

  • Content-derived cache key — no cross-domain id collisions, ever
  • A changed record auto-invalidates its own cache entry — no version field to maintain
  • Optional minScore + topK — keeps the downstream AI prompt focused, never overloaded
  • Purely additive — every pre-existing call site keeps working unchanged
Read the Full Reference
rankDocsByEmbedding()
// options (all optional)
{ minScore: 0.6,
  topK: 5 }
// cache key (content-derived)
`${text.length}:${text}`
3 of 47 embedded fresh · 44 served from cache
Graceful Fallback

No local model?
Still useful.

If Ollama isn't configured, unreachable, or every candidate falls below the threshold, Knowledge Engine drops to a keyword match instead of returning nothing — the downstream AI step still gets a relevant shortlist.

  • No embedding model configured → automatic keyword fallback
  • Ollama unreachable or an embed call fails → same fallback, never a crash
  • Threshold clears no candidates → falls back rather than showing an empty list
  • The function never throws — callers always get { matches, degraded }
Explore Semantic Search
totalapp.app / patent-collision
Local embedding model unavailable — showing keyword matches
EP3982101A2 — key isolationkeyword
US10884812B2 — secure enclavekeyword
Deeper AI analysis still runs on this shortlist
Where It Runs

Always local.
Never proxied.

Knowledge Engine talks directly to your own local Ollama instance — it has no server-side counterpart and never can, because Render's servers have no network path to your machine. The AI step that follows is separate and can run wherever you've configured it.

  • Patent & R&D Operations — competitor patents, prior art, literature, licensing guidelines
  • Customs & Global Trade Operations — trade compliance and sanctions rules
  • Semantic Search — the same primitive ranks your My Knowledge library
  • One shared engine — every new domain reuses it instead of reimplementing it
Explore Patent & R&D Operations
Settings → Agentic
Two Independent Stages
1 Knowledge Engine — always your local Ollama
2 AI Synthesis — your Settings → Agentic choice
Changing one setting never affects the other