Inspiration

In the high-stakes world of private credit, legal documents have evolved into "legal code"—complex, nested logic systems where a single missing word in a 500-page document can lead to billions in losses. We were inspired by the rise of "Adversarial Legalism," where sophisticated borrowers exploit the interaction between disparate clauses (like the J.Crew "Trap Door" or Serta "Uptiering") to strip collateral from lenders. We built ADS.SIM to give lenders the same adversarial tools that borrowers use, turning manual legal review into a unit-testable engineering process.

What it does

ADS.SIM is a deterministic intelligence engine that scans credit agreements for structural "bugs." It doesn't provide speculative advice; instead, it identifies what the contract explicitly allows. Pattern Matching: Scans for J.Crew, Serta, Chewy, and Incora-style loopholes. Adversarial Projections: Simulates a step-by-step "attack narrative" based on the specific language found. Evidence-Linked Highlighting: Every risk is mapped to verbatim text in the agreement, with adversarial highlights on the exact words that create the vulnerability.

How we built it

We utilized a dual-model architecture to handle the massive context of legal documents: Gemini 3 Flash acts as the indexer, performing high-speed verbatim extraction of specific sections (Investments, Baskets, Definitions). Gemini 3 Pro acts as the reasoning engine, performing "cross-clause dependency analysis" to see how a definition in Article I might neutralize a covenant in Article VI. The frontend is a high-fidelity dashboard built with React 19 and Tailwind CSS, designed to mirror institutional financial terminals like Bloomberg or Eikon.

Challenges we ran into

The biggest hurdle was the "Variable Reference" problem. In legal text, a covenant is often governed by a list of definitions located 400 pages earlier. Standard RAG (Retrieval-Augmented Generation) often loses the nuance of these connections. We solved this by using a multi-pass analysis where the model "compiles" the definitions section into a logic framework before scanning the negative covenants, ensuring the reasoning is grounded in the document’s specific internal logic.

Accomplishments that we're proud of

100% Determinism: We achieved a system that avoids "hallucinations" by strictly enforcing a JSON-schema response format that requires verbatim evidence for every claim. The "Adversarial Highlight" Feature: Our engine doesn't just point to a paragraph; it identifies the specific 3-4 words that create the loophole. Zero-Placeholder UI: The app is fully functional, supporting custom API key injection (BYOK) for enterprise-grade security.

What we learned

We learned that the gap between "Legal Logic" and "Computer Science" is smaller than people think. Credit agreements are essentially poorly compiled code. By treating law as a logic problem rather than a prose problem, we can find vulnerabilities that even senior legal teams might miss during a 24-hour closing window.

What's next for ADS.SIM // Adversarial Deal Simulator

The next phase is Automated Remediation. We want the system to not only find the "bug" but also suggest the "patch"—generating specific redline language to close the loophole. We are also looking into multi-document analysis, scanning the interaction between a Credit Agreement and an Intercreditor Agreement simultaneously.

Built With

  • gemini-3-flash-(extraction)
  • google-gemini-3-pro-(reasoning)
  • google-genai-sdk
  • jetbrains
  • mono
  • react-19
  • tailwind-css
  • typescript
Share this project:

Updates

posted an update

Project Overview

ADS.SIM (Adversarial Deal Simulator) is a deterministic logic engine that treats legal documentation as “legal code.” It identifies structural vulnerabilities in credit agreements by analyzing how specific clauses interact to create bugs or loopholes—such as asset leakage, lender priming, or collateral dilution.


1. Key Features

  • Adversarial Pattern Matching
    The engine scans for known structural exploits used in high-stakes debt restructurings, including:

    • J.Crew Trap Doors
    • Serta-style Uptiering
    • Chewy Asset Stripping
    • Incora Double-Dips
  • Adversarial Projections
    For every identified risk, the system generates a step-by-step “Attack Narrative,” simulating exactly how a sophisticated borrower could exploit the specific language found in the agreement.

  • Evidence-Linked Auditing
    To prevent AI hallucinations, every risk card is strictly linked to verbatim text within the document. Users can see the “Adversarial Highlight”—the exact 3–5 words that create the vulnerability.

  • Risk Vector Quantization
    Risks are categorized by severity and measured across three dimensions:

    • Recovery Risk
    • Control Risk
    • Timing Risk
  • Suggested Patch (Remediation)
    The system provides specific redline language designed to close the identified loophole while maintaining standard market flexibility.

  • Deterministic Reasoning
    Unlike standard LLM chat interfaces, ADS.SIM uses structured JSON outputs to enforce a strict legal-logic framework.


2. Target Users

ADS.SIM is designed for institutional professionals in regulated environments:

  • Credit Committees & Risk Officers
    Identify structural weaknesses in new deals before they are signed.

  • Distressed Debt & Secondary Traders
    Conduct rapid due diligence on “tightness” when buying or selling existing loan positions.

  • General Counsels & Legal Teams
    “Unit test” their own documentation against known adversarial patterns used by aggressive sponsors.

  • Portfolio Managers
    Monitor existing credits for hidden vulnerabilities as market conditions shift.


3. Tech Stack Used

Frontend

  • Built with React 19 and Tailwind CSS
  • UI uses a Terminal-to-SaaS hybrid aesthetic
  • JetBrains Mono for code-centric elements to reflect institutional precision

Dual-Model Intelligence Engine

  • Gemini 3 Flash
    Used for high-volume verbatim extraction and indexing of 500+ page documents. Focuses on ground truth retrieval of covenants, definitions, and baskets.

  • Gemini 3 Pro
    Used for deep adversarial reasoning. Leverages a long context window and high thinking budget to solve cross-clause logic puzzles (e.g., how a definition in Article I interacts with a permission in Article VI).

Structured Outputs

  • Enforced via the Gemini API’s responseSchema
  • Ensures every analysis is auditable, repeatable, and formatted for integration into enterprise risk systems

Deterministic Prompting

  • Constrained to identify only what is explicitly allowed or failed to be restricted by the text
  • Avoids speculative or predictive claims

4. System Limitations (The “Safeguards”)

  • No Legal Advice
    Identifies logic patterns, not legal conclusions.

  • No Speculation
    Does not predict borrower behavior; only analyzes structural permission.

  • Non-Predictive
    An audit-support tool, not a financial forecasting engine.

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