---
name: kiro-usage-telemetry
description: Analyzes and reports Kiro AI IDE telemetry data, token usage, credit limits, and chat logs from local SQLite databases and log directories on Windows.
license: MIT
metadata:
  author: User
  version: "1.0"
---

# Kiro Usage Telemetry Skill

This skill enables an AI Agent to extract, analyze, and report telemetry data generated by the Kiro IDE. It parses local data storage (SQLite databases, `.chat` history records, and session logs) which reside in the Windows `%APPDATA%\Kiro` directory.

## Capabilities

By utilizing the predefined scripts bundled in the `scripts/` directory, you can inspect:
1. **Credit Usage & Tokens:** Pull lifetime token counts from Kiro's internal tracking DB and compare them against the user's allocated monthly invocations.
2. **Chat & Session Analysis:** Count bot vs human interactions and map out failed operations (such as `webFetch` limits or tool invocation errors) from the JSON-encoded chat histories.
3. **Log Traversal:** Review application events from the `logs/` directory.

## Instructions for Agents

When a user asks to inspect their Kiro telemetry, logs, or credit usage, follow these steps:

1. **To retrieve credit and token metrics:**
   Run the `analyze_credits.py` script.
   ```bash
   python scripts/analyze_credits.py
   ```
   This will output the current used vs available credits (evaluated in "INVOCATIONS") and the total lifetime prompt tokens (from `devdata.sqlite`). If the percentage used is over 80%, explicitly warn the user.

2. **To retrieve chat history and identify tool failures:**
   Run the `parse_chats.py` script.
   ```bash
   python scripts/parse_chats.py
   ```
   This script parses all 32-character hexadecimal session folders stored in `%APPDATA%\Kiro\User\globalStorage\kiro.kiroagent\`. It provides a summary of messages and isolates occurrences where Kiro attempted a `tool` action but encountered an "Error" state. Highlight any of these failures to the user.

## Data Locations Reference

If you need to query custom data manually, be aware of these Windows path structures:
* **Global State (Credits):** `%APPDATA%\Kiro\User\globalStorage\state.vscdb`
* **Tokens Dataset:** `%APPDATA%\Kiro\User\globalStorage\kiro.kiroagent\dev_data\devdata.sqlite`
* **Chat JSON Histories:** `%APPDATA%\Kiro\User\globalStorage\kiro.kiroagent\[session-hash]\*.chat`
* **Session Logs:** `%APPDATA%\Kiro\logs\[session-timestamp]\`
