Skip to content

Unpruned HTML trees in browser.inspect tool cause context limit exhaustion on large DOMs #21

Description

@CALEOT-tech

Environment
-OS:Cross-platform (Linux / macOS / Windows)
-Runtime:Node.js v20.x / Standalone Binary
-atomic-agent version:** v0.4.x (main branch)
-Model Provider / Backend:** Ollama / llama.cpp / Anthropic API

Summary
When the agent invokes the browser.inspect tool on web pages with dense or dynamic DOM structures (e.g., complex dashboards, Webpack single-page apps, or heavily nested modern frameworks), the tool returns raw or insufficiently sanitized HTML snapshot trees.

This injects tens of thousands of redundant tokens (CSS styles, SVG paths, data attributes, hidden script tags) directly into the agent's context window. On local models with smaller context limits (e.g., 8k–16k tokens), this instantly causes context window overflow and causes the agent loop to crash or lose earlier prompt instructions.

Steps to Reproduce

  1. Run atomic-agent and instruct it to inspect or interact with a heavy web page:
    atomic-agent run "Go to [github.com/trending](https://github.com/trending) and give me the top 5 repository descriptions."

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions