# LegalWork: a legal AI workbench whose changelog is the documentation

> LegalWork is a legal AI workbench combining OCR, redaction, case analysis, legal retrieval, document generation and compliance review. Its README is a version-by-version changelog, so the fastest way to judge it is to read what each release stopped doing wrong: forced network calls, invented facts, truncated research and runaway token spend.

**sunyifeisb-art/legalwork** — LegalWork - legal AI workbench

- Repository: https://github.com/sunyifeisb-art/legalwork
- Website: https://bytelegal.cn/
- Stars: 64 · Forks: 9
- Language: TypeScript
- License: NOASSERTION
- Published: 2026-08-27 · Updated: 2026-08-27 · Language: en
- Canonical page: https://hysenlabs.com/projects/sunyifeisb-art-legalwork

## Six capabilities, stated once

The description is short and worth repeating accurately, because it is the only statement of scope in the project. LegalWork presents itself as an AI platform for legal professionals, integrating OCR document recognition, sensitive information redaction, intelligent case analysis, legal retrieval, document generation and compliance review. The project is TypeScript by GitHub's classification, the default branch is main, the homepage is a separate domain at bytelegal.cn, and the repository is not archived with a last push dated 2026-09-16. Recent releases are versioned densely in the 0.3.x range, with v0.3.32, v0.3.33 and v0.3.34 published inside three days in September 2026. One inconsistency to note before reading further: GitHub reports the licence as NOASSERTION even though a LICENSE file sits at the top level.

## The changelog is the documentation

There is no manual, no architecture overview and no usage guide in the README. There are release sections instead, one per version, each written as a list of specific fixes rather than features. Version 0.3.29 hardens the agent runtime, fixing first-connection threshold timeouts on the SSE stream, restarts and brief disconnects being misjudged as failures, duplicated JSON output during learning iterations, and a startup race in the document skill. Version 0.3.15 adds an incremental SQLite full-text index to knowledge base retrieval, twelve embedded legal skill libraries, and pass-through of real failure reasons from a relay service instead of a generic agent turn failure. Version 0.3.12 makes a paste of 200 characters or more in the main window become an attachment, and removes the 10MB template upload limit while adding legacy .doc support. Four of these notes are also committed as separate release note files at the repository root.

## The network became optional in 0.3.27

The most consequential change in the list is a removal rather than an addition. Earlier versions required being online to get work done; 0.3.27 states that a request needing current information now triggers an automatic search first, and that if the search fails or the network is unavailable the task is no longer blocked. The agent falls back to attachments and the local knowledge base to complete the answer, and marks as pending real-time verification only the content that genuinely needs live data and cannot be confirmed. The same version adds a fallback search source so a 404, a timeout or an empty result no longer fails an entire round, and stops surfacing a red error for a retrieval failure at all. Related work in 0.3.29 moves the default filesystem MCP to a local offline start, removing the per-launch npx fetch that npm registry instability could break.

## Legal retrieval prefers a named statute to a fuzzy match

The retrieval behaviour is described in enough detail to be testable. The national laws and regulations database now recognises explicit law names first, so a query naming a specific article of the Civil Code hits that code rather than drifting into a vague match, and an explicit instruction not to search online actually stops the forced search. The 0.3.26 notes raise the per-round legal retrieval call limit from 8 to 20 so a comprehensive investigation can gather enough material, and allow an incomplete report to continue automatically up to five times, which fixes the case where the agent declared the report delivered with no body. Source priority follows plugin configuration rather than remembered preferences, switching source only when the configured one's authentication or quota fails, and the built-in console covers PKULaw, Yuandian, Wolters Kluwer's Chinese service, Tianyancha and Qichacha for login and credential management inside the application.

## Document writing draws an explicit fact boundary

One release note is a warning label for anyone using the output. Version 0.3.29 states that only content explicitly provided by the user, attached, or coming from a verified source is written as a definite fact, and that missing acceptance, demand, quality objection, amount and date fields are no longer filled in by the model. The drafting flow had already been reshaped in 0.3.13, where uploaded material is placed first with a paste box for case text underneath, any one of material, pasted text or filled fields is enough to generate, all required markers were removed, and generating with nothing supplied now prompts for more. The same version makes pasted case text a fact source in its own right, and notes that when the side is not specified the model infers the position from what was supplied rather than assuming one.

## Cost control is written as numeric thresholds

