<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>Forem: Anand Krishna</title>
    <description>The latest articles on Forem by Anand Krishna (@anandqwe).</description>
    <link>https://forem.com/anandqwe</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F3772478%2F8b2aafd4-fa45-492e-ab8f-7c096e7870c6.png</url>
      <title>Forem: Anand Krishna</title>
      <link>https://forem.com/anandqwe</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/anandqwe"/>
    <language>en</language>
    <item>
      <title>RealityCheck CLI — Turn Legal Contracts into Decision-Grade Risk Intelligence</title>
      <dc:creator>Anand Krishna</dc:creator>
      <pubDate>Mon, 16 Feb 2026 06:13:46 +0000</pubDate>
      <link>https://forem.com/anandqwe/realitycheck-cli-turn-legal-contracts-into-decision-grade-risk-intelligence-5dcm</link>
      <guid>https://forem.com/anandqwe/realitycheck-cli-turn-legal-contracts-into-decision-grade-risk-intelligence-5dcm</guid>
      <description>&lt;p&gt;&lt;em&gt;This is a submission for the &lt;a href="https://dev.to/challenges/github-2026-01-21"&gt;GitHub Copilot CLI Challenge&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  What I Built
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;RealityCheck CLI&lt;/strong&gt; is a Python command-line tool that transforms legal contract PDFs into structured, actionable risk intelligence — not summaries, but real decision-grade analysis you can act on before signing.&lt;/p&gt;

&lt;p&gt;Most people sign contracts they can't fully parse. RealityCheck makes the risk &lt;strong&gt;explicit, structured, and actionable&lt;/strong&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  The Problem
&lt;/h3&gt;

&lt;p&gt;You receive a consulting agreement, employment contract, or NDA. It's 8 pages of dense legal text. You skim it, maybe worry about a clause or two, and sign anyway. Sound familiar?&lt;/p&gt;

&lt;p&gt;The gap between "I read it" and "I understand the risk" is where people get burned — unlimited liability exposure, one-sided termination rights, overbroad IP assignments, missing payment protections.&lt;/p&gt;

&lt;h3&gt;
  
  
  The Solution
&lt;/h3&gt;

&lt;p&gt;RealityCheck CLI takes any contract PDF and produces:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;5 quantified risk metrics&lt;/strong&gt; — Overall Risk Score (1-100), Power Imbalance (0-100), Ambiguity Index (0-100), Protection Coverage (0-100), and an original &lt;strong&gt;Leverage Index™&lt;/strong&gt; (0-100) showing your negotiation strength&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Clause-by-clause classification&lt;/strong&gt; across 7 legal categories (Non-Compete, IP Transfer, Liability, Termination, Financial Risk, Privacy, Neutral)&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Signal detection&lt;/strong&gt; — flags vague language ("sole discretion", "without notice"), one-sided rights, liability expansion, and missing protections&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Missing protections scan&lt;/strong&gt; — checks for 6 critical protections: payment timeline, termination notice, cure period, liability cap, breach notification window, IP retention&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Negotiation-ready outputs&lt;/strong&gt; — auto-generated email drafts with specific clause rewrites, ready to send to the counterparty&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Contract comparison&lt;/strong&gt; — diff two versions of a contract to catch new risks, expanded liability, or extended non-compete duration between drafts&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Optional LLM enrichment&lt;/strong&gt; — plug in Google Gemini for deeper clause classification alongside the fast heuristic engine&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Architecture
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;PDF → [ingest] → [clauses] → [analysis] → [scoring] → [negotiation] → [output]
                                  ↕                                        ↕
                              [llm_client]                          [comparison]
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The tool is modular by design — 9 internal packages wired through a single orchestration pipeline:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Module&lt;/th&gt;
&lt;th&gt;Purpose&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;ingest/&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;PDF extraction via pdfplumber + header/footer removal&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;clauses/&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Clause segmentation by heading detection + text normalization&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;analysis/&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Heuristic classification engine + optional Gemini LLM enrichment&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;scoring/&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Weighted multi-factor risk engine with category-specific weights&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;negotiation/&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Email drafts + clause rewrite suggestions&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;comparison/&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Smart clause matching + delta analysis with legal-domain flags&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;output/&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Rich terminal rendering + JSON artifact export&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;config/&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Environment-based settings (API keys, thresholds)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;cli/&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Typer-based CLI with &lt;code&gt;analyze&lt;/code&gt; and &lt;code&gt;compare&lt;/code&gt; commands&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h3&gt;
  
  
  Key Design Decisions
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Heuristic-first, LLM-optional&lt;/strong&gt; — Works fully offline with regex pattern matching. No API key needed for the core analysis. LLM only enriches, never replaces.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Weighted multi-factor scoring&lt;/strong&gt; — Not a single naive score, but 5 complementary metrics with category-specific weights (Liability: 0.22, Financial Risk: 0.20, IP Transfer: 0.17, etc.)&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Actionable by default&lt;/strong&gt; — Doesn't just flag risk — generates a negotiation email draft and clause rewrites you can actually send.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Comparison as a first-class feature&lt;/strong&gt; — Smart clause matching (70% title similarity + 30% text similarity) with domain-specific flags like non-compete duration parsing and liability expansion detection.&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  Demo
&lt;/h2&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;GitHub Repository:&lt;/strong&gt; &lt;a href="https://github.com/Anandqwe/realitycheck-cli" rel="noopener noreferrer"&gt;github.com/Anandqwe/realitycheck-cli&lt;/a&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h3&gt;
  
  
  Setup
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight powershell"&gt;&lt;code&gt;&lt;span class="n"&gt;git&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;clone&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;https://github.com/Anandqwe/realitycheck-cli.git&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="n"&gt;cd&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;realitycheck-cli&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="n"&gt;python&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;-m&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;venv&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;venv&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;\venv\Scripts\activate&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="nx"&gt;pip&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;install&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;-r&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;requirements.txt&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Demo 1: Analyzing a Real Employment Contract (&lt;code&gt;contract.pdf&lt;/code&gt;)
&lt;/h3&gt;

