KNOWLEDGE BASE · HOW-TO MANUAL & REFERENCE · v1.2.x

How to Download, Install & Use Agent Junky Tokenomics

A plain-English, beginner-friendly walkthrough explaining every feature in the Agent Junky Tokenomics suite. Learn how to stop runaway session context bloat, prune dead terminal logs, audit entire codebases, and reset multi-turn agents with zero memory loss.

01

Downloading & Installing the Extension

METHOD A

Visual GUI Install (20 Seconds)

Follow these 4 simple steps inside your editor window:

  1. 1 Open the Extensions panel on the left activity bar (or press Ctrl+Shift+X on Windows / Cmd+Shift+X on Mac).
  2. 2 Click the three dots menu (...) at the top right of the Extensions panel ("Views and More Actions").
  3. 3 Click "Install from VSIX..." in the dropdown menu.
  4. 4 Select the downloaded agentjunky-vscode-1.2.2.vsix (or agentjunky-vscode-latest.vsix) file from your Downloads folder.
EXTENSIONS: VIEWS & ACTIONS ... [CLICK HERE]
Views...
Show Recommended Extensions
✓ Install from VSIX...
Install Another Version...
METHOD B

Terminal Command (1 Click)

If you prefer the command line, open your terminal and run the one-line command for your editor:

For Visual Studio Code & Antigravity:
code --install-extension agentjunky-vscode-1.2.2.vsix
For Cursor IDE:
cursor --install-extension agentjunky-vscode-1.2.2.vsix
✓ Verification Step:
Look at the bottom-right status bar of your editor window. You will see a new glowing badge:
⚡ 0 tok ($0.000)
02

Feature 1: Status Bar Real-Time Token Telemetry

Unlike rough "word count" estimates, Agent Junky uses real Byte-Pair Encoding (BPE) algorithms matching OpenAI (cl100k_base and o200k_base) and Anthropic Claude 3.7. As you type, edit, or open any file, the telemetry item in your status bar computes:

// What you see on the bottom right of your IDE:
Ln 42, Col 18 | UTF-8 | TypeScript | ⚡ 4,120 tok ($0.012)
1. Exact Token Count

Counts tokens as the LLM's tokenizer actually perceives them. Code with many brackets and snake_case generates more tokens than English prose.

2. Character Density

Measures chars/token (typically ~3.8 for English text and ~2.2 for dense JSON). Identifies bloated formatting.

3. Live Ingestion Cost

Instantly shows how much it will cost to feed this file into Claude 3.7 Sonnet as context before you hit send.

03

Feature 2: The 3-Tab Tokenomics Command Center

The extension provides a rich interactive dashboard right inside your editor so you never have to leave your code to run diagnostics.

HOW TO OPEN THE DASHBOARD:

1. Press Ctrl+Shift+P (or Cmd+Shift+P on Mac) to open the Command Palette.

2. Type: Agent Junky: Open Tokenomics Dashboard and press Enter.

TAB 1

Active Session Telemetry

Monitors live Claude Code and Antigravity conversation sessions. Shows total turns, re-sent tokens, burn rate, and a 1-click button to trigger transcript surgery.

TAB 2

Repository & Workspace Auditor

Scans your active folder, calculates total token weights, displays a multi-model price comparison, and ranks the top 15 heaviest files consuming your context.

TAB 3

Active File & Interventions

Focuses on the currently open editor tab. Allows you to test lossless minification or AST skeletonization on code snippets with live token reduction previews.

04

Why Coding Agents Get Slow and Expensive (The Bloat Trap)

Many developers assume that if they ask a small 4-word question like "fix the bug on line 12", the LLM only bills them for 4 words. This is completely false.

// THE O(N²) HISTORY ACCUMULATION TRAP:
Turn 1:
800 tok ($0.002)
Turn 5:
14,200 tok ($0.042)
Turn 12:
68,400 tok ($0.205)
Turn 25:
182,500 tok ($0.547)
On turn 25, a simple 4-word question costs $0.55 because turns 1 through 24 are re-sent entirely!

