🔧 Programmierung 🕛 vor 2 Monaten 4 Min Lesezeit
0

Your AI coding tools are keeping detailed logs on your Mac. Here's what's in them.

↗ Quelle (dev.to)
🗣️ Stimme:
📑 Inhaltsübersicht

Run this in a terminal:




CODE
ls ~/.claude/projects/






If you use Claude Code, you just found a folder for every project you've ever opened it in. Inside each one: JSONL files logging every session, every message, every token. Codex CLI does the same thing in ~/.codex/sessions/. Cursor, Windsurf, Cline, Aider, Continue: all of them keep local logs like this.



Most developers have no idea these files exist. I've been digging through them for months, and they're genuinely useful. Here's a tour.






What one log entry looks like



Each line in a Claude Code JSONL file is one event. The interesting ones are assistant messages, which carry a usage block:




CODE
{
"type": "assistant",
"timestamp": "2026-07-06T21:14:03.812Z",
"sessionId": "a1b2c3d4-...",
"cwd": "/Users/you/projects/my-app",
"message": {
"model": "claude-sonnet-5",
"usage": {
"input_tokens": 4,
"output_tokens": 512,
"cache_creation_input_tokens": 12034,
"cache_read_input_tokens": 148220
}
}
}






Five things worth noticing:





  1. The model is recorded per message. Not per session. If Claude Code switched models mid-session, it's in here.


  2. cwd is the project directory. This is the field that makes per-project cost analysis possible.


  3. Cache tokens dwarf everything else. Look at that cache_read_input_tokens number. In a long agentic session, cache reads are routinely 95%+ of all tokens. This is why agentic coding is affordable at all: cache reads are billed at a tenth of the input price.


  4. sessionId lets you resume. claude --resume <sessionId> reopens that exact conversation. Your whole history is addressable.


  5. It's all plaintext on your disk. More on that at the end.






Total your tokens in one line



Want your lifetime output token count? jq does it:




CODE
cat ~/.claude/projects/*/*.jsonl 2>/dev/null \
| jq -s '[.[] | .message.usage.output_tokens // 0] | add'






Swap in cache_read_input_tokens and the number gets absurd. Mine is in the billions.






Turning tokens into dollars



Multiply by published API prices and the logs become a cost report. Current Anthropic list prices per million tokens for Sonnet-class models: $3 input, $15 output, $3.75 cache write, $0.30 cache read. So a quick estimate:




CODE
cat ~/.claude/projects/*/*.jsonl 2>/dev/null | jq -s '
[.[] | .message.usage // empty] |
(([.[].input_tokens // 0] | add) * 3
+ ([.[].output_tokens // 0] | add) * 15
+ ([.[].cache_creation_input_tokens // 0] | add) * 3.75
+ ([.[].cache_read_input_tokens // 0] | add) * 0.30) / 1000000
'







That prints your all-time Claude Code usage in API-equivalent dollars (roughly, assuming Sonnet pricing for everything). If you're on a Pro or Max subscription, this is a number Anthropic never shows you. /cost only works for API users. Comparing it against your plan price answers a question a lot of people are currently arguing about without data: whether the subscription is worth it for you.



Codex logs are shaped differently (rollout files, with reasoning tokens tracked separately inside the usage object) but the same idea applies.






Where every tool keeps its logs












































Tool Location
Claude Code ~/.claude/projects/
Codex CLI ~/.codex/sessions/
Claude Desktop ~/Library/Application Support/Claude/
Cursor ~/.cursor/projects/
Windsurf ~/.windsurf/
Cline ~/.cline/
Aider ~/.aider/
Continue ~/.continue/sessions/


Formats vary (Aider logs through litellm, Continue uses plain JSON) but they all record models and token counts.






The part you should actually think about



These logs also contain your conversations: prompts, file paths, project names, fragments of your code. Locally, that's fine, arguably great. But it means two things.



First, if you back up your home directory to a cloud service, your AI pair-programming history goes with it. Worth knowing.



Second, be skeptical of any "AI usage analytics" tool that wants to upload these files to give you a dashboard. There is nothing in the analysis that requires a server. It's multiplication.






I got tired of running jq, so I built the dashboard



The one-liners above got me hooked, and then annoyed. So I built



Free to build from source; there's a $9 signed build if you don't want to. But honestly, even if you never touch my app, go run that ls command. Your usage history has been sitting there this whole time, and the numbers in it will probably change how you use these tools.



What's in your logs? I'm curious whether anyone else's cache-read ratio is as lopsided as mine.

Vollständiger Original-Artikel
Den kompletten Beitrag mit allen Details direkt auf dev.to lesen.
↗ Original-Artikel auf dev.to lesen
Wie bewertest du diesen Beitrag?
1 Klick Feedback
Teilen mit Netzwerk & Team:

Community-Analysen & Experten-Meinungen 0

Verfasse deine eigene Analyse, teile Workarounds oder diskutiere diesen Vorfall im Blog.
Noch keine Community-Analyse verfasst. Markiere einen Textabschnitt oder klicke oben auf Eigene Analyse verfassen“!
Community Pulse: Relevanz-Einschätzung
1 Klick Experten-Votum
🔴 Akute Relevanz 0%
🟡 In Evaluierung 0%
🟢 Keine Auswirkung 0%
Spannende Innovation 0%
Verwandte Story-Cluster & Quellen (Vektor-KI)
Port 8095 Engine
6 Quellen
CVE-2022-44255 | TOTOLINK LR350 9.3.5u.6369_B20220309 buffer overflow (EUVD-2022-47204)
2 Quellen
CVE-2026-68426 | Linux Kernel up to 6.18.41/7.1.5/7.2-rc3 xfrm validate_xmit_skb_list use after free (Nessus ID 346426)
1 Quelle
Windows 11 Probleme mit gültiger Domänenanmeldung nach September-Update [Workaround]
Ähnliche Beiträge
🔍 Verwandte News

Auch interessante Nachrichten Your AI coding tools are keeping detailed logs on your Mac. Here's what's in them.

Thematisch verwandte Begriffe: Your, coding, tools, keeping · 6 Treffer

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...