&lt;p&gt;The repo includes a real employment contract template (&lt;code&gt;contract.pdf&lt;/code&gt;) — a multi-page agreement with clauses covering probation, compensation, termination, confidentiality, IP assignment, and more.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight powershell"&gt;&lt;code&gt;&lt;span class="n"&gt;python&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;-m&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;realitycheck_cli&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;analyze&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;\contract.pdf&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fiaxykf2jbihnpncjeapc.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fiaxykf2jbihnpncjeapc.png" alt=" " width="800" height="653"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Facu58i42c7idq84qxf7p.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Facu58i42c7idq84qxf7p.png" alt=" " width="800" height="723"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Terminal Output:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;╭──────────────────────── Analysis ────────────────────────╮
│ RealityCheck CLI                                         │
│ Contract: contract.pdf                                   │
│ Clauses analyzed: 19                                     │
╰──────────────────────────────────────────────────────────╯
╭─ Overall Risk Score ─╮ ╭─ Power Imbalance Score ─╮ ╭─ Leverage Index (TM) ─╮
│        40/100        │ │         41/100          │ │        54/100         │
╰──────────────────────╯ ╰─────────────────────────╯ ╰───────────────────────╯
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The tool parsed all 19 clauses from the PDF, classified each one, and produced:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Overall Risk: 40/100&lt;/strong&gt; — Moderate risk level&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Power Imbalance: 41/100&lt;/strong&gt; — Slightly favors the employer&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Leverage Index: 54/100&lt;/strong&gt; — Borderline negotiation position&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Category Breakdown:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;              Category Risk Summary
┏━━━━━━━━━━━━━━━━┳━━━━━━━┳━━━━━━━━┳━━━━━━━━━━━━━━┓
┃ Category       ┃ Score ┃ Weight ┃ Contribution ┃
┡━━━━━━━━━━━━━━━━╇━━━━━━━╇━━━━━━━━╇━━━━━━━━━━━━━━┩
│ IP_TRANSFER    │    57 │   0.17 │         9.69 │
│ TERMINATION    │    55 │   0.12 │         6.60 │
│ PRIVACY        │    52 │   0.09 │         4.68 │
│ NEUTRAL        │    36 │   0.05 │         1.80 │
└────────────────┴───────┴────────┴──────────────┘
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;IP Transfer and Termination clauses are the primary risk drivers. The tool detected an "Assignment (Transfer of Contract)" clause attempting broad IP assignment, and termination clauses with limited employee protections.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Ambiguity Detection:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;The tool caught a "sole discretion" clause in the Duties section — the employer can unilaterally modify duties "in the sole discretion of the Employer." This gets flagged as &lt;code&gt;VAGUE_LANGUAGE&lt;/code&gt; with &lt;code&gt;HIGH&lt;/code&gt; severity.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Missing Protections:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;╭──────────────── Missing Protections ─────────────────╮
│ - payment timeline                                    │
│ - cure period                                         │
│ - liability cap                                       │
│ - breach notification window                          │
│ - ip retained                                         │
╰──────────────────────────────────────────────────────╯
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;5 out of 6 critical protections are missing from this contract — a significant gap.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Auto-Generated Negotiation Email:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;╭──────────── Negotiation Draft (Preview) ─────────────╮
│ Subject: Proposed revisions for contract              │
│                                                       │
│ Priority clauses to discuss:                          │
│ - Assignment (Transfer Of Contract Of Employment)     │
│   (C-008, risk 57/100): Narrow IP assignment to       │
│   deliverables created under this agreement.          │
│ - Probation (C-003, risk 55/100): Require written     │
│   notice and a cure period before termination.        │
│                                                       │
│ Additional protections requested:                     │
│ - Add explicit language for: payment timeline         │
│ - Add explicit language for: liability cap            │
│ - Add explicit language for: breach notification      │
╰──────────────────────────────────────────────────────╯
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This email draft is ready to copy-paste and send to the counterparty. No more staring at a contract wondering what to push back on.&lt;/p&gt;

