Chapter 10

The WSCI Framework

Write, Select, Compress, Isolate—four strategies for managing context at enterprise scale.

Context management requires systematic strategies. The WSCI framework provides four complementary approaches that work together to ensure agents always have optimal context for their tasks.

W Write Context

Externalize state beyond the active context window. Agents "write things down" for future reference, extending memory beyond model limits.

📝 Scratchpads

Capture intermediate reasoning steps, ensuring no steps are lost and providing a clear trail of thought.

🗄️ Long-Term Memory

Store summaries or facts in external databases, enabling continuity across sessions.

🔄 Self-Reflection

Log successes and failures after each step (Reflexion pattern), creating a feedback loop.

🏢 Enterprise Value

Makes reasoning reliable across long-running tasks such as audits, research workflows, or compliance reviews.

S Select Context

Retrieve only relevant information for the current step. Not everything fits in the window—select what matters most.

🔍 Vector Search

Use embeddings to fetch relevant chunks from knowledge bases with semantic similarity.

🔧 Tool Filtering

Retrieve only top-K relevant tools instead of exposing the full list, minimizing noise.

🧠 Memory Query

Query long-term memory for the most pertinent facts, supporting accurate decisions.

🏢 Enterprise Value

Avoids information overload and improves accuracy. Critical where knowledge bases and tool sets are massive.

C Compress Context

Summarize or prune as context grows. Keep information usable while freeing space for new inputs.

📄 Summarization

Condense lengthy tool outputs into concise notes, preserving essential meaning.

📊 Hierarchical

Apply recursive summarization, layering multiple levels to maintain coherence.

✂️ Pruning

Remove irrelevant or low-priority details, keeping only essential references.

🏢 Enterprise Value

Reduces cost and latency by controlling token usage. Prevents confusion in long compliance reviews.

I Isolate Context

Divide and conquer. Split work into isolated contexts for specialized agents instead of one agent juggling everything.

👥 Specialized Agents

Assign distinct roles so each agent focuses on its expertise domain.

🗂️ Separate Buffers

Use separate memory buffers for dialogue, task goals, and domain knowledge.

🔗 Aggregator

Combine results through an aggregator that integrates outputs into coherent results.

🏢 Enterprise Value

Prevents context bloat and keeps reasoning modular. Scale complex workflows across focused agents.

Implementation Example

Python Hover each line for explanation

Combine all four strategies:

Write quality content → Select what's relevant → Compress to fit → Isolate complexity