TokenMoulds
A corporate template system for Microsoft Office and LibreOffice. Point it at a brand, get publication-quality Word, PowerPoint, Excel, and LibreOffice templates — with embedded fonts, baseline grids, OOXML compliance validation, and long-form document support for whitepapers, annual reports, manuals, and bound books.
Install
pip install tokenmoulds
Quick Start
Generate templates from brand inputs:
tokenmoulds --org-id="acme" \
--font-pair="inter-roboto" \
--primary-color="#2563EB" \
--secondary-color="#DC2626" \
--locale="GB" \
--brand-tone=0.3 \
--generate-templates --generate-odf
Or from a DTCG token file:
tokenmoulds --org-id="acme" \
--tokens-file="design.tokens.json" \
--generate-templates
What It Does
~30 brand inputs (colors, fonts, tone) produce 1,300+ derived design tokens across the current Office, ODF, and Google Workspace outputs. Every template ships with:
- WCAG AAA accessible contrast ratios
- Embedded fonts with ODTTF obfuscation (Word) and EOT with GSUB (PowerPoint)
- OpenType typography: contextual figures, size-dependent tracking, ligatures
- Baseline grid-snapped typography via modular type scales
- ISO 29500 (OOXML) and ODF schema compliance
- Zero macros — all styling baked into document structure
Long-Form Documents
Corporate whitepapers, annual reports, manuals, and bound books need more than a single page layout. They need sections — front matter with roman-numeral page numbers, a body with running chapter titles and decimal numbering, an appendix that continues the count. Each section with its own headers, footers, and page geometry.
TokenMoulds generates long-form structure from a small token vocabulary
and emits it consistently across both Word (.dotx) and LibreOffice
Writer (.ott) from one shared IR. Features:
- Per-section page geometry — A4, A5, B5, Letter, portrait or landscape, margins as formulas against the baseline grid
- Mirror margins — inner/outer semantics for bound documents, facing pages automatically flip
- Running headers —
STYLEREF:Heading1fields that update as the reader moves through chapters (Word) /<text:chapter>fields (Writer) - Per-section page numbering —
lowerRomanfor front matter,decimalrestart for the body, continuing counts for appendices - Odd/even headers — book-style layouts with different left-hand and right-hand page content
- First-page different — cover pages, chapter openers
- Multi-column sections — indexes, newsletters
- Cross-format parity — one IR → structurally identical
.dotxand.ott, locked down by a golden master test suite
See Long-Form Documents guide for a walkthrough with a three-section whitepaper example.
Output Formats
| Format | Extension | Highlights |
|---|---|---|
| Word | .dotx |
276 themed paragraph, character, and table styles |
| PowerPoint | .potx |
Theme colors, embedded fonts, table styles, layouts |
| Excel | .xltx |
Themed cell styles and number formats |
| Writer | .ott |
110 ODF styles with page geometry |
| Impress | .otp |
ODF presentation template |
| Calc | .ots |
ODF spreadsheet template |
| Draw | .otg |
ODF drawing template |
| Google Docs | .dotx |
Optimized for Google Workspace import |
| Theme | .thmx |
Standalone Office theme package |
MCP Server
For AI-assisted document creation via Claude, Cursor, or other MCP clients:
tokenmoulds mcp-server
48 tools for corporate GitHub linkage, artifact planning, validation, compilation, quality gating, artifact review bundles, GitHub PR publishing, Google Apps Script generation, direct Apps Script API deployment, Google Workspace import/export roundtrips, python-pptx intent translation, brand extraction, template generation, document creation, validation, and cache management. See the MCP tool catalog.
For a direct repo-native Google Apps Script handoff, generate the Apps Script bundle from a stored plan:
tokenmoulds google-suite --artifact-id quarterly-update --output-dir ./generated
For Google Workspace import/export evidence, roundtrip a local artifact through Drive conversion:
tokenmoulds google-roundtrip generated/acme/deck.pptx --folder-id "$TOKENMOULDS_GSUITE_FOLDER_ID"
Python API
from tokenmoulds.pipeline import BuildConfig, build
result = build(BuildConfig(
org_id="acme",
output_formats=["potx", "dotx", "xltx"],
brand_inputs={
"font_pair": {"sans": "Inter", "serif": "Roboto Slab"},
"base_colors": {"primary": "#2563EB", "secondary": "#DC2626"},
"locale": "US",
"brand_tone": 0.5,
},
))
for fmt, data in result.artifacts.items():
open(f"acme.{fmt}", "wb").write(data)
Architecture
TokenMoulds uses a single canonical build pipeline:
Design Tokens → DesignResolutionEngine → DocumentIR → Emitters → Validated Packages
- DTCG pipeline: W3C Design Tokens Community Group format with 5-layer resolution (core/fork/org/group/personal)
- Design engine: Modular type scale, baseline grid, OpenType features, tone/density adaptation
- Document IR: Format-agnostic intermediate representation
- 11 emitters: Each produces a complete, valid package
- Validation: In-process ISO 29500 schema checking via openxml-audit
See ADR 027 for the full convergence story.
Development
git clone https://github.com/BramAlkema/TokenMoulds.git
cd TokenMoulds
python -m venv .venv && source .venv/bin/activate
pip install -e ".[dev]"
python -m pytest tests/ -v --tb=short # 2,200+ tests
Contributing
See CONTRIBUTING.md for development guidelines, code conventions, and how to submit changes.
Documentation
License
Metadata
Release files for tokenmoulds 3.9.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| tokenmoulds-3.9.1.tar.gz | 884.7 kB | With provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| tokenmoulds-3.9.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 2.0 MB
Release files / tokenmoulds-3.9.1.tar.gz
| Download URL | tokenmoulds-3.9.1.tar.gz |
|---|---|
| Size | 884.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
b3ff7c46d88fe5c4852386e55f3b24fa6a059ad93aeeb674ec0c404b344ab2ea
|
|
BLAKE2b-256 checksum How to use checksums |
4e03d218b93f4c35368e0527974d408570172ea76dc401adce457f72a2cd6c7c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on May 3, 2026.
Transparency logRelease files / tokenmoulds-3.9.1-py3-none-any.whl
| Download URL | tokenmoulds-3.9.1-py3-none-any.whl |
|---|---|
| Size | 1.1 MB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
43a3d9ea9cae38473d0622885d3a039d939a46ff430f394387be97aa5a6ca762
|
|
BLAKE2b-256 checksum How to use checksums |
3a11257219b7fcb2d9fba431a0d60f22079772046adbe921029ae2817b4c2d18
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on May 3, 2026.
Transparency logSecurity for tokenmoulds 3.9.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
All 2 files in this release have been uploaded with provenance metadata.
Attestation for tokenmoulds-3.9.1.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on May 3, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.