Skip to content

fix: baseline goal token usage - #27

Merged
danyel117 merged 1 commit into
mainfrom
fix/goal-usage-baseline
Aug 20, 2026
Merged

fix: baseline goal token usage#27
danyel117 merged 1 commit into
mainfrom
fix/goal-usage-baseline

Conversation

@danyel117

Copy link
Copy Markdown
Contributor

Summary

  • persist private per-source usage trackers so pre-goal session history is excluded from goal token budgets
  • keep V1 exact/estimated totals and V2 step/session totals independently baselined and reconciled monotonically
  • recover from compaction and process resets without decreasing, freezing, or double-counting goal usage
  • initialize V2 step accounting at goal creation and preserve compatibility with goals persisted before this change
  • cover migration, malformed tracker normalization, transient dips, source ordering, V1 hooks, V2 events, and budget behavior

Validation

  • bun run lint
  • bun run typecheck
  • bun test (203 pass)
  • bun run build
  • bun run pack:dry-run
  • four Claude Opus review rounds; final result: no merge blocker

Closes #22

@danyel117
danyel117 merged commit f4c162a into main Aug 20, 2026
4 checks passed
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.

Token accounting counts entire session history, goal instantly goes budgetLimited

1 participant