326 lines
23 KiB
Markdown
326 lines
23 KiB
Markdown
# Themiz
|
||
|
||
A working system for a Russian court case: source files, a case map, checked citations, a draft, and a separate review.
|
||
|
||
[Русский](README.ru.md) · [中文](README.zh.md)
|
||
|
||
[](LICENSE) [](https://github.com/zarubinvibe/themiz/stargazers) [](https://github.com/zarubinvibe/themiz) [](https://github.com/zarubinvibe/athena#olympuz-family)
|
||
|
||
<p align="center"><img src="docs/assets/pantheon/hero.png" alt="Pantheon illustration of Themiz in white marble beside a classical column, with case papers and review cards" width="100%"></p>
|
||
|
||
<!-- owner-welcome:start -->
|
||
|
||
> Hello, I am Fil.
|
||
>
|
||
> I built Themiz because evenings kept disappearing into the mechanical part of a case: scans, dates, citations, and another pass through the same bundle. I wanted one workspace that remembers where a fact came from and says plainly when a check did not happen.
|
||
>
|
||
> Try it on a copy of a non-sensitive file first. If something breaks, open an issue with the command you ran and the result you saw. If it earns a place in your practice, star the repository and have a look at the other Olympuz projects: https://zarubinvibe.com
|
||
>
|
||
> Filipp Zarubin
|
||
|
||
<!-- owner-welcome:end -->
|
||
|
||
## Contents
|
||
|
||
- [What this is](#what-this-is)
|
||
- [Why it helps](#why-it-helps)
|
||
- [The main advantage](#the-main-advantage)
|
||
- [How it works](#how-it-works)
|
||
- [Quickstart](#quickstart)
|
||
|
||
**Also:**
|
||
|
||
- [Simple comparison](#simple-comparison)
|
||
- [Simple words](#simple-words)
|
||
- [Safety and privacy](#safety-and-privacy)
|
||
- [Limits](#limits)
|
||
- [Star and contribute](#star-and-contribute)
|
||
|
||
<!-- beginner-readme:start -->
|
||
|
||
## What this is
|
||
|
||
Themiz is a workspace for lawyers handling disputes under Russian law. It keeps each matter in its own folder, reads local files, assembles the facts, searches approved sources, and carries a draft through review. You can run the same project with Codex CLI or Claude Code.
|
||
|
||
The public repository holds the engine, agents, tests, safe templates and the Eunomia code. It ships no legal database and no one else's cases. Before you touch client material, you choose the sources, permissions and model provider.
|
||
|
||
### Eunomia: the legal library on your computer
|
||
|
||
<p align="center"><img src="docs/assets/pantheon/eunomia-library.png" alt="Pantheon marble scene: Eunomia, eyes open, sets a codex on a shelf of identical codices while blindfolded Themis reads at the table and a blue thread from outside stops at the window sill" width="100%"></p>
|
||
|
||
Eunomia is the local legal library of Themiz. It holds the Russian codes, Supreme Court plenary rulings and reviews, dated editions of acts, and case law. On the author's working machine on 19.10.2026: 18 codes, 435 plenary rulings, 13 reviews, 868 edition files and 235,620 court decisions.
|
||
|
||
The texts come from public sources: consultant.ru, sudact.ru and vsrf.ru. A background loader checks them every five minutes at low priority and without a model. A new edition is stored next to the old one, never on top of it. Case law refreshes hourly, the legal graph after each batch.
|
||
|
||
Open the library with `python3 scripts/eunomia.py`, then go to http://127.0.0.1:18765/.
|
||
|
||
## Why it helps
|
||
|
||
Case work gets buried under small, expensive chores: reading another scan, reconciling dates, finding the source of a quotation, checking whether the draft still matches the evidence. Themiz keeps those chores attached to one case and records what passed, what failed, and what still needs a lawyer.
|
||
|
||
It is built for Russian litigation. Its document contracts, statutory calculations, court terminology, and source routes follow Russian procedure; they are not a general legal system for every jurisdiction.
|
||
|
||
### Why the library stays local
|
||
|
||
<p align="center"><img src="docs/assets/pantheon/eunomia-editions.png" alt="Pantheon marble scene: three editions of one codex sealed in gold on an archive table, a cabinet of drawers behind, a blue thread from outside stopping at the table edge" width="100%"></p>
|
||
|
||
- **Quotes stay exact.** A model reading an article from the web can paraphrase it wrongly; that happened with Article 683 of the Civil Code on a live case. The citation tool reads the file and checks its hash. It also saves 100–300 thousand tokens per run that reading articles online would burn.
|
||
- **No article means "not found".** The citation tool never goes online and never swaps in a similar rule.
|
||
- **Works offline.** If a source is down, the last good copy stays in place. A partial download never replaces it.
|
||
- **The case stays home.** Requests to sources carry no keys, client material or case text.
|
||
- **Edition on a date.** `cite.py --on DD.MM.YYYY` returns the rule as it read on that day.
|
||
|
||
The repository holds only the Eunomia code. The loader builds the acts and case law on the lawyer's machine after install.
|
||
|
||
## The main advantage
|
||
|
||
**Main advantage:** a claim can keep its trail back to the file, source, and review status.
|
||
|
||
**Why this is better:** Code handles supported calculations such as statutory interest, procedural dates, court fees, and amounts in words. The citation tool reads from the corpus available on your disk, checks its checksum, and warns when freshness is missing or needs review. A model does not get to turn a paraphrase into a verified article.
|
||
|
||
### How this version beats the 27.09.2026 one
|
||
|
||
<p align="center"><img src="docs/assets/pantheon/new-version.png" alt="Pantheon marble diptych: on the left a winding corridor with a queue of figures and stacked papers, on the right Themis carries the case folder through one straight gate" width="100%"></p>
|
||
|
||
587 commits since 27.09.2026. The main ones:
|
||
|
||
#### How a run goes
|
||
|
||
- **One entry point.** Before: a JavaScript conductor and a 4,711-line guard. Now: `themiz-next/run.py` and eight phases in separate modules.
|
||
- **Speed.** Before: FAST took 212.6 minutes, FULL 150–220. Now: in the 07.10.2026 pilot FAST took 11.7 minutes, FULL 19.3.
|
||
- **Code writes the files.** Before: agents wrote case files themselves. Now: agents read and answer in JSON, and code writes the files.
|
||
- **Run board.** Progress goes to an event log and a page that refreshes every three seconds.
|
||
|
||
#### How a document is checked
|
||
|
||
- **Review in parts.** Before: one reviewer read the whole document. Now: Koni hands parts to blind readers, signs the verdict and rechecks only the changes.
|
||
- **Code catches distortions.** Before review, code compares a paraphrase with the corpus text, a claim with its legal basis, and a near-verbatim quote with the original.
|
||
- **Library and tools.** Rules come in the edition valid on a date, the Tax Code is complete, the form registry holds 388 entries, court details come from sudrf.ru.
|
||
|
||
## How it works
|
||
|
||
The seven scenes below show the working order. The run itself goes through `themiz-next/run.py` in eight phases: intake, case map, research, position, draft, Koni review, assembly, attachments. That is not eight mandatory swarms. A narrow question with up to six text or already recognised files fits FAST. A hard dispute, an ambiguous reading or a big stack of scans needs FULL with separate readers and reconciliation. The Pantheon scenes are illustrations, not interface screenshots.
|
||
|
||
### The lawyer lineup in Claude Code
|
||
|
||
<p align="center"><img src="docs/assets/pantheon/lineup.png" alt="Pantheon marble scene: a frieze of seven jurist medallions above a writing slab, check marks on the finished ones, a gold ring on the middle one, blindfolded Themis seated at the desk" width="100%"></p>
|
||
|
||
While a run is going, a strip with lawyer portraits sits above the Claude Code input, one per stage. The one working now has a pulsing ring; finished stages show ✓ or ✕. Next to them: the stage name, the role and the time. The strip refreshes every three seconds and keeps a finished run for 20 minutes.
|
||
|
||
The mod lives in `plugins/femida-lineup/`. Claude Code finds it through `.claude-plugin/marketplace.json`, and the project's `.claude/settings.json` already turns it on.
|
||
|
||
<!-- workflow-diagram:start -->
|
||
|
||
<p align="center"><img src="docs/assets/pantheon/takt-en.png" alt="Themiz workflow illustration: seven labelled stages from Intake to Hearing in a Pantheon marble scene, not an application screenshot" width="100%"></p>
|
||
|
||
<!-- workflow-diagram:end -->
|
||
|
||
| Stage | What happens |
|
||
|---|---|
|
||
| 1. Intake | One local folder holds the original case material |
|
||
| 2. Extract | Local extraction routes text, scans, tables, and audio |
|
||
| 3. Case map | The case map connects facts, claims, evidence, and conflicts |
|
||
| 4. Research | Research records support, procedural options, and adverse authority |
|
||
| 5. Council | The council reviews the position and is required for L3 |
|
||
| 6. Draft | One role drafts; another reviews the same version |
|
||
| 7. Hearing | The hearing pack keeps the checklist, arguments, and deadlines together |
|
||
|
||
### Step 1: Hand over the case files
|
||
|
||
Copy the selected files into the case intake folder. The workflow treats originals as source material and keeps generated notes elsewhere. Repository publication rules exclude client case folders, but you still decide what text is sent to a model provider.
|
||
|
||
<p align="center"><img src="docs/assets/pantheon/workflow/01-intake.png" alt="Pantheon workflow illustration, not a UI screenshot: stage 1, case intake" width="100%"></p>
|
||
|
||
**You get:** a bounded case workspace with the source files kept apart from generated work.
|
||
|
||
### Step 2: Scans are read on your Mac
|
||
|
||
Text PDF, DOCX, PPTX, and XLSX go through local extractors. On macOS, Apple Vision handles scans and images; Whisper can transcribe audio when its local runtime and model are available. The router stores text and extracted details beside a content hash. Check case numbers, amounts, and critical details against the original.
|
||
|
||
<p align="center"><img src="docs/assets/pantheon/workflow/02-extract.png" alt="Pantheon workflow illustration, not a UI screenshot: stage 2, local document extraction" width="100%"></p>
|
||
|
||
**You get:** searchable local text with a recorded route and details that still carry a verification duty.
|
||
|
||
### Step 3: The case map is built
|
||
|
||
FAST lets one mapper read a narrow set of no more than six text or already recognised files. FULL assigns readers by format and then reconciles their reports when the bundle is large, scanned, or disputed. Missing and conflicting details stay visible instead of being filled in.
|
||
|
||
<p align="center"><img src="docs/assets/pantheon/workflow/03-case-map.png" alt="Pantheon workflow illustration, not a UI screenshot: stage 3, case map" width="100%"></p>
|
||
|
||
**You get:** a case map with sources, open conflicts, and a clear reading boundary.
|
||
|
||
### Step 4: Case law for and against
|
||
|
||
Research starts with local material and a channel check. FAST normally uses one tactical search. FULL can split the work across supportive, sceptical, and procedural tracks. External requests are depersonalised and use approved sources; if a source is unavailable, the result says so.
|
||
|
||
<p align="center"><img src="docs/assets/pantheon/workflow/04-research.png" alt="Pantheon workflow illustration, not a UI screenshot: stage 4, legal research for both sides" width="100%"></p>
|
||
|
||
**You get:** a sourced research record that includes adverse material and named gaps.
|
||
|
||
### Step 5: Five jurists argue it out
|
||
|
||
For L2 and L3 matters, several legal roles examine the position from different angles and record disagreements. The council is required for L3. For L2 FAST, it may be skipped only when the lawyer has recorded their own position. The council organises arguments; it does not create independent providers or replace source verification.
|
||
|
||
<p align="center"><img src="docs/assets/pantheon/workflow/05-council.png" alt="Pantheon workflow illustration, not a UI screenshot: stage 5, legal council" width="100%"></p>
|
||
|
||
**You get:** a position with its assumptions, objections, and weak points on the page.
|
||
|
||
### Step 6: One writes, another checks
|
||
|
||
The drafter works from the case contract and recorded sources. A separate reviewer checks facts, citations, position, form, and completeness, then records a controlled verdict. Mechanical guards can stop assembly when required evidence, review, format, or personal-data checks fail. They do not certify legal correctness.
|
||
|
||
<p align="center"><img src="docs/assets/pantheon/workflow/06-draft.png" alt="Pantheon workflow illustration, not a UI screenshot: stage 6, drafting and separate review" width="100%"></p>
|
||
|
||
**You get:** a reviewed draft and an explicit list of unresolved issues for the lawyer.
|
||
|
||
### Step 7: Hearing prep and reminders
|
||
|
||
The preparation role builds a hearing checklist from the case map and available positions. Status tools show missing steps and calculated dates with their rule where supported. Telegram reminders are optional. The lawyer checks the file, chooses what to submit, signs it, and appears in court.
|
||
|
||
<p align="center"><img src="docs/assets/pantheon/workflow/07-hearing.png" alt="Pantheon workflow illustration, not a UI screenshot: stage 7, hearing preparation" width="100%"></p>
|
||
|
||
**You get:** a preparation pack and visible open items, not an automatic filing decision.
|
||
|
||
## Quickstart
|
||
|
||
For the verified macOS path you need Python 3.11 or newer and Xcode Command Line Tools. Apple Vision scan recognition runs on macOS. Codex CLI and Claude Code are equal alternatives; use the one you have configured.
|
||
|
||
```bash
|
||
git clone https://git.zarubinvibe.com/zarubinvibe/themiz.git
|
||
cd themiz
|
||
bash install.sh
|
||
. .venv/bin/activate
|
||
```
|
||
|
||
The shared block only installs the project and activates its Python environment. Then choose one agent client. Do not run both commands as one setup sequence.
|
||
|
||
**Option A: Codex CLI**
|
||
|
||
```bash
|
||
codex
|
||
```
|
||
|
||
Ask Codex to set up Themiz for your practice.
|
||
|
||
**Option B: Claude Code**
|
||
|
||
```bash
|
||
claude
|
||
```
|
||
|
||
In Claude Code, run `/themiz-setup`.
|
||
|
||
To open the folder in an editor:
|
||
|
||
```bash
|
||
code .
|
||
```
|
||
|
||
First create the case with an agent. Replace `cases/client/case` with the actual path of an existing case folder. This command gives a summary of that specific case, not a general runtime overview:
|
||
|
||
```bash
|
||
python3 scripts/themiz_status.py cases/client/case --brief
|
||
```
|
||
|
||
One document run follows this shape (illustrative trace, not a recorded session):
|
||
|
||
```text
|
||
step 1 action: markdown_extract.py on 00_intake/ result: local OCR and text; no model call, nothing leaves the computer
|
||
step 2 tool: practice_search.py, depersonalised query result: candidate acts, each checked by verify_act.py
|
||
step 3 action: doc-drafter writes the draft result: draft.md in the case folder, not filed
|
||
step 4 tool: doc-reviewer + quality_gate.py result: verdict for this exact revision
|
||
stop a gate fails or a source is unavailable result: the run halts; the reason is in stderr and state.json
|
||
```
|
||
|
||
Permissions: filing, signing, sending, and paid actions need your explicit approval. Data: case files stay local; only text you route to an agent reaches your model provider. Cost: local steps make no paid API call; agent steps use your provider account. Stop: any red gate stops the run instead of degrading silently.
|
||
|
||
The optional browser cockpit starts with:
|
||
|
||
```bash
|
||
.venv/bin/python cockpit/app.py
|
||
```
|
||
|
||
The cockpit opens locally at `http://127.0.0.1:8800`. Its agent actions currently call Claude Code; for Codex work, use Codex CLI or your editor. No Git? Download the [ZIP](https://git.zarubinvibe.com/zarubinvibe/themiz/archive/refs/heads/main.zip) and follow the same install steps.
|
||
|
||
Never done this before? [The onboarding](docs/ONBOARDING.md) walks the whole first run step by step and says what you see after every command.
|
||
|
||
**You get:** an installed workspace with both CLI configurations, safe starter templates, and a status command. Configure your model access and approved legal sources before opening a live case.
|
||
|
||
## Simple comparison
|
||
|
||
| Product | Purpose | Legal sources | Case documents | Drafting | Review |
|
||
|---|---|---|---|---|---|
|
||
| **Themiz** | Workflow for a Russian court case | Local corpus and approved external sources, with source status | Local extraction; you decide what the chosen model provider receives | Procedural documents under the case contract | Separate reviewer and mechanical gates; the lawyer decides whether to file |
|
||
| Manual work | A lawyer works from the case folder | The lawyer checks primary sources | The lawyer reads the originals | The lawyer writes | Full responsibility stays with the lawyer |
|
||
| [ConsultantPlus](https://www.consultant.ru/about/software/cons/) | Russian legal reference system | Legislation, case law, and commentary | Documents supplied by the system; arbitrary case-file upload was not verified | Contract and local-document tools depend on the package | The system flags risks; the user chooses |
|
||
| [Garant](https://udalenka.garant.ru/) | Legal information and support | Legal database, encyclopaedia, and expert materials | Document and approval tools depend on the connected services | Not confirmed on the reviewed product page | Organisation and expert help; the user decides |
|
||
| [ChatGPT](https://help.openai.com/en/articles/9260256) | General AI assistant | Search and deep research depend on settings and plan; no dedicated Russian-law corpus is claimed here | Supports uploaded PDFs, presentations, and text files | Drafting, rewriting, and summarising | No legal acceptance is claimed; the user reviews the result |
|
||
| [Claude](https://claude.com/product/overview) | General AI assistant | Web search and connections are available by setup; no dedicated Russian-law corpus is claimed here | Works with PDFs, Word, Excel, and images | Drafting, editing, and polishing | Can evaluate a draft; legal certification is not claimed and the user remains in control |
|
||
|
||
Product names belong to their owners. This is a scope map, not a benchmark. Features and access can vary by service, plan, region, and configuration; follow the linked product pages for current details.
|
||
|
||
## Simple words
|
||
|
||
| Word | Simple meaning |
|
||
|---|---|
|
||
| Repository | The project folder that Git stores and versions |
|
||
| Terminal | The window where you type commands |
|
||
| Command | One instruction you give the computer |
|
||
| Branch | A separate line of changes that does not touch `main` |
|
||
| Pull Request | A request to review your change and accept it |
|
||
| Case map | A file that connects parties, dates, claims, evidence, and open conflicts |
|
||
| Agent | An assistant role with one bounded job, such as reading a document or reviewing a draft |
|
||
| LKG | The last known good local copy, kept readable when a source refresh fails |
|
||
|
||
## Safety and privacy
|
||
|
||
- Files, OCR, extraction caches, and the case workspace stay on your computer. Text sent to an agent is processed under the terms of your chosen model provider; set that boundary before using client material.
|
||
- The public release excludes case folders and the private legal corpus. A personal-data guard checks commits for known patterns, which reduces accidental publication risk but cannot prove that every possible leak is impossible.
|
||
- External legal research uses approved channels and a depersonalised query rather than the case file. A cloud check of a difficult page requires an explicit fallback; there is no silent switch from local OCR.
|
||
- Telegram is optional and off until you configure your own bot. Once enabled, permitted reminder data leaves your computer for Telegram.
|
||
- Mechanical checks cover supported formats, checksums, calculations, and workflow states. They do not certify the law, the evidence, or the final litigation decision.
|
||
|
||
Before using a shared computer or sending client text to a model, read [SECURITY.md](SECURITY.md) and set the permissions for your practice.
|
||
|
||
## Limits
|
||
|
||
Themiz is in development and is designed for work under a lawyer's control. Codex CLI and Claude Code are equal launch paths. The technical contracts and a clean macOS installation are tested; an end-to-end court matter and clean Windows or Linux installation are not certified.
|
||
|
||
- Apple Vision recognition for scans and images works on macOS only. Text formats use Python tools, but the complete Windows and Linux setup has not been verified.
|
||
- DOCX, text PDF, PPTX, and XLSX conversion passed isolated cold-install checks. Legacy XLS has a configured reader but did not receive the same synthetic conversion check.
|
||
- Legal research and corpus refresh depend on external sources. An unavailable source remains unavailable; it is not replaced with a model guess.
|
||
- The legal graph is marked `needs_review`. Some sources are blocked by site policy (the Administrative Offences Code, the bankruptcy law, part of the plenary rulings), and the Civil Code is deferred. Check a rule with the citation tool before you rely on it.
|
||
- The public clone holds the Eunomia code, not its database. The background loader builds the database after install, and the interface shows how complete and fresh it is. The bundled Graphify graph describes the project code, not your corpus.
|
||
|
||
**Also:**
|
||
|
||
- The background loader checks approved public sources independently of model subscription quotas. It keeps the last known good local copy when a refresh fails. Weekly maintenance uses factual Codex reset events for its own cycle and does not impose USD caps or manage every provider's plan.
|
||
- Local OCR, extraction, calculations, and background downloads do not require a paid model API call. Agent analysis still uses the account or subscription of the model provider you choose.
|
||
- A separate reviewer and a green workflow status do not make a document court-ready. You verify the facts and law, decide whether to file, sign the document, and remain responsible for the case.
|
||
|
||
Read [how the workflow works](docs/HOW-IT-WORKS.ru.md) and the [agent reference](docs/DETAILS.md). Both explain the machinery in more detail; the workflow guide is currently in Russian.
|
||
|
||
## Star and contribute
|
||
|
||
Useful? Give Themiz a star: [https://github.com/zarubinvibe/themiz](https://github.com/zarubinvibe/themiz). It takes a second and it decides whether other people ever find the project.
|
||
|
||
Want to change something? The path is short: fork the repository, create a branch, commit your change, push the branch, then open a Pull Request. Do not push directly to `main`.
|
||
|
||
Found a problem instead? Open an issue at [https://github.com/zarubinvibe/themiz/issues](https://github.com/zarubinvibe/themiz/issues) and say what you ran and what happened.
|
||
|
||
<!-- beginner-readme:end -->
|
||
|
||
<!-- pantheon-family:start -->
|
||
## Olympuz family
|
||
|
||
Public [Olympuz family projects](https://github.com/zarubinvibe/athena#olympuz-family) are listed below. Each row opens the repository or downloads its source as a ZIP.
|
||
|
||
| Type | Name | What it does | How it helps this house | Source |
|
||
|---|---|---|---|---|
|
||
| project | Themiz | Multi-agent assistant for Russian litigation with local OCR and review by a five-jurist council. | Runs Russian court cases with multiple agents and local storage of case material. | [Repository](https://git.zarubinvibe.com/zarubinvibe/themiz) · [ZIP](https://git.zarubinvibe.com/zarubinvibe/themiz/archive/main.zip) |
|
||
<!-- pantheon-family:end -->
|
||
|
||
## License
|
||
|
||
Themiz Community Licence 1.0 permits free use by an individual lawyer, including private practice. Organisations need a commercial licence. Model subscriptions and third-party services are separate. See [LICENSE](LICENSE) and [LICENSE.ru.md](LICENSE.ru.md).
|