&lt;h3&gt;
  
  
  Demo 2: Full Pipeline with the Demo Script
&lt;/h3&gt;

&lt;p&gt;The project includes a PowerShell demo script (&lt;code&gt;demo.ps1&lt;/code&gt;) that runs the complete pipeline — analyze both versions, then compare:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight powershell"&gt;&lt;code&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;\demo.ps1&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;-Baseline&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;\baseline.pdf&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;-Revised&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;\revised.pdf&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F954rciqab074ay6eqw4p.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F954rciqab074ay6eqw4p.png" alt=" " width="800" height="662"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F2o7rvqtaiwfwtxb6p91j.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F2o7rvqtaiwfwtxb6p91j.png" alt=" " width="800" height="760"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F6fehulgheongoivbai0n.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F6fehulgheongoivbai0n.png" alt=" " width="800" height="702"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F88gn1s6jvfkjdf8cww3w.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F88gn1s6jvfkjdf8cww3w.png" alt=" " width="800" height="736"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fqulpuf9k5x32xtap7zss.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fqulpuf9k5x32xtap7zss.png" alt=" " width="800" height="759"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fqj30winxh3rcf4cq0f68.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fqj30winxh3rcf4cq0f68.png" alt=" " width="800" height="721"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F21q6y9olf5ik2tkkkk7y.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F21q6y9olf5ik2tkkkk7y.png" alt=" " width="800" height="725"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This executes 3 steps automatically:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Step 1:&lt;/strong&gt; Analyze the baseline contract → produces risk scores, missing protections, negotiation draft&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Step 2:&lt;/strong&gt; Analyze the revised contract → same analysis on the new version&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Step 3:&lt;/strong&gt; Compare both → generates a delta report&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;strong&gt;Comparison Output:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;╭─────────────────── Comparison ───────────────────────╮
│ Baseline: baseline.pdf                                │
│ Revised: revised.pdf                                  │
╰──────────────────────────────────────────────────────╯
╭─ Baseline Risk ─╮ ╭─ Revised Risk ─╮ ╭─ Risk Delta ─╮
│       17        │ │       17       │ │      +0      │
╰─────────────────╯ ╰────────────────╯ ╰──────────────╯
╭─ Baseline Leverage ─╮ ╭─ Revised Leverage ─╮ ╭─ Leverage Delta ─╮
│         60          │ │         60         │ │        +0        │
╰─────────────────────╯ ╰────────────────────╯ ╰──────────────────╯
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The comparison engine uses smart clause matching (70% title similarity + 30% text similarity) to pair clauses across versions and flag:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;NEW_RISK&lt;/strong&gt; — new high-risk clauses or risk increases ≥20 points&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;EXPANDED_LIABILITY&lt;/strong&gt; — new liability expansion language detected&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;EXTENDED_NON_COMPETE&lt;/strong&gt; — duration increases (parses days/months/years)&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Demo 3: JSON Artifact Export
&lt;/h3&gt;

