SRag

RAG with Cognitive Memory

A knowledge system that extracts entities, facts, and relationships from every document. Detects contradictions, self-heals outdated knowledge, and provides layered search combining knowledge context with graph-boosted retrieval.

22 API Endpoints
16 MCP Tools
v0.1.0 · MIT License

Everything you need for production RAG

A complete framework with cognitive memory that handles ingestion, knowledge extraction, and intelligent retrieval.

Cognitive Layer

Knowledge Graph

Entities and relationships extracted from every document. 5-stage entity resolution with 4-way alias matching, type normalization, and all-LLM smart merge across documents.

Self-Healing Memory

Atomic facts tracked over time. Contradictions, refinements, and retractions detected automatically — outdated facts are superseded and entity descriptions refreshed.

Cognitive Search

Layered response: knowledge context (entities, facts, relationships) plus graph-boosted source chunks. Hybrid entity and fact search fused together for brain-like recall.

Entity Resolution

Two-phase merge: parallel candidate finding via embedding similarity and 4-way alias matching, then sequential merge via union-find graph. Every decision confirmed by LLM with full evidence.

Core Engine

6-Stage Retrieval

Query expansion, vector similarity, BM25 keyword search, Reciprocal Rank Fusion, MMR diversity filtering, and LLM reranking — a full retrieval pipeline in every search.

Dual-Pipeline Ingestion

Two independent pipelines: chunks are ready immediately, while the cognitive pipeline extracts knowledge in the background. Fully resumable with per-chunk persistence.

Smart Chunking

Four strategies — token, recursive, semantic, and no-split. Content is sanitized before chunking, and each document supports per-document configuration with re-ingestion.

Supabase + pgvector

PostgreSQL with halfvec embeddings for 50% storage savings. BM25 via tsvector, HNSW indexes, scope-aware indexing, and semantic deduplication.

Integration

16 MCP Tools

Model Context Protocol server with streamable HTTP transport. One-click Cursor setup, automatic scope injection, and tools for search, ingest, entities, facts, and timeline.

Full Observability

Every ingestion and cognitive step logged with timing and metrics. Live activity feeds via Supabase Realtime, processing timelines, and per-stage debug info in search results.

Project Isolation & Sharing

Every document belongs to a project with an owner. Row Level Security enforces access in the database itself — invite members as viewers or editors, share single documents, and query across everything you can access.

Flexible Providers

OpenAI, Azure, Ollama, and AWS Bedrock embedding providers via LangChain. Configurable LLM models for extraction, reranking, and query expansion.

How it works

Two independent pipelines turn raw content into searchable knowledge.

Step 01

Ingest

Send content via REST API, MCP tools, or the admin UI. Documents are validated and accepted in milliseconds.

Step 02

Process

Two pipelines run independently — chunks are ready immediately, knowledge extraction continues in the background.

Chunk Pipelineimmediate
SanitizeChunkEmbedStore
Cognitive Pipelinebackground
ExtractResolveFactsMerge
Step 03

Query

Layered search returns knowledge context (entities, facts, relationships) alongside graph-boosted source chunks.

See it in action

From raw documents to brain-like memory — walk through how the cognitive engine gives AI agents the ability to recall facts, track changes, and make connections across your entire knowledge base.

Q1 Engineering Updateproject_note

Sarah Chen (CTO) led the launch of Project Atlas using DuckDB...

chunks ready
extracting...
Architecture Decision Recorddecision

We migrated from ClickHouse to DuckDB for analytical queries...

chunks ready
extracting...
Q2 Leadership Updateannouncement

Sarah Chen was promoted to CEO effective April 2025...

chunks ready
extracting...

Feed any content. Chunks are searchable immediately while knowledge extraction runs in the background.