v13.5.3

thedotmack/claude-memv13.5.3Jun 10, 2026by thedotmack

AI Summary

Major telemetry overhaul fixing four session_compressed data-quality bugs and introducing real provider-reported analytics. Claude token counts now use finalized SDK results, cost_usd is populated from actual API data, compression ratios are validated, and model fields are correctly populated.

Key Highlights

  • Fixed Claude token counts: now uses SDK result message instead of early-streaming placeholder (verified: 8 → 45 tokens)
  • Fixed cost_usd: Claude uses SDK cumulative delta, OpenRouter uses API usage.cost, Gemini honestly reports no cost
  • Fixed compression ratios: eliminates impossible values (<1 or 0.0), requires both-sides input > 0
  • Fixed model field: uses response.model instead of configured string, normalizes arrays, error events now include model
  • New install-state snapshot: worker_started reports aggregate DB stats as person properties (counts, DB size, install age, activity deltas)

New Features

  • Real provider-reported token counts and cost data in session_compressed events
  • Install-state snapshot with aggregate memory DB statistics (observation/session/summary/project counts, DB size, install age, recent activity)
  • New endpoint_class property (openrouter | custom) for dashboard segmentation
  • Fixed IDE person property lookup (was querying legacy table)
  • Fixed epoch math for legacy seconds-unit rows

Full Release Notes

## Telemetry: real data edition

Every analytics number claude-mem reports about itself is now real, provider-reported data — plus a new daily install-state snapshot so we can see the actual state of the installed base.

### Fixed: the four session_compressed data-quality bugs

- **Claude token counts were placeholders.** The Agent SDK attaches an early-streaming usage snapshot to assistant messages (`output_tokens` of ~2–10, regardless of actual output). The `session_compressed` event is now fired from the SDK **result** message, which carries the finalized per-turn usage — verified empirically (placeholder said 8, result said 45). Compression ratios for Claude models drop from a nonsensical 6,000–38,000 to the true ~10–100 range.
- **`cost_usd` is now real and populated.** Claude: computed from the SDK's cumulative `total_cost_usd` delta between consecutive turns. OpenRouter: `usage.cost` + `cost_details.upstream_inference_cost` (covers BYOK), with usage accounting requested from openrouter.ai only. Gemini reports no cost, so the field stays honestly absent — never estimated.
- **Impossible compression ratios (< 1, or exactly 0.0) eliminated.** Custom OpenAI-compatible gateways that report suffix-only or one-sided token usage can no longer produce half-real events: usage is now both-sides-or-nothing, ratios require input > 0, and a new `endpoint_class` property (`openrouter` | `custom`) lets dashboards segment gateway-reported data.
- **`model` is never silently missing or wrong.** The model that actually served the request (`response.model`) is stamped instead of the raw configured string, array-typed model settings are normalized, error-path events now carry the model, and `unknown` is the floor everywhere — non-string values previously vanished in the telemetry scrubber.

### New: install-state snapshot

`worker_started` (start + daily heartbeat) now reports an aggregate snapshot of the local memory DB as person properties: observation/session/summary/project counts, DB file size, install age in days, observations in the last 7/30 days, and days since the last observation. Counts and day-deltas only — never project names, text, or any content. Makes retention, scale, and activity cohorts directly sliceable in analytics.

### Also fixed

- The `ide` person property on `worker_started` never populated — the lookup queried a legacy table and silently threw on every start since it shipped.
- Epoch math now normalizes legacy seconds-unit rows (a few hundred per install) that would have reported install ages of ~20,000 days.

All new properties are whitelisted in the scrubber, documented at https://docs.claude-mem.ai/telemetry, and shown in the `npx claude-mem telemetry` consent screen. Telemetry remains anonymous and opt-out (`npx claude-mem telemetry disable`).

🤖 Generated with [Claude Code](https://claude.com/claude-code)