Skip to content

feat: show dollar savings across all touchpoints#103

Merged
rajkumarsakthivel merged 3 commits into
mainfrom
feat/dollar-savings-display
Jun 15, 2026
Merged

feat: show dollar savings across all touchpoints#103
rajkumarsakthivel merged 3 commits into
mainfrom
feat/dollar-savings-display

Conversation

@rajkumarsakthivel

Copy link
Copy Markdown
Member

Summary

  • Status hook (every session start) now shows estimated cost saved: 97% saved over 22 queries ($11.16 saved)
  • Session resume context includes dollar amount so the model sees it too
  • MCP index_status response includes cost in the savings line
  • Uses configured pricing model (default: opus). Pairs with feat: multi-provider pricing and custom rate overrides #101 for multi-model support.

This is the viral mechanic. Developers see "$X saved" on every session start and share it.

Depends on #101 for full multi-model pricing support (works standalone with opus default).

Every developer touchpoint now shows estimated cost saved alongside token
percentages. The dollar amount is calculated from the configured pricing
model (default: opus). This surfaces in:

- cce status --oneline (session start hook)
- Session resume context (memory hooks)
- MCP index_status response

The goal is to make savings tangible and shareable.

Copilot AI left a comment

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.

Pull request overview

This PR adds “$X saved” cost-savings text alongside existing token-savings metrics so developers see (and the model receives) a more shareable savings number across session start/resume, MCP index_status, and cce status --oneline.

Changes:

  • Add dollar-cost savings formatting to the SessionStart resume savings line (memory/hooks.py).
  • Extend MCP index_status to append “$X saved” using the configured pricing model (integration/mcp_server.py).
  • Update cce status --oneline to include “($X saved)” next to “% saved over N queries” (cli.py).

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 6 comments.

File Description
src/context_engine/memory/hooks.py Appends a “$X saved” suffix to the SessionStart resume savings line (defaults to opus pricing).
src/context_engine/integration/mcp_server.py Adds _fmt_cost_saved() and appends cost savings to index_status output.
src/context_engine/cli.py Updates status --oneline to include a dollar savings estimate derived from pricing.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/context_engine/memory/hooks.py Outdated
Comment thread src/context_engine/memory/hooks.py
Comment thread src/context_engine/integration/mcp_server.py
Comment thread src/context_engine/integration/mcp_server.py Outdated
Comment thread src/context_engine/cli.py Outdated
Comment thread src/context_engine/cli.py Outdated
- Clamp tokens_saved to max(0, ...) in hooks, MCP index_status, and CLI
  oneline to prevent negative percentages and dollar amounts
- Use static pricing (no network) in session hook and CLI oneline paths
  to avoid latency on session start / status queries
- Guard _fmt_cost_saved early return when tokens_saved <= 0
@rajkumarsakthivel rajkumarsakthivel merged commit 2d7ebc8 into main Jun 15, 2026
37 of 38 checks passed
@rajkumarsakthivel rajkumarsakthivel deleted the feat/dollar-savings-display branch June 15, 2026 19:56
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