Generate new documents from a template

Use any Kodori document with extracted text as a template — describe what you want and Kodori drafts a new document via Claude Opus.

Updated 2026-04-27

Any Kodori document that has extracted text can serve as a structural template. Click **Use as template →** on /doc/[id], type instructions for what you want, and Kodori asks Claude Opus to draft a new document.

**Typical workflow.**

1. Open the template document — your firm's standard NDA, your engagement letter, your RFI master. 2. Click **Use as template →** in the doc-detail header (next to Download). 3. Type instructions describing the new document. Be specific about parties, dates, jurisdictions, and any clauses you want to add or skip: *"Draft a short-form NDA between Acme Corp and BigCo for a Q2 services engagement. 1-year confidentiality, mutual obligation. New York law. Add a clause requiring written consent for sub-processors."* 4. Optionally name the output. Default is "<template name> — generated <timestamp>.md". 5. Click **Generate**. The result lands as a new Kodori document — auto-classified, DLP-scanned, and linked back to the template via metadata.

**What you'll get.** Markdown formatting (headings with #, lists with -, bold with **). Opens in any editor. Pastes into Word with formatting preserved. Bracketed placeholders ([DATE], [JURISDICTION]) flag values the operator needs to fill in — the model never invents specifics you didn't supply.

**Model + quota.** Generation uses Claude Opus by default — drafting deserves the better reasoning model. Counts as one agent question for billing. If the workspace is over the Opus reasoning cap, generation falls back to Haiku silently (the existing enforcement pattern); Haiku output is serviceable for simpler templates but may need more editing.

**Lineage.** Every generated document carries metadata: `generatedFromTemplate` (the template's documentId), `generatedFromTemplateName`, `generationInstructions` (the operator's instructions, capped at 2000 chars), and `generatedAt`. Search "generated from Smith NDA template" works as a hybrid-search query against this metadata. The audit chain records the document's creation event in the normal way — every generation is auditable.

**What this is NOT.** Kodori isn't trying to replace human review. The drafted document is a starting point — the human is responsible for accuracy, jurisdiction-specific compliance, and any high-stakes clauses. The model uses bracketed placeholders precisely so reviewers see what they need to verify.

**Tips for good output.**

- *Be specific about parties + dates.* "Acme Corp" beats "the buyer". - *Be specific about jurisdiction.* "California law" beats unspecified. - *Note any deviations from the template.* "But skip the IP-assignment clause." - *Reference the template's structure.* "Keep the recital paragraph, drop the schedule." - *Templates with rich metadata work best.* If your NDA template has matter codes, custom field tags, or sensitivity-labeled sections, the model picks up on the structure better.

**What's next.** True .docx output with preserved styling (heading levels, table layouts, list bullets) is on the roadmap — requires a docx-generation library + per-template style mapping. Foundation ships markdown because it's the most useful format that works with every editor.