What makes up those 182,500 tokens? Zombie output. Terminal build outputs, 300 lines of passing unit tests from an hour ago, repeating git commit logs, and compiler warnings that were already solved. This dead baggage hogs the model's attention window, causing hallucinations and high latency.

05

Feature 3: Transcript Surgery & Zombie Pruner

Transcript Surgery (sessionPruner.ts) is a deterministic AST cleaner. It scans your conversation history, keeps recent turns untouched, and replaces older dead terminal outputs with concise 1-line semantic tombstones.

BEFORE PRUNING (Turn 4 Tool Output) 18,400 TOKENS
> pytest tests/ -v
============================= test session starts ==============================
collecting ... collected 142 items
tests/test_auth.py::test_login PASSED [ 0%]
tests/test_auth.py::test_token PASSED [ 1%]
[... 8,400 lines of test printouts, logs, & webpack bundle chunks ...]
====================== 141 passed, 1 failed in 14.2s =======================
// Re-sent on EVERY subsequent turn for the next 3 hours!
AFTER TRANSCRIPT SURGERY 42 TOKENS (99.7% SAVED)
> pytest tests/ -v
[PRUNED_TOOL_OUTPUT: pytest tests/ -v]
• Outcome: 141 passed, 1 failed in test_loop_termination.
• Exit code: 1 (Handled on turn 5).
• Reclaimed: 18,358 tokens converted to tombstone.
// Model still knows the test failed and was fixed, but costs $0.00!
How to Run It in 3 Clicks:
  1. Open the Command Palette (Ctrl+Shift+P or Cmd+Shift+P).
  2. Type Agent Junky: Prune Active Session Transcript.
  3. Select your active session file (or accept the automatically detected transcript). Agent Junky creates a timestamped .bak file as a safety backup, removes the zombie logs, and displays the total tokens reclaimed.
06

Feature 4: Deterministic State Handover (/handoff)

When you've been working with Claude Code or Cursor for hours and context approaches 100k+ tokens, native compaction triggers. Native compaction uses an LLM to write a summary of the chat. This often forgets edge cases or loses track of what you were just editing.

Agent Junky replaces this with Deterministic State Handover. It queries your actual Git index and IDE memory to generate a structured handover file called SESSION_STATE.md:

FILE: SESSION_STATE.md (Generated Handover Artifact) 1,240 TOKENS (98.5% SAVINGS)
## 1. COMPLETED OBJECTIVES
• Built the active session pruner engine (sessionPruner.ts)
• Verified 0 errors across all 38 Astro project files
## 2. MODIFIED FILES & UNCOMMITTED DIFFS
• extensions/agentjunky-vscode/package.json (bumped to 1.2.x)
• src/pages/tokenomics.astro (added interactive switcher)
## 3. NEXT PENDING TASK
• Create step-by-step Knowledge Base guide and publish VSIX
## 4. CONTEXT METRICS
• Prior session context: 82,400 tokens → New handover: 1,240 tokens.
How to Continue After a Context Reset:

1. Run Agent Junky: Generate Session State Handover.

2. Start a fresh chat or clear context in your agent (/compact or new thread).

3. Send this single prompt: @SESSION_STATE.md Please review the handover state and continue on Task 3. Your agent instantly picks up right where you left off with zero hallucination and a fresh, cheap context window!

07

Feature 5: Repository Token Weight Auditor

Before passing a whole codebase or folder into an agent with @folder or tool execution, audit its token weight. Often, a single auto-generated file (like openapi.json or a test fixture) can silently eat 60% of the entire token allowance.

WORKSPACE AUDIT: RANKED TOKEN HEAVYWEIGHTS TOTAL: 64,800 TOKENS
public/specs/openapi_giant.json 34,200 tok (52.7%)
⚠️ CULPRIT: 1 file takes more than half the entire context!
src/pages/tokenomics.astro 8,920 tok (13.7%)
src/tokenomics/sessionPruner.ts 4,620 tok (7.1%)
How to Run It:

