Community코딩 & 개발github.com

잠재 브리핑 및 KV 캐시 메모리 공유

에이전트 간 메모리 공유, KV 캐시 압축, 오케스트레이터-워커 컨텍스트 전달을 위한 기술로, 텍스트 수준이 아닌 표현 수준에서 상태를 공유하여 토큰 비용을 절감합니다.

잠재 브리핑 및 KV 캐시 메모리 공유란 무엇인가요?

이 스킬은 계층적 멀티 에이전트 시스템에서 오케스트레이터가 축적한 추론 궤적을 워커에게 효율적으로 전달하기 위한 '잠재 브리핑(Latent Briefing)' 기법을 설명합니다. 기존의 텍스트 요약, RAG, 또는 전체 궤적 전달 방식이 갖는 높은 지연 시간, 정보 손실, 토큰 비용 증가 문제를 해결하기 위해, 워커 모델의 KV 캐시 수준에서 작업 관련성이 높은 위치만 선택적으로 유지하는 표현 수준 공유를 수행합니다. 핵심 기술로는 Attention Matching(KV 캐시 압축)을 변형하여 작업 안내 쿼리 벡터, 공유 전역 마스크, 강건한 임계값(중앙값 + tau * MAD)을 사용합니다. 이 기술은 주로 오케스트레이터-워커 구조를 제어 가능한 런타임에서 실행할 때 유용하며, API 전용 스택이나 모델 공간이 다른 경우에는 적용이 어렵습니다. 공개된 벤치마크(긴 문서 QA)에서는 상당한 워커 토큰 절감과 총 토큰 절감을 보고하지만, 작업 부하에 따라 재측정이 필요합니다.

지원 대상~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에게 물어보기

이 에이전트 스킬이 미리 로드된 새 채팅을 엽니다.

문서

잠재 브리핑 및 KV 캐시 메모리 공유은(는) 무엇을 하나요?

계층적 멀티 에이전트 시스템은 종종 동일한 컨텍스트에 대해 두 번 비용을 지불합니다. 오케스트레이터는 긴 추론 궤적을 축적하지만, 각 워커는 일반적으로 하위 작업 프롬프트와 원시 문서 조각 같은 좁은 텍스트 핸드오프만 받습니다. 전체 궤적을 전달하면 커버리지는 해결되지만 모든 워커 호출에서 토큰 비용이 증가합니다. 요약은 지연 시간과 정보 손실을 유발합니다. 검색은 문서 접근에 도움이 되지만 오케스트레이터의 진화하는 추론 상태를 보존하지는 않습니다.

잠재 브리핑은 텍스트 수준이 아닌 표현 수준에서 메모리를 공유함으로써 이 문제를 해결합니다. 핵심 아이디어는 워커 모델의 KV 캐시에서 오케스트레이터 궤적을 압축하여 현재 워커 작업에 가장 관련성이 높은 위치를 유지하는 것입니다. 이 방법은 Attention Matching(AM) KV 캐시 압축을 기반으로 하며, 작업 안내 쿼리, 헤드 간 공유 토큰 마스크, 강건한 임계값 설정을 통해 추론 시 멀티 에이전트 핸드오프에 적응시킵니다.

활성화 시점

다음과 같은 경우 이 스킬을 활성화하세요:

  • 오케스트레이터-워커 또는 감독자-전문가 시스템을 설계할 때, 워커가 전체 궤적을 텍스트로 재생하지 않고 이전 오케스트레이터 상태에 접근해야 하는 경우
  • 에이전트 간 상태 전송을 위한 LLM 요약 또는 RAG의 대안을 평가할 때
  • KV 캐시 압축을 동일한 프롬프트의 프리픽스 캐싱뿐만 아니라 일급 추론 프리미티브로 구현하거나 연구할 때
  • 재귀적, 계층적 또는 도구가 많은 에이전트 그래프에서 토큰 폭발을 디버깅할 때
  • 워커 토큰 절감, 총 토큰 절감, 압축 오버헤드 및 정확도를 함께 보고하는 벤치마크를 해석할 때

