Inspiration
Company commitments are born in email and die in email. Someone reads a thread, mentally pulls out who, what, by when, and how much, then copies that into a task list. Summaries do not fix it: they are not typed, not reviewable, and not reusable.
OntoMail is the first usable brick of a larger idea: a company ontology that grows one processed email at a time. The inbox is where the facts already live. A shared TBox plus an LLM with structured output can extract them at the source, with a human still in control of what becomes work.
What it does
OntoMail is a Gmail add-on that runs the TBox → LLM → ABox cycle on the message you are viewing.
It sends the email text plus a subset of the gist upper ontology to Gemini. Gemini returns typed instances as JSON-LD: people, organizations, commitments, dates, and amounts. A parking lot shows them grouped by gist type. Commitments are actionables: you select them, edit the title and due date, and create real Google Tasks. Preserve writes a Markdown file (embedded JSON-LD plus a link back to the email) into an OntoMail folder in Drive, the seed of a future enterprise knowledge graph.
It does not summarize the email. Delete the ontology and it is just another email-to-task gadget. The gist typing is the product.
Proof of concept: one email at a time, Tasks only. Informational mail shows “nothing to action.” Failures show a retry card and create nothing.
How we built it
Google Apps Script (V8) and CardService, pushed with clasp. The add-on opens on the current Gmail message. tbox.gs holds the gist subset (gist:Person, gist:Organization, gist:Commitment, gist:TimeInterval, gist:Magnitude). GeminiService.gs calls the Gemini API with JSON structured output. The results card renders the ABox. Selected commitments go to Google Tasks. Preserve uses DriveApp to write into a get-or-create OntoMail folder.
Built in five slices: home card, real ABox extraction, task creation with edit, empty and error states, then preserve. First real extraction was a Google Payments email: organizations, a date, and an amount (453.786 CLP), grouped by gist type.
Challenges we ran into
clasp create-script overwrote appsscript.json with a bare manifest and wiped the add-on config, scopes, and the Tasks advanced service. We restored it from the first commit.
The first Gemini call returned 404 because the model path did not resolve on v1beta. The client now accepts GEMINI_MODEL with or without the models/ prefix, and 404s name the model. Free-tier 503/429 needed a short retry with backoff.
Selected commitments were invisible. The code assumed e.formInputs. CardService switches arrive on the flat e.formInput map. Two selected, zero created, until that read path was fixed.
Preserve failed with insufficient permissions. drive.file is not enough for DriveApp.createFile. The manifest needed the broader auth/drive scope. Files then landed in the Drive root, so we moved them into one OntoMail folder.
Accomplishments that we're proud of
The kernel works on a real inbox: open a mail, press Process, see gist-typed instances, edit a commitment, and watch a Google Task appear with that title and date. The human review is part of the product, not a later feature. Nothing is created on the error path. Preserved ABoxes are already a corpus, not a log line. And the script id stays out of the public repo.
What we learned
An ontology-grounded extractor is a different product from a summarizer, but only if the TBox is in the prompt and the output is typed JSON-LD you can render and store. CardService event shapes are not the Apps Script form shape you expect; dump the event before trusting a widget. OAuth scope names lie by implication: drive.file does not cover creating a standalone file. Transient model errors are part of the free-tier demo, so retry and name the failure. clasp will happily replace a manifest you spent a slice getting right.
What's next for OntoMail
Calendar events and other actions besides Tasks. A real graph store instead of Markdown seeds in Drive. The full gist TBox, not five classes. Dedup and linking of people, organizations, and commitments across emails. Batch is explicitly out of this proof of concept. The next step is the same loop on the next mail, accumulating one ABox at a time.
Built With
- appscripts
- gemini
- gist-(semantic-arts)
- gmail-add-on
- google-apps-script
- google-drive
- google-tasks
- json-ld
- kiro

Log in or sign up for Devpost to join the conversation.