Paper Format Agent

io.github.zxyasfasPublished by GitHub account zxyasfasv3.1.0Updated Oct 24, 2026

Local-first DOCX formatter for academic papers with a content-fingerprint integrity guard.

Overview

AI-generated overview

Local DOCX formatter for theses and papers that applies format-guide styling and refuses to save if the body text changed.

What you can do
  • Format a paper DOCX against a format guide, adjusting fonts, spacing, indents, headings and captions
  • Extract formatting rules from a guide document
  • Score a paper against the expected format
  • Run entirely on the local machine, with a content fingerprint compared before and after each run
When to use it
Useful when you need to bring a thesis or journal paper DOCX into line with a format guide without uploading it, and want a check that formatting did not alter the text. Also handy for extracting rules from a guide or scoring an existing draft.
Requirements
Runs as a local Python process (Python 3.10+ for the MCP server), installed from PyPI with the mcp extra. No accounts, API keys or environment variables are declared. Needs a format-guide DOCX and the paper DOCX as inputs.
Before you install
It writes a new formatted DOCX to an output directory, so keep your original file. The content guard covers body paragraphs and tables only; headers and footers are excluded, and some engines post-process after the check. Equations, footnotes and complex layouts are less reliable, and it should not be the only check before a real submission.

Installation

In SourceWeft

  1. Open Paper Format Agent in the dashboard and add it to a workspace.
  2. Enable the server for the chats that should use its tools.

Desktop only via STDIO. STDIO servers start a local process, so they need the SourceWeft desktop host.

Other MCP clients

Follow the launch instructions in the repository.

README

Paper Format Agent

中文说明 | English

[CI] [Python] [License]

A local DOCX formatter for theses and papers.

It changes fonts, spacing, indents, headings and captions to match a format guide. It does not rewrite the paper. Before saving, it compares a fingerprint of the body and table text from before and after the run. If the text changed, it aborts instead of writing the formatted file.

Everything runs on your machine. Nothing is uploaded.

the content check

Report fields from a real run (--engine python):

json
{  "content_fingerprint_before": "793e6533fd670418141d11fdcf014be19750408129ecff8b1b78a2641a3786db",  "content_fingerprint_after":  "793e6533fd670418141d11fdcf014be19750408129ecff8b1b78a2641a3786db",  "content_changed": false,  "content_guard_enforced": true}

The two hashes should match. If they don't, the formatter exits with content guard failed and the formatted DOCX is not written.

What the check covers: body paragraphs and tables, with whitespace and stray bullet characters normalized before comparing. Headers and footers are out of scope because the formatter sets those on purpose. Use --engine python when the fingerprint must cover the final saved DOCX; the other engines run a local post-processor after the check, e.g. to refresh the table of contents.

To watch the guard trip, run python tools/demo_content_guard.py. It formats a synthetic paper, then repeats the run with the styling step patched to edit one sentence of the in-memory document. The second run aborts without writing the DOCX.

docs/BENCHMARK.md tracks which authored strings survive a run in small synthetic fixtures, and lists the known gaps.

install and run

bash
pip install -r requirements.txt
python -m paper_format_agent.cli \  --format-file "format_guide.docx" \  --paper-file "paper.docx" \  --out-dir "./output" \  --engine python

There is also a GUI (python run_gui.py), a batch mode, and JSON template packs for Chinese thesis, journal and IEEE-style formats. See docs/USAGE.md.

limits

Early project. Ordinary paragraphs, headings and tables work better than equations, footnotes and complex layouts. With --strict-required-sections, checks may include char_below_min or blank_page_risk. Do not use it as the only check before a real submission. Keep your original file.

Reference-list formatting is out of scope here: that part is mechanical rules, so it lives in a separate tool, gbt7714_check, which lints reference entries against GB/T 7714.

why I made this

I did not want to upload an unfinished thesis to a formatting website, and I wanted a way to check that formatting did not touch the text. So the default engine runs locally and refuses to save if the text changed.

agents

The repo doubles as an installable agent skill (SKILL.md), and the same pipeline is available as an optional MCP server (Python 3.10+):

bash
pip install "paper-format-agent[mcp]"paper-format-agent-mcp

Tools: format_paper, extract_format_rules, score_paper. Client config in docs/MCP.md.

contributing

Small PRs are welcome. Adding a synthetic test for a school or journal formatting rule is a good place to start: docs/CONTRIBUTOR_TASKS.md, CONTRIBUTING.md. Notes on the pipeline are in docs/ARCHITECTURE.md.

Do not commit real papers, private school templates, reviewer comments, API keys or generated output. Synthetic fixtures only.

license

MIT. See LICENSE.

Source: README.md at commit f17a9e4

Tools

0
SourceWeft has not started this package in its sandbox yet, so its tools are not known.

Version history

1
  1. v3.1.0LatestSep 16, 2026

Score

50% of the applicable checks met

How complete this listing is, computed from the registry entry, the endpoint and public sources. Not a rating of the server and not a statement that it is safe or working today: reachability is a dated check, and no installs or reviews go into the score.

  • Reached in the last 30 days25 pts

    Keep the endpoint answering the MCP handshake; SourceWeft probes it every 30 days.

  • Auth declared10 pts

    Declare the credential headers in the registry entry, or keep the endpoint answering the probe so its auth can be classified.

  • Tools listed15 pts

    Answer tools/list without a credential, or ship a package that starts in a sandbox without one.

  • DescriptionRequired15 pts
  • Logo10 pts
  • Documentation15 pts
  • License10 pts