In the same way that Markdown compiles to HTML which is then interpreted by web browsers into pixels on a screen, I find it fascinating to consider the logical next step: the runtime environment in which "legal code" runs.
A contract is really a function of (world state) -> (booleans for parties in breach), and lawyers excel at traversing the function space of possible contracts based on simulations of possible world states, making them optimizers over those function spaces. Their "speculative execution" and ability to cull parts of that search space are based on having efficient caches of case law; we literally train lawyers to be optimal caches by having them take bar examinations, because even with databases at these professionals' fingertips, the latency with which they can simulate contract space given novel information (in trial, in live conversations with clients) is a core competency of the profession.
I wonder if some of the tooling and philosophies being developed in the machine learning world can be applied to great effect in this context...
Breach of contract claims, beyond the most simple scenarios, often involve difficult normative questions. It's unlikely a simple dispute capable of being resolved by a computer would wind up going to trial. It would be settled or be the subject of summary judgment.
Sure, you might have word state -> boolean in a simple scenario. But what if the party alleges the contract, or a term, is void or unenforceable because of the existence of a vitiating factor? What if there are two competing interpretations of a term which depend upon considerations such as the purpose of the agreement?
It would be a very difficult task asking someone to agree to a contract which requires no value judgements. Even more so in the Nordic countries where such agreements are governed through a lens of 'good faith'.
We then wind up making value judgements, weighing the benefits of holding parties to a bargain capable of being determined objectively, on the one hand, and the elusive and complex notion of 'fairness' on the other.
We are then well and truly outside the boundaries of the capabilities of contemporary thinking machines.
Taxation is an area of back end law where lawyers should be worried about automation.
I watched a project where the starting idea was to make and IDE for lawyers, applying the many learnings from modern IDEs including autocompletion, structure the document like code, etc. The main challenge was to get lawyers to adopt and move away from MS word. It ended up applying that approach to tools and document management for lawyers: https://tryprose.com/home
It is one thing to formalize contracts as functions. Also formalizing the world state is a much harder problem and Ethereum tries to solve it by declaring the blockchain "the world". This is the harder problem as you can observe in courts where nearly all the discussion is about the world state.
For an example, the question might be "murder" vs "manslaughter". Was there malice? This is about the world state. Once that is decided, the function to determine the sentence is relatively quick to compute.
Well, to start with, a judge who decides that part of your contract is invalid for one reason or another isn't going to care about your claims that it's impossible to alter because blockchain.
If you can come up with a function that can determine whether or not someone's behaviour is "reasonable" or not, you might be on to something.
Oh yeah, that someone might be a person, a corporation, or a government, and the standard of reasonableness will depend on what exactly it is they're doing.
I recently had to sign an agreement where I had to fill my name 3 times within the agreement. It's only then that I realized that good lawyers know variables: "This agreement is signed between ... henceforth called Employee and ... henceforth called Employer."
I’m not a coder but a designer, but I also have some experience in this space. This is also one of those areas where the HN crowd will think, “I’m so much smarter they should just do X isn’t it obvious?” What happens is that clauses are often litigated over and over and the successful evolution of the clauses that survive court battles and arbitration are then used wholesale in future contracts because the law is so settled. So it’s hard to change clauses, even to replace some small things with seemingly equal things (names vs variables in this case) because that opens up cans of worms because the clause is no longer identical to the litigated one. So the efficiency gained by only needing to write your name once is lost in the danger of additional litigation.
One analogy would be to not roll your own crypto. You may think you got it right, but better to just go with the battle tested solution.
This is also one of the many reasons people incorporate in Delaware primarily. The law is settled and doesn’t change, people can rely on it, so they use the clauses that were litigated and have settled meanings for decades.
You're not saying that the new idea wouldn't be right, but that there could be complexities the outsider would miss. I don't think anyone would disagree. But variables vs rewritten names (for example) would still be the right idea, it's just that the body of existing work hampers agile changes.
The way to deal with this is write the idea down with the blockers and benefits and work to enable it slowly. For instance, forgetting one of the three signatures needed would similarly doom you, so it's not all risk, it's also reward.
Almost any consultant deals with this constantly, in any industry.
Can you explain why name vs variable would matter? I could totally see this for other seemingly small changes, but name vs variable doesn't change the meaning at all.
Sometimes having you do something manually is part of the point. Areas of legal risk or when you're acting against your own interests are areas where the attorney might want to draw extra attention. Think of it as an "Are you sure?" dialog.
An example: when I was doing basic legal assistance, we had a lot of folks who wanted a power of attorney. Many of them insisted on getting a general power of attorney. There are significant risks that such an instrument may be too powerful, and also that it may not be powerful enough. Eventually, we had a disclaimer on the back of the request form that they had to rewrite, by hand, before we would draft the instrument for execution.
I'm curious to hear more about the affect of adding the disclaimer. Did it mean fewer people put in the request? Did it prompt them to ask more questions? Did it replace in-person discussions of the significance of the decision? I'd love to hear more details of how the change played out.
Fewer people ended up requesting them. It was common knowledge that they can be abused, so when we would explain the risks people would tune us out and their eyes would glaze over and they would insist. By making them rewrite by hand that there's also a risk that different companies and agencies will refuse to honor them, they finally understand that the risks are not just theoretical, but practical.
Yes, they even define terms in their contracts' preambles.
But be very careful about capitalization (it's "Employee" if you refer to the aforementioned employee, not "employee"), a wrong lowercase initial letter, and you may lose a lot.
Good point, but it raises the issue of checklists. If this area is too dangerous to tweak, how do you take care to avoid manual versions of these mistakes? Is there a step to search for words in the wrong case?
Usually you'll find that the new idea is good, in some contexts, but that exploring it surfaces new requirements and existing ones that were poorly understood. Usually there are things that aren't being done correctly now, that when documented and planned for, change the equation.
But the big benefit of outsiders isn't their ideas (though it often is), it's their ability to help cut through the insider problems. Usually insiders know what to do but are hampered by not only the difficulties, but the politics. Someone who doesn't know the conflicts can say that the emperor is naked, that doesn't magically clothe him but allows the tailor's who've been calling it out already to actually be heard and then the problem can actually be corrected.
No kidding. What's worse is when you capitalize defined terms but then have to translate the contract into a language that has no capital letters, like Arabic, Korean or Thai.
He kept using Word (the MS-DOS Version!) for a very very long time, because he had most of the everyday stuff he needed as predefined "Textbausteine" (text modules? text blocks?) - he would just press ESC-this-key,that-key and a complete divorce application for the court would pop up. Many paragraphs were double, so he only had to delete the male/female version.
He was bragging the "work" he did for a divorce was around 10 minutes, the rest of the time he was chatting with the client. (He also had several boxes of Kleenex around for crying clients - a big part of that work is emotional).
He also had a lot of text modules for all the other bread-and-butter stuff that turns up every day.
Yeah, I've recommended https://docassemble.org/ to a lot of friends in the lawyer space. They use it a lot to generate some automate template software.
I have had one small thing with it, if you're using the realtime preview for fancy things (one friend used it for a self-managed invitation card thing for weddings), the preview does not use the fancy fonts that are loaded into your template.
It's weird because the rest of the ecosystem is very good for almost every usecase.
Templating has a very long history in law: law firms were strongholds of WordPerfect against MS Word due to WP's non-WYSIWYG, macro/batch-friendly nature, and insurance companies used and still use SGML (SCRIPT/VS, DCF, GML on z/OS) for printing customized contracts and account statements. Early full-text databases for cases and annotations etc. also evolved in law. SGML in particular allows full markdown and custom notational conventions for referencing legal code/precedents without resorting to ad-hoc template "engines"; it was even designed by a lawyer.
This is such a cool idea. As an ex-lawyer turned developer, I wish I had thought of that.
In my career, I probably wrote 1000+ corporate contracts, but most of those were about +/- 8 types of contracts with 80% of clauses repeated.
Me (before knowing programming) and most organized lawyers I know, just had a huge "Clause Database Word File" where we dumped common clauses that we just copy/pasted when building new contracts.
I believe there are a lot of opportunities to make software for lawyers that automate those things.
I'm glad I made the transition to programming, but it would have been awesome to know those tricks when I was write dozens of those contracts every week.
With the proximity of legal text and computer code, I always wondered how big a market lawyers are for pretty standard programming language tools and services. At the same time I am not so sure whether we should bring said tools and services to lawyers because they increase productivity so immensely...
I'm a lawyer, and a former (and still occasional) programmer. In my experience, tools developed for (or at any rate, targeted at) lawyers seem to always be bloated, slow, and of negligible utility as far as I can tell. For "legal development" purposes (i.e., writing a letter, contract, memo, brief, etc.), nothing I've experienced surpasses plain old Word Perfect (still in use in some offices I deal with). Word's automated numbering system can burn in eternal damnation.
What might be useful would be better change tracking and management. The problem here is Word's dominance as a means of exchanging drafts. When working on an agreement, I and opposing counsel usually exchange Word drafts along with PDF redlines, which works well enough. Some attorneys like to use the "Track Changes" feature of word, but after a few turns you end up with a complete mess. Still, the sophistication and power of a git or mercurial would probably be wasted in the sort of contexts in which lawyers typically work (a series of form-based documents which are individually tailored in essentially one-off transactions).
I'll ignore your quip about productivity, except to note that you might feel differently if you were the one paying the fees.
https://draftable.com/https://api.draftable.com/examples is a secret weapon I've used frequently as a non-lawyer, including to silver-platter documents for counsel and to review things sent by external parties: you can give it two versions of a contract, and it automatically derives a redline, meaning that as long as you have sane file naming schemes, you essentially have `git diff` for contracts without ever needing the overhead of managing a repository. It's remarkably robust and has self-hosted options.
Thinking more broadly about tools for lawyers, I feel like too many attempts have fallen into the trap of "we need to disrupt everything and remove all rote work." From the lawyers I've talked to, the common thread is that they just want better visibility and a second pair of eyes; they'll be responsible for their work product at the end of the day and will need to type changes manually, but if something could help them find the "gotcha" buried on page 93 with slightly greater speed and reliability (or, to wit, find all typos from Word's automatic numbering), without requiring a full change in toolkit, it could meaningfully improve quality of life for counsel and clients alike.
I'll piggyback on your final comment to state that the biggest problem in the legal space is cost (effectively a proxy for productivity). Almost all litigation against individuals and small businesses is an exercise is borderline blackmail (e.g. this will cost you $100k to defend and win so might as well pay $10k).
It's a hard problem to actually fix, and mostly a byproduct of the attorneys monopoly on the legal profession and various mandates to make it require human intervention.
Where we need to get to is letting technology and true startups (with limited liability) provide legal services.
I will give a shout-out to fairclaims.com which I recommend so much more over traditional arbitration/mediation firms. One example of the type of thing we need.
I am a lawyer and I use Track Changes a lot - but I cheat. I'll change my name in Word to something that makes sense for versioning. Redlining the 40-year history of a statutory provision? Well first my name is NDAA FY '84, now it's NDAA FY '15, etc.
I can speak to this a bit. My mom is a lawyer and we've talked before about the need for better templating systems. The problem is that the market for solo practitioners and small firms is just not that large or lucrative, and AIUI the market for large law firms is already pretty mature, or at least there's a high barrier to entry.
But there's definitely a need among solo practitioners and small firms, and that need goes beyond templating to include better ways of organizing documents, automating workflows, ensuring security, and so forth. There are companies like Practice Panther which are trying to do this, but the problem I've seen with them is they encourage vendor lock-in and make it hard to do anything not officially supported by the platform.
I don’t know if you have started working on a potential solution (I am assuming not based off your verbiage), but I’d love to hear more.
I find tremendous purpose and joy in enabling more productive and efficient work by developing digital tools & applications, especially for intelligent individuals such as your mother and other lawyers.
If interested in sharing more, whether you want to have nothing to do with a potential venture or not, I have my public email on my profile. Cheers!
I've written code a lot longer than I've written legal text. But the longer I've written both, the less "proximate" they've seemed. Drawing parallels pleases the mind, but it's more trouble than helpful, most of the time.
If you want to make legal texts even worse to read and write, throw in a heavy dose of CS-esque structuralism.
I’ve been a coder on-and-off since the 1990’s, and an attorney for >10 years, in litigation. I actually disagree. I think legal writing is closer to programming in a lot of ways than it is to creative writing. They are all different things, but I’ve always found the parallels kind of interesting.
I'm constantly repeating Justice Holmes' adage that "the life of the law has not been logic; it has been experience." In my opinion, non lawyers vastly overestimate the extent to which legal writing and legal argument have anything to do with logic.
I had the pleasure of building software requirements from legislation once and discovered that everything left room for interpretation, made what seemed on the face of it a relatively well understood thing difficult to build.
Someone can come out with it and then someone will wrap a dashboard around it and advertise it as "look - you don't even have to write code!"
The biggest enemy of programming languages as general purpose tools for business is the idea that code == hard, and coder == expensive specialized labor.
If we reach a point where programming is taught as a basic skill like arithmetic or writing then maybe we can apply standard PL tools to basic business tasks.
I´m a law graduate and a product manager in the legal space at the moment, so this is very interesting to me. Templating is a solved problem in general and there are many ways to achieve the same thing, some startups are build simply on the premise that a nice frontend for a templating engine will be a huge value.
But I think in order to create meaningful change for legal professionals, you need more components.
1. Knowledge management
a. privat knowledge
b. public knowledge like laws
2. Templating
3. Insights in the combination of 1. and 2.
4. Results that look equally good as custom build contracts in Word
5. A link to reference code, if there is code enforcing the legal prosa
Its all about knowledge graphs and an interface to them.
We encounter a similar problem in the medical field: endless clinic and operative notes that are 95% repetitive but are critically important for recording medical care, medicolegal defense, and payment for the work done. There are surprisingly few commercial options out there (the ones included with EMR's suck) and I finally ended up making my own op-note templating program in python with pysimplegui that generates and submits a pdf so my op-notes take 20-30 seconds instead.
Our legal team code most of our documents in a hybrid of Pug, Markdown and Handlebars which works for us - it also supports automatic sectioning as well. This works well for the general case where documents are generated from question sets defined in JSON, developer time is required when the documents need to use something more complex - modelling a cap table, the vesting schedule for an option grant, convertible loans etc.
In a case of hidden issues in plain sight; your first markdown example, speaks of what the # means but ignore the leading # being used to signifiy a header in markdown. Make sense to me as a coder, but I expect non-coders will be left confused as the # obviously does important things and yet there’s an extra one there that’s unexplained (that does header markup).
Consider removing the header all together for the sake of simplified grokking.
Hah, our legal document templates are a combination of Pug for document structure with features from Markdown for text formatting and Handlebars for variable formatting.
We have been working on this to a degree with our new platform, along with other layers of the agreement process. We are mostly focusing on contracts for digital agencies (and their clients and suppliers) to begin with, with templates based on services being delivered, deliverable signoffs, variation handling, and recurring agreement elements.
A contract is really a function of (world state) -> (booleans for parties in breach), and lawyers excel at traversing the function space of possible contracts based on simulations of possible world states, making them optimizers over those function spaces. Their "speculative execution" and ability to cull parts of that search space are based on having efficient caches of case law; we literally train lawyers to be optimal caches by having them take bar examinations, because even with databases at these professionals' fingertips, the latency with which they can simulate contract space given novel information (in trial, in live conversations with clients) is a core competency of the profession.
I wonder if some of the tooling and philosophies being developed in the machine learning world can be applied to great effect in this context...