A common request from clients is that staff keep asking the same questions about policies, products and old decisions. Arwahyn AI, an automation agency based in Dhaka, demonstrates how to answer these queries using AI without uploading everything to a third-party chatbot builder. The setup keeps documents and the search index in the client's own Postgres database, addressing security and privacy concerns.

The Core Stack: Postgres, pgvector, and n8n

The architecture relies on Postgres with the pgvector extension to store document chunks and their embeddings. The author specifically mentions using Supabase for this database layer. n8n handles the orchestration, managing two distinct workflows: ingestion and answering. You plug in an embeddings model and a chat model from whichever AI provider the client already trusts, ensuring no new vendor lock-in for the LLM layer itself.

Workflow 1: Ingestion and Cleanup

The ingestion pipeline triggers on new or updated files in a shared folder, such as Google Drive, or via an upload form. It extracts text, handling PDFs and docs with specific parsing logic, then splits content into chunks of a few paragraphs with slight overlaps. Each chunk is embedded and upserted into the database with metadata like source file name, page, and updated date. Crucially, the workflow includes a deletion step: when a file is removed, its chunks are deleted too. The author notes that people forget this step, and the bot keeps quoting a policy that no longer exists.

Workflow 2: Answering with Strict Rules

When a question arrives via internal chat, WhatsApp, or a small web page, the system embeds the query and retrieves the closest chunks from Postgres. The LLM is instructed to answer only from those chunks, quote the source file, and say "I don't know" when the chunks don't cover it. Trustworthiness is enforced through three strict rules: "No source, no answer," restricting what each person can search (e.g., HR documents shouldn't answer questions for everyone), and reading the "I don't know" log every week. This log isn't just an error report; it's the best list of documents your company still needs to write.

Key Takeaways

  • Keep data sovereignty by storing embeddings in your own Postgres/pgvector instance rather than third-party vector DBs.
  • Implement strict deletion logic in ingestion workflows to prevent bots from quoting obsolete documents.
  • Use the "I don't know" log as a feedback loop to identify gaps in your company's written knowledge.
  • Restrict search permissions at the retrieval level to ensure sensitive documents don't leak to unauthorized staff.

The Bottom Line

This approach proves you don't need complex, proprietary AI platforms to solve internal knowledge retrieval. By combining n8n's automation with standard Postgres infrastructure, you get a transparent, auditable, and secure system that actually answers the questions your team is already asking.

Why This Matters for Builders

For developers and IT leaders, this pattern is a masterclass in pragmatic AI implementation. It avoids the hype cycle of "AI-native" databases in favor of boring, reliable tech. The emphasis on metadata (page numbers, source files) makes the output verifiable, which is critical for enterprise adoption. It’s a reminder that the best AI tools are often just good search engines with a language model attached, running on infrastructure you already control.