Docu-Morty
A Slack bot that answers "what's the template variable for X?" with copy-pasteable document-template blocks in about a minute, across a 40+ tab glossary. Built V1 on Apps Script + Gemini, then rebuilt V2 on Google Cloud Functions with semantic search and persistent memory.
01 Overview
The docs/ops team works from a sprawling document-template system whose variables live across a 40+ tab glossary. Finding the right template variable used to mean hunting through tabs. Docu-Morty answers the question in Slack in about a minute with a copy-pasteable block.
It started as a V1 on Apps Script + Gemini, then was rebuilt as a V2 on Google Cloud Functions to add semantic search and persistent memory.
02 How it works
Dual search runs in parallel — text-embedding vectors catch synonyms and loose phrasing,
while keyword matching catches exact variable names; the index is rebuilt every 30 minutes
via Cloud Scheduler. On top sits a Gemini function-calling
agent loop over a compact tab directory; using parallel tool calls cut a typical answer
from 4–6 rounds down to 1–3.
Persistent multi-level memory (Firestore per-user history plus a memory
sheet) lets it learn team-specific terminology over time. An async-on-cold-start pattern
returns Slack's required 200 OK instantly, then continues processing in the
same invocation.
03 Engineering highlights
- Dual search — embedding vectors for synonyms + keyword match for exact names — with the index rebuilt every 30 min via
Cloud Scheduler. - Gemini function-calling agent loop with parallel tool calls, cutting rounds from 4–6 to 1–3.
- Persistent multi-level memory (Firestore per-user history + a memory sheet) so it learns team terminology.
- Admin approval workflow: the bot proposes glossary corrections/additions that an admin approves via Slack buttons.
- Async-on-cold-start pattern returns Slack's
200 OKinstantly, then processes in the same invocation.
04 Outcome
Saves the docs/ops team hours a week and removes onboarding friction on a sprawling template system — institutional knowledge, answered in Slack in about a minute.