Progressive Disclosure

πŸš€ Core principle

Show what exists and its retrieval cost first. Let the agent decide what to fetch based on relevance and need.

Information architecture pattern that reveals complexity gradually instead of all at once. The default approach for Context Engineering in agent systems.

πŸ—’οΈ The three layers

  1. Layer 1 β€” Index β€” lightweight metadata: titles, dates, types, token counts
  2. Layer 2 β€” Details β€” fetch full content only when relevant
  3. Layer 3 β€” Deep dive β€” read original source files if required

Mirrors human cognition: scan headlines before articles, TOC before chapters, filenames before opening files.

☘️ The problem: context pollution

Traditional RAG dumps everything upfront:

  • 35k tokens of past sessions, observations, summaries
  • Maybe 2k actually relevant β€” 6% efficiency
  • Wastes attention budget; user prompt buried under history

Progressive disclosure inverts it:

  • ~800 tokens of index β†’ agent scans β†’ fetches ~200 tokens on demand
  • 100% relevance, 99k tokens free for the actual task

🧩 The index format

Compact tabular index showing what exists, when, type, retrieval cost:

| ID    | Time     | T  | Title                                    | Tokens |
|-------|----------|----|------------------------------------------|--------|
| #2543 | 2:14 PM  | πŸ”΄ | Hook timeout: 60s too short for npm     | ~155   |
| #2587 | 12:58 AM | πŸ”΅ | Context hook script file is empty       | ~46    |
| #2592 | 1:16 AM  | βš–οΈ | Web UI strategy redesigned              | ~193   |

Grouped by date (temporal context), file path (spatial context), and project (logical context).

Legend system

Emoji icons signal observation type β€” visual scanning, language-agnostic, token-efficient:

  • 🎯 session-request β€” user’s original goal
  • πŸ”΄ gotcha β€” critical edge case or pitfall
  • 🟑 problem-solution β€” bug fix or workaround
  • πŸ”΅ how-it-works β€” technical explanation
  • 🟒 what-changed β€” code/architecture change
  • 🟣 discovery β€” learning or insight
  • 🟠 why-it-exists β€” design rationale
  • 🟀 decision β€” architecture decision
  • βš–οΈ trade-off β€” deliberate compromise

🎨 Mental model: context as currency

ApproachMetaphorOutcome
Dump everythingSpending whole paycheck on speculative groceriesWaste, can’t afford what’s needed
Fetch nothingRefusing to spend any moneyStarvation, can’t accomplish tasks
Progressive disclosureCheck pantry, list what’s needed, buy thatEfficiency, room for surprises

Implementation principles

  1. Make costs visible β€” every index row shows token count so the agent makes informed ROI decisions
  2. Use semantic compression β€” good titles compress observations into ~10 actionable words. β€œHook timeout: 60s too short for npm install” not β€œObservation about a thing”
  3. Group by context β€” date / file path / project β€” spatial locality reduces scanning
  4. Provide retrieval tools β€” index without search / timeline / get_observations is useless

The 3-layer workflow (Claude-Mem)

  • Layer 1 β€” search β€” search({ query: "hook timeout", limit: 10 }) β†’ returns IDs (~50–100 tokens each)
  • Layer 2 β€” timeline β€” timeline({ anchor: 2543, depth_before: 3, depth_after: 3 }) β†’ narrative arc around an observation
  • Layer 3 β€” get_observations β€” get_observations({ ids: [2543, 2102] }) β†’ full details for selected IDs

Cognitive load theory

  • Intrinsic load β€” inherent task difficulty (unavoidable)
  • Extraneous load β€” burden of poorly-presented information. Traditional RAG adds this. Progressive disclosure minimizes it.
  • Germane load β€” building mental models. Consistent structure (legend, grouping, semantic titles) supports it.

⚠️ Anti-patterns

  • ❌ Verbose titles β€” β€œInvestigation into the issue where hooks time out” vs β€œHook timeout: 60s too short for npm install”
  • ❌ Hiding costs β€” index without token counts forces the agent to guess
  • ❌ No retrieval path β€” index with no MCP search tools is dead weight
  • ❌ Skipping the index layer β€” fetching IDs [1..10] blind instead of searching first

Measuring success

  • βœ… Low waste ratio β€” relevant tokens / total context > 80%
  • βœ… Selective fetching β€” index of 50, agent fetches 2–3
  • βœ… Fast time-to-relevant β€” 30s with index vs 90s scanning everything
  • βœ… Appropriate depth β€” depth scales with task complexity

πŸ“’ Key takeaways

  1. Show, don’t tell β€” index reveals what exists without forcing consumption
  2. Cost-conscious β€” visible retrieval costs enable informed decisions
  3. Agent autonomy β€” the agent knows current context better than you do
  4. Semantic compression β€” good titles make or break the system
  5. Consistent structure β€” patterns reduce cognitive load
  6. Two-tier everything β€” index first, details on-demand
  7. Context as currency β€” spend wisely on high-value information

The best interface is one that disappears when not needed, and appears exactly when it is.

πŸ“– Further reading

Claude Code Claude Code Best Practice Brain

  • Cognitive Load Theory (Sweller, 1988)
  • Information Foraging Theory (Pirolli & Card, 1999)
  • Progressive Disclosure (Nielsen Norman Group)

Source: Claude-Mem documentation, Progressive Disclosure: Claude-Mem’s Context Priming Philosophy.


Template: knowledge_note_info