CLI Usage

February 9, 2026 ยท View on GitHub

Environment Setup

Install Python deps:

pip install -r farmer_factory/requirements.txt

Optional system dependency for PDF handling (platform-specific):

  • macOS: brew install poppler
  • Ubuntu/Debian: sudo apt-get install poppler-utils

Discover Commands

python3 -m farmer_factory.cli --help

List domains:

python3 -m farmer_factory.cli list-domains

Core Workflow Commands

Create a case:

python3 -m farmer_factory.cli create-case --id CASE-001 --name "My Case" --family "Family" --domain cuban_property

Detect multi-part document groups:

python3 -m farmer_factory.cli detect-groups CASE-001

Process intake documents:

python3 -m farmer_factory.cli process CASE-001 --domain cuban_property

Validate graph export:

python3 -m farmer_factory.cli validate CASE-001 --domain cuban_property

Rebuild graph from saved extractions (no OCR/LLM rerun):

python3 -m farmer_factory.cli rebuild-graph CASE-001 --domain cuban_property

Apply confirmed merge authority:

python3 -m farmer_factory.cli apply-merges CASE-001 --domain cuban_property

Resolve orphan relations:

python3 -m farmer_factory.cli resolve-orphans CASE-001

Run AI analysis outputs:

python3 -m farmer_factory.cli analyze CASE-001 --max-cost 2.00 --domain cuban_property

Analysis Subcommands

Generate entity descriptions only:

python3 -m farmer_factory.cli generate-descriptions CASE-001 --max-cost 0.50 --domain cuban_property

Generate document analyses only:

python3 -m farmer_factory.cli generate-analyses CASE-001 --max-cost 1.00 --domain cuban_property

Generate case narrative only:

python3 -m farmer_factory.cli generate-narrative CASE-001 --model sonnet --max-cost 2.00 --domain cuban_property

Merge and Dedupe Commands

Train dedupe model(s):

python3 -m farmer_factory.cli train-deduplication CASE-001 --entity-type PERSON --num-examples 30 --domain cuban_property

Interactive group review:

python3 -m farmer_factory.cli review-groups CASE-001 --entity-type PERSON --domain cuban_property

Manual entity merge:

python3 -m farmer_factory.cli merge-entities CASE-001 entity_a entity_b --domain cuban_property

Utility Commands

List cases:

python3 -m farmer_factory.cli list-cases

List entities:

python3 -m farmer_factory.cli list-entities CASE-001 --type PERSON

Generate dossier:

python3 -m farmer_factory.cli generate-dossier CASE-001 --property-id property_x --family-member-id person_y --domain cuban_property

Clean generated outputs (keeps intake and analyst authority files):

python3 -m farmer_factory.cli clean CASE-001 --confirm

Generate manifest from existing outputs:

python3 -m farmer_factory.cli generate-manifest CASE-001

Placeholder Commands

These commands exist but are currently placeholders in this codebase:

  • upload
  • retry
  • retry-relations

Check command help output before integrating them into automation.