다른 스킬이 담당하는 인접 작업에는 이 스킬을 활성화하지 마세요:

  • 내부 KV 텐서에 접근할 수 없는 API 전용 스택: context-compression, memory-systems 또는 multi-agent-patterns 사용.
  • 일반적인 영구 메모리, 엔티티 추적 또는 그래프 검색: memory-systems 사용.
  • 표현 수준 상태 공유가 없는 일반 멀티 에이전트 토폴로지: multi-agent-patterns 사용.
  • KV 상태를 변환하지 않는 프리픽스 캐싱, 마스킹 또는 예산 정책: context-optimization 사용.

핵심 개념

토큰 폭발 패턴. 재귀적 또는 REPL 스타일 시스템에서 오케스트레이터는 증거 검사, 가설 검증 또는 하위 질문 응답을 위해 워커를 반복적으로 호출합니다. 오케스트레이터의 궤적은 부분 결론, 막다른 길, 도구 출력 및 이전 워커 응답으로 커집니다. 해당 궤적이 모든 워커 호출에 완전히 전달되면 비용이 빠르게 증가합니다.

표현 수준 공유. 시스템은 궤적을 자연어로 요약하는 대신 워커 모델의 KV 캐시에서 작동합니다. 현재 작업에 대해 워커가 주목할 위치를 유지하고 나머지는 버립니다. 이는 일반 프리픽스 캐싱보다 더 구체적입니다. 프리픽스 캐싱은 동일한 프리픽스를 재사용하는 반면, 잠재 브리핑은 재사용된 궤적 내에서 작업 조건부 선택적 유지를 수행합니다.

압축 엔진으로서의 Attention Matching. AM은 출력이 전체 캐시의 주의 출력을 근사하는 더 작은 캐시를 찾습니다. 잠재 브리핑은 점수 신호와 배치 전략을 변경하여 멀티 에이전트 추론에 AM을 적용합니다:

  1. 현재 워커 프롬프트에서 파생된 작업 안내 쿼리 벡터를 사용합니다.
  2. 헤드별 독립 하위 집합 대신 공유 전역 마스크로 점수를 집계합니다.
  3. 헤드별 고정 top-k 대신 중앙값 + tau * MAD와 같은 강건한 임계값을 사용합니다.

참고 결과 형태. 공개된 글은 긴 문서 QA 작업(claim-latent-briefing-public-results)에서 상당한 워커 토큰 감소, 실질적인 총 토큰 절감 및 낮은 단위 초 압축 오버헤드를 보고합니다. 이 숫자를 일반적인 보장이 아닌 작업 부하별 증거로 취급하십시오.

세부 주제

텍스트 전용 완화 방법이 부족한 이유

접근 방식주요 약점
LLM 요약높은 지연 시간, 손실 있는 추상화, 요약이 다음 하위 작업에 필요한 것을 보존한다는 보장 없음
검색 / RAG청킹 및 임베딩에 의존; 청크 간 또는 단계 간 종속성을 놓칠 수 있음
전체 궤적 전달모든 워커 호출에서 비용이 확장되고 관련 없는 컨텍스트가 워커 품질을 저하시킬 수 있음

잠재 브리핑은 병목이 문서 검색 자체가 아니라 오케스트레이터 상태를 워커로 효율적이고 정확하게 전송하는 방법일 때 유용합니다.

재귀적 오케스트레이터-워커 구조

Recursive Language Models와 같은 프레임워크는 긴 컨텍스트를 환경으로 취급하고 그 위에서 재귀합니다: 오케스트레이터가 작업을 분해하고 워커에 위임합니다. 잠재 브리핑은 오케스트레이터가 이미 워커에 정보를 제공해야 하는 작업별 상태를 구축했지만, 해당 상태를 텍스트로 다시 직렬화하는 것이 너무 비싸거나 잡음이 많은 경우에 적합합니다.

이상적인 설정에서 워커는 오케스트레이터 궤적에 대한 영구 KV 상태를 유지합니다. 새 궤적 토큰이 해당 상태를 확장한 다음, 현재 하위 작업 생성을 위해 압축이 실행됩니다.