&lt;p&gt;Every analysis produces structured JSON artifacts for downstream workflows:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight powershell"&gt;&lt;code&gt;&lt;span class="n"&gt;python&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;-m&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;realitycheck_cli&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;analyze&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;\contract.pdf&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;--json-output&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;\artifacts\contract.analysis.json&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"summary"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"overall_risk_score"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;40&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"power_imbalance_score"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;41&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"ambiguity_index"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;5&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"protection_coverage_score"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;15&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"leverage_index"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;54&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"missing_protections"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="s2"&gt;"payment_timeline"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="s2"&gt;"cure_period"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="s2"&gt;"liability_cap"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="s2"&gt;"breach_notification_window"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="s2"&gt;"ip_retained"&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="p"&gt;},&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"negotiation_email"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"Subject: Proposed revisions for contract..."&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Each clause includes its category, risk score, risk level, signals, rewrite suggestion, and negotiation points — fully structured for integration into legal tech workflows, dashboards, or review pipelines.&lt;/p&gt;

&lt;h3&gt;
  
  
  Demo 4: LLM-Enriched Analysis (Optional)
&lt;/h3&gt;

&lt;p&gt;For deeper analysis, plug in Google Gemini:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight powershell"&gt;&lt;code&gt;&lt;span class="nv"&gt;$&lt;/span&gt;&lt;span class="nn"&gt;env&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="nv"&gt;GEMINI_API_KEY&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"your-key"&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="n"&gt;python&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;-m&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;realitycheck_cli&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;analyze&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;\contract.pdf&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;--use-llm&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The LLM enrichment adds structured signals on top of the heuristic baseline — it doesn't replace the pattern engine, it supplements it. Signals from both engines are merged with deduplication.&lt;/p&gt;

&lt;h3&gt;
  
  
  Commands Quick Reference
&lt;/h3&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Command&lt;/th&gt;
&lt;th&gt;What it does&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;python -m realitycheck_cli analyze contract.pdf&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Analyze a single contract&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;python -m realitycheck_cli analyze contract.pdf --use-llm&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Analyze with Gemini enrichment&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;python -m realitycheck_cli analyze contract.pdf -j output.json&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Export JSON artifacts&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;python -m realitycheck_cli compare baseline.pdf revised.pdf&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Compare two contract versions&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;.\demo.ps1 -Baseline baseline.pdf -Revised revised.pdf&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Run full demo pipeline&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;.\demo.ps1 -Baseline baseline.pdf -Revised revised.pdf -UseLLM&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Demo with LLM&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;




&lt;h2&gt;
  
  
  My Experience with GitHub Copilot CLI
&lt;/h2&gt;

&lt;p&gt;GitHub Copilot was my co-pilot throughout this entire build — from architecture decisions to implementation details.&lt;/p&gt;

&lt;h3&gt;
  
  
  Scaffolding the Architecture
&lt;/h3&gt;

&lt;p&gt;When I started, I had the idea but not the structure. I described what I wanted to Copilot:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;"A CLI tool that parses legal PDFs, classifies clause risk, detects power imbalance, and generates negotiation outputs."&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Copilot helped me design the modular architecture — separating concerns into &lt;code&gt;ingest/&lt;/code&gt;, &lt;code&gt;clauses/&lt;/code&gt;, &lt;code&gt;analysis/&lt;/code&gt;, &lt;code&gt;scoring/&lt;/code&gt;, &lt;code&gt;negotiation/&lt;/code&gt;, &lt;code&gt;comparison/&lt;/code&gt;, and &lt;code&gt;output/&lt;/code&gt; packages. This clean separation made each module independently testable and swappable.&lt;/p&gt;

&lt;h3&gt;
  
  
  Building the Heuristic Engine
&lt;/h3&gt;

