跳至正文
OpenAgentSkill
浏览已开放 · 目录记录日期 2026-11-21 · 自动更新和账户服务暂时关闭。
设计与 UI

context-budget-governance

Design and review context budget governance for agent prompts and model calls. Use when assembling long conversation context, tool results, retrieved evidence, memory, task state, system rules, multimodal observations, or compressed summaries under a token budget.

HsienW · 已有静态检查记录

安装与使用

运行命令前先阅读来源与依赖说明。复制命令不会自动安装或执行。

npx skills add HsienW/ai-agent-engineering-playbook --skill context-budget-governance

技能说明


name: context-budget-governance description: Design and review context budget governance for agent prompts and model calls. Use when assembling long conversation context, tool results, retrieved evidence, memory, task state, system rules, multimodal observations, or compressed summaries under a token budget.

Context Budget Governance

Skill Interface

  • Name: context-budget-governance.
  • Description: Design and review context budget governance for agent prompts and model calls that assemble conversation context, tool results, retrieved evidence, memory, task state, system rules, multimodal observations, and compressed summaries under a token budget.
  • Parameters: Token budget, output reserve, candidate context blocks, priority model, relevance and recency scores, safety filters, compression policy, source identifiers, and verification scenarios.
  • Instructions: Use this skill when a model call must fit useful context into a fixed budget. Prioritize safety and current task state, normalize blocks, redact before inclusion, compress lower-priority content, drop low-value blocks last, and record what changed.

Context assembly is a policy decision. The model should receive the most important safe context under a budget, with deterministic degradation when the budget is exceeded.

Priority Model

Use explicit priorities:

PriorityContent
P0System and security rules
P1Current task, user request, and task state
P2Relevant contracts, schemas, and caller-injected rules
P3High-value retrieved evidence and memory
P4Recent conversation summary
P5Low-value raw tool output

P0 and P1 should remain unless the request is impossible to serve safely.

Assembly Process

  1. Define token budget and reserve output space.
  2. Normalize all candidate context into typed blocks.
  3. Score blocks by priority, recency, relevance, and safety.
  4. Redact sensitive fields before inclusion.
  5. Compress lower-priority blocks when over budget.
  6. Drop low-value blocks only after compression options are exhausted.
  7. Record what was included, compressed, or dropped.

Compression Rules

  • Preserve requirements, constraints, and evidence references.
  • Compress raw tool output before dropping task-critical context.
  • Keep source identifiers and timestamps when evidence freshness matters.
  • Do not summarize secrets into the prompt.
  • Do not allow untrusted retrieved content to override system or developer instructions.
  • Keep current user intent separate from historical summaries.

Verification

Test ultra-long conversations, large tool outputs, many retrieved sources, multimodal observations, malicious retrieved instructions, missing budget, over-budget P0/P1 content, deterministic compression, and traceability of included and dropped blocks.