Log per-stage input/output tokens in the token tracker (baseline for token reduction)
Maintainers usually reply within 6 days
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 62/100
- Issue type
- Feature
- Clarity
- Clearly specified
- Activity status
- Active
- Tech stack
- ai-infra-agents, javascript
- Domain
- devtools
Research direction
Start in bundle/hooks/lib/token-tracker.js, at recordPhaseTokens (around L307-343) and printTokenReport (around L622), and check how the handoff payload from buildHandoffEnforcement in bundle/hooks/lib/handoff-enforcer.js is sized against MAX_HANDOFF_CHARS. Add handoff_chars and handoff_tokens_est to each phase entry, then extend the fake 4-stage case in scripts/test-adaptive-loop.js. Done when per-stage input and output estimates appear in the report, the test passes, and bundle/opencode/hooks/lib/token-tracker.js matches byte-for-byte.
Written by the indexing model from the issue text.
Description
Summary
Beginner-friendly first step of "Reduce AI token usage": make the token tracker log input and output tokens per stage so a baseline exists.
Context
bundle/hooks/lib/token-tracker.js:estimateTokens(L70-73) isceil(chars/4)andrecordPhaseTokens(L307-343) estimates fromextractOutputText(input)— i.e. only the subagent's output, unless the host reports usage (extractReportedUsage).- Each phase entry already stores
output_chars,estimated_tokens,reported,cache_read_tokens,cache_hit_rate,over_budget,budget. - The handoff size (
buildHandoffEnforcementinbundle/hooks/lib/handoff-enforcer.js;MAX_HANDOFF_CHARS = 2500) is not recorded.
Task
- Record
handoff_chars/handoff_tokens_est(the payload sent into each stage) in the phase entry. - Show input vs output per stage in
printTokenReport(token-tracker.js:622). - Add a unit test in
scripts/test-adaptive-loop.js(it already covers the token tracker) that checks both fields exist for a fake 4-stage run. - Mention the new fields in
docs/where token budgets are described.
Acceptance criteria
- A run produces per-stage
{input_est, output_est, reported?}. - Tests pass; the opencode mirror (
bundle/opencode/hooks/lib/token-tracker.js) is kept byte-identical.
Part of the token-usage reduction issue (linked there).
Raised from the v3.8.0 audit.
- Dominant language
- JavaScript
- Stars
- 0
- Forks
- 0
- PR merge metrics
- No merged PRs in 30d
Getting set up
- No Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from P-Core-System/pcore-orchestra
-
documentation good first issue priority: medium
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
P-Core-System/pcore-orchestra#37 ·
Maintainers usually reply within 6 days
-
documentation good first issue priority: low
Difficulty 1/5 1-3 hours Newbie friendliness 72/100
P-Core-System/pcore-orchestra#36 ·
Maintainers usually reply within 6 days
-
documentation good first issue priority: low
Difficulty 1/5 1-3 hours Newbie friendliness 84/100
P-Core-System/pcore-orchestra#35 ·
Maintainers usually reply within 6 days
-
documentation good first issue priority: medium
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
P-Core-System/pcore-orchestra#33 ·
Maintainers usually reply within 6 days
-
enhancement good first issue installer priority: low
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
P-Core-System/pcore-orchestra#20 ·
Maintainers usually reply within 6 days
All issues in P-Core-System/pcore-orchestra
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Fei-Away/Codex-Dream-Skin#449 ·
Maintainers usually reply within 1 day
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
outline/outline#14489 · 1 comment ·
Maintainers usually reply within 1 day
-
Claude Code plugin does not wire the edit-time Floor hookPossibly taken @dgr8akki claimed this today. Open
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Maintainers usually reply within 4 days
-
Difficulty 2/5 1-3 hours Newbie friendliness 86/100
Maintainers usually reply within 1 day
-
Administration: required plugin configuration field stays invalid after restoring its saved valueOpenneeds-triage Platform(Default)
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
Maintainers usually reply within 1 day