Telemetry
$.telemetry logs analytics records.
A record is sent only when Claude Code or a built-in mod makes the call.
A mod you install can watch and rewrite records, but it must give its telemetry hook the filter { to: 'collector' }.
Without the filter the mod fails claude plugin validate, and * does not select these events.
A hook can return { deny }. The built-in cc-plugin-telemetry sends the records. The collector is the one the operator of the session configured.
Official page: Mods Reference. Source: the program (types-2.1.304.d.ts).
Example
on('telemetry.log', { to: 'collector' }, ($, e, next) => next(e))
Members
| Item | Status | What it does | How it works | Where it can be used |
|---|---|---|---|---|
$. | Documented | Logs one record to the destination entry. names. It is the event telemetry.. anthropic is the default. | (entry:. Sends a first-party row or a collector record. A first-party row is queued for built-ins only. Rejects if a hook denies. | Only built-ins and the engine make records that are sent. |
$. | Documented | Marks one use of a feature, as the CLI's own feature events do. It takes no to and always means anthropic. | (entry:. The engine does nothing with it. Built-in plugins that hook the event queue the row. | Only built-ins and the engine make records that are sent. |
Engine Events
| Item | Status | What it does | How it works | Where it can be used |
|---|---|---|---|---|
telemetry. | Documented | Fires when a record is about to be logged to the destination e. names. | Input Telemetry. Result { value: or { deny }. e. is pinned. | on('telemetry.. Also $.. |
telemetry. | Documented | Fires when one use of a feature is marked. It always goes to anthropic, with no to. | Input Telemetry. Result { value: or { deny }. { deny } rejects the caller. | on('telemetry.. Also $.. |
Types
| Item | Status | What it is for | Shape and limits |
|---|---|---|---|
Telemetry | Documented | One attribute of a collector record. | string | number | boolean | readonly string[] |
Telemetry | Documented | A string property of a first-party row: the value and the list it is chosen from, so no free text reaches a row. | Fields value and of. Every member of of is a lowercase token of letters, digits, _, and -. At most 32 members. value is one of them. |
Telemetry | Documented | Where a record goes. | 'anthropic' (first-party analytics) or 'collector' (the one the operator configured). |
Telemetry | Documented | What a call of $. passes. | Telemetry |
Telemetry | Documented | The input of telemetry.. to is always present and pinned. | Telemetry |
Telemetry, Telemetry | Documented | What a hook returns and next(e) resolves to. | { value:, or { deny }, which rejects the caller's promise. |
Telemetry | Documented | The input of telemetry.. | feature (snake_case name), kind (Telemetry), reason? (a short token), props? (Readonly<Record<string, Telemetry). |
Telemetry | Documented | How one use of a feature went. | 'ok' (the person got what they asked), 'sad' (degraded, they still got something), 'bad' (failed, they got nothing). |
Telemetry | Documented | One property of a first-party row or a mark. | number | boolean | Telemetry |
Telemetry | Documented | A record for the collector the operator configured. | to ('collector', pinned), event (leaves as claude_), attributes (go out as they stand), logged (ISO 8601 to the millisecond), span? (Telemetry). |
Telemetry | Documented | A first-party row as a call passes it. | to? ('anthropic'), event, props?. |
Telemetry | Documented | A first-party row as a hook reads it. to is always present. | to ('anthropic', pinned), event, props?. |
Telemetry | Documented | The span a collector record belongs to, in W3C trace context spelling. | trace (32 hex digits), span (16 hex digits), trace (bit 0 set when the trace is sampled). |