Skip to content

bitwize-music-studio/claude-ai-music-skills / skills/document-hunter

document-hunter

Verified

Searches and retrieves documents from free public sources using automated browser navigation. Use when research needs primary source documents like court filings, government reports, or public records.

FileKindSize
SKILL.mdskill md7.1 KB
site-patterns.mdmarkdown5.3 KB

site-patterns.md

View on GitHub
# Site-Specific Patterns

Automation strategies for each document source.

---

## 1. DocumentCloud (https://www.documentcloud.org/)

- Nonprofit document archive
- Journalists upload PACER docs after purchasing
- **Critical**: SvelteKit/React app - PDF links only appear AFTER JavaScript renders

**Automation Strategy**:
1. Load page with `wait_until='networkidle'`
2. Wait additional 5 seconds for JavaScript to finish rendering
3. Query rendered DOM for links (`query_selector_all('a')`)
4. Find S3 bucket URLs (pattern: `s3.documentcloud.org/documents/*/...pdf`)
5. Download from S3 directly (faster than clicking)

**Success Rate**: High (tested with historical court documents)

---

## 2. CourtListener / RECAP (https://www.courtlistener.com/)

- Crowdsourced PACER archive
- Search by: case number, docket, party names

**Automation**:
1. Navigate to search page
2. Search by case number or party names
3. Navigate to docket page
4. Check which docs are free (RECAP uploaded)
5. Download available documents

---

## 3. Scribd (https://www.scribd.com/)

- User-uploaded documents
- Many journalists upload court docs

**Automation**:
1. Search by case name
2. Filter for documents (not books)
3. Identify court docs by title/description
4. Download or scrape content

**Note**: May require free account

---

## 4. Justia (https://www.justia.com/)

- Free legal database
- Good for appellate opinions

**Automation**:
1. Search by case number or party names
2. Navigate to case page
3. Download opinions and key filings

---

## 5. Court Websites

Example: `cand.uscourts.gov/cases-of-interest/`

**Automation**:
1. Navigate to court's "cases of interest" or "notable cases"
2. Search for case name
3. Check for document downloads

---

## 6. Government Agencies

### DOJ (justice.gov)
- Press releases link to indictments/complaints
- URL pattern: `justice.gov/usao/[district]/press-releases`

### SEC (sec.gov)
- Litigation releases at `sec.gov/litigation`
- Complaints and settlements publicly available

**Automation**:
1. Search press releases for case name
2. Extract PDF links from release
3. Download directly

---

## 7. Legal Publisher Sites

### CCH (business.cch.com)
- Some case documents hosted
- Search by case name + "PDF"

---

## Python Code Template

```python
from playwright.sync_api import sync_playwright
import os
import json
from datetime import datetime

def hunt_documents(case_name, case_number, output_dir):
    """
    Systematically search all free sources for court documents.
    """
    manifest = {
        "case_name": case_name,
        "case_number": case_number,
        "search_date": datetime.now().isoformat(),
        "sources_searched": [],
        "documents_found": []
    }

    with sync_playwright() as p:
        browser = p.chromium.launch(headless=True)
        context = browser.new_context(
            user_agent="Mozilla/5.0 (research bot)"
        )
        page = context.new_page()

        # Search each source
        for source_func in [search_documentcloud, search_courtlistener,
                           search_scribd, search_government]:
            try:
                results = source_func(page, case_name, output_dir)
                manifest["documents_found"].extend(results)
            except Exception as e:
                print(f"Error: {e}")

        browser.close()

    # Save manifest
    manifest_path = os.path.join(output_dir, "metadata", "document-manifest.json")
    with open(manifest_path, 'w') as f:
        json.dump(manifest, f, indent=2)

    return manifest


def search_documentcloud(page, case_name, output_dir):
    """Search DocumentCloud for case documents."""
    results = []

    page.goto("https://www.documentcloud.org/app", timeout=30000)
    page.wait_for_selector('input[type="search"]', timeout=10000)

    # Search
    page.fill('input[type="search"]', case_name)
    page.press('input[type="search"]', 'Enter')
    page.wait_for_load_state('networkidle')

    # Wait for JS rendering
    page.wait_for_timeout(5000)

    # Extract document links
    doc_links = page.query_selector_all('a[href*="/documents/"]')

    for link in doc_links[:10]:
        href = link.get_attribute('href')
        title = link.inner_text()

        # Navigate to document, find PDF, download
        # ... (implementation details)

    return results


def search_courtlistener(page, case_number, output_dir):
    """Search CourtListener for RECAP documents."""
    results = []

    page.goto(f"https://www.courtlistener.com/?q={case_number}")
    page.wait_for_load_state('networkidle')

    # Find and download free documents
    # ... (implementation details)

    return results
```

---

## RECAP Extension

The RECAP browser extension crowdsources PACER documents to CourtListener.

**Location**: `${CLAUDE_PLUGIN_ROOT}/tools/extensions/recap-extension/`

**Setup**:
```bash
cd tools/extensions
curl -L "https://github.com/freelawproject/recap-chrome/releases/download/2.8.6/chrome-release.zip" -o recap.zip
unzip recap.zip -d recap-extension
rm recap.zip
```

**Usage**: Script auto-loads RECAP extension when launching Chromium.

---

## Known Issues

### SEC.gov
- Has Akamai WAF (blocks automation)
- **Alternative**: Use DOJ press releases which link to the same documents

### Scribd
- May require account for some downloads
- Rate limiting possible

### Court Websites
- Layout varies by court
- May require custom selectors
add-product-e2e-evalpaperclipai/paperclipAdd or extend a Paperclip full-stack runner E2E workflow, fixture, matcher, or report evidence path for local or Daytona execution.Stars: 115kUpdated Claude CodeCodexVerifiedInstall
add-runner-evalpaperclipai/paperclipAdd or extend a Paperclip Runner protocol evaluation definition, roster, assertion, or report fixture with provenance and narrow validation.Stars: 115kUpdated Claude CodeCodexVerifiedInstall
diagnose-why-work-stoppedpaperclipai/paperclipCompatibility entry point for failed, stalled, looping, or over-recovered Paperclip work. Use fix-failed-paperclip-run for the full diagnosis, regression, repair, real verification, and green-PR workflow; honor an explicitly requested diagnosis-only scope.Stars: 115kUpdated Claude CodeCodexVerifiedInstall
fix-failed-paperclip-runpaperclipai/paperclipDiagnose and fix failed, stuck, slow, or incorrectly blocked Paperclip tasks and runs. Use with a task/run URL or failure report to trace the root cause, prove a regression red then green, check second-order effects, verify the real workflow, and deliver a PR with passing checks.Stars: 115kUpdated Claude CodeCodexVerifiedInstall