CtrlK
BlogDocsLog inGet started
Tessl Logo

g14wxz/rag-ingestion-trigger-pipeline

Configures database INSERT triggers that offload document chunking and embedding to Edge Functions.

94

Quality

94%

Does it follow best practices?

Impact

Pending

No eval scenarios have been run

SecuritybySnyk

Risky

Do not use without reviewing

Overview
Quality
Evals
Security
Files

rag-ingestion-rules.mdrules/

RAG Ingestion Rules

FATAL Constraints

  • Synchronous embedding inside the trigger is FATAL. The trigger MUST NOT call the embedding API directly. It MUST offload to an Edge Function via pg_net.http_post(). Synchronous HTTP calls inside triggers block the transaction and cause timeouts.
  • Missing pg_net extension is FATAL. The pg_net extension MUST be enabled before creating the trigger function. HALT if it is not available.
  • BEFORE INSERT triggers for the pipeline are FATAL. The trigger MUST fire AFTER INSERT to guarantee the row is committed before the Edge Function attempts to read it.
  • Hardcoded secrets in trigger functions are FATAL. The service role key MUST be stored in Vault or passed via environment configuration, NEVER as a literal string in the function body.

Mandatory Behaviors

  • MUST use pg_net.http_post() for all HTTP callouts from the database to Edge Functions.
  • MUST set document status to 'processing' when the trigger fires and update to 'embedded' or 'failed' in the Edge Function.
  • MUST include the document id in every Edge Function payload to enable idempotent retries.
  • MUST chunk documents before embedding. NEVER send full documents as a single embedding input.
  • MUST store the chunk-to-document relationship (source document ID) alongside each vector row.
  • MUST NOT create more than one trigger per document table for the embedding pipeline.

tile.json