A 'codemap' idea to cut token waste in coding agents

A developer behind a tool called Agentlas tried a new approach to reduce . The tool originally centered on human-approval discipline, relying on a sitemap and curated memory. After adding a swarm feature that runs multiple agents at once, token consumption spiked.

Two causes were identified. First, each swarm run starts as an independent new session, forcing the agent to re-explore the entire codebase from scratch every time. Second, even without swarms, modifying code in a fresh session still burns a lot of time on code navigation.

As a codebase grows, agents run into two compounding problems: exhausting their context while grepping, guessing, and opening errors one by one, and missing things because they rely only on saved memory instead of actually reading the code. The developer framed the shared root cause as 'an attention cost, not a storage cost.' The proposed fix borrows from how the tool built its sitemap — tagging every UI page into a map-like structure — and applies the same idea to code, creating a 'codemap' so the agent can jump straight to the relevant part instead of scanning .

Key points

  • A developer behind the Agentlas tool shares a token-saving idea
  • spiked after adding a swarm feature that runs multiple agents at once
  • Cause 1: each swarm session re-explores the codebase from scratch
  • Cause 2: as codebases grow, grep-guess-check-error loops exhaust context, and memory-only lookups miss real code
  • Proposed fix: build a 'codemap' — tagging code like a sitemap — so agents navigate directly instead of scanning
Read original