Skip to main content
Glama

compact_conversation

Folds a long agent conversation transcript into a Consolidated State Ledger to reduce context bloat when token budgets warn or before starting a new subtask.

Instructions

On-demand context compaction: folds a long agent conversation transcript into a compact Consolidated State Ledger. Use when tokensafe:context_budget reports warning/critical, when the context window feels heavy, or before starting a new subtask inside the same session. The transcript path comes from your host session (hook payload transcript_path / session start context).

Tool call template

Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {
      "transcript_path": "<transcript_path>"
    },
    "name": "compact_conversation"
  }
}

Input Schema

NameRequiredDescriptionDefault
invocation_numNoOptional: current turn number (default 3; folding requires >= 3 turns)
transcript_pathYesPath to the JSONL transcript of the current session

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv2.8.4

TDQS

A4.2/5.0
Behavior3/5

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

With no annotations, the description carries the full burden. It discloses the key behavioral constraint that folding requires a session with turns and acts on an existing transcript, but it never says whether the transcript file is mutated or only read, where the resulting ledger goes (returned vs. written to state), or whether the compaction replaces prior context. Those are material unknowns for a context-mutating operation.

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?

Two sentences, front-loaded with the operation and output artifact, then the trigger conditions, then the parameter provenance. No filler or redundant restatement of the title.

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?

For a two-parameter tool with full schema coverage and no annotations, the description covers purpose, triggers, prerequisites, and parameter provenance. The remaining gap is the fate of the produced ledger and the transcript, which an agent would still need to know before invoking.

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?

Schema description coverage is 100%, so both parameters are already documented, which sets the baseline at 3. The description does add one piece of real value beyond the schema — the provenance of transcript_path (hook payload transcript_path / session start context) — but adds nothing about invocation_num semantics beyond what the schema states.

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

Purpose5/5

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

States a specific verb+resource+output artifact: folding an agent conversation transcript into a 'Consolidated State Ledger'. That verb+artifact pair is distinct from siblings like compress_prompt or smart_bundle, and an agent can identify the operation without opening the schema.

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

Usage Guidelines5/5

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

Gives three explicit trigger conditions (context_budget reports warning/critical, context window feels heavy, before a new subtask in the same session) and names the sibling tool whose signal gates it. The only thing absent is a when-not-to-use clause, but the trigger set is concrete enough to select the tool confidently.

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