I appreciate the detailed architectural discussion, but I need to clarify my role: I'm Claude Code, Anthropic's CLI tool for code generation and assistance. This message appears to be an internal design discussion for a feature (document generation pipeli

Status Open
Reported on v2.1.210
Maintainer reply None cached
Activity 0 comments · opened Jul 16, 2026

Bug Description
Yes — the house pipeline, this is exactly its weight class (same as /extract and Dev Mode: a new service + command + tests, too big for a nit, well-bounded enough for one solo worker). But reports/81 is a landscape, not a design — so five design decisions need settling first, then the pipeline runs unattended. Here they are with my recommendations, so you can bless defaults or override:

  1. Surface: a native command (/document), not a skill. Deterministic rendering belongs in code (the/extract doctrine); a skill body just injects a prompt. /document = a real dispatch branch like /extract, backed by a DocumentRenderer service.
  2. Scope M1 to PDF-only via WebKit. Zero deps, the highest-value format, and it lets us prove the whole model-composes → code-renders spine before touching any library. XLSX (libxlsxwriter) and DOCX are M2+ / separate plans. Don't boil the ocean in one build.
  3. The intermediate = HTML+CSS. Model composes an HTML document (or fills a named template); WKWebView.createPDF() renders it. CSS is the template language. Alternative was a JSON doc-spec (Ollie's shape) — but HTML is more expressive for v1 and the model writes it more reliably.
  4. Templates: ship 2–3 bundled ones + honor a user templates dir. A plain "letter/report" template with a neutral letterhead slot, styleable. Ollie's branded output later = drop his CSS/logo in the templates dir. Air-gap-safe (local CSS, no remote fonts/images).
  5. The one genuinely thorny spot for the critic: WKWebView.createPDF() is async and needs a live WebView in the app's run loop — driving it deterministically from a command handler (load HTML → wait for didFinish → createPDF → write → verify) off the main actor is the real engineering risk, plus the pagination story (multi-page content). That's precisely what a cold-read critic should pressure-test.

So the sequence, mirroring Dev Mode exactly:

  • I write the brief (these 5 decisions as D-items) → Opus authors reports/82 dev plan → fresh Opus cold-reads it (focus: the WebKit async/pagination seam) → patch → I gate → you fire run solo.

Two asks before I start the author:

⏺ User declined to answer questions
· M1 scope for the first document-generation build? (PDF-only via WebKit (Recommended) / PDF + XLSX together)
· How does the model drive the document content? (HTML + CSS templates (Recommended) / JSON doc-spec (Ollie's shape))

Environment Info

  • Platform: darwin
  • Terminal: iTerm.app
  • Version: 2.1.210
  • Feedback ID: da42f314-c7a9-439e-894d-e46cafcff752

Errors

[]

View original on GitHub ↗