# PATAS agent context

## Product boundary

PATAS analyzes historical moderation exports for repeated commercial-spam patterns. It returns pattern clusters, sanitized evidence, review-only candidate rules, and false-positive risk notes.

PATAS is not a live single-message spam classifier. The hosted API does not ban users or authorize automatic enforcement. A customer system must validate candidate rules on representative local spam and ham data before applying them.

## Choose one deployment mode

### Hosted API

- Base URL: `https://kikuai.dev`
- Authentication: `Authorization: Bearer YOUR_API_KEY`
- Create and manage keys: `https://account.patas.app/account/patas/`
- Run audit: `POST /v1/patas/audits`
- Fetch completed audit: `GET /v1/patas/audits/{job_id}`
- Read current usage: `GET /v1/patas/usage`
- OpenAPI: `https://kikuai.dev/api/patas/openapi.json`

The audit request is synchronous. Supported `input_format` values are `csv`, `json`, `jsonl`, `ndjson`, and `text`. The only hosted policy is `commercial_spam_patterns`. Each audit accepts at most 500 parsed rows and a 262,144-byte body.

The daily free allowance is 10 jobs and 2,500 rows per key. A one-time $19 pack adds 100 jobs and 100,000 account-wide rows. The free allowance is used first only when the entire request fits.

Hosted raw input rows are not persisted. PATAS stores an input hash, job and usage metadata, and the sanitized report. Customer report processing does not require cloud AI.

### Self-hosted Core

- Source: `https://github.com/PATAS-TAS/PATAS`
- Wiki: `https://github.com/PATAS-TAS/PATAS/wiki`
- License: AGPL-3.0
- Runtime: Python 3.10 with Poetry

Core is a broader pattern-discovery and rule-management system. It includes ingestion, deterministic candidate scanning, optional semantic analysis, rule generation, historical evaluation, safety profiles, and monitoring examples.

Inspect the checked-out source before generating configuration. The wiki contains broad and historical examples; verify CLI commands, environment variables, migrations, and deployment files against the exact commit being deployed. Do not enable external LLM or embedding providers without explicit operator approval.

## Hosted request example

```json
{
  "input_format": "csv",
  "policy": "commercial_spam_patterns",
  "source_name": "moderation-export.csv",
  "rows": "sender,message,label\na,Claim bonus now https://example.test/ref,spam\nb,Claim bonus now https://example.test/ref,spam\nc,Can someone help tomorrow?,ham",
  "return": ["summary", "clusters", "candidate_rules", "risk_notes"]
}
```

## Agent safety rules

1. Never request or expose the full API key in chat, source, logs, or commits.
2. Never invent request fields or endpoints absent from the hosted OpenAPI contract.
3. Never send credentials, private URLs, payment data, or unrelated customer records as audit rows.
4. Never turn a hosted `candidate_rule` into automatic enforcement.
5. Always show risk notes with candidate rules.
6. Branch on the structured API `code`, not English error-message text.
7. For Core, verify configuration against source before running migrations or deployment commands.
