
Building in Public: Powering Contract Review with Bad Cases & Dify

Why am I doing this? Most contract-review tools today lean on rigid rule engines that miss edge cases and demand constant upkeep. So over the past few weeks, I prototyped a Dify workflow that marries general checks with a library of “Bad Cases.” Here’s the 4-step pipeline:
Preprocess & OCR the contract text
LLM-based initial risk scan
Retrieve similar Bad Cases from our case bank
Deep-dive analysis & structured report generation
I’ve just run a demo on 3 sample contracts and 5 Bad Cases—it flags key issues and spits out actionable rewrite suggestions. Along the way, I wrestled with prompt length limits, list-vs-string type bugs, and context-window headaches… Turns out I’m a pretty decent prompt-engineer after all 😂.
Next up:
• Add a loop node for per-case correlation analysis
• Generate clause-level amendment suggestions directly
• Build an interactive feedback loop for deeper dives
What do you think? Any tips on better retrieval strategies or prompt hacks? Let’s co-create—drop your ideas below!
Replies