Skip to content
Β 
Β 

Latest commit

Β 

History

3,164 Commits

Folders and files

NameName
Last commit message
Last commit date
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

WriterAgent, LibrePy & LibreHarper

WriterAgent logo

License: GPL v3+ Python 3.11+ LibreOffice 7.0+ Release

CI status CI status page

Python, NumPy, and Agentic AI for LibreOffice (Writer, Calc, and Draw)

Run Python and scientific compute directly in spreadsheet formulas, edit documents with private local-first AI, conduct autonomous web research, generate diagrams, and automate office workflows β€” without cloud lock-in.

The project is distributed as three standalone extension packages (install only one at a time):

Package What's Included Best For
πŸ€– WriterAgent (WriterAgent.oxt) (Full stack) Everything in LibrePy and LibreHarper + AI sidebar, =PROMPT(), web research, Calc β†’ Python converter, MCP server Users wanting the complete AI assistant, spreadsheet converter, and scientific compute suite
🐍 LibrePy (LibrePy.oxt) Python runtime, =PY(), NumPy, pandas, SymPy, Monaco, Jupyter File β†’ Open .ipynb, domain helpers, OCR Users who want Python and Data Science in Calc/Writer without AI or API keys
✍️ LibreHarper (LibreHarper.oxt) Standalone offline Harper grammar engine for Writer Users who only want fast, local grammar checking without AI or Python stacks

Download .oxt Releases Β· Feature Index Β· NumPy in LibreOffice Guide Β· Discussions


Key Capabilities

πŸ€– Local-First Agentic AI & Writing (Writer)

  • Sidebar Chat with Multi-turn Tool Calling β€” Edit, restructure, or expand documents using natural language. 9 core tools plus dozens of specialized sub-agents for page layout, footnotes, bookmarks, revisions, and forms.
  • Format-Preserving Edits β€” Surgical redlines and section rewrites maintain your existing formatting (bold, italics, highlights, font sizes, tables, and nested lists) without clobbering styles.
  • Autonomous Web Research β€” Integrated private smolagents loop with DuckDuckGo. Synthesizes multiple web sources and updates open documents with real-time facts and citations. Agent Search
  • Real-Time Grammar & Proofreading β€” Local, privacy-preserving grammar checking via Harper (fast, auto-installing), LanguageTool, or LLM endpoints with mixed-language sentence detection. Details
  • Math & LaTeX Import β€” Converts LaTeX and MathML into native, editable LibreOffice Math objects. Math Guide

🐍 Python & Scientific Computing (Calc & Writer)

  • Native =PY() Spreadsheet Formulas β€” Execute Python, NumPy, and pandas expressions directly inside Calc cells with automatic array spill, shared workbook kernels, and persistent scripts.
    • =PY("np.mean(data)"; A1:A10) β€” Calculate array statistics directly on Calc ranges.
    • =PY("data.to_pandas(date_cols=True)"; A1:C10) β€” Load sheet data into pandas with automatic type and date parsing.
    • NumPy in LibreOffice Guide Β· Data Shapes & Type Mapping
  • Embedded Monaco Code Editor β€” Write, test, and debug multi-line Python scripts directly inside cells or through the Tools β†’ Run Python Script environment with syntax highlighting, autocomplete, and diagnostics.
  • Built-in Scientific & Analytics Domains β€” Ready-to-use helpers for EDA, outlier detection, OLS regression, KMeans clustering, Monte Carlo simulations, symbolic algebra (SymPy), plotting, and physical unit conversions (convert_quantity(60, "mph", "m/s") β†’ 26.8224 m/s). Domain Reference Β· Analysis Helpers
  • Spreadsheet β†’ Python Converter (WriterAgent) β€” Translate 235+ classic Calc/Excel formulas into clean Python expressions using the built-in calc.* parity library while preserving constants, dates, and cell formats. Details
  • Local Vision & OCR β€” Extract text from embedded images or scanned documents directly into Writer and Calc via offline Docling OCR. Vision Guide
  • Jupyter logo Jupyter Notebook Support β€” File β†’ Open… a .ipynb (or double-click / soffice notebook.ipynb) creates a Writer document with markdown, editable code fields, and β–Ά run buttons against a shared Python kernel. Jupyter in Writer

πŸ“Š Diagrams, Slides & Multi-Modal (Draw & Impress)

  • Diagram & Presentation Generation β€” Generate, adjust, and style flowcharts, shapes, connectors, speaker notes, and slide transitions through chat commands or Python scripts. Details
  • LO-DOM Semantic Tree β€” Structural understanding of headings, sections, tables, and relationships across entire documents. Semantic Tree
  • Cross-Document Search & Memory β€” Query other documents in the same folder via local embeddings / hybrid search, with persistent cross-session agent memory. Embeddings Β· Memory

πŸ”Œ Integrations & Extensibility

Full catalog of capabilities: docs/features.md.


