Morph Compaction
morph_compaction · Nodes · AI
Compacts an AI conversation transcript with Morph.
Morph Compaction#
Compacts structured transcript entries to reduce context window pressure before long-context AI steps.
Use after transcript entries exist. AI transcription and raw user request handling produce entries; this node consumes those entries and returns a smaller transcript representation.
Configuration#
Connection - Morph connection id. Use list_connections; pass the returned ULID id, not the connection name.
Query - What the compacted transcript should preserve. Required.
Compression ratio - Target fraction to keep. Must be greater than 0.0 and at most 1.0. Default: 0.3.
Preserve recent - Number of recent transcript entries to keep verbatim. Default: 8.
Inputs & Outputs#
Input: canonical input.
Accepted shapes:
[
{
"id": "u1",
"timestamp": "2026-06-05T12:00:00Z",
"kind": { "type": "user", "content": "What changed?" }
}
]
{
"transcript": [
{ "kind": { "type": "assistant", "content": "Here is the diff." } }
]
}
Transcript entries require kind.type. Known types: user, human, assistant, reasoning, tool, tool_call, tool_result, system, compaction, compact. Optional top-level id and timestamp are included in the rendered transcript passed to Morph.
Output: canonical output.
{
"output": "compacted transcript",
"input_kind": "transcript",
"compression_ratio": 0.3,
"preserve_recent": 8,
"compacted_line_ranges": []
}
Output fields:
output: compacted transcript text.input_kind: currentlytranscript.compression_ratio: ratio used for compaction.preserve_recent: recent entries preserved verbatim.compacted_line_ranges: source line ranges compacted by Morph.
Example#
[Conversation transcript]
↓
[Morph Compaction: preserve decisions and blockers]
↓ output
[AI Agent: continue with compacted context]
Inputs
inputRequired
Outputs
output
Configuration
| Field | Type | Required | Description |
|---|---|---|---|
connection | connection(morph) | Yes | Morph connection used to compact the transcript |
query | string | Yes | What the compacted transcript should preserve |
compression_ratio | number | No | Target fraction of the transcript to keep, from 0.0 to 1.0 |
preserve_recent | integer | No | Recent transcript entries to keep verbatim |
base_config | record | No | Shared node configuration. failure_mode decides what a failure of this node does to the workflow; leave it at the default stop unless the workflow handles the failure itself on the node's error output (route_to_error) or the node is a rare emergency kill switch (stop_workflow). |