Artag.dev
FeaturedLast updated: 2026-10-29

Doc Harness — Structured AI Document Editing

A document transformation system that rewrites, anonymizes, converts and generates Word, PDF and Excel files through an editable structured representation rather than repeated AI calls.

Role: AI Engineer & Full-Stack Developer — sole developer

6
input document formats
3
real output formats
17/17
E2E checks in deterministic mock mode
NestJSTypeScriptPrismaBullMQRedisNext.jsDeepSeekGroqpdfkitdocxexceljs
Private repositoryTalk about this project

Problem

Documents are difficult to transform consistently across PDF, Word and Excel. Many tools require external accounts, and naïve AI workflows repeatedly resend the whole document even when the user only wants to edit or export it.

Solution

I built extractors that normalize documents into an editable intermediate structure. AI transforms that structure once, the user can review and edit it, and dedicated renderers export it to DOCX, PDF or XLSX without another model call. Anonymization is a separate scan-and-approve workflow with literal replacements.

Results

  • Six input formats and three output formats through one intermediate model.
  • Block-level editing and re-rendering without additional AI usage.
  • Seventeen of seventeen E2E checks passed against the real stack in deterministic mock mode.
  • Eleven backend tests documented in the source project.

Architecture

  1. 01Upload → format-specific extractor adapter
  2. 02Normalized JSONB content → editable blocks or workbook content
  3. 03AI or deterministic mock → requested transformation
  4. 04Human review → block editing and anonymization approval
  5. 05Renderer adapter → DOCX, PDF or XLSX download

Key decisions

Intermediate structured content

Editing and exporting reuse the normalized document instead of repeating the AI transformation.

Deterministic anonymization

AI proposes entities, but the user approves them and replacement is a literal operation.

Lightweight renderers

pdfkit, docx and exceljs avoid a Chromium dependency and isolate each output format behind a port.

Explicit failure modes

Mock mode is clearly separated from real provider behavior so a test without keys cannot be mistaken for production validation.

Challenges

  • Normalizing materially different document formats without pretending they have identical layout semantics.
  • Preserving useful editability while supporting multiple output renderers.
  • Making missing AI configuration produce an explicit test mode rather than fabricated success.

Key learnings

  • A structured intermediate representation is the boundary between AI flexibility and deterministic output.
  • Human approval is safer than allowing a model to silently anonymize a document.
  • File rendering and AI transformation should scale and fail independently.

Limitations & roadmap

  • Generation with the real DeepSeek provider remains to be validated.
  • The 17/17 E2E result applies to deterministic mock mode, not a claim about every real-model output.
  • No public demo or universal layout-fidelity guarantee is claimed.

Next project

WhatsApp Operations Platform

Real-time WhatsApp operations with Redis and WebSockets