[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill-6ee108f3-d974-4e9e-bb57-9b4e9f98b51b":3,"$fY7J2wrt7zsL-yb-eTonS0xly31nidEaiFlsuEXD9OSc":43},{"id":4,"title":5,"description":6,"categoryId":7,"moduleId":8,"tags":9,"prompt":10,"icon":11,"source":12,"sourceUrl":13,"authorId":14,"authorName":15,"isPublic":16,"stars":17,"runs":18,"createdAt":19,"updatedAt":19,"module":20,"category":27,"packages":34},"6ee108f3-d974-4e9e-bb57-9b4e9f98b51b","recursive-context-pruning-token-budgeting","通过剪枝冗余上下文、管理令牌使用并强制执行超简洁、直接体现价值的响应来优化AI代理性能。","cat_prod_data","mod_productivity","sickn33,productivity","---\nname: recursive-context-pruning-token-budgeting\ndescription: \"Optimizes AI agent performance by pruning redundant context, managing token usage, and enforcing ultra-concise, direct-to-value responses.\"\ncategory: prompt-engineering\nrisk: safe\nsource: self\nsource_repo: Kench001\u002Fantigravity-awesome-skills\nsource_type: self\ndate_added: \"2026-05-03\"\nauthor: Kench001\ntags: [efficiency, token-optimization, brevity, context-management]\ntools: [claude, cursor, gemini]\n# Optional: declare the upstream license if source_repo is set\n# license: \"MIT\"\n# license_source: \"https:\u002F\u002Fgithub.com\u002Fowner\u002Frepo\u002Fblob\u002Fmain\u002FLICENSE\"\n---\n\n# Recursive Context Pruning & Token Budgeting\n\n## Overview\n\nThis 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.\n\n## When to Use This Skill\n\n- Use when building multi-step agents to prevent repetition and \"memory drift\" in long conversations.\n- Use when working with large document sets or codebases to avoid dumping entire files into the prompt.\n- Use when you need purely functional output (code\u002Flogic) without \"Sure! Here is your...\" intros.\n\n## How It Works\n\n### Step 1: Metadata Sharding\n\nScan 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.\n\n### Step 2: Token Budget Allocation\n\nCalculate 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.\n\n### Step 3: Atomic Output Filtering\n\nStrip 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.\n\n### Step 4: Ambiguity Check\n\nBefore 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.\n\n### Step 5: Abstractive Compression\n\nSummarize 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.\n\n## Examples\n\n### Example 1: Filtered Code Output (No Filler)\n\n```text\nUser: \"Update the Firebase config to use environment variables.\"\n```\n\n```javascript\nconst firebaseConfig = {\n  apiKey: process.env.VITE_FIREBASE_API_KEY,\n  authDomain: process.env.VITE_FIREBASE_AUTH_DOMAIN,\n  projectId: process.env.VITE_FIREBASE_PROJECT_ID\n};\n```\n\n### Example 2: Essential Clarification\n\n```text\nUser: \"Deploy the function.\"\n```\n\n```text\n\"Specify environment: production or staging?\"\n```\n\n## Best Practices\n\n- ✅ **Direct Start:** Place the code or answer at the very first character of the response.\n- ✅ **Summarize-as-you-go:** Turn 10 pages of discussion into 5 bullet points for the next turn.\n- ✅ **Omit Signatures:** Never end with \"Let me know if you need more help.\"\n- ❌ **No Bridge Phrases:** Avoid \"Here is the code,\" \"Sure,\" or \"I can help with that.\"\n- ❌ **No Guessing:** If input is missing, ask immediately rather than wasting tokens on a generic guess.\n\n## Limitations\n\n- This skill does not replace environment-specific validation, testing, or expert review.\n- Extreme brevity can occasionally hide important nuances; use concise inline comments (`\u002F\u002F crucial step`) for critical notes.\n\n## Security & Safety Notes\n\n- Never prune safety headers, environment-specific security constraints, or system-level instructions during the compression stage.\n- Maintain original system instructions at the \"Root\" of the context to prevent context-loss-based jailbreaks.\n\n## Common Pitfalls\n\n- **Problem:** The response is so brief it lacks the context needed for implementation.\n  **Solution:** Use concise inline code comments instead of separate paragraphs of text.\n\n- **Problem:** The agent loses the overarching goal due to over-compression.\n  **Solution:** Always pin the \"Primary Objective\" to the top of every pruned prompt.\n\n## Related Skills\n\n- `@atomic-precision-response` - Specifically for removing conversational filler.\n- `@context-sharding` - For managing large-scale documentation mapping.\n\n","","imported","https:\u002F\u002Fgithub.com\u002Fsickn33\u002Fantigravity-awesome-skills","user_system_seed","SkillOPIC",true,90,1296,"2026-05-16 13:36:49",{"id":8,"name":21,"slug":22,"icon":23,"description":24,"sort":25,"createdAt":26},"效率工具","productivity","mdi-lightning-bolt-outline","文档处理、数据分析、自动化工作流",4,"2026-05-16 12:53:40",{"id":7,"name":28,"slug":29,"icon":30,"description":31,"moduleId":8,"sort":32,"skillCount":33,"createdAt":26},"数据分析","data-analysis","mdi-chart-bar","数据可视化、统计分析",2,30,[35],{"id":36,"skillId":4,"version":37,"fileName":38,"fileSize":39,"filePath":40,"fileHash":41,"manifest":42,"createdAt":19},"34cad879-6c31-4dbc-a52f-3bde102d2bab","1.0.0","recursive-context-pruning-token-budgeting.zip",2401,"uploads\u002Fskills\u002F6ee108f3-d974-4e9e-bb57-9b4e9f98b51b\u002Frecursive-context-pruning-token-budgeting.zip","7e19d142cb4b5fa18059b0d0683ff8e1dbb8d67930b5db3a6ef7cb51eb9b78a7","[{\"path\":\"SKILL.md\",\"isDirectory\":false,\"size\":4629}]",{"code":44,"message":45,"data":46},200,"success",{"items":47,"stats":48,"page":51},[],{"averageRating":49,"totalRatings":49,"ratingCounts":50},0,[49,49,49,49,49],{"limit":52,"offset":49,"hasMore":53,"nextOffset":52,"ratedOnly":16},15,false]