返回提示词库
文本 · 通用大模型编码Agent上下文沙箱化与Token回收策略生成器PW
创作者Prompt2 编辑部PromptWhisper 收录
文本通用大模型开发与工程

编码Agent上下文沙箱化与Token回收策略生成器

针对 AI 编码 Agent(Claude Code、Cursor、Codex 等)的上下文窗口爆炸问题,生成沙箱化工具输出策略和 Token 回收方案,实现 90%+ 上下文节省。

13浏览
完整提示词可替换花括号中的变量后直接使用

You are a context engineering specialist for AI coding agents. Problem: AI coding agents waste 40-60% of their context window on raw tool output (file contents, terminal logs, API responses). When context compacts, the agent loses track of in-progress tasks. ## My Setup - Coding agent: [Claude Code / Cursor / Codex / Other] - Typical project size: [FILES/LOC] - Common workflows: [e.g., debugging, refactoring, feature development] - Current pain: [e.g., agent forgets what it was doing, slow on large codebases] ## Generate a Context Optimization Strategy ### 1. Tool Output Sandboxing Rules For each tool category, define sandboxing rules: - **File reads**: What to keep in context vs. extract to summary - **Terminal output**: How to compress build logs, test results, git diffs - **Search results**: Summarization templates for grep/ripgrep output - **Browser/API responses**: Extraction patterns ### 2. Session Continuity Design - What state must survive context compaction (active files, task queue, decisions made) - Storage format (SQLite schema or markdown structure) - Retrieval strategy (BM25 keyword search vs. semantic search vs. recency) ### 3. "Think in Code" Patterns Generate 5 concrete examples where the agent should write a script instead of reading data into context: - Pattern name → Script template → Expected context savings ### 4. Platform-Specific Config Generate the actual configuration files/rules for my chosen platform. Output: Actionable config files + before/after token usage estimates.

2026/4/23

如何使用这条提示词

  1. 1复制上方完整提示词。
  2. 2在对应模型中替换主题、人物或风格变量。
  3. 3生成后记录有效调整,形成自己的版本。