The AI belongs inside the document
Reviewers should never alt-tab to a chatbot and paste the answer back. We build Office.js add-ins that return structured redlines as native Word tracked changes, grounded in your own clause library, with a citation on every suggestion.
We ship this surface in our own product: Paralegent AI is an add-in lawyers work in daily.
6
stages from the user's click to a tracked change
1
surface: the document they are already in
0
suggestions without a citation to your own library

Five failure modes we have already hit
We have shipped this stack to production, which means we have met each of these — and the architecture below is what came out of that.
Copy-paste between Word and a chatbot
Reviewers alt-tab out of Word into a separate tool, paste a clause, then paste the answer back as a comment.
Context is lost between hops, tracked changes break, and there is no record of what the model actually saw.
Slow round-trips inside the pane
A naive add-in calls the model directly from the client and waits many seconds for each suggestion.
Users move on before the suggestion renders, the pane feels broken, and adoption stalls after the pilot.
Manifest and AppSource rejections
Manifest schema, permissions and store validation reject submission after submission.
Launch slips by months while internal users keep sideloading a development build.
Enterprise SSO and Graph permissions
The add-in cannot reach the document management system because the identity scopes were never wired.
The AI has no access to precedent clauses, so every review starts from nothing and the suggestions are ungrounded.
Office.js concurrency bugs
Tracked changes get inserted at stale ranges, and comments attach to the wrong paragraph after the document reflows.
Users lose trust in the output and turn the add-in off, which is the one failure you cannot recover from.
From the click to the tracked change
Six stages, each engineered against a specific latency or correctness failure. The batching and the range bindings are where add-ins are won or lost.
The task pane captures the action
The user highlights a clause or asks for a review. The pane is a first-class Word surface, not a browser tab pretending to be one.
Office.js · React · TypeScript
Document context is extracted
The active selection, surrounding paragraphs, document metadata and any existing tracked changes — pulled through a batched proxy that minimises round-trips to the host.
Office.js batched proxy
The edge worker enriches
The identity token is validated, the prompt is enriched with the matching clauses from your library, and the request goes out with the key never leaving the server.
Edge functions · vector index
The model returns structured redlines
Not prose: a diff. Spans to delete, spans to insert, comments to attach, and citations to the source clause each suggestion came from.
Claude · OpenAI · structured output
Tracked changes are inserted
The diff is applied as native tracked changes attributed to the AI author, with range bindings that stay stable even while the user keeps typing.
Office.js Range API
A comment carries the reasoning
Each suggestion is mirrored in the comment pane with its citation and a short reasoning summary, plus accept and reject controls where reviewers already look.
Office.js comments API
Six capabilities, one add-in
Every box on the architecture diagram has a name, and you get the source for all of them.
In-document redlining
The model returns a structured diff; our Office.js layer applies it as native Word tracked changes, so accept and reject work exactly as a reviewer expects and authorship is attributed.
Clause-library grounding
Your precedent clauses, playbook positions and prior matters are indexed, and every suggestion is grounded against that library with a citation back to the source clause.
Edge-proxied model calls
An edge worker sits between the task pane and the model provider, handling streaming, retries, rate limiting and prompt-injection filtering — and keeping the key off the client.
Single sign-on and Graph
Office.js SSO hands over an identity token which is exchanged server-side for access to the document stores the firm already uses, under scopes the tenant approves.
Document-system integrations
Connectors to the legal document management systems, document generation for sales contracts, and the e-signature step downstream, so the add-in fits the workflow rather than interrupting it.
AppSource publication
We ship the manifest, the security questionnaire and the validation package, and handle enterprise distribution through the Microsoft 365 admin centre.
Wherever Word is the surface the work happens on
Legal
Contract review and redlining in the document itself, with redlines citing the firm's own playbook rather than general legal knowledge.
Procurement
Inbound agreements triaged in Word, with risky clauses flagged before they reach a lawyer's queue.
Enterprise sales
Proposals drafted with approved language pulled from the company's own document store, so brand and legal positions stay consistent.
Corporate finance
Memoranda and term sheets reviewed in place, with deal terms extracted and compared against comparable documents.
Professional services
Engagement letters personalised from templates with firm-standard scope language applied automatically.
From manifest to AppSource
A sideloaded prototype your own reviewers can use is the week-three deliverable, because an add-in nobody has tried in a real document is still a guess.
Weeks 1–3
Prototype, sideloaded
An Office.js task pane behind a sideloaded manifest, wired to the model through an edge worker, with tracked changes already flowing into real documents.
Weeks 4–6
Clause library and SSO
Your playbook indexed, the identity app registered, document-store scopes wired, and the connectors your firm actually needs.
Weeks 7–8
Hardening and submission
The manifest hardened against store validation, the security questionnaire and privacy policy completed, and the submission made.
Week 8+
Multi-host expansion
The same manifest extended to other Office hosts, so the AI layer follows the user across the suite rather than living in one application.
Bring a contract and your playbook
This is our AI engineering practice
It is real work and it is where our four products came from. But what Cognilium leads with is narrower: optimization apps that run in tandem with Microsoft Dynamics 365, computing the decisions the ERP records but does not derive — the optimal price, the optimal pick path, the optimal stock level. See the optimization apps · How we build inside the ERP.