Local Qwen Models Achieve Browser Automation with Stepwise Planning and Compact DOM

Stepwise Planning Overcomes Upfront Planning Failures
The developer discovered that asking models to invent a full multi-step plan before seeing the real page state works on familiar sites but breaks quickly on unexpected elements. What worked better was stepwise planning where the model replans from the current DOM snapshot at each step.
Example Flow on Ace Hardware
The tested flow with Qwen 8B as planner and 4B as executor on Ace Hardware (a site the model had no prior task for) completed a full cart flow with zero vision model usage. The stepwise approach looked like this:
- Step 1: see search box → TYPE "grass mower"
- Step 2: see results → CLICK Add to Cart
- Step 3: drawer appears → dismiss it
- Step 4: cart visible → CLICK View Cart
- Step 5: DONE
Compact DOM Representation Enables Small Models
The model never sees raw HTML or screenshots—just a semantic table representation:
id|role|text|importance|bg|clickable|nearby_text
665|button|Proceed to checkout|675|orange|1|
761|button|Add to cart|720|yellow|1|$299.99
1488|link|ThinkPad E16|478|none|1|Laptop 16"
This allows the 4B executor to pick an element ID from a short list. Vision approaches burn 2-3K tokens per screenshot, easily 50-100K+ for a full flow, while compact snapshots use ~15K total for the same task.
Modal Handling Critical for Success
After each click, if the DOM suddenly grows, the agent scans for dismiss patterns (close, ×, no thanks, etc.) before planning again. This fixed many failures that appeared to be "bad reasoning" but were actually hidden overlays.
The developer notes being curious if others are seeing stepwise planning beat upfront planning once sites get unfamiliar.
📖 Read the full source: r/LocalLLaMA
👀 See Also

Driftwatch V3 Released: AI-Assisted Codebase Monitoring Tool
Driftwatch V3 is now available as a public repository after a 5-6 day build involving approximately 9,000 lines of code and $160 in API credits. The in-browser tool tracks markdown file issues, flags contradictory instructions, and provides cost tracking with recommendations.

CLAUDE.md: Drop-in file reduces Claude output tokens by 63%
CLAUDE.md is a single file that cuts Claude output verbosity by approximately 63% without code changes. It targets sycophancy, verbosity, and formatting noise in Claude's responses.

OpenClaw developer builds unified memory system for AI agents
A developer has built a 15-tool unified memory system for OpenClaw AI agents that combines structured facts, vector search, entity graphs, episode timelines, hierarchical compression, and event-driven coordination. The system runs locally without cloud dependencies or monthly fees.

Custom Output Styles Collection for Claude Code
A developer has created 13 custom output styles for Claude Code that modify the AI's behavior through system prompts. The styles include Roast for brutal code critique, Socratic for guided questioning, Breaker for adversarial testing, Ship It for pragmatic solutions, Paranoid for security focus, and TDD for test-driven development.