Tail preserving task output truncation

From ychampion/cskill-agents · View interactive version

Tail preserving task output truncation is an AI agent skill from the GitHub repository ychampion/cskill-agents. Persist tool outputs alongside metadata and truncate only the preview, ensuring the header points back to the persisted replica.

How to use this skill

Skill file

SKILL: Tail-Preserving Task Output Truncation

Domain: task-output

Trigger: Use this when a task produces output larger than the session’s configured limit and you need to keep a concise preview plus a persistent archive.

Source Pattern: Distilled from reviewed tool execution, streaming, persistence, and output-budget implementations.

Core Method

Track each task’s output size before emitting it. If it exceeds the configured limit, store the full output on disk, prepend a header that points to the saved file, and emit only the final slice of the log that still fits. Keeping the tail preserves the most recent progress or failure details while the persisted artifact holds the complete transcript.

Key Rules

Example Application

When a build step emits 100 KB of logs, save the full output to a file such as tool-results/build-task.txt, then return only the tail of the log plus a header that tells the reader where the full output lives.

Anti-Patterns (What NOT to do)

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.