Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

max_total_tokens: count the conversation's growth, not every resent prompt (low priority)

Open Beginner friendly
#236 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
75/100
Issue type
Feature
Clarity
Clearly specified
Activity status
Active
Tech stack
rust

Research direction

Start in the ExecutionTracker module, add the new record_turn_usage(prompt, output) method alongside the existing record_turn(tokens) method, and update the token counting logic to track the largest prompt seen so far plus total model-generated output instead of summing all prompt resend parts per turn. Run the execution tracker's test suite to verify the new behavior is linear, monotonic, and avoids double-counting outputs.

Written by the indexing model from the issue text.

Description

enhancement P3

Follow-up to #226, which was resolved by documenting the current behaviour.

Today: each turn adds its whole prompt (input + cache_read + cache_write) plus its output to ExecutionTracker::tokens_used. The prompt resends the conversation, so the total grows with turns × context. The 1M default is reached around turn 16 at a 60K-token context, whether or not the prompt is cached. As a ceiling on work done, that's coherent, and it's now documented. As a budget it surprises people: "1M tokens" sounds like far more than 16 turns.

Idea: count what the conversation actually accumulates:

tokens used = the largest prompt seen so far + everything the model has generated

  • Provider-independent: cached and uncached runs count the same.
  • Linear: it grows with the conversation, so a long session can use its max_turns.
  • Monotonic: compaction doesn't lower it.
  • Avoids a double count: a naive "new input + output per turn" would count each output twice, since an output reappears in the next prompt.

API: additive. Add an ExecutionTracker::record_turn_usage(prompt, output) and keep record_turn(tokens).

Behaviour change: runs hit the cap later, so anyone using it as a strict cost ceiling would spend more before it trips. It belongs in a minor release, or behind an option.

Priority: low. Nothing is broken, the behaviour is documented, and callers can raise the cap or set it to usize::MAX.

Dominant language
Rust
Stars
327
Forks
46
Avg merge
2h 30m
Merged PRs (30d)
143

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from yologdev/yoagent

All issues in yologdev/yoagent

Similar issues

More Rust issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.