head-tail-log-clipping

Installation
SKILL.md

Head/Tail Log Clipping (Sandwich Truncation Protocol)

Overview

When running large test suites, Docker image builds, or package installations (npm test, cargo test, docker build), terminal commands frequently generate 500 to 5,000 lines of output.

In 99% of software failures, the critical diagnostic information is distributed in two places:

  1. The Head (First 15-25 lines): Command invocation arguments, environment variables, compiler flags, and target module names.
  2. The Tail (Last 30-50 lines): The fatal assertion failure, exact line number, exception stack trace, and final exit code summary.

The middle 90% of the log consists of redundant progress meters ("Passing test 1..140", "Downloading layer 4a3f..."). Ingesting unclipped logs burns 10,000+ tokens per failure turn.

The Head/Tail Log Clipping Protocol (also known as the Sandwich Truncation Protocol) extracts the Head and Tail while replacing the middle with a compact tombstone count.


3,000-Line Raw Log vs. Sandwich Truncation

Installs
1
GitHub Stars
2
First Seen
Oct 23, 2026