Community程式設計與開發github.com

潛在簡報 (Latent Briefing)

此技能應在用戶要求「在代理之間共享記憶」、「多代理 KV 快取壓縮」、「協調器工作者上下文」、「潛在簡報」、「減少工作者 token」、或討論 Attention Matching 壓縮、遞迴語言模型與工作者、或層級代理中的 token 爆炸時啟用。

潛在簡報 (Latent Briefing) 是什麼?

此技能描述「潛在簡報 (Latent Briefing)」技術,專為層級多代理系統設計,旨在解決協調器長時間推理軌跡在傳遞給工作者時造成的 token 成本與資訊損失問題。核心概念是在工作者模型的鍵值 (KV) 快取層級共享記憶,而非文字層級,透過任務引導的注意力匹配 (Attention Matching) 壓縮技術,保留與當前工作者任務最相關的協調器軌跡位置。此方法支援多種平台,如支援內部 KV 張量存取的自訂推理堆疊,但對於僅限 API 的堆疊不適用。其優勢在於能顯著減少工作者 token 使用量,同時保持精確的狀態傳遞,但需注意其效果高度依賴工作負載、壓縮閾值設定,且需要較強的基礎設施控制能力。

相容平台~Claude Code~Codex CLI~Cursor
npx skills add https://github.com/muratcankoylan/Agent-Skills-for-Context-Engineering/tree/main/skills/latent-briefing

Installed? Explore more 程式設計與開發 skills: steipete/bluebubbles, steipete/eightctl, steipete/blucli · View all 6 →

在你喜歡的 AI 中提問

開啟一個已預先載入此 Agent Skill 的新對話。

說明文件

潛在簡報與 KV 快取記憶共享

層級多代理系統經常為相同的上下文支付兩次費用。協調器累積了冗長的推理軌跡,但每個工作者通常只接收到狹隘的文字交接,例如子任務提示加上原始文件片段。傳遞完整軌跡可以解決覆蓋率問題,但會使每次工作者呼叫的 token 成本飆升。摘要會引入延遲和資訊遺失。檢索有助於文件存取,但無法保留協調器不斷演進的推理狀態。

潛在簡報透過在表徵層級而非文字層級共享記憶來解決此問題。其核心想法是在工作者模型的 KV 快取中壓縮協調器軌跡,只保留與當前工作者任務最相關的位置。此方法建立在注意力匹配 (Attention Matching, AM) KV 快取壓縮之上,並將其適用於推理時的多代理交接,具有任務引導查詢、跨注意力頭的共享 token 遮罩以及強健的閾值設定。

何時啟用

當遇到以下情況時啟用此技能:

  • 設計協調器-工作者或監督者-專家系統時,工作者需要存取先前的協調器狀態,但不想以文字方式重播完整軌跡
  • 評估 LLM 摘要或 RAG 用於跨代理狀態轉移的替代方案
  • 實作或研究KV 快取壓縮作為一級推論基元,而不僅是相同提示的前綴快取
  • 偵錯遞迴、層級或大量使用工具的代理圖中的 token 爆炸
  • 解讀同時報告工作者 token 節省量、總 token 節省量、壓縮開銷和準確度的基準

請勿為其他技能負責的相鄰工作啟用此技能:

  • 僅限 API 的堆疊,其中內部 KV 張量不可存取:請使用 context-compression、memory-systems 或 multi-agent-patterns。
  • 一般的持久記憶、實體追蹤或圖形檢索:memory-systems。
  • 不含表徵層級狀態共享的一般多代理拓撲:multi-agent-patterns。
  • 不轉換 KV 狀態的前綴快取、遮罩或預算策略:context-optimization。

核心概念

Token 爆炸模式。 在遞迴或 REPL 風格的系統中,協調器反覆呼叫工作者來檢查證據、驗證假設或回答子問題。協調器的軌跡會隨著部分結論、死胡同、工具輸出和先前工作者回應而增長。如果每次工作者呼叫都完整傳遞該軌跡,成本會很快複合。

