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

# API Reference — Performing Identity Detection Engineering

## Agent Tools

| Tool | Description |
|---|---|
| Author Rule | `author_rule(technique, identity_source, event_ids)` — Author an identity detection rule. |
| Analyze Baseline | `analyze_baseline(log_source, time_range)` — Analyze identity baseline for anomaly thresholds. |
| Simulate Attack | `simulate_attack(technique)` — Generate identity attack simulation commands. |

## CLI Usage

```bash
# Author rule
node agent.js author --technique T1558.003 --identity-source windows_security --event-ids 4769 4770
```

```bash
# Analyze baseline
node agent.js baseline --log-source azure_ad --time-range 30d
```

```bash
# Simulate attack
node agent.js simulate --technique T1558.003
```

## 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
