Skip to main content

Progressive Disclosure: Claude-Mem’s Context Priming Philosophy

Core Principle

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

What is Progressive Disclosure?

Progressive disclosure is an information architecture pattern where you reveal complexity gradually rather than all at once. In the context of AI agents, it means:
  1. Layer 1 (Index): Show lightweight metadata (titles, dates, types, token counts)
  2. Layer 2 (Details): Fetch full content only when needed
  3. Layer 3 (Deep Dive): Read original source files if required
This mirrors how humans work: We scan headlines before reading articles, review table of contents before diving into chapters, and check file names before opening files.

The Problem: Context Pollution

Traditional RAG (Retrieval-Augmented Generation) systems fetch everything upfront:
Problems:
  • Wastes 94% of attention budget on irrelevant context
  • User prompt gets buried under mountain of history
  • Agent must process everything before understanding task
  • No way to know what’s actually useful until after reading

Claude-Mem’s Solution: Progressive Disclosure

Benefits:
  • Agent controls its own context consumption
  • Directly relevant to current task
  • Can fetch more if needed
  • Can skip everything if not relevant
  • Clear cost/benefit for each retrieval decision

How It Works in Claude-Mem

The Index Format

Every SessionStart hook provides a compact index:
What the agent sees:
  • What exists: Observation titles give semantic meaning
  • When it happened: Timestamps for temporal context
  • What type: Icons indicate observation category
  • Retrieval cost: Token counts for informed decisions
  • Where to get it: MCP search tools referenced at bottom

The Legend System

Purpose:
  • Visual scanning (humans and AI both benefit)
  • Semantic categorization
  • Priority signaling (🔴 gotchas are more critical)
  • Pattern recognition across sessions

Progressive Disclosure Instructions

The index includes usage guidance:
What this does:
  • Teaches the agent the pattern
  • Suggests when to fetch (critical types)
  • Recommends search over code re-reading (efficiency)
  • Makes the system self-documenting

The Philosophy: Context as Currency

Mental Model: Token Budget as Money

Think of context window as a bank account:

The Attention Budget

LLMs have finite attention:
  • Every token attends to every other token (n² relationships)
  • 100,000 token window ≠ 100,000 tokens of useful attention
  • Context “rot” happens as window fills
  • Later tokens get less attention than earlier ones
Claude-Mem’s approach:
  • Start with ~1,000 tokens of index
  • Agent has 99,000 tokens free for task
  • Agent fetches ~200 tokens when needed
  • Final budget: ~98,000 tokens for actual work

Design for Autonomy

“As models improve, let them act intelligently”
Progressive disclosure treats the agent as an intelligent information forager, not a passive recipient of pre-selected context. Traditional RAG:
Progressive Disclosure:
The agent knows:
  • The current task context
  • What information would help
  • How much budget to spend
  • When to stop searching
We don’t.

Implementation Principles

1. Make Costs Visible

Every item in the index shows token count:
Why:
  • Agent can make informed ROI decisions
  • Small observations (~50 tokens) are “cheap” to fetch
  • Large observations (~500 tokens) require stronger justification
  • Matches how humans think about effort

2. Use Semantic Compression

Titles compress full observations into ~10 words: Bad title:
Good title:
What makes a good title:
  • Specific: Identifies exact issue
  • Actionable: Clear what to do
  • Self-contained: Doesn’t require reading observation
  • Searchable: Contains key terms (hook, timeout, npm)
  • Categorized: Icon indicates type

3. Group by Context

Observations are grouped by:
  • Date: Temporal context
  • File path: Spatial context (work on specific files)
  • Project: Logical context
Benefit: If agent is working on src/hooks/context-hook.ts, related observations are already grouped together.

4. Provide Retrieval Tools

The index is useless without retrieval mechanisms:
Available MCP tools:
  • search - Search memory index (Layer 1: Get IDs)
  • timeline - Get chronological context (Layer 2: See narrative arc)
  • get_observations - Fetch full details (Layer 3: Deep dive)
The 3-layer workflow ensures progressive disclosure: index → context → details.

Real-World Example

Scenario: Agent asked to fix a bug in hooks

Without progressive disclosure:
With progressive disclosure:

The Index Entry

