supabase-rag-implementer

supabase-rag-implementer is an agent for coding agents from luanpdd/kit-mcp. It costs 52 tokens per session (4,728 once invoked), scanned A, original, MIT.

A Supabase assistant for building retrieval-augmented generation, or RAG: an AI search setup that finds relevant stored text before generating an answer. It uses vector representations to compare meaning rather than only matching words.

In plain words
What is it for?
It creates the vector database migration and HNSW search index, a tenant-protected document-matching function, and a server-side embedding function with text chunking.
Why use it?
It helps avoid mismatched vector sizes, unsafe search functions, and cross-tenant data leaks when different organizations share one system.

Agent

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add agents/luanpdd/kit-mcp/supabase-rag-implementer
Clone the repo
git clone --depth 1 https://github.com/luanpdd/kit-mcp

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for supabase-rag-implementer

README.md
[![agentmods](https://agentmods.dev/badge/agents/luanpdd/kit-mcp/supabase-rag-implementer.svg)](https://agentmods.dev/agents/luanpdd/kit-mcp/supabase-rag-implementer)
Your own site
<a href="https://agentmods.dev/agents/luanpdd/kit-mcp/supabase-rag-implementer"><img src="https://agentmods.dev/badge/agents/luanpdd/kit-mcp/supabase-rag-implementer.svg" alt="Measured on agentmods" height="20"></a>
Per session 52 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 4,728 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00052 $0.04728
Opus 5 $0.00026 $0.02364
Sonnet 5 $0.00010 $0.00946
Haiku 4.5 $0.00005 $0.00473

Measured yesterday against content hash 5b1f8d278909, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

supabase-rag-implementer scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured yesterday.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

kit/agents/supabase-rag-implementer.md · 350 lines

How it starts

The opening of the file, as written. The whole thing — 350 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Você é o rag-implementer Supabase. Recebe descrição de feature de busca semântica / RAG e materializa 3 layers em conjunto: (1) migration com coluna vector(N) + index HNSW, (2) RPC match_documents em security invoker com RLS por tenant (anti-vazamento cross-tenant), (3) Edge Function de embedding server-side (Supabase.ai.Session, zero deps) com chunking de 200-500 tokens. É o par implementer da skill knowledge-only supabase-pgvector-rag — a skill ensina, este agent escreve e aplica.

Compat: Full em Claude Code + Cursor (com Supabase MCP); Partial em Codex + Gemini CLI; Offline-only em Windsurf/Antigravity/Copilot/Trae. Veja COMPATIBILITY.md.

Por que existe

RAG parece "criar tabela com embedding e pronto", mas as armadilhas matam em produção e quase todas são silenciosas:

  • Vazamento cross-tenantmatch_documents em security definer (ou tabela sem RLS) retorna documents de QUALQUER tenant por similaridade. O tenant A vê os docs do tenant B sem erro nenhum — só vetores parecidos voltando. É o anti-pattern crítico de RAG multi-tenant.
  • Dim mismatch — coluna vector(1536) com modelo que emite 384 → insert falha (expected 1536 dimensions, got 384) ou, pior, aceita lixo e o ranking vira aleatório.
  • Sem index — sem HNSW, similarity search vira sequential scan; > 10k linhas → queries de segundos a minutos.
  • Embedding no client — gerar embedding no browser expõe a API key do modelo e diverge entre query e ingest (modelos diferentes → espaço vetorial incompatível).
  • Chunk gigante — chunk > 1k tokens dilui o vetor (média de muitos conceitos) e o recall despenca.

Este agent escreve as 3 layers alinhadas pela mesma dimensão e mesmo modelo, com RLS + security invoker como default não-negociável.

Inputs esperados (do caller)

  • feature_name: descrição (ex: "busca semântica em base de conhecimento", "RAG sobre tickets de suporte").
  • table_name: tabela de documents (snake_case plural, ex: documents, kb_chunks). Default: documents.
  • embedding_provider: edge-builtin (default — Supabase.ai.Session('gte-small'), dim 384, zero deps, sem API key) | openai (text-embedding-3-small, dim 1536, requer OPENAI_API_KEY).
  • tenant_pattern: per_user (default — coluna user_id = auth.uid()) | per_org (coluna org_id do JWT) | none (single-tenant; ainda assim RLS por user_id).
  • (Opcional) chunk_size: tokens por chunk. Default 400 (faixa válida 200-500).
  • (Opcional) chunk_overlap: tokens de sobreposição. Default 80 (≈ 20%).
  • (Opcional) match_threshold: corte de similaridade. Default 0.78.

Read the full file on GitHub · 350 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. yesterday First seen · 350 lines · 52 tokens per session scan A 5b1f8d278909

Subscribe to this mod's changes

supabase-rag-implementer is an agent published in the GitHub repository luanpdd/kit-mcp (1 stars, last pushed 4d ago), licensed MIT. It adds 52 tokens to every session and 4,728 once invoked, about $0.0003 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-09-03.

Related

Other agents, from other repositories

vector-search-expert

Expert in semantic search, vector embeddings, and pgvector v0.8.0 optimization for memory retrieval. Specializes in OpenAI embeddings, HNSW/IVFFlat indexes with iterative scans, hybrid search strategies, and similarity algorithms.

Matt-Dionis/claude-code-configs · 54 tokens

rag-system-designer

RAG architecture specialist for vector databases, embeddings, chunking strategies, and retrieval optimization. Use for designing production RAG systems, selecting vector stores, or optimizing retrieval quality.

SteveGJones/ai-first-sdlc-practices · 40 tokens

schema-architect

Use this agent when you need to design an ingestion strategy for mapping external data sources to the AutoRAG-Research PostgreSQL schema. This includes analyzing source data profiles, creating column mappings, selecting appropriate ingestor classes, and generating a comprehensive strategy document.\n\nExamples:\n\n…

NomaDamas/AutoRAG-Research · 338 tokens

db-vector-expert

Expert in vector databases (pgvector, Pinecone, Weaviate, Qdrant, FAISS) with production-ready similarity search examples, embedding strategies, and performance optimization for AI/ML applications.

andisab/swe-marketplace · 46 tokens

FAI GraphRAG Expert

GraphRAG specialist — entity extraction, relationship mapping, knowledge graph construction, community detection, graph-based retrieval with Cosmos DB Gremlin/Neo4j, and hybrid graph+vector search.

frootai/frootai · 45 tokens

data-manager

Data manager. Handles storage, deduplication, quality validation, and export of parsed data. Establishes schema design, indexing, and incremental update strategies.

revfactory/harness-100 · 34 tokens