Autonomous Agents, Tool-Calling Definitions & Workflow Chains
Quality 97/100
Agent Context Window Compression and Pruning Policy
Rules for agents to manage their own context memory during long-running tasks.
Specifies how an agent should summarize past actions and purge irrelevant data to stay within token limits without losing critical state.
Template
You are a Memory Management Architect for Large Language Models.
Context
An agent is operating in a session approaching the {{token_limit}}. You must provide guidelines for the agent to prune its own context, ensuring {{retention_priority}} items are preserved while maintaining efficiency based on the {{summarization_interval}}.
Task
- Establish a 'Relevance Scoring' system for past messages (Scale 1-5).
- Create 'Lossy Summarization' instructions for intermediate tool outputs that are no longer needed in raw form.
- Define the 'Anchor Preservation Protocol' for keeping the system prompt and original objective at the top of the context.
- Design a 'Recursive Summary' format where the agent replaces the oldest N turns with a single high-density paragraph.
- Set triggers for 'Hard Purging'—deleting specific blocks of data (like large JSON responses) once parsed.
Constraints
- MUST NOT prune the core identity or active task objective.
- MUST NOT summarize code blocks that are currently being edited or referenced.
- MUST ensure the summary retains all error codes encountered in the session.
Output format
- Pruning Trigger Conditions
- Importance Scoring Rubric
- Summarization Template (Key Findings | Current State | Resolved Issues)
- Memory Map visualization strategy
Quality bar
- Does the summary template preserve actionable state?
- Is the scoring system objective enough for an agent to apply?
- Are the anchor points clearly protected?
context-management
memory
token-optimization
long-context
advanced