The Hidden Cost of Using AI for Documents
Your team regenerates the same NDA every Monday and pays for it three times. I built katib to fix that. 44 print-grade PDF templates…
The Hidden Cost of Using AI for Documents

Your team regenerates the same NDA every Monday and pays for it three times. I built katib to fix that. 44 print-grade PDF templates. English and Arabic. Zero tokens at render time.
It’s 4 p.m. on a Tuesday in a corporate office somewhere.
Someone needs an NDA. Or a service agreement, a tax invoice, a quarterly progress report. They open ChatGPT, type ”draft me a non-disclosure agreement for a UAE-based vendor relationship,” wait for a wall of text, paste it into Word, and spend the next forty-five minutes fixing the layout, the page breaks, the bilingual mirroring (because half their counterparties read Arabic), the signature blocks, and the table that legal will reject.
You’ve done it. I’ve done it. You pay tokens for every word the model generates, then pay them again for every revision, then drop the output into the same Word file you were trying to escape.
This is the workflow we pretend works. It doesn’t.
I built katib to skip that loop. It’s an open, Arabic-first document engine. As of today it ships 44 print-grade PDF templates, every one bilingual, with zero tokens consumed at render time.
It’s live at jneaimi.com/katib.
draft me a non-disclosure agreement for a UAE-based vendor relationship,
The Problem with Prompting Documents
The default mental model right now treats the LLM as the document generator. You describe what you want, and the model invents the structure, the words, the layout, the formatting, all of it, every time, from scratch.
That gets expensive in three ways most teams haven’t priced in.
It’s expensive in tokens. Every regenerated NDA is another few thousand tokens. Multiply that by team size, by revision count, by counterparty count. The bill compounds invisibly.
It’s expensive in time. The model gives you a wall of text. You then translate that text into a document: apply the layout, fix the headings, mirror the Arabic side, set the page breaks, place the signature fields. The “AI did it” framing hides the human hour at the end.
It’s expensive in trust. Every regeneration produces a slightly different document. No two outputs come out byte-identical. Legal can’t audit them. Compliance can’t sign them off as a standard form. The “speed” comes at the cost of reproducibility.
The Flip
katib treats templates as code.
A template specifies a document deterministically: structure, layout, bilingual fields, typography, page breaks. The LLM doesn’t generate the document. It generates the variables the template needs: the counterparty name, the contract value, the effective date, the jurisdiction.
Then the engine renders.
The render is deterministic. Byte-for-byte reproducible. Run it ten times with the same inputs, get ten identical PDFs. Run it in your CI pipeline, in a Lambda, in a Coolify-hosted job, on your laptop. Same output every time.
You go from generating around two thousand words of legal prose to filling around fifteen variables. That shift is where the 10× to 100× drop in tokens per render comes from.
The Real Engine: 45 Components Underneath
The “templates are code” story is only half of it. The reason templates can be this cheap, reproducible, and bilingual is what sits underneath them: 45 reusable components.
A component is a small, named, typed building block. Sixteen primitives handle typography styles, fields, signature blocks, and page breaks. Twenty-eight section components handle clause blocks, branded headers, party tables, RTL-aware columns, and footer attestations. One cover-page system handles the rest. Each component gets built once, tested, and locked.
A template isn’t a document. It’s a composition of components. An NDA is a header bar plus a clauses section plus a signature block. An invoice is a branded header plus a line-item table plus VAT-aware totals. A CV, a financial report, and an executive summary all assemble from the same library.
That’s what makes the engine work with AI.
When the LLM enters the loop, it doesn’t generate prose, layout, or structure from scratch. It does a smaller, easier job: it picks which components apply, orders them, and fills their typed slots. Composition is a kilobyte-scale task. Generation is a megabyte-scale one. LLMs are good at the former and expensive at the latter.
That’s where the 10× to 100× token savings translate into real money. The model becomes the dispatcher choosing factory pieces, not the factory itself. Every assembly produces a byte-identical output.
The effect compounds. Add one new section component to the engine, and every existing template that fits it inherits the upgrade. Improve typography in one primitive, and every document picks it up. Time saved per document compounds across your team. Cost per render trends toward zero.
Arabic Wasn’t an Afterthought
Most document tools treat Arabic as a translation layer bolted onto an English-first engine. You’ve seen the result a thousand times: text that flows the wrong way, broken bidirectional rendering, fonts that fall back to Times New Roman, paragraph alignment that fails to mirror, headers that sit on the wrong side of the page.
I built katib the other way. Every template ships English and Arabic as first-class outputs:
- Right-to-left layout is the Arabic default
- Mirrored composition flips margins, section blocks, and signature fields correctly
- Real Arabic typography ships with Cairo, IBM Plex Arabic, 29LT Bukra, and DIN Next Arabic. No Latin fallbacks.
- Bilingual side-by-side mode handles documents that need both languages on the same page (NDAs with Arabic and English columns are common in the Gulf)
If you’ve ever shipped a contract where the Arabic version had to be opened, fixed, and re-exported by hand, you know the unpaid tax that puts on bilingual teams. katib pays it once at template-build time instead of every render.
What’s in the Marketplace Today
The launch ships across 8 domains, all live at jneaimi.com/katib:
- Legal: NDAs, mutual NDAs, MoUs, service agreements, vendor contracts
- Finance: UAE FTA-format tax invoices, quotes, statements, financial reports
- HR: offer letters, internal policies, onboarding packs
- Reports: executive summaries, project status reports, board updates
- Editorial: news covers, magazine layouts, article tear-sheets
- CVs: bilingual professional resumes with Arabic-first and English-first variants
- Decks: slide-frame layouts for executive briefings
- Tutorials: instructional document layouts
44 packs at launch. Each one is open source, bilingual English and Arabic, and built from the same 45-component engine. Each one uses the .katib-pack artifact format, frozen at pack_format: 1 as the public contract.
The catalog grows fast because of the substrate. Adding a new pack isn’t writing a document from scratch; it’s wiring a handful of existing components in a new arrangement. A team can install any pack, fork it, rebrand it, and re-render in two commands. More packs land regularly, and the open submission path means any pack a team builds for itself can become the starting point for someone else.
The catalog isn’t the product. The engine is. The 45 components that built these 44 packs scaffold any new document your team needs without re-paying generation costs. The marketplace shows you the floor of what’s possible. The ceiling is whatever you build with it.
What Using It Looks Like
Two commands.
katib pack install jneaimi/legal-nda
katib render legal-nda - lang ar - brand mine
The first command resolves against the public registry, downloads the pack from Cloudflare R2, and unpacks it into ~/.katib/recipes/. The second renders the document in Arabic, branded with your team’s identity (logo, colors, accent), into ~/Documents/katib/.
If your team has a .katib.yaml in the project root, your defaults flow through automatically. You brand once and render anywhere.
The output is a PDF. A4 by default, with real margins, clean page breaks, and signature fields where signature fields belong. Print it, sign it, send it. Or pipe it into DocuSign and ship it the modern way.
Build for Your Team. Share If You Want.
katib is a public registry of bilingual document templates and the components they’re built from, packaged as code, shipped as an open artifact format. You install packs. You render documents. You can extend either layer privately for your team, or publicly for everyone.
Path 1: build a template. If your team has a recurring document like a quarterly report shape, a corporate letterhead, a contract template, or an internal policy, package it once and stop re-prompting it from a language model. Keep it private inside ~/.katib/recipes/ so it never leaves your machine. Or push it to the registry. Your choice.
Path 2: build a component. Go a layer deeper. Build a new clause block, branded header bar, chart section, regional compliance footer, or signature attestation, and every template that fits it inherits the upgrade. Components are the higher-leverage contribution because they compound. One good component shows up in dozens of documents you’ll use. The CLI scaffolds the whole thing for you:
/katib new component
Sharing is optional. The default is private. You build it for your team, store it under ~/.katib/, and stop there. If you want to push something back to the public registry, both paths live at github.com/jneaimi/katib-marketplace.
Why This Matters Beyond Documents
Documents are the canary.
The same pattern shows up across most applied AI workflows right now: prompt the model to generate everything every time, pay tokens for it, regenerate on every revision. It’s the same story for reports, slide decks, marketing copy, status updates, forms, and briefs. You’re paying generation costs for outputs that should be deterministic.
The replacement looks a lot like what katib does for documents: templates as code, models as variable-fillers, deterministic renders, byte-reproducible outputs. You compose once. You render forever. The model becomes the smallest, cheapest, most predictable part of the loop instead of the most expensive and least reliable.
I think that shift is coming for the whole applied-AI surface. katib is what it looks like in one domain, today.
Try It
→ Marketplace: jneaimi.com/katib → GitHub: github.com/jneaimi/katib → CLI: npx @jasemal/katib install → Submit a pack: github.com/jneaimi/katib-marketplace
44 bilingual, open-source, print-grade templates. Build the document once. Stop re-prompting it forever.
메타데이터
- post_id
- eca24819bfcd
- slug
- the-hidden-cost-of-using-ai-for-documents-eca24819bfcd
- url
- https://medium.com/@jneaimi/the-hidden-cost-of-using-ai-for-documents-eca24819bfcd
- canonical_url
- https://medium.com/@jneaimi/the-hidden-cost-of-using-ai-for-documents-eca24819bfcd
- author_url
- https://medium.com/@jneaimi
- status
- ok
- fetched_at
- 2026-08-05 18:25:39