세 가지 추론 시간 수정

  1. 작업 안내 쿼리 벡터. 컨텍스트의 일반 샘플이 아닌 현재 워커 작업 프롬프트의 쿼리를 사용합니다. 워커 모델을 통해 궤적과 현재 작업을 순방향 전달한 다음, 작업이 궤적 위치에 얼마나 강하게 주목하는지 점수를 매깁니다.

  2. 공유 토큰 선택. 레이어와 헤드 전반의 점수를 위치당 하나의 점수로 집계합니다. 하나의 공유 마스크는 배치 작업을 가능하게 하고 수백 개의 호환되지 않는 헤드별 솔루션을 피합니다.

  3. MAD 임계값 설정. 중앙값 + tau * MAD와 같은 강건한 이상치 임계값 위의 위치를 유지합니다. tau가 높을수록 더 공격적입니다. 최적 설정은 작업 영역, 궤적 품질 및 문서 길이에 따라 다릅니다.

인프라 전제 조건

잠재 브리핑은 시스템이 KV 상태를 검사하거나 변환할 수 있을 만큼 워커 추론 런타임을 밀접하게 제어할 때만 실용적입니다. 내부 KV 텐서에 접근할 수 없는 API 전용 스택에는 부적합한 기본값입니다. 또한 오케스트레이터 궤적이 워커의 모델 공간에서 표현될 수 있다고 가정합니다. 오케스트레이터와 워커가 토크나이저, 아키텍처 또는 주의 레이아웃에서 실질적으로 다르다면 직접적인 표현 공유가 가능하지 않을 수 있습니다.

결정 프레임워크

병목 현상과 일치하는 메커니즘을 선택하세요:

필요선호이유
최소한의 로직 변경으로 안정적인 반복 프리픽스프리픽스 캐싱가장 저렴한 최적화; 정보 손실 없음
사람이 읽고 감사할 수 있는 단계 간 상태구조화된 노트 또는 요약검사 및 저장 용이
대규모 외부 코퍼스에 대한 희소 조회검색 / RAG문서를 효율적으로 찾음
워커가 오케스트레이터 상태의 작업별 조각이 필요하고 런타임 접근 권한이 있는 경우잠재 브리핑모든 텍스트를 재생하지 않고 관련 잠재 상태 전송

잠재 브리핑은 요약 또는 검색의 보편적인 대체재가 아닙니다. 제어 가능한 오케스트레이터-워커 스택을 이미 실행하는 시스템을 위한 특수 최적화입니다.

임계값 영역

보고된 긴 문서 QA 결과는 다음을 시사합니다:

  • 긴 문서: 가벼운 압축이 토큰을 절약하면서도 더 넓은 증거 범위를 보존할 수 있습니다.
  • 어려운 질문: 오케스트레이터 궤적에 추측성 또는 가치가 낮은 분기가 포함된 경우 더 공격적인 압축이 도움이 될 수 있습니다.
  • 짧고 쉬운 컨텍스트: 중간 정도의 압축이 필요한 증거를 떨어뜨리지 않고 중복성을 제거할 수 있습니다.

이는 이식 가능한 법칙이 아닌 조정 가설입니다. 대상 작업 부하에서 재측정하십시오.

실용적인 지침

  • 먼저 공유 메모리 경계를 정의하십시오. 궤적 캐시에 정확히 무엇이 입력되는지 결정하십시오: 이전 워커 응답, 도구 출력, 사고 사슬 또는 선택된 아티팩트만. 압축 품질은 처음에 캐시에 허용되는 내용에 따라 달라집니다.
  • 일화가 아닌 검증 데이터로 튜닝하십시오. 작업 정확도, 워커 토큰, 총 토큰, 유지율 및 압축 오버헤드를 함께 추적하십시오.
  • 종단 간 지연 시간을 측정하십시오. 압축 비용 + 생성 비용이 동일한 품질 목표에 대한 최상의 텍스트 계층 대안을 능가할 때만 압축이 효과적입니다.
  • 강력한 기준선을 사용하십시오. "모두 보내기"뿐만 아니라 프리픽스 캐싱, 구조화된 노트, 검색 및 선택적 텍스트 핸드오프와 비교하십시오.
  • 오케스트레이터 변동성을 예상하십시오. 분해 전략이 실행마다 변경되는 경우, 오케스트레이터 노이즈로부터 압축 효과를 분리하기 위해 충분한 시행 횟수로 평균을 내십시오.

예시

시나리오: 워커 호출 전반에 걸쳐 오케스트레이터 궤적 증가

