> ## Documentation Index
> Fetch the complete documentation index at: https://docs.ardenstats.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Claude

# Claude Code Integration

Automatically track telemetry events when using Claude Code.

## Overview

The Arden CLI provides built-in hooks for Claude Code that automatically send telemetry events when you start, stop, or interact with Claude sessions.

## Setup

### 1. Install Arden CLI

```bash
npm install -g arden
```

### 2. Configure Claude Hooks

Add hooks to your Claude Code configuration file:

```json
{
  "hooks": {
    "start": "arden claude start",
    "stop": "arden claude stop",
    "message": "arden claude message"
  }
}
```

### 3. Test the Integration

Start a Claude Code session. Arden will automatically:

* Send a telemetry event when the session starts
* Track each message exchange
* Log session end events

## Hook Types

| Hook      | Triggered When        | Agent ID         |
| --------- | --------------------- | ---------------- |
| `start`   | Claude session begins | `claude.start`   |
| `stop`    | Claude session ends   | `claude.stop`    |
| `message` | User sends message    | `claude.message` |

## Event Data

Each Claude hook automatically enriches telemetry with:

```json
{
  "provider": "claude_code",
  "hook": "start|stop|message",
  "timestamp": "2024-01-15T10:30:00Z",
  "payload": {
    // Original Claude payload data
  }
}
```

## CLI Options

```bash
# Dry run (don't send events)
arden claude start --dry-run

# Print enriched payload
arden claude start --print

# Custom API host
arden claude start --host "https://api.example.com"
```

## Troubleshooting

**Hook not triggering?**

* Verify Claude Code hook configuration
* Check Arden CLI is installed globally
* Run `arden --version` to confirm installation

**Events not appearing?**

* Check network connectivity
* Verify API token if using authentication
* Use `--dry-run --print` to debug payload

## Manual Integration

You can also manually send Claude-related events:

```bash
arden events send --agent "claude.custom" --bid 1000 --data '{"task": "code_review"}'
```

This gives you full control over when and what telemetry is sent.