What the agent learns WITHOUT fetching:
  • There’s a known gotcha (🔴) about hook timeouts
  • It’s related to npm install taking too long
  • Full details are ~155 tokens (cheap)
  • Happened at 2:14 PM (recent)
Decision tree:

The Three-Layer Workflow

Claude-Mem implements progressive disclosure through a 3-layer workflow pattern:

Layer 1: Search (Index)

Start by searching to get a compact index with IDs:
Returns:
Cost: ~50-100 tokens per result Value: Agent can scan and decide which observations are relevant

Layer 2: Timeline (Context)

Get chronological context around interesting observations:
Returns: Chronological view showing what happened before/during/after observation #2543 Cost: Variable based on depth Value: Understand narrative arc and context

Layer 3: Get Observations (Details)

Fetch full details only for relevant observations:
Returns:
Cost: ~155 tokens for full details Value: Complete understanding of the issue

Cognitive Load Theory

Progressive disclosure is grounded in Cognitive Load Theory:

Intrinsic Load

The inherent difficulty of the task itself. Example: “Fix authentication bug”
  • Must understand auth system
  • Must understand the bug
  • Must write the fix
This load is unavoidable.

Extraneous Load

The cognitive burden of poorly presented information. Traditional RAG adds extraneous load:
  • Scanning irrelevant observations
  • Filtering out noise
  • Remembering what to ignore
  • Re-contextualizing after each section
Progressive disclosure minimizes extraneous load:
  • Scan titles (low effort)
  • Fetch only relevant (targeted effort)
  • Full attention on current task

Germane Load

The effort of building mental models and schemas. Progressive disclosure supports germane load:
  • Consistent structure (legend, grouping)
  • Clear categorization (types, icons)
  • Semantic compression (good titles)
  • Explicit costs (token counts)

Anti-Patterns to Avoid

❌ Verbose Titles

Bad:
Good:

❌ Hiding Costs

Bad:
Good:

❌ No Retrieval Path

Bad:
Good:

❌ Skipping the Index Layer

Bad:
Good:

Key Design Decisions

Why Token Counts?

Decision: Show approximate token counts (~155, ~203) rather than exact counts. Rationale:
  • Communicates scale (50 vs 500) without false precision
  • Maps to human intuition (small/medium/large)
  • Allows agent to budget attention
  • Encourages cost-conscious retrieval

Why Icons Instead of Text Labels?

Decision: Use emoji icons (🔴, 🟡, 🔵) rather than text (GOTCHA, PROBLEM, HOWTO). Rationale:
  • Visual scanning (pattern recognition)
  • Token efficient (1 char vs 10 chars)
  • Language-agnostic
  • Aesthetically distinct
  • Works for both humans and AI

Why Index-First, Not Smart Pre-Fetch?

Decision: Always show index first, even if we “know” what’s relevant. Rationale:
  • We can’t know what’s relevant better than the agent
  • Pre-fetching assumes we understand the task
  • Agent knows current context, we don’t
  • Respects agent autonomy
  • Fails gracefully (can always fetch more)

Why Group by File Path?

Decision: Group observations by file path in addition to date. Rationale:
  • Spatial locality: Work on file X likely needs context about file X
  • Reduces scanning effort
  • Matches how developers think
  • Clear semantic boundaries

Measuring Success

Progressive disclosure is working when:

✅ Low Waste Ratio

Most of the context consumed is actually useful.

✅ Selective Fetching

Agent is being selective, not fetching everything.

✅ Fast Task Completion

Time-to-relevant-information is faster.

✅ Appropriate Depth

Depth scales with task complexity.

Future Enhancements

Adaptive Index Size

Relevance Scoring

Cost Forecasting

Progressive Detail Levels


Key Takeaways

  1. Show, don’t tell: Index reveals what exists without forcing consumption
  2. Cost-conscious: Make retrieval costs visible for informed decisions
  3. Agent autonomy: Let the agent decide what’s relevant
  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

Remember

“The best interface is one that disappears when not needed, and appears exactly when it is.”
Progressive disclosure respects the agent’s intelligence and autonomy. We provide the map; the agent chooses the path.

Further Reading


This philosophy emerged from real-world usage of Claude-Mem across hundreds of coding sessions. The pattern works because it aligns with both human cognition and LLM attention mechanics.