<!-- Copyright (c) 2026 defconxt. All rights reserved. -->
<!-- Licensed under AGPL-3.0 — see LICENSE file for details. -->

# API Reference — Detection Lifecycle Management

## Agent Tools

| Tool | Description |
|---|---|
| State Tracker | `track_state(rule, current, action)` — Manage transitions |
| Review Scheduler | `schedule_reviews(rules, interval)` — Plan review cadence |
| Ownership Auditor | `audit_ownership(rules)` — Identify unowned rules |

## CLI Usage

```bash
# Track state
node agent.js state --rule 5e1c0d42 --current review --action testing

# Schedule reviews
node agent.js reviews --rules '[{"rule_id": "5e1c", "last_review": "2026-01-01"}]'

# Audit ownership
node agent.js ownership --rules '[{"rule_id": "5e1c", "owner": "jsmith"}]'
```

## Output Format

All commands return JSON with the following structure:

```json
{
  "action": "<command_name>",
  "...": "command-specific fields"
}
```

## Error Handling

- Invalid input returns `{"error": "description"}` with non-zero exit code
- JSON parsing errors are caught and reported with context
- Missing required arguments trigger argparse help display
