Turn Gmail messages into a searchable knowledge base. Emails are saved to a Postgres database and also converted into vector embeddings for smart search. This helps teams find past conversations fast and review large inboxes without digging through threads.
Two paths keep the data complete. A manual run slices your mailbox history into weekly ranges, pulls each batch from Gmail, extracts clean fields like subject, sender, recipients, dates, and text, and writes them to a structured table. The text is split into readable chunks, embedded with the nomic embed text model in Ollama, and stored in a pgvector table for similarity search. A live Gmail trigger checks the inbox every minute and applies the same steps to new messages so your index stays fresh.
Setup needs a Gmail account, a PostgreSQL database with the pgvector extension, and an Ollama server running the embedding model. You add your Gmail account start date in the code node for the bulk import, test a small date range, then switch on the trigger. Expect one source of truth for email metadata and a vector store that supports fast related message lookup, customer thread research, and simple email analytics.