表徵層級共享。 系統不是將軌跡摘要成自然語言,而是操作於工作者模型的 KV 快取。它保留工作者為了當前任務會關注的位置,並捨棄其餘部分。這比普通的前綴快取更具體:前綴快取重複使用相同的前綴,而潛在簡報還在重複使用的軌跡內部執行任務條件化的選擇性保留。

注意力匹配作為壓縮引擎。 AM 旨在尋找一個較小的快取,使其注意力輸出近似於完整快取。潛在簡報透過更改評分信號和批次策略,將 AM 適用於多代理推論:

  1. 使用從當前工作者提示衍生的任務引導查詢向量。
  2. 將分數聚合為共享的全域遮罩,而不是每個頭獨立的子集。
  3. 使用強健的閾值,例如 中位數 + tau * MAD,而不是每個頭的固定 top-k。

參考結果形狀。 公開報告顯示在長文件 QA 工作負載中,工作者 token 大幅減少、總 token 顯著節省,且壓縮開銷僅為個位數秒(請參閱 claim-latent-briefing-public-results)。請將這些數字視為特定工作負載的證據,而非一般保證。

詳細主題

為何純文字緩解方案不足

方法主要弱點
LLM 摘要高延遲、有損抽象,且無法保證摘要能保留下一個子任務所需的內容
檢索 / RAG依賴於分塊和嵌入;可能遺漏跨塊或跨步驟的依賴關係
傳遞完整軌跡每次工作者呼叫成本都會增加,且不相關的上下文可能降低工作者的品質

當瓶頸不在於文件檢索本身,而是如何有效且精確地將協調器狀態轉移到工作者時,潛在簡報就很有用。

遞迴協調器-工作者形狀

諸如遞迴語言模型之類的框架將長上下文視為環境並對其進行遞迴:協調器分解工作並委派給工作者。潛在簡報適用於這種情況:協調器已經建立了特定於任務的狀態,這些狀態應該告知工作者,但將該狀態重新序列化為文字的成本過高或雜訊過多。

在理想的設定中,工作者為協調器軌跡維護一個持久的 KV 狀態。新的軌跡 token 會擴展該狀態,然後在為當前子任務生成之前執行壓縮。

三個推理時修改

  1. 任務引導查詢向量。 使用來自當前工作者任務提示的查詢,而不是來自上下文的通用樣本。透過工作者模型對軌跡加上當前任務進行前向傳遞,然後根據任務關注軌跡位置的強度對其進行評分。

  2. 共享 token 選擇。 將跨層和跨頭的得分聚合為每個位置一個分數。一個共享遮罩能夠進行批次操作,並避免數百個不相容的逐頭求解。

  3. MAD 閾值設定。 保留分數高於強健離群值閾值(例如 中位數 + tau * MAD)的位置。更高的 tau 意味著更積極的壓縮。最佳設定取決於任務情境、軌跡品質和文件長度。

基礎設施前提

潛在簡報只有在系統能夠充分控制工作者推理執行時期以檢查或轉換 KV 狀態時才實用。對於內部 KV 張量不可存取的僅 API 堆疊,這是一個不好的預設選項。它也假設協調器軌跡可以在工作者的模型空間中表示。如果協調器和工作者在 tokenizer、架構或注意力佈局上有實質差異,直接的表徵共享可能不可行。

決策框架

選擇符合瓶頸的機制:

需求偏好原因
穩定的重複前綴,邏輯變更最少前綴快取最便宜的優化;無資訊遺失
可人工閱讀和稽核的跨步驟狀態結構化筆記或摘要易於檢查和儲存
跨大型外部語料庫的稀疏查詢檢索 / RAG有效地找到文件
工作者需要協調器狀態的特定任務片段,且存在執行時期存取權潛在簡報無需重播所有文字即可轉移相關潛在狀態

