Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/viewer/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -1355,7 +1355,7 @@ <h1>agentmemory</h1>
var totalObs = d.sessions.reduce(function(a, s) { return a + (s.observationCount || 0); }, 0);
var tokenBudget = parseInt(new URLSearchParams(window.location.search).get('tokenBudget') || '2000', 10) || 2000;
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.

⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Remove unused tokenBudget variable.

The tokenBudget variable is no longer used after the formula change on line 1358. The new calculation uses the constant 38 instead of the query parameter value, making this line dead code that can confuse future maintainers.

🧹 Proposed fix
       var totalObs = d.sessions.reduce(function(a, s) { return a + (s.observationCount || 0); }, 0);
-      var tokenBudget = parseInt(new URLSearchParams(window.location.search).get('tokenBudget') || '2000', 10) || 2000;
       var estFull = totalObs * 80;
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
var tokenBudget = parseInt(new URLSearchParams(window.location.search).get('tokenBudget') || '2000', 10) || 2000;
var totalObs = d.sessions.reduce(function(a, s) { return a + (s.observationCount || 0); }, 0);
var estFull = totalObs * 80;
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/viewer/index.html` at line 1356, Remove the dead local variable
tokenBudget: the parseInt(...) assignment to tokenBudget is no longer used after
the change that hardcodes 38 in the subsequent calculation, so delete the var
tokenBudget = ... statement (remove any reference to tokenBudget) to avoid
confusing dead code; ensure no other code in index.html references tokenBudget
before committing.

var estFull = totalObs * 80;
var estInjected = d.sessions.length * tokenBudget;
var estInjected = Math.min(totalObs, 50) * 38;
var savings = estFull > 0 ? Math.round((1 - estInjected / Math.max(estFull, 1)) * 100) : 0;
if (savings < 0) savings = 0;
var tokensSaved = Math.max(0, estFull - estInjected);
Expand Down