recursive-context-pruning-token-budgeting – skill Agent & Tự động hóa cho agent AI
Tối ưu hiệu năng agent AI bằng cách cắt tỉa context dư thừa, quản lý lượng token và buộc phản hồi cực kỳ ngắn gọn, đi thẳng vào giá trị.
Cài skill recursive-context-pruning-token-budgeting bằng một lệnh
Chọn công cụ bạn đang dùng, copy lệnh và dán vào terminal. Skill sẽ nằm trong thư mục skills của công cụ đó và sẵn sàng dùng ở phiên làm việc tiếp theo.
Claude Code
mkdir -p ~/.claude/skills && curl -fsSL https://skill.dn1nguoi.com/z/recursive-context-pruning-token-budgetin-c13e4.tgz | tar xz -C ~/.claude/skills
Gọi trong Claude Code: /recursive-context-pruning-token-budgeting – rồi mô tả công việc bạn muốn làm.
Codex
mkdir -p ~/.codex/skills && curl -fsSL https://skill.dn1nguoi.com/z/recursive-context-pruning-token-budgetin-c13e4.tgz | tar xz -C ~/.codex/skills
Gọi trong Codex: $recursive-context-pruning-token-budgeting – rồi mô tả công việc bạn muốn làm.
Hermes Agent
mkdir -p ~/.hermes/skills && curl -fsSL https://skill.dn1nguoi.com/z/recursive-context-pruning-token-budgetin-c13e4.tgz | tar xz -C ~/.hermes/skills
Gọi trong Hermes Agent: /recursive-context-pruning-token-budgeting – rồi mô tả công việc bạn muốn làm.
DeepSeek
mkdir -p ~/.deepcode/skills && curl -fsSL https://skill.dn1nguoi.com/z/recursive-context-pruning-token-budgetin-c13e4.tgz | tar xz -C ~/.deepcode/skills
Gọi trong DeepSeek: /recursive-context-pruning-token-budgeting – rồi mô tả công việc bạn muốn làm.
Nội dung SKILL.md
Nội dung SKILL.md gốc bằng tiếng Anh.
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. Read relevant files completely when correctness, security, repository policy or the task requires it; metadata sharding is navigation, not proof of review. Preserve exact evidence locations for omitted material.
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: import.meta.env.VITE_FIREBASE_API_KEY,
authDomain: import.meta.env.VITE_FIREBASE_AUTH_DOMAIN,
projectId: import.meta.env.VITE_FIREBASE_PROJECT_ID
};This example assumes Vite. VITE_* values are exposed to browser code; Firebase client configuration is not a place for server credentials. Access controls and security rules remain necessary.
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.
Skill liên quan
- reddit-automation – Tự động hóa tác vụ Reddit qua Rube MCP (Composio): tìm kiếm subreddit, tạo bài đăng…
- render-automation – Tự động hóa các tác vụ Render qua Rube MCP (Composio): dịch vụ, deployment, dự án. Luôn…
- restosignals – Tìm nhà hàng và quán bar ở Mỹ trước khi mở cửa, dưới dạng lead đã chấm điểm, tổng hợp từ…
- reverse-browser-automation – Tự động hóa trình duyệt (Playwright) và ứng dụng desktop Windows (UI automation) để thu…
- review-multi-agent-orchestration – Dùng khi hệ thống supervisor, swarm, graph, planner-worker hoặc quy trình agent song…
- run-deep-swe – Chạy các đánh giá benchmark cho coding agent DeepSWE có thể tái lập thông qua OpenRouter…
- saga-orchestration – Các mẫu quản lý giao dịch phân tán và quy trình nghiệp vụ chạy dài.
- salesforce-automation – Tự động hóa tác vụ Salesforce qua Rube MCP (Composio): lead, liên hệ, tài khoản, cơ hội…