Open Command Palette and run: Agent Junky: Audit Workspace Repository Tokens.
The auditor will scan all files, respect .gitignore, skip binaries/lockfiles, and print out the ranked heavyweights table and cost matrix across Claude 3.7 Sonnet, Haiku, GPT-4o, and Gemini Flash.

08

Feature 6: AST Skeletonizer & Lossless Minifier

When an agent needs to know how to call code from another file, it only needs the function signatures, class declarations, argument types, and return types. It does not need 300 lines of internal SQL queries and loops.

FULL SOURCE CODE (UserService.ts) 350 TOKENS
export class UserService {
  constructor(private db: Database) {}

  async findUser(id: string): Promise<User> {
    const query = "SELECT * FROM users WHERE id = ?";
    const result = await this.db.query(query, [id]);
    if (!result.rows.length) {
      throw new UserNotFoundError(id);
    }
    return mapRowToUser(result.rows[0]);
  }
}
SKELETONIZED SKELETON 48 TOKENS (86% SAVED)
export class UserService {
  constructor(private db: Database);
  findUser(id: string): Promise<User>;
}
How to Run It:

Open any TypeScript, JavaScript, or Python file and run Agent Junky: Skeletonize Active File (AST). A clean interface file will be copied to your clipboard ready to pass to your agent!

09

All 11 Extension Commands Quick Reference

Command Palette Name Internal ID What It Does
Open Tokenomics Dashboard agentjunky.openTokenomicsDashboard Opens the full 3-tab Command Center Webview.
Prune Active Session Transcript agentjunky.pruneActiveSession Detects zombie terminal outputs and replaces with tombstones.
Generate Session State Handover agentjunky.generateStateHandover Freezes active diffs and tasks into SESSION_STATE.md.
Audit Workspace Repository Tokens agentjunky.auditWorkspaceTokens Scans workspace tree, ranks heavy files, and prints cost table.
Count Tokens in Active File agentjunky.countTokens Returns precise BPE token count and char density for active tab.
Skeletonize Active File (AST) agentjunky.skeletonizeActiveFile Strips function and method bodies, leaving pure type interfaces.
Lossless Minify Selection agentjunky.minifySelection Removes indentation and excess whitespace from JSON/code.
Configure Claude Desktop MCP agentjunky.configureClaudeDesktop Automates adding the Agent Junky MCP server to Claude Desktop.
Inspect Claude Config File agentjunky.inspectClaudeConfig Opens claude_desktop_config.json directly in your editor.
View Seven Layers Blueprint agentjunky.viewArchitectureBlueprint Opens the Layer 1–7 production AI systems blueprint.
Test Local MCP Server agentjunky.testLocalMcpServer Pings local stdio harness and confirms all 4 tools respond.
10

Troubleshooting & Frequently Asked Questions

Q: Will Transcript Surgery break my Git history or delete my code files?

Absolutely not. Transcript Surgery only edits the internal conversation JSON/JSONL transcript file used by your AI agent (in your user app data folder). It never modifies your repository files, never commits to Git, and automatically saves a timestamped .bak file in the transcript directory before touching a single line.

Q: Can I undo a Transcript Surgery prune operation?

Yes. If you ever want to revert a pruned transcript, locate the file with the same name ending in .bak and rename it back to the original filename.

Q: Does this extension work if I'm not connected to the internet?

Yes. All Byte-Pair Encoding tokenization, transcript pruning, AST skeletonization, and repository auditing run 100% locally on your machine in Node.js. No telemetry or code is sent to external servers.

Q: Where can I test these features in my browser without installing anything?

You can test the full simulator live on our web platform at agentjunky.com/tokenomics. It includes the interactive 3-mode switcher with live pruning, repo auditing, and single-file minification.

Ready to take control of your token economics?

Download v1.2.x or explore the interactive browser simulator.

Newsletter Edition #1

Subscribe to The AgentJunky AI Brief

Get practical thinking on agentic AI, enterprise architecture, RAG, and production governance delivered straight to your LinkedIn feed.

Subscribe on LinkedIn ↗

Discuss an AI Opportunity

Need an architectural review, help transitioning an agent prototype to production, or designing governed tool gateways? Let's connect.