T02 — An Italian lease on one page, in plain English
Daniel has moved to Milan for work and is about to sign the lease of his first flat there: eight pages in legal Italian. He wants to know what he will pay, when, what he cannot do, and — above all — how and by when he can leave. This workflow reads the contract and gives him one page in plain English, with the figures and the dates computed by the workflow, not by a model, and the sentence he will have to send to give notice, already written in Italian.
The reference run, on the lease — 5.37 credits:
| Delivered | What is in it |
|---|---|
| Summary | one page: the lease in one sentence, the rent, the deposit and the notice deadline, five clauses to know, three things to check before signing, the notice sentence in English and Italian |
| The facts | the parties, the address, the dates, the terms, the amounts as printed, and what each of the seventeen articles says |
| Checks | the printed end date against the computed one: 0 days apart; the yearly rent against twelve months: 0 apart |
| Notice deadline | 2030-04-30 |

The case
Section titled “The case”The lease is the common Italian 4 + 4: four years, renewed automatically for four more. It is a PDF of seventeen articles — the flat, its use, the term, leaving, the rent, the flat-rate tax, the deposit, shared costs, repairs, alterations, subletting, pets, handing back the keys, visits, the energy certificate, the court, the law:
Art. 3 — DurataLa locazione ha la durata di anni 4 (quattro), con decorrenza dal 1° novembre 2026 e scadenza il 31 ottobre 2030. …
Art. 4 — Recesso del Conduttore e disdettaIl Conduttore può dare disdetta del contratto alla scadenza, … con un preavviso di almeno 6 (sei) mesi, dacomunicarsi a mezzo lettera raccomandata con avviso di ricevimento o posta elettronica certificata (PEC) …
Art. 5 — CanoneIl canone annuo di locazione è convenuto in € 15.000,00 (euro quindicimila/00), da corrispondersi in dodici ratemensili anticipate di € 1.250,00 (euro milleduecentocinquanta/00) ciascuna, entro il giorno 5 (cinque) di ogni mese …The lease, the parties, the address and every code in it are fictional, written for this example.
| Input | Who provides it | Example |
|---|---|---|
| The lease | the landlord or the agency, before signing | a PDF uploaded as an asset |
| Link to the contract | optional: where the full contract is kept | printed as The full contract → |
What it shows
Section titled “What it shows”- The model copies; the workflow computes. Document Analysis reads the PDF and copies the facts exactly as
printed — dates as
YYYY-MM-DD, amounts as numbers, the term and the notice in years and months — and says in a sentence what each article means for the tenant. Its brief forbids computing, rounding or converting anything. A schema checks the copy; from then on no model touches a figure. See Reading video and documents and Structured answers. - The contract is checked against itself. A contract states some facts twice. Date Calculation adds the term
to the start and takes off a day — a four-year lease from 1 November 2026 ends on 31 October 2030 — and measures the
days between that and the printed end; Calculate subtracts twelve monthly rents from the yearly rent. Two
Predicates require both gaps to be
0, Combine Conditions requires both, and a Filter lets the page’s words reach the template only then. A misread digit — or a contract that contradicts itself — stops the page before the costly illustration is painted. See Calculating — Dates and Deciding. - The deadline is computed, not read. The lease never prints the last day to give notice; it says six months before the end. Date Calculation subtracts the notice months from the end: 30 April 2030. That is the figure a tenant most needs and the one a model most easily gets wrong by a day or a month.
- The notice is written, word for word, by the workflow. Two Text Templates fill a fixed sentence — Comunico la disdetta del contratto di locazione dell’immobile di [address], con effetto dal [end]. and its English version — with the copied address and the computed end, written as Italian and English dates by Format as Text. The legal sentence a tenant will send is never improvised by a model.
- Plain words, no figures. Text Generation writes the page’s sentence, the five clauses to know and three
checks before signing, from the articles alone. Its brief forbids amounts, dates, durations and counts — in figures
or in words — and the schema refuses any digit in them; the figures reach the template through their own field
inputs (
byline,step_1…step_3, the notice fields). It is told not to give advice beyond what the articles say. - Names as people write them. Italian contracts print the parties in capitals. On the first run the page said ELENA MARCHETTI to DANIEL OKAFOR; the reading’s brief now asks for the names as a person writes them.
- One template, used again. The page is the layout of T01 — itself the gallery’s visual summary — copied with new headings and a green palette: Lease at a glance, What it costs · When to act, Clauses to know, Before you sign.
The PDF is read by the model directly: Madoo has no step that extracts a PDF’s text without a model, so the copy of the facts is checked by the arithmetic above rather than against the extracted text.
The workflow
Section titled “The workflow”The figure above tells the workflow as stages; the exact graph is the workflow (as a diagram), node by node in the table.
| Node | Type | Why |
|---|---|---|
| The lease / Link to the contract | input/document, input/text |
The PDF; where the full contract is kept |
| Read the lease | ai/document_analysis, JSON mode |
The parties, the address, the dates, the terms, the notice and how to give it, the rent, the deposit, the condominium advance, and every article in a sentence |
| The facts are complete | utility/json_schema_validate, fail |
Every key, dates as YYYY-MM-DD, whole numbers where they must be, at least five articles |
| Landlord, Tenant, …, Deposit | utility/extract ×13 |
The checked facts, typed |
| Start plus the term / End, computed / Printed end minus computed end | utility/date ×3 |
add years, subtract one day, difference in days |
| Yearly rent minus twelve months | utility/calculate |
rent_annual - rent_monthly * 12 |
| The end date agrees / The rent agrees / The contract agrees with itself | utility/predicate (equals 0) ×2, utility/boolean_combine (all) |
Both checks at once |
| Last day to give notice | utility/date |
The end minus the notice months |
| Deposit in months of rent | utility/calculate |
deposit / rent_monthly |
| Rent, Deposit, …, End in Italian, Notice date | text/format ×10 (en-GB, it-IT) |
The figures and dates as the page prints them |
| Byline, Step 1–3, The notice in Italian and in English, How and by when | text/template ×7 |
The page’s fixed sentences, filled with the facts |
| The articles as text / Write the page | text/format json, ai/text_generation JSON mode |
The sentence, four or five clauses, three checks, an illustration prompt |
| The words fit the page | utility/json_schema_validate, fail |
Lengths for the printed page; no digits in the AI’s words |
| Only a consistent contract goes to print | utility/filter |
The page’s words pass only if the contract agrees with itself |
| Illustration prompt / Paint the illustration | utility/extract, ai/text_to_image |
The picture of the building — painted only after the filter |
| Render the summary | design/template_render |
The AI’s words on data_0; title, byline, steps, notice and picture on their fields |
| Outputs | output/pdf, output/image, output/json ×4, output/text |
The summary, the facts, the two checks, the deadline and the layout report |
Reading a run: End date check and Rent check are 0 when the contract agrees with itself; any other value
names the gap, and the page is not made. The layout report says whether every text fitted its box.
Cost: under half a credit to read the lease and write the page, 5 for the illustration — 5.37 in all. Without the illustration the summary costs under 1 credit.
Install it
Section titled “Install it”The example installs into your workspace with an API key, through the public API only — see Installing an example. It installs the document template too:
node madoo-install-example.mjs t02-lease-key-terms --api <your Madoo API URL> --key <key.json> --run--run uploads the example lease and summarises it (about 5.4 credits). To summarise your own, run the workflow with
your PDF on the input The lease.
Change it
Section titled “Change it”- Another kind of lease: a 3 + 2 agreed-rent lease or a short transitional one changes only the facts; the checks hold. For a lease with no automatic renewal, drop renewal from the byline.
- Another document: an employment contract (salary, probation, notice), an insurance policy (premium, excess, renewal), a supplier agreement (price, delivery, termination). Change the keys the reading copies, the checks that tie them together and the notice sentence.
- Another reader: the page’s brief says in plain English; ask for French or Spanish, and rewrite the template’s headings and the notice translation.
- No illustration: disconnect Paint the illustration and give the template a fixed picture on its
illustrationfield. - Before relying on it: the page summarises; it is not legal advice. The notice sentence is the common form — have it checked for a contract with unusual terms.
manifest · workflow · the complete graph · the template · the lease