AgentStack
Browse Sign in
Browse Why AgentStack Sell Docs
Sign in
SKILL verified MIT Self-run

Api Round Ptl Retry Truncation

skill-ychampion-cskill-agents-api-round-ptl-retry-truncation · by ychampion

On prompt-too-long retries, drop the oldest API-round groups first and inject a synthetic user preamble when needed so the summarize request stays valid.

No reviews yet
0 installs
14 views
0.0% view→install

Install

$ agentstack add skill-ychampion-cskill-agents-api-round-ptl-retry-truncation

✓ scanned · ✓ verified, works with Claude Code, Cursor, and more.

Security review

✓ Passed

No issues found. Passed automated security review. · v0.1.0 How review works →

  • Prompt-injection patterns
  • Secret / credential exfiltration
  • Dangerous shell & filesystem operations
  • Untrusted network calls
  • Known-malicious package signatures

What it can access

  • Network access No
  • Filesystem access No
  • Shell / process execution No
  • Environment & secrets No
  • Dynamic code execution No

From automated source analysis of v0.1.0. “Used” means the capability is present in the source — more access means more to trust, not that it’s unsafe.

View the full security report →

Verified badge

Passed review? Show it. Paste this badge into your README, it links to the public security report.

AgentStack Verified badge Links to your public security report.
[![AgentStack Verified](https://agentstack.voostack.com/badges/verified.svg)](https://agentstack.voostack.com/security/report/skill-ychampion-cskill-agents-api-round-ptl-retry-truncation)

Reliability & compatibility

Security review passed
0 installs to date
no reviews yet
4mo ago

Declared compatibility

Claude CodeClaude Desktop

Compatibility is declared by the source manifest. End-to-end runtime verification is coming, see below.

Preview Execution monitoring

We're building live execution health for every listing: tool-call success rate, median latency, uptime, and last-checked timestamps, measured, not self-reported. It isn't live yet, so we don't show numbers we can't stand behind.

How agent discovery & health will work →
Are you the author of Api Round Ptl Retry Truncation? Claim this listing to set pricing, connect Stripe payouts, and keep 70% of every sale.
Sign up to claim

About

SKILL: API-Round PTL Retry Truncation

Domain: compaction Trigger: Apply when the compaction request itself hits prompt-too-long and you need a last-resort retry path that removes old context without breaking API message validity. Source Pattern: Distilled from reviewed session memory, compaction, and context-budgeting implementations.

Core Method

Recover from a prompt-too-long summary attempt by trimming whole API-round groups from the head of the message list instead of slicing arbitrary messages. Size the drop by the reported token gap when available, or by a fallback fraction when it is not, and keep at least one summarizeable group. If trimming leaves the message list starting with an assistant turn, prepend a synthetic user marker so the next retry still satisfies the API's user-first contract.

Key Rules

  • Group by assistant-response boundaries, not raw human turns, so each dropped unit preserves tool-use pairing semantics as much as possible.
  • Strip any prior synthetic retry marker before regrouping so repeated retries keep making progress instead of dropping only the marker.
  • Keep at least one group after truncation; return null when nothing safe remains to summarize.
  • Use the parsed token gap when available, but fall back to a deterministic percentage when the provider error format does not expose it.
  • Repair assistant-first retries with a synthetic user preamble so the request remains API-valid after head truncation.

Example Application

If a compaction call on a long single-user-turn session still exceeds the limit, group the transcript by API rounds, drop the oldest rounds until the estimated gap is covered, and retry with a synthetic meta user line when the remaining transcript would otherwise start with an assistant block.

Anti-Patterns (What NOT to do)

  • Do not trim arbitrary individual messages from the head; you can strand tool-use sequences and create invalid retry payloads.
  • Do not keep reusing the previous retry marker as part of the grouped history or each retry can stall without reducing real context.

Source & license

This open-source skill is cataloged on AgentStack and links to its original source — we do not rehost the code.

Install and usage instructions live in the source repository linked above.

Reviews

No reviews yet, be the first.

Versions

  • v0.1.0 Imported from the upstream source.