Skip to content

Let users download their logged data from the account page - #701

Open
kcarnold wants to merge 1 commit into
mainfrom
claude/download-my-data
Open

kcarnold wants to merge 1 commit into
mainfrom
claude/download-my-data

Conversation

@kcarnold

@kcarnold kcarnold commented Nov 2, 2026

Copy link
Copy Markdown
Contributor

Adds a Download my data section to the account page with three choices: Today, Past 7 days, and Everything.

Backend

  • GET /api/me/data[?since=<epoch ms>] returns one JSON attachment: { exported_at, since, user_id, events, usage }
    • events: the user's study-log JSONL entries (in the shape they were written)
    • usage: their llm_usage rows (content-free billing records)
  • Tool callers are refused (clientId set, which covers wtk_ grant tokens and device clients that identify themselves). They were granted AI calls, not a read of the user's history. Mindmap OAuth tokens are already rejected by resolveUser; this route is now in the e2e "elsewhere" list.
  • 400 on a malformed since.

Frontend

  • downloadMyData(token, since?) in api/account.ts. It uses fetch + blob because the route needs a bearer token, which a plain <a href> can't send.
  • "Today" means the viewer's local midnight and is computed on the client. "Past 7 days" is a rolling 168 hours.

Docs

  • Updated the privacy policy's "Access" bullet. It now describes the self-service download and says the PostHog profile is not included.
  • Added a note to backend/CLAUDE.md.

Tests

  • Backend: export contents, user isolation, since filtering, bad since, 401. All 140 tests pass.
  • Frontend: the API wrapper's URL and auth. The vitest suites under src/api and src/account pass.

Generated by Claude Code

Adds GET /api/me/data (optional since=epoch ms) returning the user's
study-log events and LLM usage rows as one JSON attachment, and a
'Download my data' section on the account page with Today / Past 7
days / Everything. 'Today' is computed client-side from local midnight.
Tool callers are refused: they were granted AI calls, not a read of the
user's history.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017KwGFfNCjAkLnb8nq62Swt
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.

2 participants