Installation & Setup

  1. Download your chosen .oxt package from Latest Releases and double-click to install (or open LibreOffice and go to Tools β†’ Extension Manager β†’ Add). Remember to install only one extension package.
  2. Restart LibreOffice.
  3. Quick Configuration:
    • Python / LibrePy users: Open Calc, check Tools β†’ LibrePy (or WriterAgent) β†’ Settings β†’ Python, and click Test to verify your environment and NumPy/pandas availability.
    • AI / WriterAgent users: Open WriterAgent β†’ Settings and enter your endpoint (e.g. http://localhost:11434 for local Ollama, or an OpenRouter / Together.AI API key). Open the sidebar via View β†’ Sidebar β†’ WriterAgent or press Ctrl+Q / Ctrl+E.

UI Modes: In classic toolbar mode, access tools through the top menubar. In tabbed/ribbon interfaces, use the WriterAgent chat sidebar and/or the Python sidebar (Writer + Calc): Settings βš™, Python 🐍, LaTeX math or Edit cell, search πŸ” (WriterAgent chat only), and full menus via ☰.

For detailed setup instructions, see the Install and Troubleshooting Guide.


Showcase

Python in LibreOffice Writer

Python in LibreOffice

Spreadsheet Analytics & Dashboard

Chat Sidebar with Dashboard

Hermes + Opus 4.6 (Autonomous Web Research)

Hermes-Agent / Opus-4.6 Akihabara

Math Expressions & LaTeX

Math Expressions

Arch Linux Resume

Opus 4.6 Resume

Diagrams in Draw

Sonnet 4.6 Visual


Benchmarks & Evaluation

WriterAgent's LLM Evaluation Suite benchmarks models on Writer, Calc, and Draw tasks. The 2026-09-01 snapshot uses the 17-task string harness β€” it emulates document and tool behavior without running LibreOffice (OpenRouter, live token pricing). Full methodology: docs/eval/benchmarks.md.

Cost–quality Pareto fronts

Distance-to-frontier view: docs/eval/pareto-distance.svg.

Model Correctness
avg task score (0–1)
Value
CorrectnessΒ² Γ· $/task
openai/gpt-oss-120b 0.971 1290
upstage/solar-pro4 0.741 800
openai/gpt-oss-20b 0.687 606
poolside/laguna-xs-2.1 0.826 571
google/gemma-4-31b-it 0.918 559
meta/muse-spark-1.3-contributor 0.979 350
google/gemma-4-26b-a4b-it 0.680 329
deepseek/deepseek-v4-flash-0731 0.987 274
poolside/laguna-s-2.1 0.759 262
openai/gpt-5.6-luna 0.981 219
bytedance-seed/seed-2.0-mini 0.918 200
z-ai/glm-5.3-flash 0.913 193
mistralai/mistral-small-2603 0.629 188
google/gemini-3.5-flash-lite 0.806 116
meta/muse-glimmer-30b 0.987 85
ibm-granite/granite-4.2-8b 0.802 83
inception/mercury-2.5-preview 0.811 74
nvidia/nemotron-3.5-lightning 0.315 37
qwen/qwen3.8-27b 0.922 33
minimax/minimax-m3 0.820 32
x-ai/grok-4.6 0.982 20
qwen/qwen3.8-flash 0.118 12

Documentation & Architecture

Topic Documentation Link
Feature Index docs/features.md
NumPy & Python in Calc docs/enabling_numpy_in_libreoffice.md Β· docs/calc/py-data-shapes.md
LibrePy Core Architecture docs/scripting/librepy-split.md
Domain Helper Functions docs/scripting/numpy-domains.md Β· docs/calc/analysis-tools.md
Full Architecture docs/writeragent-architecture.md Β· docs/framework/formal-verification.md
Model Context Protocol (MCP) docs/mcp-protocol.md
Embeddings & Search docs/embeddings.md
Benchmarks docs/eval/benchmarks.md
Localization (34 Locales) docs/localization.md
Code Explorer DeepWiki
Cursor / Agent Skills cursor-libreoffice Β· libreoffice-skill

Under the hood, all agentic interactions are governed by a formally verified finite state machine with strict type checking and static analysis.

State machine architecture


Project Evolution

A chronicle of building a Python runtime and AI suite inside LibreOffice:


Contributing & Development

Ask DeepWiki Discussions

Prerequisites: Python 3.11–3.13 for development (pinned to 3.13 via .python-version), uv. Run make check-setup to verify. On macOS: install make, gettext.

git clone https://github.com/KeithCu/writeragent.git
cd writeragent
uv python install 3.13
uv sync
make deploy          # Builds & installs WriterAgent.oxt (or: make deploy writer)
make test
make help

To build and test the standalone extension variants:

# Standalone Python / NumPy compute suite (LibrePy)
make build-core      # Produces build/LibrePy.oxt
make deploy-core     # Installs LibrePy.oxt (removes WriterAgent)

# Standalone Harper grammar checker (LibreHarper)
make build-harper    # Produces build/LibreHarper.oxt
make deploy-harper   # Installs LibreHarper.oxt

See AGENTS.md (invariants), docs/repo-map.md (entry points), and docs/scripting/librepy-split.md for architecture details.


Credits

Project Contribution
localwriter Original Writer LLM extension (John Balis)
LibreCalc AI Assistant Calc AI foundation and inspiration
LibreOffice MCP Extension MCP server patterns, Makefile, tool registry
Hermes Agent Tool-call parsers, JSON repair, memory patterns
latex2mathml LaTeX β†’ MathML
mathml-to-latex MathML β†’ LaTeX (Writer formula export)
isodate ISO 8601 duration parse/format (Calc wire)

License

GNU GPL v3 (or later) β€” see LICENSE. Originally MPL 2.0; relicensed in 2026 for stronger reciprocity and library compatibility.

Year Contribution Contributor
2024 Original release John Balis
2025–2026 Config, registries, build system quazardous
2026 Calc integration (originally MIT) LibreCalc AI Assistant
2026 Modifications and relicensing KeithCu

About

A LibreOffice extension that adds agentic AI and NumPy features.

Resources

Stars

115 stars

Watchers

2 watching

Forks

Releases

Packages

Contributors

Languages