360 Secure SkillHub
360 安全技能中心

Truncated Output

该 Skill 是一份诊断指南,描述回复因 token 上限、流取消或代码围栏未闭合而中断的症状,并给出检查围栏配对、核对 finish reason、调整 max_tokens、控制上下文预算、拆分任务及显式提示不完整等处理建议。

mvogt99
mvogt99
热度 32.19
最近更新 2026-05-11 17:46:01
分类:知识依赖:纯提示词应用场景:概念解释

安装技能

复制下面的话术发给你的 Agent,它会通过 secure-skills 检索并安装该技能。

执行命令安装此 skill: npx secure-skills-cli add truncated-output
Metadata
name
truncated-output
description
The reply ends mid-sentence or mid-code-block because the model hit a token limit or was cut short.
emoji
✂️
metadata
{"clawdis":{"os":["macos","linux","windows"]}}

truncated-output

The reply the user receives is incomplete — the model ran out of tokens, the stream was cancelled, or a code fence opened without closing.

Symptoms

  • Reply ends without terminal punctuation and reads as if more was coming.
  • A fenced code block is open (```) with no matching close.
  • Enumerated lists or steps trail off before the final item.
  • Provider metadata reports finish_reason: "length" or stop_reason: "max_tokens".

What to do

  • Before returning the reply, check for an unmatched code fence. If present, the reply is incomplete — do not ship it.
  • Check the provider's finish reason. If it indicates a length cap, regenerate with a higher max_tokens budget or summarize the remaining work inline.
  • Watch context budget. If the prompt is already close to the context ceiling, the reply has no room — trim context before retrying, don't just raise the cap.
  • If truncation happens repeatedly on the same task, break the task into smaller turns instead of asking for one giant reply.
  • When truncation cannot be avoided (e.g., streaming to a channel with its own cap), surface the incompleteness to the user explicitly rather than pretending the reply is done.