Retention cohorts
@usagemetrics/retention-cohorts
Build weekly or monthly retention cohorts for users or accounts from an events CSV. Writes the cohort table, a size-weighted average curve, where the curve flattens, and the best and worst cohorts, as markdown, CSV, and JSON.
- Activity
- New: be the first to try it
- Installs
- 0 installs
- Likes
- 0 likes
- Clones
- 0 clones
- 1# Retention cohorts
- 3Builds the retention triangle from a product events export: weekly or monthly cohorts, by user or by account, with a size-weighted average curve and a note on where it flattens. Partial periods stay blank instead of showing up as fake drops.
- 5**Who it is for:** product managers, founders, and growth folks who need to answer "is retention getting better?" for a product review or board deck.
- 7## Example
- 9Input: `examples/events.csv` (about 1,250 events from about 130 users over 12 months).
- 11Output (`out/retention.md`):
- 13| Cohort | Size | M0 | M1 | M2 | M3 |
- 14| --- | --- | --- | --- | --- | --- |
- 15| 2025-11 | 11 | 100% | 27% | 27% | 27% |
- 16| 2026-06 | 9 | 100% | 78% | 56% | 56% |
- 18```
- 19Average curve: M1 58%, M2 48%, M3 45%, M4 40%.
- 20Best M1: 2026-06 (78%). Worst M1: 2025-11 (27%).
- 21```
- 23Plus `out/retention.csv` for a spreadsheet heatmap and `out/retention.json`.
- 25## What it can access
- 27- Runs `node scripts/cohorts.mjs` (Node built-ins only).
- 28- Reads `data/`. Writes `out/retention*`.
- 29- No network.
- 31## Setup
- 33None. Export events (`timestamp, account_id, user_id, event`) to `data/events.csv` and ask Claude for retention cohorts.
