<!-- Copyright (c) 2026 defconxt. All rights reserved. -->
<!-- Licensed under AGPL-3.0 — see LICENSE file for details. -->
<!-- NERF is a trademark of defconxt. -->
# Building Attack Trees — API Reference

## agent.js CLI

```bash
# Build action
node scripts/agent.js --action build

# Analyze action
node scripts/agent.js --action analyze

# Countermeasures action
node scripts/agent.js --action countermeasures

# Export action
node scripts/agent.js --action export
```

## Attack Tree Node Schema

```json
{
  "id": "node_1",
  "name": "Exploit SQL injection",
  "gate": "OR",
  "children": ["node_2", "node_3"],
  "annotations": {
    "cost": 500,
    "probability": 0.7,
    "skill_level": "intermediate",
    "detection_risk": "medium"
  }
}
```

## Path Analysis Output

```json
{
  "path": ["Root Goal", "Sub-goal 1", "Leaf Action"],
  "total_cost": 500,
  "success_probability": 0.42,
  "depth": 3
}
```
