[
    {
        "role": "user",
        "content": "in%20%7E%2F.claude%2C%20I%20have%20stats-cached.json.%20what%20is%20this%20file%3F"
    },
    {
        "role": "assistant",
        "content": "`stats-cache.json` is a file used by **Claude Code** (by Anthropic) to store pre-aggregated usage statistics. Here\u2019s a breakdown of what it is, what it contains, and what you can do with it:\n\n---\n\n## What is `stats-cache.json`?\n\n- It lives in the `~/.claude/` directory (Unix-based home directory). ([gist.github.com](https://gist.github.com/samkeen/dc6a9771a78d1ecee7eb9ec1307f1b52?utm_source=openai))  \n- It captures historical usage data: number of sessions, messages, tool calls, token usage per model, timestamps, etc. ([gist.github.com](https://gist.github.com/samkeen/dc6a9771a78d1ecee7eb9ec1307f1b52?utm_source=openai))  \n- This is not raw transcript data\u2014it\u2019s more of a summary or a cache of data derived from your history/session logs. ([mintlify.com](https://www.mintlify.com/1shanpanta/claude-analytics/guides/understanding-data?utm_source=openai))\n\n---\n\n## Key Contents / Schema\n\nHere are the major fields you\u2019re likely to see in the file, based on current versions:\n\n| Field | What it Represents |\n|---|---|\n| `version` | Schema version of the cached stats. ([gist.github.com](https://gist.github.com/samkeen/dc6a9771a78d1ecee7eb9ec1307f1b52?utm_source=openai)) |\n| `lastComputedDate` | The date when stats were last updated. ([gist.github.com](https://gist.github.com/samkeen/dc6a9771a78d1ecee7eb9ec1307f1b52?utm_source=openai)) |\n| `firstSessionDate` | When you first used Claude Code. ([gist.github.com](https://gist.github.com/samkeen/dc6a9771a78d1ecee7eb9ec1307f1b52?utm_source=openai)) |\n| `totalSessions`, `totalMessages` | Lifetime counts of how many sessions and messages you\u2019ve had. ([mintlify.com](https://www.mintlify.com/1shanpanta/claude-analytics/guides/understanding-data?utm_source=openai)) |\n| `dailyActivity` | Array of objects, one per day: number of sessions, messages, tool-uses per day. ([mintlify.com](https://www.mintlify.com/1shanpanta/claude-analytics/guides/understanding-data?utm_source=openai)) |\n| `dailyModelTokens` | Token usage per day, broken down by model. ([mintlify.com](https://www.mintlify.com/1shanpanta/claude-analytics/guides/understanding-data?utm_source=openai)) |\n| `modelUsage` | Aggregate usage per model: input tokens, output tokens, cache reads/writes, etc. ([mintlify.com](https://www.mintlify.com/1shanpanta/claude-analytics/guides/understanding-data?utm_source=openai)) |\n| `hourCounts` | What hours of day you use Claude Code most (0-23). ([mintlify.com](https://www.mintlify.com/1shanpanta/claude-analytics/guides/understanding-data?utm_source=openai)) |\n| `longestSession` | Info on your longest session so far: session ID, duration, message count. ([gist.github.com](https://gist.github.com/samkeen/dc6a9771a78d1ecee7eb9ec1307f1b52?utm_source=openai)) |\n\n---\n\n## What It\u2019s Used For\n\n- Showing usage stats via in-terminal command like `/stats`. ([tilomitra.com](https://www.tilomitra.com/blog/claude-stats-public?utm_source=openai))  \n- Generating dashboards or visualizations (active days, token usage, etc.). ([tilomitra.com](https://www.tilomitra.com/blog/claude-stats-public?utm_source=openai))  \n- Estimating \u201ccosts\u201d of usage locally\u2014input/output tokens, but note: cache reads/writes may not always count fully toward billing. ([reddit.com](https://www.reddit.com/r/ClaudeCode/comments/1raqnl5/claude_code_stats_seems_to_underreport_usage_vs/?utm_source=openai))  \n\n---\n\n## What It Doesn\u2019t Include / Caveats\n\n- It\u2019s not a full record of every interaction (those are in session transcripts elsewhere in `~/.claude/projects/`). ([gist.github.com](https://gist.github.com/samkeen/dc6a9771a78d1ecee7eb9ec1307f1b52?utm_source=openai))  \n- Cache-read tokens or token savings via caching may not map directly to actual API billing. Some cached tokens are \u201cfree\u201d or heavily discounted. ([reddit.com](https://www.reddit.com/r/ClaudeCode/comments/1raqnl5/claude_code_stats_seems_to_underreport_usage_vs/?utm_source=openai))  \n- Because stats are derived/cached periodically, very recent activity may not be reflected until the file updates. ([gist.github.com](https://gist.github.com/samkeen/dc6a9771a78d1ecee7eb9ec1307f1b52?utm_source=openai))  \n\n---\n\n## Can I Delete It / Maintain It?\n\n- Yes\u2014you *can* delete it. Doing so will clear out these summary stats. Claude Code will start rebuilding them from whatever older logs it still has (session logs, history) as you continue to use it. ([code.claude.com](https://code.claude.com/docs/en/claude-directory?utm_source=openai))  \n- It\u2019s safe in that you won\u2019t lose conversations, transcripts, or major data. But you'll lose the convenience of aggregated usage insights until the cache is rebuilt. ([code.claude.com](https://code.claude.com/docs/en/claude-directory?utm_source=openai))  \n\n---\n\nIf you want, I could help you read your `stats-cache.json` and interpret your usage (e.g. tokens per model, recent trends). Do you want me to walk through that with you?"
    },
    {
        "role": "user",
        "content": "cool.%20I%20see%20there%20is%20a%20projects%20directory%20in%20%7E%2F.claude.%20It%20seems%20to%20map%20to%20the%20various%20directories%20I%27ve%20started%20claude%20in.%20Is%20this%20where%20it%20stores%20its%20per-project%20memories%3F"
    },
    {
        "role": "assistant",
        "content": "Yes \u2014 that `~/.claude/projects/` directory *is* where Claude Code stores its **per-project memories**. Here\u2019s how it works and what you\u2019ll see there:\n\n---\n\n## How Per-Project Memory Works\n\n- Claude Code has an **auto-memory system** that learns about your project (conventions, decisions, preferences, etc.) and saves useful details between sessions. These become part of the project\u2019s memory. ([code.claude.com](https://code.claude.com/docs/en/memory?utm_source=openai))\n- Memory is stored per project, meaning each git repository or working tree gets its own memory, even across subfolders or multiple worktrees of the same repo. ([code.claude.com](https://code.claude.com/docs/en/memory?utm_source=openai))\n\n---\n\n## What\u2019s in Each Project\u2019s Memory Directory\n\nInside `~/.claude/projects/<project-path>/memory/` you\u2019ll typically find:\n\n| File / Folder | Purpose |\n|---------------|---------|\n| **MEMORY.md** | The primary index file. Claude loads the first ~200 lines (or up to ~25 KB) of this file at the start of every session. It contains important recurring context (e.g. \u201cwe use pnpm,\u201d \u201ctests are in `__tests__/`\u201d). ([code.claude.com](https://code.claude.com/docs/en/memory?utm_source=openai)) |\n| Other `.md` files (e.g. `debugging.md`, `api-conventions.md`) | Topic-specific notes, patterns, and details that are useful but not loaded by default. Claude reads them only when needed. ([code.claude.com](https://code.claude.com/docs/en/memory?utm_source=openai)) |\n\n---\n\n## Manual vs. Automatic\n\n- **CLAUDE.md / CLAUDE.local.md**: These are manually written files that you create (in your project, user, or organization directories). They store project standards, build commands, rules, workflows. Claude reads them every session. ([code.claude.com](https://code.claude.com/docs/en/memory?utm_source=openai))  \n- **Auto-Memory (MEMORY.md etc.)**: Automatically maintained by Claude Code based on what it notices in your conversations (common mistakes, preferences you express, patterns in your code). You can turn it off if you want. ([code.claude.com](https://code.claude.com/docs/en/memory?utm_source=openai))\n\n---\n\n## Things to Know\n\n- **Truncation limits**: The first 200 lines (or ~25KB) of `MEMORY.md` are loaded per session. Anything beyond that isn\u2019t loaded by default. ([code.claude.com](https://code.claude.com/docs/en/memory?utm_source=openai))  \n- **Local-only**: These memory files are stored locally on your machine. They\u2019re *not* version-controlled with your repo (unless you manually copy or symlink them), and they don\u2019t automatically sync between machines. ([code.claude.com](https://code.claude.com/docs/en/memory?utm_source=openai))  \n- **Editable**: You can edit or clear your memory files whenever you want (rename `MEMORY.md`, delete topic files, disable auto memory, etc.). ([code.claude.com](https://code.claude.com/docs/en/memory?utm_source=openai))  \n\n---\n\nIf you like, I can help you inspect your own project\u2019s memory files (see what\u2019s stored, how much, maybe even suggest what to clean up). Do you want to do that?"
    }
]