潛在簡報並非摘要或檢索的通用替代方案。它是一種針對已執行可控制協調器-工作者堆疊的系統的專業化最佳化。

閾值區間

報告的長文件 QA 結果表明:

  • 較長的文件: 較輕的壓縮可以保留更廣泛的證據覆蓋範圍,同時仍節省 token。
  • 較難的問題: 當協調器軌跡包含推測性或低價值分支時,更積極的壓縮可能會有所幫助。
  • 較短、較簡單的上下文: 適度的壓縮可以去除冗餘,而不會遺漏所需的證據。

這些是調優假設,非可移植法則。請在目標工作負載上重新測量。

實務指導

  • 首先定義共享記憶邊界。 精確決定哪些內容進入軌跡快取:先前工作者回覆、工具輸出、思維鏈,還是僅限選定的工件。壓縮品質首先取決於允許哪些內容進入快取。
  • 在驗證資料上進行調優,而非根據傳聞。 同時追蹤任務準確度、工作者 token、總 token、保留率和壓縮開銷。
  • 測量端到端延遲。 只有在壓縮加上生成的速度超過最佳文字層級替代方案以達到相同品質目標時,壓縮才值得。
  • 使用強基準。 與前綴快取、結構化筆記、檢索和選擇性文字交接進行比較,而不僅僅是「全部發送」。
  • 預期協調器變異性。 如果分解策略在每次執行之間發生變化,請平均足夠多的試驗次數,以將壓縮效果與協調器雜訊分離。

範例

情境:協調器軌跡在多次工作者呼叫之間增長

呼叫 1:軌跡 T1 -> 工作者回答子問題 A
呼叫 2:軌跡 T2 = T1 + 新的推理 + 回覆 A
        使用任務提示 B 壓縮 KV(T2)
        工作者回答子問題 B

任務提示 B 決定了 T2 的哪些部分會存活到壓縮後的工作者狀態中。

負面範例:僅 API 工作者

如果工作者執行於一個不暴露 KV 張量的託管文字生成 API 之後,則無法直接實作潛在簡報。請改用 context-compression 的結構化文字交接,或從 memory-systems 檢索狀態。

指導原則

  1. 當浪費主要來自向工作者重播協調器狀態,而非檢索來源文件時,優先使用潛在簡報。
  2. 當可稽核性、可移植性或封閉模型 API 比 token 效率更重要時,優先使用純文字交接。
  3. 將壓縮與評估共同設計。微小的品質下降可能會抹去大量的 token 節省。
  4. 將壓縮積極性公開為可控參數,而非隱藏常數。

陷阱

  1. 基礎設施存取是第一道關卡。 如果執行時期無法檢查和重寫工作者 KV 狀態,潛在簡報只是一個研究想法,而非可部署的技術。
  2. 共享模型空間很重要。 KV 壓縮是在特定模型的注意力空間中定義的。不要假設潛在交接能在不相關的模型系列之間順利運作。
  3. 閾值取決於工作負載。 一個全域的 tau 很少能同時適用於長篇與短篇上下文、簡單與困難任務。當壓縮變得過於積極時,預計會出現準確度懸崖。
  4. 基準範圍很窄。 公開結果集中在長文件 QA 上。程式碼生成、數學和多文件合成可能表現不同。
  5. 協調器變異性會掩蓋訊號。 隨機協調器可能足以改變軌跡,從而淹沒小的壓縮收益或損失。
  6. 弱基準會誇大明顯的勝利。 在聲稱系統級優勢之前,請與強大的文字層級替代方案進行比較。

