#16091: feat(browser): lower default snapshot size to 10K with progressive hints
agents
stale
size: S
Cluster:
Memory Management Enhancements
## Summary
- Lower `DEFAULT_AI_SNAPSHOT_MAX_CHARS` from 80K to 10K to reduce context consumption
- When truncation occurs, append a context-aware hint suggesting `mode="efficient"` (compact ARIA role-tree) or increasing `maxChars`
- Set `truncated` flag in route post-hoc truncation for role snapshots
- Add descriptions to snapshot schema fields so the model understands its options
## Motivation
Large AI snapshots (up to 80K chars) consume excessive context window. Lowering the default to 10K and progressively teaching the model about `mode="efficient"` and `maxChars` gives the best of both worlds: rich AI snapshots by default, with clear guidance when pages are too large.
## Test plan
- [ ] Snapshot a small page — should return full AI snapshot (no truncation hint)
- [ ] Snapshot a large page (e.g. Wikipedia "United States") — should truncate at ~10K with hint about `mode="efficient"` and `maxChars`
- [ ] Snapshot with `mode="efficient"` on a large page — hint should only suggest `maxChars`, not re-suggest efficient mode
- [ ] Snapshot with explicit `maxChars=50000` — should return larger snapshot
- [ ] `pnpm build` passes
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Most Similar PRs
#11342: fix(browser): respect fullPage=false for viewport-only screenshots
by higginsvott · 2026-02-07
53.4%
#10915: fix: prevent session bloat from oversized tool results and improve ...
by DukeDeSouth · 2026-02-07
53.1%
#5057: fix: add per-tool-result hard cap to prevent context overflow
by hanxiao · 2026-01-31
53.0%
#18886: fix(status): prefer configured contextTokens over model metadata
by BinHPdev · 2026-02-17
53.0%
#10465: Context pruning: strip image blocks instead of skipping
by quentintou · 2026-02-06
52.8%
#22303: fix: extend cacheRetention auto-injection and runtime pass-through ...
by snese · 2026-02-21
52.7%
#8617: fix: truncate large console payloads before writing to file log
by dbottme · 2026-02-04
52.5%
#22782: fix(browser): respect fullPage option in screenshot captureBeyondVi...
by miloudbelarebia · 2026-02-21
52.4%
#20747: feat(copilot): support Claude models with correct context windows (...
by yuf1011 · 2026-02-19
52.3%
#6053: fix: use 400K context window instead of 200K if the model allows (g...
by icedac · 2026-02-01
52.1%