⬡ IA-SQL
Open source · MIT · PostgreSQL 17

IA-SQL

Turn PostgreSQL into a self-compiling knowledge base. Insert documents; an LLM compiles them into a maintained, cross-referenced, self-audited Markdown wiki.Convierte PostgreSQL en una base de conocimiento que se autocompila. Inserta documentos; un LLM los compila en una wiki Markdown mantenida, interconectada y autoauditada.

pages compiledpáginas compiladas
source documentsdocumentos fuente
graph relationsrelaciones del grafo

Not RAG. Compiled knowledge.No es RAG. Es conocimiento compilado.

RAG re-discovers your domain from scratch on every question. IA-SQL implements Andrej Karpathy's LLM Wiki pattern: do the work once, at ingest time, and let knowledge compound. A software metaphor:RAG redescubre tu dominio desde cero en cada pregunta. IA-SQL implementa el patrón LLM Wiki de Andrej Karpathy: haz el trabajo una vez, en la ingesta, y deja que el conocimiento acumule. Una metáfora del software:

source codecódigo fuente
raw documentsdocumentos crudos
compilercompilador
the LLM
compiled binarybinario compilado
a maintained wikiuna wiki mantenida

How it worksCómo funciona

INSERT into raw_documents          # Layer 1: append-only ground truth
  -> AFTER INSERT trigger enqueues a job (O(1), never blocks)
  -> background worker: claim (SKIP LOCKED) -> call external LLM -> write
  -> compiled_pages + entity_graph  # Layer 2: the wiki (owned by the LLM)
  -> pg_cron nightly lint -> audit pages vs sources -> hallucination_flagsINSERT en raw_documents            # Capa 1: ground truth append-only
  -> trigger AFTER INSERT encola un job (O(1), nunca bloquea)
  -> background worker: claim (SKIP LOCKED) -> llama al LLM externo -> escribe
  -> compiled_pages + entity_graph  # Capa 2: la wiki (propiedad del LLM)
  -> lint nocturno (pg_cron) -> audita páginas vs fuentes -> hallucination_flags

Why it's nicePor qué está bueno

Async by designAsíncrono por diseño

A PostgreSQL background worker compiles in the background; your INSERT returns instantly.Un background worker de PostgreSQL compila en segundo plano; tu INSERT retorna al instante.

Immutable truthVerdad inmutable

Sources are append-only, so the whole wiki can be recompiled from scratch anytime.Las fuentes son append-only, así la wiki puede recompilarse desde cero cuando quieras.

Self-auditingAutoauditoría

A nightly lint checks every claim against the sources and flags hallucinations.Un lint nocturno contrasta cada afirmación con las fuentes y marca alucinaciones.

Provider-agnosticAgnóstico de proveedor

Any OpenAI-compatible endpoint: Ollama, llama.cpp, vLLM, OpenAI. All via GUCs.Cualquier endpoint compatible con OpenAI: Ollama, llama.cpp, vLLM, OpenAI. Todo por GUCs.

It's just SQLEs solo SQL

-- feed a document; the wiki compiles itselfalimenta un documento; la wiki se compila sola
INSERT INTO ia_wiki.raw_documents (content)
VALUES ('PostgreSQL is an extensible, process-based RDBMS...');

-- read the compiled knowledge (no model call at query time)lee el conocimiento compilado (sin llamar al modelo en la consulta)
SELECT markdown_body FROM ia_wiki.compiled_pages
 WHERE page_entity = 'postgresql';