duncanmcqueen stops Word from inventing legal numbering

Generated letters now stay readable by default, with clause numbering reserved for documents that actually need it.

draftingworkflow

duncanmcqueen has tightened document generation around a familiar legal drafting annoyance: ordinary prose being turned into numbered subclauses just because it sits under a heading.

  • Letters and other prose documents now open without automatic legal-style numbering.
  • Workflows or templates can explicitly turn on numbering for section headings.
  • Manually typed references remain plain text, rather than being reformatted.
  • Bullet lists render as actual Word bullets, not as clause levels.

The change is backed by checks against the finished Word document, including protection against malformed settings accidentally switching numbering on.

So what Teams producing demand letters, client correspondence or mixed-format legal documents should care because the output now follows the intended structure instead of imposing one.

View this fork on GitHub →

Spotted something wrong? Or know the PR text has fresher detail than the writeup above?

Commits in this thread

1 commit from duncanmcqueen/mike, oldest first. Source extracted verbatim from the harvested git log.

SHA Subject Author Date
8baa5529 fix(docx): avoid numbering generated letter paragraphs duncanmcqueen 2026-08-21 ↗ GitHub
commit body
The DOCX generator configured legal numbering unconditionally and
inferred a numbering level for every paragraph under a section heading,
so ordinary demand-letter prose came out as "1. DEMAND FOR PAYMENT /
1.1 We represent the claimant. / (a) Payment is required...". Prompting
alone could not fix it: the renderer numbered the output whether or not
the model asked for numbering.

- Numbering is now opt-in via an optional numberSections tool argument.
  Letters and other prose render unnumbered by default.
- When requested, only section headings are numbered; body prose is not.
- Explicit bullets keep Word bullet formatting, and manually typed
  prefixes like "1." stay literal text when automatic numbering is off.
- Both the dispatcher and the renderer test `=== true`, so a missing,
  null, or malformed value cannot switch numbering on by accident.

Adds DOCX XML regression tests that read word/document.xml (and
word/numbering.xml for bullets) out of the generated bytes.

Rebased onto main; no conflicts with the docx text-value work in #328,
whose numeric-text regression test still passes alongside these.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>

Capture this thread into my fork

Download a single Markdown prompt that tells Claude how to port every commit above into your working tree — adapting paths and structure to match your repo. Run it via claude -p < capture-thread-1269.md from inside the repo you want the changes in.

⬇ Download capture-thread-1269.md