跳到正文
Skillpedia
智能体48k · #5593

recursive-context-pruning-token-budgeting

它能做什么

这个工具可以帮助 AI 变得更加直接、高效。它会删掉不必要的信息,专注于给你所需的准确答案,不说多余的话。

适用场景

  • ✓在为长对话构建 AI 助手时。
  • ✓在处理大量文档或代码时。
  • ✓当你只想要最终结果,不需要额外的客套话时。

技能链接

https://github.com/sickn33/agentic-awesome-skills/blob/main/plugins/agentic-awesome-skills-claude/skills/recursive-context-pruning-token-budgeting/SKILL.md

复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。

使用方法

最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。

可直接粘贴的消息

请用这个技能帮我:https://github.com/sickn33/agentic-awesome-skills/blob/main/plugins/agentic-awesome-skills-claude/skills/recursive-context-pruning-token-budgeting/SKILL.md 阅读该链接中的 SKILL.md 文件,并在我的任务中按照它的说明来做。
想让你的 AI 自己找到这样的技能吗?安装免费的 Skillpedia MCP:只需一行,每次任务前它都会在 15,000+ 个技能中搜索。1 分钟完成安装 →

可以这样问 AI

“给我连接数据库的代码。”

每周 5 个新技能,1 分钟读完。

工作原理

AI 会先判断哪些信息是重要的,然后决定答案要使用多少空间(token),并去掉“废话”式的表达,直接切入重点。

技术内容(原始 SKILL.md)

作者在 GitHub 上的英文原文。

Recursive Context Pruning & Token Budgeting

Overview

This skill implements a "Gatekeeper" logic to prevent context window bloat and unnecessary token expenditure. It ensures the agent only processes relevant data shards and adheres to an Atomic Precision protocol—delivering functional answers with zero conversational filler. By recursively summarizing state and stripping "bridge phrases," it maximizes the longevity and speed of long-running development workflows.

When to Use This Skill

  • Use when building multi-step agents to prevent repetition and "memory drift" in long conversations.
  • Use when working with large document sets or codebases to avoid dumping entire files into the prompt.
  • Use when you need purely functional output (code/logic) without "Sure! Here is your..." intros.

How It Works

Step 1: Metadata Sharding

Scan the available data for headers, summaries, and key indicators. Create a "map" of the context rather than injecting the full source. Never pull the entire file into the prompt unless a specific, narrowed fragment is requested.

Step 2: Token Budget Allocation

Calculate a "Safe Response Limit" based on the current context window. Allocate 30% for current logic processing, 20% for immediate output, and 50% for a future context buffer.

Step 3: Atomic Output Filtering

Strip all "Bridge Phrases" (e.g., "I've updated the code," "Based on your request," "Sure"). Start the response immediately with the solution or the code block.

Step 4: Ambiguity Check

Before executing Step 3, scan for missing critical variables (e.g., specific file names or environment types). If the prompt is too ambiguous, bypass the atomic output and generate exactly one concise question to resolve the blocker.

Step 5: Abstractive Compression

Summarize the current turn into a "compressed state string" (e.g., [Project: Feasify | State: Auth-Fixed | Remaining-Tasks: 2]) to discard redundant conversational data before the next prompt.

Examples

Example 1: Filtered Code Output (No Filler)

User: "Update the Firebase config to use environment variables."
const firebaseConfig = {
  apiKey: process.env.VITE_FIREBASE_API_KEY,
  authDomain: process.env.VITE_FIREBASE_AUTH_DOMAIN,
  projectId: process.env.VITE_FIREBASE_PROJECT_ID
};

Example 2: Essential Clarification

User: "Deploy the function."
"Specify environment: production or staging?"

Best Practices

  • ✅ Direct Start: Place the code or answer at the very first character of the response.
  • ✅ Summarize-as-you-go: Turn 10 pages of discussion into 5 bullet points for the next turn.
  • ✅ Omit Signatures: Never end with "Let me know if you need more help."
  • ❌ No Bridge Phrases: Avoid "Here is the code," "Sure," or "I can help with that."
  • ❌ No Guessing: If input is missing, ask immediately rather than wasting tokens on a generic guess.

Limitations

  • This skill does not replace environment-specific validation, testing, or expert review.
  • Extreme brevity can occasionally hide important nuances; use concise inline comments (// crucial step) for critical notes.

Security & Safety Notes

  • Never prune safety headers, environment-specific security constraints, or system-level instructions during the compression stage.
  • Maintain original system instructions at the "Root" of the context to prevent context-loss-based jailbreaks.

Common Pitfalls

  • Problem: The response is so brief it lacks the context needed for implementation. Solution: Use concise inline code comments instead of separate paragraphs of text.

  • Problem: The agent loses the overarching goal due to over-compression. Solution: Always pin the "Primary Objective" to the top of every pruned prompt.

Related Skills

  • @atomic-precision-response - Specifically for removing conversational filler.
  • @context-sharding - For managing large-scale documentation mapping.
常见问题

为什么 AI 不说“好的,这是代码”?

为了节省时间和空间,AI 会直接给出代码或答案,不做开场介绍。

如果 AI 没听懂我的请求怎么办?

AI 不会瞎猜,而是会提出一个简短、直接的问题,帮你明确需求。

这个工具会让 AI 忘记重要的东西吗?

不会。它的设计是保留核心指令和安全信息,只去掉对当前回答不必要的内容。

详情

作者的原始描述

Optimizes AI agent performance by pruning redundant context, managing token usage, and enforcing ultra-concise, direct-to-value responses.

repo: sickn33/agentic-awesome-skills

热度

GitHub 星标
48k
排名
#5593
许可证
MIT
更新时间
2026/10/15

这个技能有用吗?

0

登录 后即可投票。

评论

  • …

同一仓库的更多技能

相似技能