The cost notes are the most quantitative part of the changelog, and they are the reason to read it in order. Version 0.3.9 changes the default model to the flash tier when the user has not chosen one, with the pro tier costing roughly three times as much and used only on explicit selection. It lowers the DeepSeek context folding threshold from 980,000 tokens to 40,000 or 60,000 so long conversations collapse instead of replaying, truncates knowledge base search results to the first 500 characters with at most eight sources and full text read on demand, cuts the web fetch ceiling from 1MB to 96KB, and short-circuits repeated retrieval in the same thread. The same note reports a prefix cache hit rate of up to 99 percent on complex tasks and a cost of roughly 0.2 cents per call, both given as measured figures rather than targets.

## The document pipeline is pinned Python, not TypeScript

The repository is classified as TypeScript, but the requirements file is a fully pinned Python environment, and the root holds Python agents beside the application directories: an OCR agent, a redaction agent, an agent loop applier, a skill runner and a redaction mode reference. The pinned list explains the shape of the product. It carries three OCR engines and frameworks in the form of PaddleOCR, PaddlePaddle, PaddleX and pytesseract, two PDF engines in PyMuPDF and pypdfium2, and document generation through python-docx and reportlab, alongside lxml, shapely and Pillow for layout work. It also carries Chinese platform SDKs, with a Baidu SDK, ModelScope and an AI studio SDK, which lines up with the domestic legal databases the console section supports.

## The root doubles as a landing page and a scratchpad

The top level is a mixture of project, site and working files. Alongside the README, LICENSE, CLAUDE.md, DESIGN.md and PROJECT_STRUCTURE.md there is a landing page HTML file, a site-data directory, a landing directory, two favicons and roughly a dozen screenshots named after the feature each one shows. Then there are the working directories, plans/, projects/, evals/, tests/, tools/, skills/, a skill engine, redaction and knowledge base directories, plus two configuration directories whose names are not self-explanatory. Two entries say more about the state of the repository than any documentation would. A Chinese-named .docx template for a civil complaint sits at the root next to a file that is its corrupted-text backup, and a shell script named for undoing an organisation change dated 2026-06-12 is also committed at the top level.

## Conclusion

LegalWork suits a legal professional who wants document OCR, redaction, retrieval and drafting in one desktop tool and who reads release notes before trusting output. It does not suit anyone treating its answers as research: the changelog itself records a version that stopped filling in missing amounts and dates, which tells you what to check. Before relying on it, read the version notes for the retrieval call limits and the fact boundary rules, and note that the primary language reported for the repository is TypeScript while the document pipeline is pinned Python with an OCR stack, so both runtimes are part of the install.

## FAQ

### What is LegalWork?

It is an AI workbench for legal professionals that combines OCR document recognition, sensitive information redaction, intelligent case analysis, legal retrieval, document generation and compliance review. GitHub reports TypeScript as its primary language, its homepage is bytelegal.cn, and its default branch is main.

### Which legal data sources can LegalWork use?

PKULaw, Yuandian, the Wolters Kluwer Chinese service, Tianyancha and Qichacha are all supported through an in-app console for login and credential management, alongside the national laws and regulations database and local knowledge bases. The primary research source follows the plugin configuration and only switches when that source fails authentication or quota.

### Does LegalWork need an internet connection to work?

Not since version 0.3.27. A request needing current information triggers an automatic search first, and if that search fails or the network is unavailable the agent falls back to attachments and the local knowledge base, marking only unverifiable real-time content as pending verification. The default filesystem MCP also starts locally instead of fetching over the network.

### How does LegalWork avoid inventing facts in a document?

Version 0.3.29 states that only content explicitly provided by the user, attached, or from a verified source is written as definite fact, and that missing acceptance, demand, quality objection, amount and date fields are no longer filled in by the model. Uploaded material or pasted case text alone is enough to generate a draft.

### How is the LegalWork knowledge base indexed?

Since version 0.3.15 retrieval uses an incremental SQLite full-text index, a revision-aware cache and structured chunking that splits by heading level and carries provenance and hashes. It is enabled with the LEGALWORK_KNOWLEDGE_SQLITE=1 setting, and search results are truncated to 500 characters with at most eight sources.

## Sources

- [Official documentation](https://bytelegal.cn/)
- [Official README](https://github.com/sunyifeisb-art/legalwork#readme)
- [Project repository](https://github.com/sunyifeisb-art/legalwork)
- [Release notes](https://github.com/sunyifeisb-art/legalwork/releases)

---

Hysen Labs editorial analysis, written from the project's own repository and release notes. Cite the canonical page: https://hysenlabs.com/projects/sunyifeisb-art-legalwork
