Repository navigation
Closed
Labels
Description
Summary
Create a predefined workflow template that compares multiple documents (e.g., contracts) and produces a structured comparison report highlighting differences and frequently modified sections.
Motivation
A common use case for document-heavy organizations is comparing multiple versions of similar documents to identify patterns, differences, and frequently negotiated sections. This workflow automates what would otherwise be hours of manual side-by-side reading.
Proposed Workflow Design
Step 1 (LLM node):
Tools: [document_list]
Prompt: "List the most recent {count} documents matching {filter criteria}"
Output: JSON array of document IDs and metadata
Step 2 (Loop node):
Collection: Step 1 output document list
Per iteration (LLM node):
Tools: [document_retrieve]
Prompt: "Retrieve document {item.id} and extract its structural outline
(sections, clauses, key terms). Output as structured JSON."
Output format: JSON with clause structure
Step 3 (LLM node):
Prompt: "Compare all extracted structures from Step 2 iterations.
Identify: (1) clauses present in all documents,
(2) clauses that differ across documents,
(3) most frequently modified sections.
Produce a comparison summary."
Output format: JSON
Step 4 (LLM node):
Tools: [docx]
Prompt: "Generate a DOCX comparison report from the analysis in Step 3.
Include a summary table, per-clause comparison, and frequency statistics."
Implementation Notes
- Add to
services/platform/convex/predefined_workflows/following existing patterns - The workflow should accept input parameters: document filter criteria (folder, date range, limit)
- Use
threadIdsharing across LLM steps for context continuity - Output schema for Step 2 iterations should be consistent for aggregation in Step 3
Dependencies
- Depends on feat(platform): Add document_list agent tool #658 (
document_listtool) - Depends on feat(platform): Add document_retrieve agent tool with pagination #659 (
document_retrievetool)
Acceptance Criteria
- Predefined workflow registered and available in the system
- Accepts configurable parameters (folder filter, document count, etc.)
- Produces a downloadable DOCX comparison report
- Handles documents of varying sizes via paginated retrieval
- End-to-end test with sample documents
Activity
feat(rag): add filename to search results, sync upload mode, and retu…
feat(platform): add sync mode support to RAG upload workflow action
feat(platform): extract shared RAG fetch helper and extend document a…
feat(platform): add search operation to RAG workflow action
feat(platform): add contract comparison workflow example
fix(platform): add missing output stepType to create_workflow agent tool
fix(platform): validate step configs strictly at approval creation time
feat(rag): add filename to search results, sync upload mode, and retu…
feat(platform): add sync mode support to RAG upload workflow action
feat(platform): extract shared RAG fetch helper and extend document a…
feat(platform): add search operation to RAG workflow action
feat(platform): add contract comparison workflow example
fix(platform): add missing output stepType to create_workflow agent tool
fix(platform): validate step configs strictly at approval creation time