整合

  • context-optimization - 前綴快取和觀察遮罩仍然是預設的第一步;對於相容的協調器-工作者堆疊,潛在簡報是一個更專業化的最佳化。
  • multi-agent-patterns - 當多代理 token 成本是由監督者軌跡重播驅動,而不僅僅是協調開銷時適用。
  • context-compression - 當人類可讀的狀態、可移植性或稽核日誌很重要時,文字層級摘要仍然是首選。
  • memory-systems - 幫助決定何時將跨步驟狀態保存在外部記憶體中,而不是工作者的潛在狀態中。
  • tool-design - 工作者呼叫形狀和任務提示決定了壓縮期間哪些 token 得分較高。

參考資料

內部參考:

此集合中的相關技能:

  • context-optimization - 何時閱讀:主要需求是前綴快取、觀察遮罩或文字層級壓縮,而非工作者 KV 操作
  • multi-agent-patterns - 何時閱讀:決定架構是否應該是協調器-工作者
  • context-compression - 何時閱讀:人類可讀的摘要可能比潛在轉移更適合
  • memory-systems - 何時閱讀:比較模型內潛在狀態與外部持久記憶

外部資源:


技能元資料

建立日期:2026-04-14 最後更新:2026-05-15 作者:Agent Skills for Context Engineering 貢獻者;主要技術來源 Ramp Labs(公開貼文) 版本:1.2.0

Individual skills in this repo

This repo contains 20 individual skills — each has its own dedicated page.

advanced-evaluation

This skill should be used for advanced LLM evaluation: LLM-as-judge systems, direct scoring, pairwise comparison, rubric calibration, evaluator bias mitigation, confidence scoring, and automated quality assessment.

bdi-mental-states

This skill should be used when modeling agent mental states with BDI concepts: beliefs, desires, intentions, RDF-to-belief transformations, rational agency traces, cognitive agents, BDI ontologies, and neuro-symbolic AI integration.

book-sft-pipeline

This skill should be used for book-to-SFT pipelines: ePub extraction, literary segmentation, author-voice dataset construction, style-transfer training, LoRA workflows, and model evaluation for voice replication.

compaction-control-profiling

This skill should be used when deciding, for a specific model and workload, whether the harness or the model should control compaction, and when qualifying or calibrating that choice with measurements: context-budget sweeps that compare harness-driven and model-driven compaction on one harness, the context-pressure regime where delegation pays, a per-model compaction behavior profile (interface uptake, compression factor per call, reopen rate of archived content, context fill at first compaction, response to pressure warnings), context anxiety and timing-instruction calibration, reversible collapse-and-archive interfaces, and re-qualification after a model or prompt change. Route the editable-file protocol, harness invariants, and edit-position cache cost of self-editing agents to self-managed-context, summary content to context-compression, harness thresholds and cache layout to context-optimization, and general evaluation design to evaluation.

comprehensive-research-agent

Ensure thorough validation, error recovery, and transparent reasoning in research tasks with multiple tool calls

context-compression

This skill should be used when long-running agent sessions need context compression, structured summarization, compaction, token-per-task optimization, or durable handoff summaries that preserve decisions, files, risks, and next actions.

context-degradation

This skill should be used for diagnosing and mitigating context degradation: lost-in-middle failures, context poisoning, context clash, context confusion, attention-pattern issues, and agent performance degradation caused by accumulated or conflicting context.

context-fundamentals

This skill should be used to explain or reason about the foundational concepts of context engineering: what context is, the anatomy of a context window, how attention mechanics work, the U-shaped attention curve, why context quality matters more than quantity, and the mental models needed to interpret every other context-engineering decision. Use this for conceptual explanation, onboarding, and background reading. Route operational work to the specialized skills: debugging attention failures goes to context-degradation, token-efficiency work goes to context-optimization, conversation summarization goes to context-compression, and project-shape decisions go to project-development.

context-optimization

This skill should be used for improving context efficiency: context budgeting, observation masking, prefix or KV-cache strategy, partitioning, token-cost reduction, retrieval scoping, and extending effective context capacity without lowering answer quality.

evaluation

This skill should be used when building agent evaluation systems: deterministic checks, regression suites, multi-dimensional rubrics, quality gates, production monitoring, baseline comparison, and outcome measurement for agent pipelines.

