MARK GARASLEGAL AI & SOFTWARE
← Back to all projects

Drafting and contracts

Document Loop

A research prototype for legal drafting software that checks whether an AI revision breaks requirements elsewhere in the document.

Implemented research prototype
Intended users
Legal-workflow builders studying controlled document revision
What they leave with
Candidate drafts with policy-check results and replayable evaluation records.

01 / Research use

Check what an AI edit changes elsewhere in a document.

A builder of legal drafting software wants an assistant to change a deadline without losing an existing confidentiality clause. Reviewing only the edited sentence would miss that second problem.

The task

The builder needs a way to compare complete candidate drafts against explicit requirements, including protected text, factual support and unresolved questions.

How the project approaches it

The prototype preserves the source, generates candidate drafts and evaluates each whole document against a policy. The builder compares alternatives and can replay saved evaluations without generating new text. Without a policy, the original remains the recommendation.

What this helps someone assess

This gives the builder a repeatable way to investigate whether an edit satisfied the request while breaking another requirement. The retained example accepts a deadline change and blocks removal of protected confidentiality text. It demonstrates a checking method for a future drafting workflow, not a finished contract editor.

An illustrative research use, bounded by the findings and limits below.

Starts with

The original document, a record identifying that source, and the rules for evaluating proposed changes.

Produces

Complete proposed drafts, their check results, and saved comparisons that can be rerun against the same source and policy.

02 / Workflow

How it works

  1. 01

    Keep the source

    The original text and its identity remain the baseline. The evaluation policy defines the checks a proposal must pass.

  2. 02

    Propose a revision

    Model-assisted revision produces complete drafts through serial repair or fresh generation. Without a policy, the original stays the default recommendation.

  3. 03

    Check the whole document

    Deterministic checks inspect protected text, support, unresolved questions and dependencies after each proposal.

  4. 04

    Compare saved drafts

    Candidates can be checked again without generating new text. The saved source must pass an integrity check before replay.

03 / Public or synthetic example

An example

Two authored alternatives changed a fictional document covering refunds and confidentiality. Adding a refund deadline passed the configured checks. Removing the protected confidentiality clause was blocked. The comparison used no new model generation and did not select a legal winner.

What still needs reviewA qualified reviewer decides whether to use a revision. Passing the checks does not establish enforceability, legal quality or another party’s assent.

Build details and capabilities
My work
I designed the workflow, built the software, and tested it.
Built with
Python · Model-assisted drafting · Deterministic policy checks

A smoother sentence can still make a document worse. A revision might remove a protected clause or leave a factual claim without support. Document Loop checks the whole document after each proposed change, including the parts the model was not asked to edit.

  • Source-preserving serial repair and fresh generation
  • Experiments that revise sections and combine alternatives while checking dependencies
  • Checks on protected text, unresolved questions, and saved alternative drafts
  • Reevaluation and replay without new generation
A choice I made

Without an evaluation policy, the original document remains the recommendation. A proposed draft must pass the document’s checks before it can replace that source.

04 / Verification

What I tested

All 37 tests passed on 31 October 2026, including eight replay-integrity regressions. The retained services-document run replayed 57 of 57 evaluations unchanged without a model call. A fresh authored example passes a deadline-only proposal and blocks removal of a protected confidentiality clause; altered saved sources are refused before replay output is written.

Limits

The tests use public and synthetic text. Passing them does not establish legal quality, enforceability or whether another party would accept the revision.

Reviewed 31 October 2026. These software checks and synthetic examples do not establish legal accuracy or performance in production. Client materials and private source code are not included.