From bc4818376d548ae50bf066e0ddb586f5cbf1bf74 Mon Sep 17 00:00:00 2001 From: tv5171621-source Date: Tue, 2 Jun 2026 18:25:08 +0300 Subject: [PATCH] Add full dependency documentation and improved setup.sh - README: full dependency stack (Python, Claude Code skills, MCP servers) - Links to caveman/humanizer (ECC), markitdown (Microsoft), PyMuPDF, Firecrawl - setup.sh: checks caveman/humanizer presence, guides through MCP config - LibreOffice alternative for non-macOS documented --- README.md | 136 ++++++++++++++++++++++++++++++++++++++++++++++++++---- setup.sh | 100 +++++++++++++++++++++++++-------------- 2 files changed, 194 insertions(+), 42 deletions(-) diff --git a/README.md b/README.md index 124b4f2..ef2e132 100644 --- a/README.md +++ b/README.md @@ -162,12 +162,123 @@ cases/ --- -## Requirements +## Full Dependency Stack -- **Claude Code** with claude-sonnet-4-6 or higher -- **Python 3.9+** with: `pymupdf`, `Pillow`, `markitdown`, `python-docx` -- **Microsoft Word** (macOS) — for `/finalize` PDF export -- **Firecrawl MCP** (recommended) or ScrapeGraphAI for legal research +Themis builds on top of several tools. Everything below is required for full functionality. + +--- + +### 1. Claude Code + +```bash +npm install -g @anthropic-ai/claude-code +``` + +Models used: +| Agent | Model | +|-------|-------| +| doc-drafter (L2/L3), practice-hunter-skeptic | `claude-opus-4-8` | +| case-mapper, hunters, reviewers | `claude-sonnet-4-6` | +| readers, archivist (leaf workers) | `claude-haiku-4-5` | + +--- + +### 2. Python Packages + +```bash +pip install pymupdf Pillow markitdown python-docx +``` + +| Package | Source | Used for | +|---------|--------|---------| +| [pymupdf](https://github.com/pymupdf/PyMuPDF) | pip | Scan-PDF rendering, signature overlay | +| [Pillow](https://github.com/python-pillow/Pillow) | pip | Signature image processing | +| [markitdown](https://github.com/microsoft/markitdown) | pip (Microsoft) | DOCX/XLSX/PPTX/PDF/HTML → Markdown, zero tokens | +| [python-docx](https://github.com/python-openxml/python-docx) | pip | DOCX reading | + +--- + +### 3. Claude Code Community Skills + +Two skills control how all 13 agents communicate and write. **Required.** + +#### [caveman](https://github.com/eastcoastcode/ecc) — token-efficient communication +Compresses agent output ~65–75% while keeping full technical accuracy. Used for all inter-agent and user communication. + +```bash +npx skills add caveman +``` + +#### humanizer — professional legal language +Transforms AI output into authentic professional prose. Used when writing court documents, practice reports, and case maps. + +```bash +npx skills add humanizer +``` + +> Both skills are part of the **ECC (Engineering Claude Code)** skill pack. +> If `npx skills add` is unavailable, copy the skill folders manually to `~/.claude/skills/`. + +--- + +### 4. MCP Servers + +Configure in `~/.claude/mcp.json`. + +#### Firecrawl — primary web search (required for practice hunters) + +```json +{ + "mcpServers": { + "firecrawl-mcp": { + "command": "npx", + "args": ["-y", "firecrawl-mcp@latest"], + "env": { "FIRECRAWL_API_KEY": "YOUR_KEY_HERE" } + } + } +} +``` + +Get API key: [firecrawl.dev](https://firecrawl.dev) + +#### ScrapeGraphAI — fallback search + +```bash +pip install scrapegraphai +# CLI: sgai validate --json +``` + +Get API key: [scrapegraphai.com](https://scrapegraphai.com) → store in `~/.scrapegraphai/config.json` + +#### markitdown MCP (optional — adds MCP-based document conversion) + +```bash +pip install markitdown-mcp +``` + +Add to `~/.claude/mcp.json`: +```json +"markitdown": { "command": "python3", "args": ["-m", "markitdown_mcp"] } +``` + +--- + +### 5. Microsoft Word (macOS) + +Required for `/finalize` — exports `.docx` → `.pdf` via AppleScript. +`Microsoft Word.app` must be installed in `/Applications/`. + +**Linux/Windows alternative** — replace AppleScript block in `scripts/sign_and_pdf.py`: +```python +subprocess.run(["libreoffice", "--headless", "--convert-to", "pdf", docx_path]) +``` + +--- + +### 6. Anthropic Built-in Skill + +`anthropic-skills:docx` is used by the doc-drafter to generate `.docx` files. +Bundled with Claude Code — no separate install. --- @@ -176,12 +287,21 @@ cases/ ```bash git clone https://github.com/your-username/themis.git my-legal-practice cd my-legal-practice + +# 1. Python dependencies + directory setup bash setup.sh -# Add your signature (optional, for /finalize) -# Place PNG file: cases/_assets/подпись.png +# 2. Community skills +npx skills add caveman +npx skills add humanizer -# Open Claude Code +# 3. Configure MCP servers in ~/.claude/mcp.json (see above) + +# 4. Signature for /finalize (optional) +# Photograph your signature → crop → save as PNG: +# cases/_assets/подпись.png (~400×130px, transparent background) + +# 5. Start claude ``` diff --git a/setup.sh b/setup.sh index 9a99aa7..b3afd90 100755 --- a/setup.sh +++ b/setup.sh @@ -1,42 +1,39 @@ #!/bin/bash # Themis — Setup Script -# Installs Python dependencies for the Themis legal AI system +# Run from the project root: bash setup.sh set -e - echo "=== Themis Setup ===" echo "" -# Python dependencies -echo "[1/3] Installing Python dependencies..." -pip3 install --quiet \ - pymupdf \ - Pillow \ - markitdown \ - python-docx +# ── 1. Python packages ──────────────────────────────────────────────────────── +echo "[1/4] Installing Python packages..." +pip3 install --quiet pymupdf Pillow markitdown python-docx markitdown-mcp 2>/dev/null || \ + pip3 install pymupdf Pillow markitdown python-docx -echo " ✓ pymupdf (PDF manipulation + OCR support)" -echo " ✓ Pillow (image processing)" -echo " ✓ markitdown (document → Markdown conversion)" -echo " ✓ python-docx (DOCX reading)" +echo " ✓ pymupdf (PyMuPDF — PDF rendering, signature overlay)" +echo " ✓ Pillow (image processing)" +echo " ✓ markitdown (Microsoft — DOCX/XLSX/PDF → Markdown, zero tokens)" +echo " ✓ python-docx (DOCX reading)" +echo " ✓ markitdown-mcp (optional MCP server for markitdown)" -# Make scripts executable -echo "[2/3] Making scripts executable..." -chmod +x scripts/markdown_extract.py -chmod +x scripts/sign_and_pdf.py +# ── 2. Scripts executable ───────────────────────────────────────────────────── +echo "" +echo "[2/4] Making scripts executable..." +chmod +x scripts/markdown_extract.py scripts/sign_and_pdf.py echo " ✓ scripts/markdown_extract.py" echo " ✓ scripts/sign_and_pdf.py" -# Create required directories -echo "[3/3] Creating required directories..." +# ── 3. Directories ──────────────────────────────────────────────────────────── +echo "" +echo "[3/4] Creating required directories..." mkdir -p cases/_assets cases/_logs knowledge -echo " ✓ cases/_assets/ (place подпись.png here)" -echo " ✓ cases/_logs/ (session error logs)" -echo " ✓ knowledge/ (global practice index)" +echo " ✓ cases/_assets/ → place подпись.png here for /finalize" +echo " ✓ cases/_logs/ → session error analysis logs" +echo " ✓ knowledge/ → global practice index (auto-maintained)" -# Initialize practice index if absent if [ ! -f "knowledge/practice_index.md" ]; then - cat > knowledge/practice_index.md << 'INDEXEOF' + cat > knowledge/practice_index.md << 'EOF' # Индекс судебной практики _Обновлено: — | Записей: 0_ @@ -47,19 +44,54 @@ _Обновлено: — | Записей: 0_ |-----------|---------|-----------| --- -INDEXEOF - echo " ✓ knowledge/practice_index.md (created empty)" +EOF + echo " ✓ knowledge/practice_index.md (initialized empty)" fi +# ── 4. Community skills check ───────────────────────────────────────────────── +echo "" +echo "[4/4] Checking community skills..." + +CAVEMAN_PATH="$HOME/.claude/skills/caveman" +HUMANIZER_PATH="$HOME/.claude/skills/humanizer" + +if [ -d "$CAVEMAN_PATH" ]; then + echo " ✓ caveman skill found at $CAVEMAN_PATH" +else + echo " ✗ caveman skill NOT found" + echo " Install: npx skills add caveman" + echo " Source: https://github.com/eastcoastcode/ecc" +fi + +if [ -d "$HUMANIZER_PATH" ]; then + echo " ✓ humanizer skill found at $HUMANIZER_PATH" +else + echo " ✗ humanizer skill NOT found" + echo " Install: npx skills add humanizer" + echo " Source: https://github.com/eastcoastcode/ecc" +fi + +# ── Summary ─────────────────────────────────────────────────────────────────── echo "" echo "=== Setup complete ===" echo "" -echo "Next steps:" -echo " 1. Add your signature PNG: cases/_assets/подпись.png" -echo " (PNG, ~400×130px, transparent or white background)" -echo " 2. Open a new Claude Code session in this directory" -echo " 3. Run /new-case {client} {case} to start your first case" +echo "Remaining manual steps:" +echo "" +echo " 1. Install community skills (if missing above):" +echo " npx skills add caveman" +echo " npx skills add humanizer" +echo "" +echo " 2. Configure MCP servers in ~/.claude/mcp.json:" +echo " - firecrawl-mcp (npx -y firecrawl-mcp@latest, needs FIRECRAWL_API_KEY)" +echo " - scrapegraph (pip install scrapegraphai, needs API key)" +echo " See README.md for full config." +echo "" +echo " 3. Microsoft Word must be installed (macOS) for /finalize PDF export." +echo " Linux/Windows: use LibreOffice (see README.md for substitution)." +echo "" +echo " 4. Add signature for /finalize:" +echo " cases/_assets/подпись.png (~400×130px PNG, transparent background)" +echo "" +echo " 5. Open Claude Code in this directory:" +echo " claude" echo "" -echo "Requirements:" -echo " • Microsoft Word (for /finalize PDF export)" -echo " • Claude Code with claude-sonnet-4-6 or higher"