Skip to content

kew backfill-first-edit

Derive steps/tokens-to-first-edit from existing dispatch transcripts and persist them onto their run records (spec D2 — the context-memory measurement substrate).

Replays each run's stream-json log_file, finds the first Edit/Write/MultiEdit tool call, and records how many model-response steps and cumulative tokens the run spent before it. Runs that never edited stay NULL (never 0). New runs populate these columns automatically at finalization; this command establishes the baseline for runs that predate the metric.

Usage: kew backfill-first-edit [OPTIONS]

Options:
  --days INTEGER  Backfill runs started within the last N days (0 = all history).
                  [default: 14]
  --force         Re-derive metrics even for runs already populated.

Example:

# Backfill the last two weeks (the default baseline window)
kew backfill-first-edit

# Backfill all history, re-deriving any previously-populated rows
kew backfill-first-edit --days 0 --force