Skip to content

report: add cost section, fix task stats zeros#343

Draft
deepmasq wants to merge 2 commits intomainfrom
feat/karen-plan-24
Draft

report: add cost section, fix task stats zeros#343
deepmasq wants to merge 2 commits intomainfrom
feat/karen-plan-24

Conversation

@deepmasq
Copy link
Copy Markdown
Contributor

Summary

  • Add section05-costs to Karen daily report: total coins, USD cost, avg cost per conversation, budget utilization %
  • Fix section02-tasks: populate from kanban resolution data instead of hardcoded zeros (issue Fi slack test #8 from plan)
  • Update report instruction text: remove stale "section02 are zero" message

Trade-offs

  • Only counts completed task costs (ktask_coins), not overhead from triage, scheduled tasks, or in-progress threads
  • Per-expert cost breakdown deferred — if needed later, should be structured fields not a freeform string

Karen plan items

Test plan

  • Install Karen on staging, trigger daily report
  • Verify section02-tasks shows real counts (not zeros)
  • Verify section05-costs shows total coins, USD, avg, budget utilization
  • Verify instruction text no longer says "section02 are zero"

🤖 Generated with Claude Code

- add section05-costs to report schema: total coins, USD cost, avg cost
  per conversation, budget utilization percentage
- fix section02-tasks: populate from kanban data instead of hardcoded zeros
- update instruction text: remove stale "section02 are zero" message

trade-off: only counts completed task costs, not triage/scheduled overhead

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Comment thread flexus_simple_bots/karen/karen_bot.py
Comment thread flexus_simple_bots/karen/karen_bot.py
@deepmasq
Copy link
Copy Markdown
Contributor Author

Good catch from @humbertoyusta on the coins-vs-USD redundancy. Plan: drop the USD column and keep coins only — fewer numbers to read and aligned with how budgets are exposed elsewhere. Will push the change.

- drop total_cost_usd and avg_cost_per_conversation USD fields from
  section05-costs; coins are the source of truth (Humberto comment)
- rename avg field to avg_coins_per_conversation, integer division
- revert section02-tasks fix and instruction text update — that work
  belongs to #340 (Humberto comment)

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@deepmasq
Copy link
Copy Markdown
Contributor Author

@hbenoit thanks — both addressed in 51db872:

  1. karen_bot.py:376 (already in fix report stats: populate task counts from kanban #340) — reverted the section02-tasks fix and the instruction text update on this branch. That work stays in fix report stats: populate task counts from kanban #340. This PR now only adds section05-costs.
  2. karen_bot.py:190 (coins vs USD) — dropped total_cost_usd and the USD-titled avg_cost_per_conversation. Renamed the avg field to avg_coins_per_conversation (integer). Coins-only.

Net diff vs main is +18, -0 (cost section additions only).

"refund_amount": refund_amount,
},
"section02-tasks": {
"tasks_completed": 0,
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

until we fix the bad idea, we can use it here instead of having zeroes

or maybe we let model ask and fill stuff, and ask it to fill here and also fill averages (but it may not be easy enough for model to get that

we could have one small back end handler for these stats, but is this worth a back end handler? maybe it's useful, not sure

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it will conflict with #340

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