Skip to main content
Glama

memory_compact

Compact old memory entries into digest summaries, archiving raw data to save tokens while keeping recent context active.

Instructions

Compact old memories into compressed digests to save tokens.

How it works:

  1. Splits memories into HOT (recent/pinned) and COLD (old)

  2. Groups cold entries by agent session

  3. Compresses each group into a local digest

  4. Archives raw cold entries to archive.json

  5. Keeps only hot entries in memories.json + adds digest references

Token savings: typically 60-80% reduction on old entries.

Config via env vars:

  • AGENT_MEM_HOT_HOURS: hours to keep full detail (default: 24)

  • AGENT_MEM_MAX_HOT: max hot entries (default: 50)

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
paramsYes

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

The description discloses significant behavioral detail beyond the annotations: it splits memories into HOT/COLD, groups by session, compresses into digests, archives raw entries to archive.json, and keeps digest references. This provides rich context about side effects without contradicting the destructiveHint=false annotation.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is front-loaded with purpose, uses a numbered 5-step breakdown, includes a token savings estimate, and lists environment variables. Every section contributes useful information with no filler or redundancy, making it appropriately sized for a multi-step operation.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

The description covers the end-to-end process, archival behavior, environmental configuration, and token impact. It does not explain the relationship to memory_prepare_compaction or the auto-compaction threshold, but given the rich mechanism description and presence of an output schema, it is sufficiently complete.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The tool description does not mention force or agent_name, but the input schema provides clear descriptions for both properties ('Force compaction even if under threshold', 'Who is running the compaction'). The schema already covers parameter meaning, so the description adds no extra value; baseline 3 is appropriate.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description opens with 'Compact old memories into compressed digests to save tokens,' a specific verb+resource+outcome statement. It clearly describes what the tool does, but it does not explicitly differentiate it from the sibling memory_prepare_compaction tool, so it falls just short of a 5.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description implies usage for saving tokens on old memories and explains the HOT/COLD split mechanism, but it never states explicit when-to-use/when-not-to-use conditions or mentions alternatives like memory_prepare_compaction. The context is useful but the guidance is mostly implied.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/swisspra/On_Board'

If you have feedback or need assistance with the MCP directory API, please join our Discord server