feat(optimize): flag low-worth expensive sessions#241
Closed
ozymandiashh wants to merge 1 commit into
Closed
Conversation
Member
|
Superseded by #247, which preserves your original intent and integrates the review fixes cleanly on top of #246's dedup pattern. Found via real-data probe (22.6K sessions / $4.8K spend):
Plus 17 new tests for the detector (including Closing in favor of #247. The detector concept is solid — "weak delivery signal" catches a class of waste that cost outliers and context bloat both miss. |
iamtoruk
added a commit
that referenced
this pull request
May 6, 2026
Adds a low-worth detector to codeburn optimize that flags expensive sessions with weak delivery signals (no edits, repeated retries, or no one-shot edits) when no git/gh delivery command is observed. Priority order is low-worth → context-bloat → outliers; each later detector excludes sessions named by an earlier one so the same session is never listed in three findings. Detection: floor, for no-edit, 3+ retries, regex matches git commit/push and gh pr create/merge but excludes commit-tree/commit-graph and dry-run. Three impact tiers consistent with #246. Token-savings uses full session tokens for no-edit sessions and the retry fraction for edit-with-retry sessions. Supersedes #241 with review fixes. Original implementation by @ozymandiashh.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This adds a Worth-it Score style detector to
codeburn optimizeso expensive sessions with weak delivery signals are easy to review before they become a habit.git commit,git push,gh pr create, andgh pr mergeas delivery signals, while ignoring dry-run commands and read-only git commands likegit tag -lDetection model
The detector is intentionally heuristic and bounded:
$2are ignored entirely$3spend before they are reportedFor compatibility with older parsed data, the implementation reads aggregate
categoryBreakdowndata when present and falls back to rawturnswhen the aggregate is empty.Validation
npx vitest run tests/optimize.test.tsnpm run buildnpx vitest runnode dist/cli.js optimize --helpgit diff --checknpx tsc --noEmitstill fails on the existing Copilot provider type errors insrc/providers/copilot.ts, outside this diff. The same failure is present onorigin/main.