Skip to content

Web export missing per-bubble token counts and aggregated cost metadata #6

Description

@wpak-ai

Problem

The web bulk export (POST /api/export) produces Markdown files that are missing
several fields visible in the UI for each conversation:

Per-message metadata line — the UI shows token counts (input, output, cached)
for each AI bubble in the workspace view, but the exported Markdown omits them
entirely.

Frontmatter — the following aggregated fields shown in the UI tab summary are
absent from the exported frontmatter:

  • workspace_name (human-readable, URL-decoded folder name)
  • total_input_tokens
  • total_output_tokens
  • total_cached_tokens
  • total_cost_usd

This violates the "what you see is what you get" principle: content clearly
visible in the browser disappears in the exported file.

Fix

  • Extract tokenCount from each raw bubble in cursorDiskKV and include
    inputTokens, outputTokens, cachedTokens in the per-bubble data
    structure, then render them as _In: X / Out: Y / Cached: Z_ in the
    Markdown metadata line.
  • Aggregate the above into total_input_tokens, total_output_tokens,
    total_cached_tokens for the frontmatter.
  • Derive total_cost_usd from the composer's usageData.cost /
    usageData.estimatedCost field.
  • Always include workspace_name (URL-decoded display name) in the frontmatter
    alongside the existing workspace slug.

Affected file

api/export_api.py

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions