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
This commit is contained in:
@@ -162,12 +162,123 @@ cases/
|
|||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
## Requirements
|
## Full Dependency Stack
|
||||||
|
|
||||||
- **Claude Code** with claude-sonnet-4-6 or higher
|
Themis builds on top of several tools. Everything below is required for full functionality.
|
||||||
- **Python 3.9+** with: `pymupdf`, `Pillow`, `markitdown`, `python-docx`
|
|
||||||
- **Microsoft Word** (macOS) — for `/finalize` PDF export
|
---
|
||||||
- **Firecrawl MCP** (recommended) or ScrapeGraphAI for legal research
|
|
||||||
|
### 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
|
```bash
|
||||||
git clone https://github.com/your-username/themis.git my-legal-practice
|
git clone https://github.com/your-username/themis.git my-legal-practice
|
||||||
cd my-legal-practice
|
cd my-legal-practice
|
||||||
|
|
||||||
|
# 1. Python dependencies + directory setup
|
||||||
bash setup.sh
|
bash setup.sh
|
||||||
|
|
||||||
# Add your signature (optional, for /finalize)
|
# 2. Community skills
|
||||||
# Place PNG file: cases/_assets/подпись.png
|
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
|
claude
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|||||||
@@ -1,42 +1,39 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
# Themis — Setup Script
|
# Themis — Setup Script
|
||||||
# Installs Python dependencies for the Themis legal AI system
|
# Run from the project root: bash setup.sh
|
||||||
|
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
echo "=== Themis Setup ==="
|
echo "=== Themis Setup ==="
|
||||||
echo ""
|
echo ""
|
||||||
|
|
||||||
# Python dependencies
|
# ── 1. Python packages ────────────────────────────────────────────────────────
|
||||||
echo "[1/3] Installing Python dependencies..."
|
echo "[1/4] Installing Python packages..."
|
||||||
pip3 install --quiet \
|
pip3 install --quiet pymupdf Pillow markitdown python-docx markitdown-mcp 2>/dev/null || \
|
||||||
pymupdf \
|
pip3 install pymupdf Pillow markitdown python-docx
|
||||||
Pillow \
|
|
||||||
markitdown \
|
|
||||||
python-docx
|
|
||||||
|
|
||||||
echo " ✓ pymupdf (PDF manipulation + OCR support)"
|
echo " ✓ pymupdf (PyMuPDF — PDF rendering, signature overlay)"
|
||||||
echo " ✓ Pillow (image processing)"
|
echo " ✓ Pillow (image processing)"
|
||||||
echo " ✓ markitdown (document → Markdown conversion)"
|
echo " ✓ markitdown (Microsoft — DOCX/XLSX/PDF → Markdown, zero tokens)"
|
||||||
echo " ✓ python-docx (DOCX reading)"
|
echo " ✓ python-docx (DOCX reading)"
|
||||||
|
echo " ✓ markitdown-mcp (optional MCP server for markitdown)"
|
||||||
|
|
||||||
# Make scripts executable
|
# ── 2. Scripts executable ─────────────────────────────────────────────────────
|
||||||
echo "[2/3] Making scripts executable..."
|
echo ""
|
||||||
chmod +x scripts/markdown_extract.py
|
echo "[2/4] Making scripts executable..."
|
||||||
chmod +x scripts/sign_and_pdf.py
|
chmod +x scripts/markdown_extract.py scripts/sign_and_pdf.py
|
||||||
echo " ✓ scripts/markdown_extract.py"
|
echo " ✓ scripts/markdown_extract.py"
|
||||||
echo " ✓ scripts/sign_and_pdf.py"
|
echo " ✓ scripts/sign_and_pdf.py"
|
||||||
|
|
||||||
# Create required directories
|
# ── 3. Directories ────────────────────────────────────────────────────────────
|
||||||
echo "[3/3] Creating required directories..."
|
echo ""
|
||||||
|
echo "[3/4] Creating required directories..."
|
||||||
mkdir -p cases/_assets cases/_logs knowledge
|
mkdir -p cases/_assets cases/_logs knowledge
|
||||||
echo " ✓ cases/_assets/ (place подпись.png here)"
|
echo " ✓ cases/_assets/ → place подпись.png here for /finalize"
|
||||||
echo " ✓ cases/_logs/ (session error logs)"
|
echo " ✓ cases/_logs/ → session error analysis logs"
|
||||||
echo " ✓ knowledge/ (global practice index)"
|
echo " ✓ knowledge/ → global practice index (auto-maintained)"
|
||||||
|
|
||||||
# Initialize practice index if absent
|
|
||||||
if [ ! -f "knowledge/practice_index.md" ]; then
|
if [ ! -f "knowledge/practice_index.md" ]; then
|
||||||
cat > knowledge/practice_index.md << 'INDEXEOF'
|
cat > knowledge/practice_index.md << 'EOF'
|
||||||
# Индекс судебной практики
|
# Индекс судебной практики
|
||||||
|
|
||||||
_Обновлено: — | Записей: 0_
|
_Обновлено: — | Записей: 0_
|
||||||
@@ -47,19 +44,54 @@ _Обновлено: — | Записей: 0_
|
|||||||
|-----------|---------|-----------|
|
|-----------|---------|-----------|
|
||||||
|
|
||||||
---
|
---
|
||||||
INDEXEOF
|
EOF
|
||||||
echo " ✓ knowledge/practice_index.md (created empty)"
|
echo " ✓ knowledge/practice_index.md (initialized empty)"
|
||||||
fi
|
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 ""
|
||||||
echo "=== Setup complete ==="
|
echo "=== Setup complete ==="
|
||||||
echo ""
|
echo ""
|
||||||
echo "Next steps:"
|
echo "Remaining manual steps:"
|
||||||
echo " 1. Add your signature PNG: cases/_assets/подпись.png"
|
echo ""
|
||||||
echo " (PNG, ~400×130px, transparent or white background)"
|
echo " 1. Install community skills (if missing above):"
|
||||||
echo " 2. Open a new Claude Code session in this directory"
|
echo " npx skills add caveman"
|
||||||
echo " 3. Run /new-case {client} {case} to start your first case"
|
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 ""
|
||||||
echo "Requirements:"
|
|
||||||
echo " • Microsoft Word (for /finalize PDF export)"
|
|
||||||
echo " • Claude Code with claude-sonnet-4-6 or higher"
|
|
||||||
|
|||||||
Reference in New Issue
Block a user