Getting it into your agent
One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.
npx skills add alivirgo/Major-AI-Skills --skill head-tail-log-clippinggit clone --depth 1 https://github.com/alivirgo/Major-AI-SkillsWrote this? Show the measurements
A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.
[](https://agentmods.dev/skills/alivirgo/major-ai-skills/head-tail-log-clipping)<a href="https://agentmods.dev/skills/alivirgo/major-ai-skills/head-tail-log-clipping"><img src="https://agentmods.dev/badge/skills/alivirgo/major-ai-skills/head-tail-log-clipping/github.svg" alt="Measured on agentmods" height="20"></a>Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.
<a href="https://agentmods.dev/skills/alivirgo/major-ai-skills/head-tail-log-clipping"><img src="https://agentmods.dev/badge/skills/alivirgo/major-ai-skills/head-tail-log-clipping.svg" alt="Reviewed on agentmods" width="80" height="20"></a>What it costs to keep this loaded
Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5.1 | $0.00027 | $0.01247 |
| Opus 5 | $0.00014 | $0.00624 |
| Sonnet 5 | $0.00005 | $0.00249 |
| Haiku 4.5 | $0.00003 | $0.00125 |
Grade A, and why
head-tail-log-clipping scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured yesterday.
A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.
Nothing flagged
None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.
How it starts
The opening of the file, as written. The whole thing — 123 lines — stays where its author put it; the contents beside it link to each section on GitHub.
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:
- The Head (First 15-25 lines): Command invocation arguments, environment variables, compiler flags, and target module names.
- 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
┌─────────────────────────────────────────────────────────────┐
│ Log Stream Ingestion Impact │
│ │
│ Unclipped Terminal Log (3,000 Lines / 18,500 Tokens): │
│ • Lines 1-20: `pytest tests/` (Environment info) │
│ • Lines 21-2950: 2,930 lines of passing green dots / tests │
│ • Lines 2951-3000: AssertionError on line 42 │
│ ↳ 18,500 tokens billed, agent loses attention in middle │
│ │
│ Sandwich Truncated Log (60 Lines / 420 Tokens - 97.7% Cut):│
│ === HEAD (Lines 1-20) === │
│ pytest tests/auth/ -v --color=no │
│ [... 2,930 passing test lines truncated for efficiency ...]│
│ === TAIL (Lines 2960-3000) === │
│ FAILED tests/auth/test_jwt.py::test_expiry - AssertionError │
│ ↳ 420 tokens billed, instant pinpoint fix on test_jwt.py │
└─────────────────────────────────────────────────────────────┘
What this file has done since we first saw it
Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.
- yesterday Changed · -22 tokens per session 05c320faabaa
- 7d ago First seen · 123 lines · 49 tokens per session scan A 2e92284282f2
head-tail-log-clipping is a skill published in the GitHub repository alivirgo/Major-AI-Skills (1 stars, last pushed today), licensed MIT. It adds 27 tokens to every session and 1,247 once invoked, about $0.0001 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-09-05.
Other skills, from other repositories
agenttrace-session-audit
Audit local AI coding-agent sessions with agenttrace for cost, tool failures, latency, anomalies, health, diffs, and CI gates.
error-experience-library
An error knowledge base that stores recurring error patterns, their causes, and the fixes that worked. It can search past entries and track whether each suggested fix succeeded.
agent-memory-mcp-v2
Agent Memory Skill workflow skill. Use this skill when the user needs A hybrid memory system that provides persistent, searchable knowledge management for AI agents (Architecture, Patterns, Decisions) and the operator should preserve the upstream workflow, copied support files, and provenance before merging or handing…
azure-network-watcher
Expert knowledge for Azure Network Watcher development including troubleshooting, decision making, limits & quotas, security, configuration, and integrations & coding patterns. Use when configuring flow logs, Traffic Analytics, packet capture, VPN monitoring, or KQL/Terraform integrations, and other Azure Network…
aio-golang-mastery
Write, review, and lint Go code. Lint mode runs go build, go vet, golangci-lint, govulncheck, nilaway, deadcode, and race detection (race detector), then applies idiomatic fixes. Reference mode covers concurrency, error handling, generics, testing, gRPC, and production hardening. Use when asked to lint golang, run a…
aio-gitnexus
Install, configure, and manage the GitNexus code intelligence engine — index codebase, setup MCP, check status, troubleshoot, and document local git-hook auto-refresh for master-only workflows.