Nothing lost to an edit
The stronger version from two weeks ago is still on the list to be brought back, and everything written after it stays there as the record of what was approved while it stood.
Available now
In build
The whole team
Nineteen specialists, each with a defined job and an honest status label.
See all nineteenThe business can see how a piece of copy evolved and can bring an earlier version back when a later edit made it worse; bringing it back appends a new version carrying the old text rather than deleting or rewinding the history in between.
Works with
What it does
A document is a lekha_documents row with an append-only lekha_versions history, all served under /api/v1/agents/lekha from app/api/v1/agents/lekha.py. Every explicit save appends a version: POST /documents (:2599) writes version 1 and POST /documents/{document_id}/versions (:2680) writes the next, and each one runs the guard before the row is written and raises one flag per finding — the guard is `guard` at app/services/lekha.py:464, and the three routes that write a version reach it through `_write_version` at app/api/v1/agents/lekha.py:2155 (called at :2621, :2703 and :2780, and nowhere else). There is no autosave — keystrokes are never versioned and a /write result is not kept until someone posts it. Any two versions compare through GET /documents/{document_id}/diff (app/api/v1/agents/lekha.py:2716) with from_version and to_version, a local word-set diff with no model call (`diff_copy` at app/services/lekha.py:369) that lists the numbers and proper nouns the later version dropped. The version list itself comes from GET /documents/{document_id} (app/api/v1/agents/lekha.py:2649): there is no route that serves a single version and no edit or delete on one. Restoring is POST /documents/{document_id}/versions/{version_number}/restore (app/api/v1/agents/lekha.py:2744), gated on the edit permission at :2767 exactly like a version save (:2685) — the first save of a new document is gated on `generate` instead (:2603) — and it writes the older text forward as a new guarded version with edit_source `restored` (:2782) and bumps current_version_number; because every version write resets status to draft or in_review (`_write_version` at :2197-2198), putting an old draft back can pull an approved document out of approved. Tenancy is the token's workspace_id: every handler resolves the document through `_owned_document` (:2145), which answers 404 for another workspace's rows so no caller can address them.
An edtech marketing team rewrites a course-description page for the third time this month, and the newest version is actually weaker than the one from two weeks ago — a well-meaning edit dropped a detail that mattered, and nobody remembers exactly what the earlier draft said. Hunting for it in a saved email attachment is a slow, unreliable way to undo a mistake.
Every save here writes a numbered version, whether you kept a draft Lekha produced or typed the change in yourself, and the history only ever grows: no saved version is edited in place and none is deleted. Any two of them can be compared, and an earlier one can be brought back — as a new version at the end of the list, run through the checks again on the way, because text that read fine against last month's facts is not automatically fine against this month's.
Lekha runs this directly on the platforms your customers already use — no separate app for them to install.
How it works
Keeping a piece of copy opens a numbered history, and each later save adds the next number. Versions are append-only: there is no edit-in-place and no delete on anything already saved, on the API or on the screen.
Choose a from and a to and the comparison comes back as words added, words removed, and a separate list of the numbers, prices and names the later version no longer contains. It is word-level and makes no model call.
Restoring version 2 of a document at version 7 writes a version 8 carrying version 2's text and leaves 3 to 7 where they are. The entry is labelled restored, and the control is disabled on the version already current.
A restore is not a way past the checks. The stored text goes through the same guard as any new save, against the fact base as it stands today, and each finding comes back as a flag waiting on a person.
Why it matters
The stronger version from two weeks ago is still on the list to be brought back, and everything written after it stays there as the record of what was approved while it stood.
Dropped specifics are listed apart from ordinary word changes, so a price that quietly disappeared between two drafts is named rather than left for you to spot by re-reading both in full.
Bringing old text back is one action that adds one entry. You are not reconstructing a draft from memory, and the document does not lose the versions made in between.
The detail
The comparison half of this capability really is mechanical: the diff is a word-level set comparison over two stored texts, with no model asked to summarise the difference. What the restored text then is, is a separate question, and the plain answer is that a restore is not a rewind to a known-good state. It comes back through the guard against the fact base as it stands now, not the one in place when it was written — which is the point: a figure supported then may be unsupported today. Held, and the document moves to in_review; clean, and it moves to draft. Either way an approved document stops being approved, because the approval was of a particular text, and carrying it onto different words would make the record say a person approved something they never read. Approving it again is then refused while any flag on the current version is open, with no override and no role that skips it. A restore needs the same edit permission as saving a new version, with the caveat that the gate is opt-in per workspace — one that has never assigned a role has none.
The practical cost is how fast an append-only history grows. It is driven by deliberate saves rather than keystrokes, because nothing writes a version while you type, so a heavily edited document accumulates one entry per save and nothing is pruned. That is the price of the choice that keeps the audit question answerable a month later.
What this does not do is judge which version reads better. It makes every version visible and brings any of them back, but which draft was the stronger writing, and whether a fact was more accurate in one than the other, stays your call — the comparison supports that judgment rather than making it. One limit is worth knowing when you read a diff: because the check is set membership, a sentence that survives with its words intact but in a different order is not reported as changed.
Industry use cases
13 industries where Lekha applies this directly.
A used-car dealer pastes the make, model, year, and mileage for a new arrival, and Lekha drafts a listing description plus a short social caption, both flagging that any claim about condition or history beyond the given facts needs the dealer's own confirmation before posting.
See the automotive playbookA sales manager sets up a persona for "IT decision-maker at a mid-size manufacturer," and every rep on the team generates cold-email drafts from the same persona so outreach feels coordinated rather than ad hoc.
See the b2b sales playbookA regional NBFC drafts a loan-product social post, and Lekha flags the line mentioning an interest rate range as a regulated claim, holding the post in a pending-review queue until the compliance officer confirms the number matches the current approved rate sheet.
See the banking and finance playbookA skincare brand uploads its full product line as a spreadsheet with ingredients and benefits per item, and Lekha generates a description and a caption for each product in one bulk run instead of one at a time.
See the beauty and cosmetics playbookA test-prep institute asks Lekha for a blog post targeting the keyword "best online coaching for class 10 boards," and Lekha returns a structured draft with headings and an FAQ section, with any specific outcome claim about pass rates flagged for the institute to verify before publishing.
See the education playbookA freelance interior consultant uses Lekha to turn one client project photo caption into a LinkedIn post, an Instagram caption, and a one-line portfolio blurb, all in the same evening.
See the freelancers and consultants playbookA physiotherapy clinic drafts a social post about a new treatment offering, and Lekha flags the phrase implying guaranteed pain relief as a health claim needing review, holding it until the treating physiotherapist approves the wording.
See the health and wellness playbookA furniture retailer uploads a new collection's specs and Lekha drafts descriptions for the e-commerce listing plus a matching Instagram caption set, keeping material and dimension details exactly as supplied.
See the home decor and furnishing playbookAn agency managing five retail clients keeps five separate brand-voice profiles in Lekha, so the same campaign-brief-to-assets workflow produces distinctly different-sounding output for each client from the same underlying template.
See the marketing agencies playbookA broker pastes a property's square footage, bedroom count, and location, and Lekha drafts a listing description and a short email to interested buyers, both built strictly from the supplied facts.
See the real estate playbookA restaurant launching a new seasonal menu pastes the dish names and ingredients, and Lekha generates a description for each dish plus a launch-announcement caption, ready to review before the menu print deadline.
See the restaurants and food playbookA day spa asks Lekha to write copy for a new facial package, and Lekha drafts the description but flags a line implying a specific skin-improvement result as needing the owner's confirmation before it's used in an ad.
See the spas and salons playbookA tour operator asks for a Kerala backwaters package description in both English and Hindi, and Lekha produces two natural-reading versions rather than a literal translation of one into the other.
See the travel and tourism playbookMore from Lekha
The business states its tone and the words it never uses once, instead of re-explaining them in every prompt.
Learn moreThe business drafts a first version of an ad, caption, email, or product description instead of starting from a blank page.
Learn moreThe business can move a draft it already has from formal to playful, or the other way, without rewriting it by hand, and gets back in the same response the words and numbers the rewrite changed and any claim the guard now holds.
Learn moreThe business reaches Hindi-speaking and code-mixed audiences with copy that reads naturally, not like a literal translation.
Learn moreThe business moves a piece of copy into one other language at a time and sees what the new wording dropped, without hiring a translator for routine content.
Learn moreThe business gets a structured long-form draft built around a target keyword, stored with its outline, meta description and questions.
Learn moreQuestions
A comparison cannot introduce anything: it reads two texts already stored and reports which words are in one and not the other, with no model call and no rewriting. A restore also brings back stored words rather than generating new ones. But mechanical is not harmless — a restored version is guarded again against the current fact base, and it can take an approved document out of approved.
No. A version is written when a save is actually submitted — the endpoints are explicit and nothing saves in the background while you type — so a document accumulates one entry per deliberate save, not one per character. Restoring an older version counts as one of those saves, which is why the history grows instead of rewinding.
Each version carries a source label shown beside it, along with the account that saved it. Read that as how the save reached the API, not as a verified record of who wrote the words: keeping a document records it as generated whatever its origin, and the label on a later version is whatever the caller sends. A restore is the one case where the label describes what actually happened.
No — and it does something adjacent that is worth not confusing: it re-runs the checks over the restored text against the fact base as it stands today, so an older draft that no longer satisfies them comes back held and flagged. That can tell you the earlier version is not currently supportable. It cannot tell you which version was the better writing.
The rest of your stack
No rip-and-replace — track draft versions and compare works alongside the systems already running your business.
In development