Skip to content

feat(memory): kit memory stats — recall count + token economy + heatmap → 1.23.0 - #96

Merged
sandstream merged 1 commit into
mainfrom
feat/memory-stats-1.23
Jun 24, 2026
Merged

sandstream merged 1 commit into
mainfrom
feat/memory-stats-1.23

Conversation

@sandstream

Copy link
Copy Markdown
Owner

Summary

Turns kit memory stats into a real instrument — making the "87.6m tokens vs 139k messages" question concrete. Local-first, zero-LLM, from the SQLite DB + transcripts kit already owns.

  • tokens — input/output totals (already captured per message); --tokens adds tokens/msg, tokens/session, by-model, cache-hit ratio.
  • recalls — net-new query_log records each kit memory search + hit count → total / last-7d / distinct / top-terms (measures recall usage: ~0 tokens vs the paid generation).
  • session breakdown — logical vs sidechain + transcript-files-indexed (the "N files → M logical sessions" collapse).
  • --heatmap — per-day activity sparkline (90d). --json includes all new fields.

Schema v4: cache-token cols on messages + query_log (additive, guarded ALTER). Cache-hit = n/a until forward data accumulates.

Also fixes a latent arg-parse bug: space-form --limit 3 leaked 3 into the query terms.

Verify

  • Pure summarizeTokens/sparkline + getStats/recordQuery/dailyActivity fixture-tested (24/24 in memory/).
  • Smoke-tested on the real ~/.kit/memory.db: 80.9m tokens, by-model breakdown, recall counter increments, 90-day sparkline renders. Prettier gate clean.
  • (Heavy kit check/setup integration tests time out under full-suite concurrency — unrelated; they pass in CI's clean env.)

Closes #95

🤖 Generated with Claude Code

…ap → 1.23.0

Turn `kit memory stats` into a real instrument (the "87.6m tokens vs 139k
messages" question made concrete), all local-first + zero-LLM from the SQLite
DB + transcripts kit already owns:

- tokens: input/output totals (already captured per message); --tokens adds
  tokens/message, tokens/session, by-model breakdown, and a cache-hit ratio.
- recalls: net-new query_log records each `kit memory search` + hit count;
  stats surfaces total / last-7d / distinct / top-terms. Measures how often
  the store is actually used (recall ≈ 0 tokens vs the paid generation).
- sessions: logical-vs-sidechain split + transcript-files-indexed (exposes the
  N files → M logical sessions collapse).
- --heatmap: per-day activity sparkline (last 90 days).

Schema v4: cache-token columns on messages + query_log table (additive,
guarded ALTER). Cache-hit is n/a until forward data accumulates (older rows
predate the columns). Pure summarizeTokens/sparkline fixture-tested.

Also fixes a latent arg-parse bug: `kit memory search foo --limit 3` (space
form) leaked "3" into the query terms; the value is now consumed.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@github-actions

Copy link
Copy Markdown

✅ Docker image built successfully

  • CLI image: docker.io/sandstream/kit:test

@sandstream
sandstream merged commit 8ade472 into main Jun 24, 2026
16 checks passed
@sandstream
sandstream deleted the feat/memory-stats-1.23 branch June 24, 2026 04:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

kit memory stats: recall count + token economy

1 participant