호출 1: 궤적 T1 -> 워커가 하위 질문 A에 응답
호출 2: 궤적 T2 = T1 + 새로운 추론 + 응답 A
        작업 B 프롬프트를 사용하여 KV(T2) 압축
        워커가 하위 질문 B에 응답

작업 B 프롬프트는 T2의 어떤 부분이 압축된 워커 상태에서 살아남을지 결정합니다.

부정 예시: API 전용 워커

워커가 KV 텐서를 노출하지 않는 호스팅된 텍스트 생성 API 뒤에서 실행되는 경우, 잠재 브리핑을 직접 구현할 수 없습니다. 대신 context-compression의 구조화된 텍스트 핸드오프를 사용하거나 memory-systems에서 상태를 검색하십시오.

지침

  1. 주요 낭비가 소스 문서 검색이 아닌 오케스트레이터 상태를 워커로 재생하는 데서 발생할 때 잠재 브리핑을 선호하십시오.
  2. 감사 가능성, 이식성 또는 폐쇄형 모델 API가 토큰 효율성보다 더 중요할 때는 일반 텍스트 핸드오프를 선호하십시오.
  3. 평가와 함께 압축을 공동 설계하십시오. 작은 품질 저하가 큰 토큰 절감을 무효화할 수 있습니다.
  4. 압축 공격성을 숨겨진 상수가 아닌 제어된 매개변수로 노출하십시오.

주의사항

  1. 인프라 접근이 첫 번째 관문입니다. 런타임이 워커 KV 상태를 검사하고 다시 쓸 수 없다면, 잠재 브리핑은 배포 가능한 기술이 아닌 연구 아이디어입니다.
  2. 공유 모델 공간이 중요합니다. KV 압축은 특정 모델의 주의 공간에서 정의됩니다. 잠재 핸드오프가 관련 없는 모델 제품군 간에 깔끔하게 작동한다고 가정하지 마십시오.
  3. 임계값은 작업 부하에 따라 다릅니다. 하나의 전역 tau가 긴 컨텍스트 대 짧은 컨텍스트, 쉬운 작업 대 어려운 작업에서 거의 작동하지 않습니다. 압축이 너무 공격적일 때 정확도 급락을 예상하십시오.
  4. 벤치마크 범위가 좁습니다. 공개 결과는 긴 문서 QA에 초점을 맞춥니다. 코드 생성, 수학 및 다중 문서 합성은 다르게 동작할 수 있습니다.
  5. 오케스트레이터 변동성이 신호를 숨길 수 있습니다. 확률적 오케스트레이터는 작은 압축 이득이나 손실을 압도할 만큼 궤적을 변경할 수 있습니다.
  6. 약한 기준선은 겉보기 이득을 부풀립니다. 시스템 수준 이점을 주장하기 전에 강력한 텍스트 수준 대안과 비교하십시오.

통합

  • context-optimization - 프리픽스 캐싱 및 관찰 마스킹은 기본 첫 번째 이동으로 유지됩니다. 잠재 브리핑은 호환되는 오케스트레이터-워커 스택을 위한 더 특수화된 최적화입니다.
  • multi-agent-patterns - 멀티 에이전트 토큰 비용이 조정 오버헤드뿐만 아니라 감독자 궤적 재생에 의해 주도될 때 적용됩니다.
  • context-compression - 사람이 읽을 수 있는 상태, 이식성 또는 감사 로그가 중요할 때 텍스트 계층 요약이 여전히 선호됩니다.
  • memory-systems - 단계 간 상태를 외부 메모리 대 워커의 잠재 상태에 유지할 시기를 결정하는 데 도움이 됩니다.
  • tool-design - 워커 호출 형태와 작업 프롬프트는 압축 중에 어떤 토큰이 높은 점수를 받는지 결정합니다.

참고 자료

내부 참고:

이 컬렉션의 관련 스킬:

  • 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 19 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.

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.

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.

tool-design

This skill should be used for the tool-interface layer of an agent system specifically: writing tool descriptions agents can route on, designing tool schemas and response formats, naming conventions, actionable error recovery messages, MCP server design, tool-set consolidation, and deciding when to add or remove an individual tool. Use this when the unit of work is a single tool or a set of tools. Route project-shape, pipeline architecture, and task-model-fit decisions to project-development; route deciding whether to introduce sub-agents to multi-agent-patterns.

관련 스킬