&lt;p&gt;The pattern-based classification engine in &lt;code&gt;analysis/heuristics.py&lt;/code&gt; was built iteratively with Copilot. I'd describe a legal concept — "detect clauses that mention sole discretion or unilateral rights" — and Copilot would generate the regex patterns, signal types, and severity mappings. The result is a comprehensive heuristic engine that covers 7 clause categories, 4 signal types, and 6 missing-protection checks — all without any API calls.&lt;/p&gt;

&lt;h3&gt;
  
  
  The Scoring System
&lt;/h3&gt;

&lt;p&gt;The weighted multi-factor scoring system was where Copilot really shined. I asked it to help design a scoring model where:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Different clause categories have different weights (liability should matter more than neutral clauses)&lt;/li&gt;
&lt;li&gt;Vague language and missing protections should add penalty points&lt;/li&gt;
&lt;li&gt;There should be a composite "Leverage Index" that tells you your negotiation strength&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Copilot helped me implement the weighted average in &lt;code&gt;scoring/risk_engine.py&lt;/code&gt;, the power imbalance detector in &lt;code&gt;scoring/power_imbalance.py&lt;/code&gt;, and the Leverage Index formula in &lt;code&gt;scoring/leverage.py&lt;/code&gt; — each with clear, auditable logic rather than a black-box score.&lt;/p&gt;

&lt;h3&gt;
  
  
  Rich Terminal Output
&lt;/h3&gt;

&lt;p&gt;The premium terminal output with Rich was built entirely in collaboration with Copilot. Color-coded score cards (red ≥80, yellow ≥60, green &amp;lt;60), formatted tables for category breakdowns, and the negotiation draft preview panel — Copilot generated the Rich markup and helped me iterate on the layout until it felt polished and professional.&lt;/p&gt;

&lt;h3&gt;
  
  
  Contract Comparison Engine
&lt;/h3&gt;

&lt;p&gt;The comparison module was the most complex feature. Copilot helped me implement:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Clause matching&lt;/strong&gt; with weighted similarity scoring (70% title + 30% text, 0.55 threshold)&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Non-compete duration parsing&lt;/strong&gt; that converts between days, months, and years for accurate comparison&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Liability expansion detection&lt;/strong&gt; with domain-specific legal patterns&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Risk flag generation&lt;/strong&gt; for new risks, expanded scope, and extended terms&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  LLM Integration
&lt;/h3&gt;

&lt;p&gt;Integrating Google Gemini as an optional enrichment layer was straightforward with Copilot's help. It generated the structured JSON system prompt, response parsing, schema validation, and the signal-merging logic that deduplicates heuristic and LLM signals by key.&lt;/p&gt;

&lt;h3&gt;
  
  
  Testing
&lt;/h3&gt;

&lt;p&gt;Copilot helped scaffold the test suite in &lt;code&gt;tests/&lt;/code&gt; — unit tests for the heuristic engine, scoring calculations, LLM client mocking, and comparison logic. The tests validate that the scoring math is correct and the classification patterns work as expected.&lt;/p&gt;

&lt;h3&gt;
  
  
  What Copilot Changed
&lt;/h3&gt;

&lt;p&gt;Without Copilot, this project would have been significantly harder to ship as a solo developer. The legal domain knowledge encoding (regex patterns for clause types, signal detection rules, scoring weights) is the kind of tedious, error-prone work that Copilot accelerates dramatically. It turned what could have been weeks of research and implementation into a focused, iterative build process where I could stay in flow and keep shipping.&lt;/p&gt;

&lt;p&gt;The biggest impact was on &lt;strong&gt;code quality&lt;/strong&gt; — Copilot consistently suggested Pydantic models for data validation, proper error handling boundaries, and clean separation of concerns. The codebase ended up more maintainable than most solo projects I've built.&lt;/p&gt;




&lt;p&gt;&lt;strong&gt;Tech Stack:&lt;/strong&gt; Python 3.10+ | Typer | Rich | pdfplumber | Pydantic | Google Gemini (optional)&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Try it:&lt;/strong&gt; &lt;a href="https://github.com/Anandqwe/realitycheck-cli" rel="noopener noreferrer"&gt;github.com/Anandqwe/realitycheck-cli&lt;/a&gt;&lt;/p&gt;

</description>
      <category>githubcopilot</category>
      <category>python</category>
      <category>cli</category>
      <category>githubchallenge</category>
    </item>
  </channel>
</rss>
