Skip to content
SlashClone

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.

SkillDatav1.0.0 (latest)Tested
Activity
New: be the first to try it
  1. 1# Retention cohorts
  2. 2
  3. 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.
  4. 4
  5. 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.
  6. 6
  7. 7## Example
  8. 8
  9. 9Input: `examples/events.csv` (about 1,250 events from about 130 users over 12 months).
  10. 11Output (`out/retention.md`):
  11. 13| Cohort | Size | M0 | M1 | M2 | M3 |
  12. 14| --- | --- | --- | --- | --- | --- |
  13. 15| 2025-11 | 11 | 100% | 27% | 27% | 27% |
  14. 16| 2026-06 | 9 | 100% | 78% | 56% | 56% |
  15. 18```
  16. 19Average curve: M1 58%, M2 48%, M3 45%, M4 40%.
  17. 20Best M1: 2026-06 (78%). Worst M1: 2025-11 (27%).
  18. 21```
  19. 23Plus `out/retention.csv` for a spreadsheet heatmap and `out/retention.json`.
  20. 25## What it can access
  21. 27- Runs `node scripts/cohorts.mjs` (Node built-ins only).
  22. 28- Reads `data/`. Writes `out/retention*`.
  23. 29- No network.
  24. 31## Setup
  25. 33None. Export events (`timestamp, account_id, user_id, event`) to `data/events.csv` and ask Claude for retention cohorts.