Back to Home

Command Line Tool

Run PATAS analysis offline. Configure two-stage processing, profiles, and simple mode.

Installation

# Clone repository
git clone https://github.com/kiku-jw/PATAS.git
cd PATAS

# Install dependencies
poetry install  # or: pip install -e .

# Run commands using poetry run
poetry run patas <command> [options]

# Alternative: create alias (add to ~/.zshrc or ~/.bashrc)
alias patas="cd /path/to/PATAS && poetry run patas"

Quick Start

# Ingest logs from API (last 7 days)
poetry run patas ingest-logs --source=api --since-days=7

# Mine patterns with two-stage processing (default)
poetry run patas mine-patterns --days=7 --use-llm

# Evaluate rules in shadow mode
poetry run patas eval-rules --days=7

# Promote rules based on metrics
poetry run patas promote-rules

# Run demo
poetry run patas demo --input=logs.jsonl --profile=balanced --out=./report

Available Commands

poetry run patas ingest-logs

Ingest abuse/spam logs from various sources.

  • --source - Source of logs (api, storage, telegram)
  • --since-days - Number of days to look back (default: 7)
  • --limit - Maximum number of messages to ingest

poetry run patas mine-patterns

Run pattern mining on recent messages with two-stage processing.

  • --days - Number of days of messages to analyze (default: 7)
  • --use-llm - Enable LLM for pattern discovery
  • --no-semantic - Disable semantic mining
  • --no-two-stage - Disable two-stage processing (simple deterministic mode only)

poetry run patas eval-rules

Evaluate rules in shadow mode with precision/recall metrics.

  • --rule-id - Evaluate specific rule ID
  • --days - Number of days of messages to evaluate on (default: 7)
  • --min-sample-size - Minimum sample size for evaluation (default: 10)

poetry run patas promote-rules

Promotion/rollback of rules based on metrics and aggressiveness profiles.

  • --monitor-only - Only monitor active rules, don't promote shadow rules

poetry run patas demo

Run demo with sample data for safety/infra teams.

  • --input - Path to JSONL file with messages (optional)
  • --profile - Safety profile: conservative, balanced, aggressive (default: conservative)
  • --out - Output directory (default: ./patas_demo)

poetry run patas explain-rule

Explain a single rule in detail with examples.

  • --id / --rule-id - Rule ID to explain (required)
  • --max-examples - Maximum number of examples to show (default: 5)

Features

Two-stage processing
Fast deterministic scanning + deep semantic analysis
Pattern discovery
Semantic + deterministic pattern mining
Rule evaluation
Shadow evaluation with precision/recall/coverage metrics
Modern CLI
Argparse-based argument parsing with named flags
Safety profiles
Conservative, balanced, aggressive
Simple mode
Deterministic-only processing with --no-two-stage flag