Skip to content

Latest commit

 

History

History
74 lines (50 loc) · 2.34 KB

File metadata and controls

74 lines (50 loc) · 2.34 KB

Token Savings: ASTral MCP

Why This Exists

AI agents waste tokens when they must read entire files to locate a single function, class, or constant. ASTral indexes a repository once and allows agents to retrieve exact symbols on demand, eliminating unnecessary context loading.


Example Scenario

Repository: Medium Python codebase (300+ files) Task: Locate and read the authenticate() implementation

Approach Tokens Consumed Process
Raw file loading ~7,500 tokens Open multiple files and scan manually
ASTral MCP ~1,449 tokens search_symbols > get_symbol

Savings: ~80.7%


Typical Savings by Task

Task Raw Approach With ASTral Savings
Explore repo structure ~200,000 tokens ~2k tokens ~99%
Find a specific function ~40,000 tokens ~200 tokens ~99.5%
Read one implementation ~40,000 tokens ~500 tokens ~98.7%
Understand module API ~15,000 tokens ~800 tokens ~94.7%

Scaling Impact

Queries Raw Tokens Indexed Tokens Savings
10 400,000 ~5k 98.7%
100 4,000,000 ~50k 98.7%
1,000 40,000,000 ~500k 98.7%

Key Insight

ASTral shifts the workflow from:

"Read everything to find something" to "Find something, then read only that."


Live Token Savings Counter

Every tool response includes real-time savings data in the _meta field:

"_meta": {
  "tokens_saved": 2450,
  "total_tokens_saved": 184320,
  "cost_avoided": { "claude_opus": 0.0368, "gpt5_latest": 0.0245 },
  "total_cost_avoided": { "claude_opus": 2.76, "gpt5_latest": 1.84 }
}
  • tokens_saved: Tokens saved by the current call (raw file bytes vs response bytes / 4)
  • total_tokens_saved: Cumulative total across all calls, persisted to ~/.code-index/_savings.json
  • cost_avoided: Per-model cost savings (Claude Opus at $15/1M tokens, GPT-5 at $10/1M tokens)

No extra API calls or file reads — computed using fast file size checks only.