AI & RAG

Index new contract versions into a citation-ready clause store

When a contract lands or changes in Google Drive, it splits the document into clauses, embeds each one with version and section metadata.

CategoryAI & RAG
Enginesim
Difficultyintermediate
Triggerevent
Steps6
Setup~15 min

How it runs

The automated pipeline, trigger to output.

  • TriggerContract added or updated in Drive folderGoogle DriveGoogle Drive
  • ActionFetch and parse document textGoogle DriveGoogle Drive
  • LogicSkip if checksum unchanged (no new version)
  • ActionSplit into clauses with section paths
  • ActionEmbed each clause with version metadataOpenAI
  • OutputUpsert clauses + vectors into Supabase storeSupabaseSupabase

What it does

Keeps a versioned, citation-grounded clause index in sync with your legal document library. Every time a contract is added or revised in Google Drive, this workflow turns it into individually addressable clauses — each tagged with the source file, version, effective date, and section path — and writes them to a Supabase pgvector table that downstream answer flows query.

When to use it

Run this as the foundation under any contract Q&A or clause-lookup workflow. It is the ingestion side: you want retrieval to know *which* version of an MSA a clause came from, not just that the text exists somewhere. Ideal when legal owns a Drive folder of evolving agreements and templates.

How it works

  1. 1A Google Drive change on the watched contracts folder fires the trigger.
  2. 2The file content is pulled and parsed, and a logic step skips anything that is not a new or updated version (by checksum).
  3. 3The document is segmented into clauses with section headings preserved as a path.
  4. 4OpenAI embeds each clause along with its metadata.
  5. 5The clauses and vectors are upserted into Supabase, superseding the prior version's rows while retaining version history for citations.

Set it up

What you configure once, before turning it on.

  1. 1
    Connect Google DriveDocs, sheets, slides, files.
  2. 2
    Connect OpenAIModels, embeddings, files.
  3. 3
    Connect SupabaseTables, auth, storage, edge functions.
  4. 4
    Set each agent's modelWe leave models unset so you pick the tier — fast + cheap, or top-quality.
  5. 5
    Tune it to your dataEdit the prompts, filters, and field mappings so it matches how your team works.
  6. 6
    Test, then turn it onRun once against a sample, confirm the output, then enable the trigger.

Run this workflow in your colony.

14-day trial. No DevOps. No Sales call. Provisioned in under a minute.