filesystem-context

This skill should be used when agent work needs file-backed context: durable scratchpads, tool-output offloading, just-in-time discovery, cross-agent handoff files, filesystem memory, or cleanup policies for context stored outside the prompt.

harness-engineering

This skill should be used when designing autonomous agent harnesses: research loops, evaluation scaffolds, locked and editable surfaces, durable logs, novelty gates, pruning, rollback, PR preparation, and human approval boundaries.

hosted-agents

This skill should be used when designing hosted or background agent infrastructure: sandboxed execution, remote coding environments, warm pools, session persistence, multiplayer collaboration, self-spawning agents, or Modal-style sandboxes.

instruction-surface-security

Hardens agent runtimes against persistent prompt injection or unauthorized changes to instructions and permissions. Use to audit what agents auto-load, design reviewed activation for project rules, skills, memory, or tool configuration, and test whether trust boundaries hold after reload, restart, or delegation.

long-horizon-prompting

This skill should be used when writing, enhancing, or evaluating the launch prompt for a long-running autonomous agent or a parallel multi-agent orchestration attacking a hard problem: pseudo-formal task briefs that define terms and an exact success predicate linguistically, enumerate non-counting outcomes, set persistence rules with explicit stop and return conditions and effort floors, manage a diverse portfolio of parallel approaches with an approach registry and blocked-route bookkeeping, and gate the return on adversarial audit. Route agent topology and coordination protocols to multi-agent-patterns, runtime control surfaces and loop governance to harness-engineering, evaluator and quality-gate construction to evaluation, judge design to advanced-evaluation, and compaction or memory mechanics to context-compression and memory-systems.

memory-systems

This skill should be used for persistent semantic memory in agent systems: cross-session knowledge retention, entity tracking, temporal validity, graph or vector retrieval, memory consolidation, and memory benchmark selection. Route file-backed scratchpads to filesystem-context, handoff summaries to context-compression, and token-efficiency tactics to context-optimization.

multi-agent-patterns

This skill should be used when designing multi-agent systems that need context isolation, supervisor or swarm coordination, explicit handoffs, parallel execution, or a decision on whether multiple agents are justified.

project-development

This skill should be used for project-level decisions about LLM-powered systems: whether an LLM is the right primitive for the task at hand, the shape of a multi-stage batch or agent pipeline, token and cost estimation, choosing between single-agent and multi-agent at the project level, structured output design for downstream parsing, and structuring agent-assisted iteration. Use this when the unit of work is a whole project or a multi-stage pipeline. Route individual tool design to tool-design and individual skill-loading or context-budget tactics to context-optimization.

self-improvement-loops

This skill should be used when the harness, scaffold, workflow, or optimizer itself is the optimization target: recursive self-improvement (RSI) loops, meta-harnesses, self-improving harnesses that mine their own failures and propose bounded edits, evolutionary or population-based search over agent scaffolds, acceptance gates for self-modifying systems, and agentic context evolution where the mechanism that produces context is versioned and evolved. Route governance of a single autonomous loop (locked surfaces, durable logs, rollback, novelty gates, approval boundaries) to harness-engineering, measurement and quality-gate design to evaluation, judge design to advanced-evaluation, and remote sandbox infrastructure to hosted-agents.

self-managed-context

This skill should be used when a model gets read-write control over its own live context window instead of a harness-scheduled compaction policy: the context exposed as an editable file the model rewrites with code tools, model-driven eviction and in-place updates, the harness invariants that keep self-editing safe (pinned prefix, edit gate, edit receipts, budget readouts, rollback on overflow), the prefix-cache cost of mid-context edits, and steering or training the model's own context-editing strategy. Route note content and fixed-threshold summarization to context-compression, cache-stable layout under harness control to context-optimization, file offloading to filesystem-context, and loop governance to self-improvement-loops.

相關技能