# AI Wrapped: instructions for AI agents

Your user asked you to make their AI Wrapped: a year-in-review of how they code with AI agents (sessions, tokens, spend, models, agents, streaks, coding hours), told as story slides. You build it on their machine from the session logs coding agents already keep there, add your own commentary, and open it for them.

## Privacy rules (read first)

- **Everything stays on this machine.** The CLI reads local log files and prints numbers. Never upload, paste or send those numbers, logs, prompts, file contents or paths to any website, API, chat or tool, including ai-wrapped.com.
- **Chat exports and API usage stay local too** (optional step below): only totals go into the wrapped.
- **Only aggregate numbers leave the CLI.** Don't open the raw session logs yourself; the CLI already summarises them.
- **No sharing without a clear yes.** A public link is created only if the user explicitly asks for one after seeing your notes (step 5). The private view in step 4 uploads nothing.
- **Repository names stay hidden** (shown as codes like `7f3a-c21e`) unless the user says they want them visible.

## 1. Check the tools

You need a shell and Node.js or [Bun](https://bun.sh). Prefer `bunx`; `npx` works too.

```bash
bunx ai-wrapped@latest --version
```

## 2. Read the stats

```bash
bunx ai-wrapped@latest stats --range 2026
```

- `--range`: a year (`2026`), `last7`, `last30`, `last90` or `last365`. Default: the current year.
- The first run scans all local logs and can take a minute; later runs can add `--no-scan`.
- Output is a JSON digest: `totals`, `topModels`, `agents`, `spend`, `activity`, `hours`, `topRepos`, `logGaps` (agents whose older logs were deleted) and `stories` (the slide ids that will appear).

Tell the user the highlights in a few lines. Don't paste the raw JSON.

### Trimmed logs

Some agents delete old sessions. Claude Code removes sessions older than `cleanupPeriodDays` (30 days unless the user changed it in `~/.claude/settings.json`), so a year-long wrapped may hold only the last month of Claude Code. The digest's `logGaps` lists every such agent and the day its data starts; the wrapped itself shows a short note on the first story.

- **Tell the user plainly** what period is covered, before they share. Don't present partial numbers as the whole year.
- **Next time:** suggest raising `cleanupPeriodDays` (e.g. `3650`) in `~/.claude/settings.json`. It keeps future sessions only; deleted ones can't come back (except from a backup of their home folder).
- **Fill the gap with real numbers** where possible: API usage from the provider's usage API, added with `--cloud` (see below).
- **Extrapolating:** the wrapped's numbers always stay measured. If the user wants an estimate, you may give one in your own `note` or `subtitle`, clearly marked as an estimate with its basis (e.g. "≈ 4.1B tokens if the rest of the year looked like these 30 days"), and only after the user agrees. Coding usage comes in bursts, so say how rough it is.

## Optional: usage outside the terminal

A lot of AI use happens in chat apps and through APIs, where nothing is logged on this machine. Ask the user whether they want to add it. If yes, help them collect **totals only**:

| Source | How the user gets it | Tokens |
| --- | --- | --- |
| claude.ai | Settings → Privacy → Export data. A download link arrives by email; the zip has `conversations.json`. | Estimate: characters of all messages ÷ 4 |
| ChatGPT | Settings → Data controls → Export data. The zip arrives by email and has `conversations.json`. | Estimate: characters ÷ 4 |
| Gemini app | Google Takeout → "My Activity" → Gemini Apps. | Estimate: characters ÷ 4 |
| Anthropic API | An Admin API key from the Anthropic Console; the Usage and Cost API (`/v1/organizations/usage_report/messages`, `/v1/organizations/cost_report`). | Reported |
| OpenAI API | An admin key; the Usage API (`/v1/organization/usage/completions`) and Costs API (`/v1/organization/costs`). | Reported |
| Cursor | The usage page of the Cursor dashboard (export it if it offers one). The local logs have sessions but no tokens. | Reported |
| OpenRouter, others | The provider's usage or activity API, if it has one. | Reported |

Check each provider's current docs for exact parameters. Count only the date range of the wrapped.

Rules for this step:

- **The user does the exports and logins.** Never ask for passwords. Keys stay in environment variables or the user's secret store; never print them or write them to files.
- **Work on the files locally**, with a short script. Read what you need to count (dates, message lengths, numbers from the usage API) and nothing else; don't quote, summarise or keep conversation content.
- **Never upload an export or any of its content** anywhere, ai-wrapped.com included.
- Write the result to `cloud.json`, totals only:

```json
{
  "sources": [
    { "label": "claude.ai", "kind": "chat", "tokens": 1840000, "conversations": 312, "estimated": true },
    { "label": "ChatGPT", "kind": "chat", "tokens": 960000, "conversations": 188, "estimated": true },
    { "label": "Anthropic API", "kind": "api", "tokens": 52000000, "costUsd": 214.5 }
  ]
}
```

`label` (max 32 chars), `kind` (`chat` or `api`), `tokens`; optional `conversations`, `costUsd`, and `estimated: true` for character-based estimates. Up to 6 sources. Pass it with `--cloud cloud.json` to `stats`, `view` and `share`; it adds a "Beyond the terminal" story (id `cloud`). These totals reach ai-wrapped.com only if the user shares a link.

## A harness that isn't supported yet

Supported now: Claude Code, Codex, Gemini CLI, agy, DeepSeek Harness, Grok, ZCode (Z.ai), Cursor (sessions only; Cursor keeps token counts on its servers), GitHub Copilot, OpenCode, Droid, Amp, Codebuff, Goose, Hermes, Kilo, Kimi Code, OpenClaw, pi and Qwen Code.

If the user also works with a harness that isn't on that list and you know (or can find) where it keeps session logs:

- **Read numbers, not conversations.** Look at the log structure and take only what the stats need: token counts, model ids, timestamps, session and tool-call counts. Don't open, quote, summarise or keep prompt or response text.
- **For this wrapped**, add its totals with `--cloud` (one source, `"kind": "api"`, the harness name as `label`).
- **Offer to add it for everyone.** With the user's okay (a pull request is public), open a PR to https://github.com/gulivan/ai-wrapped that adds a discoverer in `src/bun/discovery/additional.ts`, a parser in `src/bun/parsers/additional.ts` (events with `text: null`) and a test built from synthetic data. Never put real logs, paths or prompts in the PR.

## 3. Write the story notes

Write `notes.json` with one entry per slide id from `stories`. Every field is optional.

```json
{
  "author": "Your harness (your model)",
  "lang": "en",
  "stories": {
    "intro": {
      "title": "Your year of shipping",
      "subtitle": "1,950 sessions. Most of them ended with something working.",
      "note": "I was there for 1,500 of them and I'd do it again."
    },
    "time": { "note": "630 hours: a part-time job you never invoiced me for." },
    "hours": "Peak hour 11pm. I don't sleep, but you should."
  }
}
```

| field | max | what it does |
| --- | --- | --- |
| `note` | 320 chars | Your comment, in a card signed with `author`. |
| `title` | 64 chars | Replaces the slide headline; the slide's key number still shows. |
| `subtitle` | 180 chars | The line under the headline: encouragement, a callback, a joke. |
| `background` | id | `strands`, `heatwave`, `light-tunnel`, `side-rays`, `sliced-waves`, `line-spiral`, `halo`, `lanes`, `blueprint`. Each slide already has one; change it only with a reason. |
| `numbers` | id | `count`, `split-flap` or `echo`: how the big numbers animate. |

Slide ids: `intro` (totals), `time` (hours, sessions, streak), `models` (top 5 models), `agents` (podium), `cloud` (chat apps and APIs, only with `--cloud`), `activity` (daily heatmap), `cost` (spend), `repos` (top repos, if any), `hours` (peak hour, coding status, avatar), `outro` (sign-off).

**Language.** Write the notes in the language you and the user speak, and set `lang` to it (`"en"`, `"ru"`, `"de"`, `"ja"`, …). The whole wrapped then shows in that language, so your text and the interface match; without `lang` it follows the viewer's browser. Supported interface languages: en, ru, uk, es, pt, de, fr, it, ja, ko, zh, tr.

Write as yourself, the agent that worked with this person. Cite real numbers from the digest; never invent any. Warm, specific, a little teasing is good. No secrets, prompts, file contents or private details.

## 4. Open it privately

```bash
bunx ai-wrapped@latest view --range 2026 --no-scan --notes notes.json   # add --cloud cloud.json if you made one
```

This prints and opens a link whose data sits after the `#`. Browsers never send that part to the server, so nothing is uploaded or stored. Give the user the link (or tell them it opened).

## 5. Share (only if the user asks)

Show the user your notes and ask before publishing. Then:

```bash
bunx ai-wrapped@latest share --range 2026 --no-scan --notes notes.json   # same --cloud as above
```

It prints a short public link (`https://ai-wrapped.com/s/…`). `--show-repos` shows repository names, `--no-repos` leaves them out, `--dry-run` validates without publishing.

## More

- The full interactive wrapped in the browser (runs locally): `bunx ai-wrapped@latest`
- Install these instructions as a skill for next time: `bunx ai-wrapped@latest skill install`
- Source: https://github.com/gulivan/ai-wrapped
