latent-briefing
This skill should be used when the user asks to "share memory between agents", "KV cache compaction for multi-agent", "orchestrator worker context", "latent…
Skill by mouadja02
Install
Works with Claude Code, Claude apps, Codex, Cursor, Gemini CLI, GitHub Copilot, VS Code, OpenCode, Goose, Windsurf. Read the repository before you give any tool access to your data.
npx agentmarket install skill/mouadja02-latent-briefing
Asks which of your tools to add it to (Claude Code, Codex, Cursor, VS Code, Windsurf, Gemini CLI, Claude Desktop) and shows the change first. See https://agentmart.dev/cli.
Get the weekly diff
The weekly diff: one email a week with new agent tools, notable updates and grade changes, plus security alerts for tools you follow. Double opt-in, one-click unsubscribe.
About
Use cases: design, agent-building
Reviews
Write a reviewNo reviews yet. Installed it? Reviews come from verified installers only. How reviews work
Permissions: not checked yet.
What's inside
- Skill name
latent-briefing- Description
- This skill should be used when the user asks to "share memory between agents", "KV cache compaction for multi-agent", "orchestrator worker context", "latent briefing", "reduce worker tokens", "cross-agent memory without summarization", or discusses Attention Matching compaction, recursive language models with workers, or token explosion in hierarchical agents.
- License
- MIT
- Instructions
- 156 lines in SKILL.md · view on GitHub
Files (3)
- LICENSE
- SKILL.md
- attention-matching-formulation.md · references/
SKILL.md (first lines)
> **Attribution:** Sourced from [muratcankoylan/Agent-Skills-for-Context-Engineering](https://github.com/muratcankoylan/Agent-Skills-for-Context-Engineering) by [Muratcan Koylan](https://github.com/muratcankoylan).
# Latent Briefing and KV Cache Memory Sharing
Hierarchical multi-agent systems often pay for the same context twice. The orchestrator accumulates a long reasoning trajectory, but each worker usually receives only a narrow text handoff such as a subtask prompt plus raw document slices. Passing the full trajectory fixes coverage but drives token cost up on every worker call. Summarization introduces latency and information loss. Retrieval helps with document access but does not preserve the orchestrator's evolving reasoning state.
Latent Briefing addresses this by sharing memory at the **representation level** rather than the text level. The core idea is to compact the orchestrator trajectory in the worker model's KV cache, keeping positions that are most relevant to the **current worker task**. The method builds on **Attention Matching (AM)** KV cache compaction and adapts it for inference-time multi-agent handoff with task-guided queries, a shared token mask across heads, and robust thresholding.
## When to Activate
Activate this skill when:
- Designing orchestrator-worker or supervisor-specialist systems where workers need access to prior orchestrator state without replaying the full trajectory as text
- Evaluating alternatives to LLM summarization or RAG for cross-agent state transfer
- Implementing or studying **KV cache compaction** as a first-class inference primitive, not only prefix caching of identical prompts
- Debugging token explosion in recursive, hierarchical, or tool-heavy agent graphs
- Interpreting benchmarks that report worker-token savings, total-token savings, compaction overhead, and accuracy together
## Core Concepts
**The token explosion pattern.** In recursive or REPL-style systems, the orchestrator repeatedly calls a worker to inspect evidence, verify hypotheses, or answer subquestions. The orchestrator's trajectory grows with partial conclusions, dead ends, tool output, and prior worker responses. If that trajectory is passed in full on every worker call, cost compounds quickly.
**Representation-level sharing.** Instead of summarizing the trajectory into natural language, the system operates on the worker model's **KV cache**. It retains the positions that the worker would attend to for the current task and drops the rest. This is more specific than ordinary prefix caching: prefix caching reuses identical prefixes, while Latent Briefing also performs **task-conditioned selective retention** inside the reused trajectory.
**Attention Matching as the compaction engine.** AM seeks a smaller cache whose attention outputs approximate the full cache. Latent Briefing adapts AM for multi-agent inference by changing the scoring signal and batching strategy:
1. Use **task-guided query vectors** derived from the current worker prompt.
2. Aggregate scores into a **shared global mask** instead of per-head independent subsets.
3. Use a robust threshold such as `median + tau * MAD` rather than fixed top-k per head.
**Reference result shape.** The public write-up reports substantial worker-token reduction, material total-token savings, and low-single-digit-second compaction overhead on long-document QA workloads. Treat these numbers as workload-specific evidence, not a general guarantee.
## Detailed Topics
### Why Text-Only Mitigations Fall Short
| Approach | Primary weakness |
|----------|------------------|
| LLM summarization | High latency, lossy abstraction, and no guarantee the summary preserves what the next subtask needs |
| Retrieval / RAG | Depends on chunking and embeddings; can miss cross-chunk or cross-step dependencies |
| Pass full trajectory | Cost scales with every worker call and irrelevant context can degrade worker quality |
Latent Briefing is useful when the bottleneck is not document retrieval itself, but **how to transfer orchestrator state into a worker efficiently and precisely**.
### Recursive Orchestrator-Worker Shape
Frameworks such as **Recursive Language Models** treat long context as an environment and recurse over it: an orchestrator decomposes work and delegates to workers. Latent Briefing fits the gap where the orchestrator has already built task-specific state that should inform the worker, but re-serializing that state as text is too expensive or noisy.
In the ideal setup, the worker maintains a persistent KV state for the orchestrator trajectory. New trajectory tokens extend that state, then compaction runs just before generation for the current subtask.
### Three Inference-Time Modifications
1. **Task-guided query vectors.** Use queries from the current worker task prompt, not generic samples from the context. Forward-pass the trajectory plus current task through the worker model, then score trajectory positions by how strongly the task attends to them.
2. **Shared token selection.** Aggregate scores across layers and heads into one per-position score. One shared mask enables batched operations and avoids hundreds of incompatible per-head solves.
3. **MAD thresholding.** Keep positions above a robust outlier threshold such as `median + tau * MAD`. Higher `tau` is more aggressive. Optimal settings depend on task regime, trajectory quality, and document length.
### Infrastructure Preconditions
Latent Briefing is only practical when the system **controls the worker inference runtime** closely enough to inspect or transform KV state. It is a poor default for API-only stacks where internal KV tensors are inaccessible. It also assumes the orchestrator trajectory can be represented in the worker's model space. If orchestrator and worker differ materially in tokenizer, architecture, or attention layout, direct representation sharing may not be viable.
### Decision Framework
Choose the mechanism that matches the bottleneck:
| Need | Prefer | Why |
|------|--------|-----|
| Stable repeated prefix with minimal logic changes | Prefix caching | Cheapest optimization; no information loss |
| Human-readable and auditable cross-step state | Structured notes or summarization | Easy to inspect and store |
| Sparse lookup across a large external corpus | Retrieval / RAG | Finds documents efficiently |
| Worker needs task-specific slices of orchestrator state and runtime access exists | Latent Briefing | Transfers relevant latent state without replaying all text |
Latent Briefing is not a universal replacement for summarization or retrieval. It is a specialized optimization for systems that already run a controllable orchestrator-worker stack.
### Threshold Regimes
Reported long-document QA results suggest:
- **Longer documents:** lighter compaction can preserve broader evidence coverage while still saving tokens.
- **Harder questions:** more aggressive compaction can help when the orchestrator trajectory contains speculative or low-value branches.
- **Shorter, easier contexts:** moderate compaction may remove redundancy without dropping needed evidence.
These are tuning hypotheses, not portable laws. Re-measure on the target workload.
## Practical Guidance
- **Define the shared memory boundary first.** Decide exactly what enters the trajectory cache: prior worker replies, tool output, chain-of-thought, or only selected artifacts. Compaction quality depends on what is allowed into the cache in the first place.
- **Tune on validation data, not anecdotes.** Track task accuracy, worker tokens, total tokens, retention rate, and compaction overhead together.
- **Measure end-to-end latency.** Compaction only pays off if compaction plus generation beats the best text-layer alternative for the same quality target.
- **Use strong baselines.** Compare against prefix caching, structured notes, retrieval, and selective text handoff, not only "send everything."
- **Expect orchestrator variance.** If decomposition strategy changes run to run, average over enough trials to separate compaction effects from orchestrator noise.
## Examples
**Scenario: orchestrator trajectory grows across worker calls**
```text
Call 1: trajectory T1 -> worker answers subquestion A
Call 2: trajectory T2 = T1 + new reasoning + reply A
compact KV(T2) using the task prompt for B
worker answers subquestion B
```
The task prompt for B decides which parts of `T2` survive into the compacted worker state.
## Guidelines
1. Prefer Latent Briefing when the main waste comes from replaying orchestrator state into workers, not from retrieving source documents.
2. Prefer plain text handoff when auditability, portability, or closed-model APIs matter more than token efficiency.
3. Co-design compaction with **evaluation**. A small quality drop can erase large token savings.
4. Expose compaction aggressiveness as a controlled parameter, not a hidden constant.
## Gotchas
1. **Infrastructure access is the first gate.** If the runtime cannot inspect and rewrite worker KV state, Latent Briefing is a research idea, not a deployable technique.
2. **Shared model space matters.** KV compaction is defined in a specific model's attention space. Do not assume latent handoff works cleanly across unrelated model families.
3. **Threshold is workload-dependent.** One global `tau` rarely works across long vs short context and easy vs hard tasks. Expect accuracy cliffs when compaction becomes too aggressive.
4. **Benchmark scope is narrow.** Public results focus on long-document QA. Code generation, math, and multi-document synthesis may behave differently.From mouadja02/skills, MIT.
More from mouadja02/skills
- 0.637score
gdpr-compliant
mouadja02
Apply GDPR-compliant engineering practices across your codebase.
SkillAFreshness: A★ 11Claude Code +9 - 0.637score
semantic-kernel
mouadja02
Create, update, refactor, explain, or review Semantic Kernel solutions using shared guidance plus language-specific references for .NET and Python.
SkillAFreshness: A★ 11Claude Code +9 - 0.637score
python-pypi-package-builder
mouadja02
End-to-end skill for building, testing, linting, versioning, and publishing a production-grade Python library to PyPI.
SkillAFreshness: A★ 11Claude Code +9 - 0.637score
ai-team-orchestration
mouadja02
Bootstraps and runs a multi-agent development team with roles (dev, QA, DevOps), parallel work, and sprint plans that survive context resets.
SkillAFreshness: A★ 11Claude Code +9 - 0.637score
eval-driven-dev
mouadja02
Improve AI application with evaluation-driven development.
SkillAFreshness: A★ 11Claude Code +9 - 0.634score
nano-banana-pro-openrouter
mouadja02
Generate or edit images via OpenRouter with the Gemini 3 Pro Image model.
SkillAFreshness: A★ 11Claude Code +9 - 0.632score
autoresearch
luiscantero
Runs an autonomous experiment loop on any programming task: you define the goal, metric, and eval command; the agent edits code, measures, and keeps or…
SkillAFreshness: A★ 11Claude Code +9 - 0.632score
structured-autonomy-plan
mouadja02
Use when an autonomous agent run needs a plan before execution — decomposing the goal, setting explicit boundaries and stop conditions, and defining what the…
SkillAFreshness: A★ 11Claude Code +9 - 0.632score
memory-merger
mouadja02
Merges mature lessons from a domain memory file into its instruction file.
SkillAFreshness: A★ 11Claude Code +9 - 0.632score
create-agentsmd
mouadja02
Generates a complete AGENTS.md at the repository root following the agents.md format: setup, build, test, style, and PR conventions coding agents need.
SkillAFreshness: A★ 11Claude Code +9 - 0.632score
rich-claude-code-tui-clone
mouadja02
Use when building a Python terminal UI inspired by Claude Code with Rich.
SkillAFreshness: A★ 11Claude Code +9 - 0.632score
bmm-skills
mouadja02
Routes requests to the BMad Method (v6.12.4) agile framework: persona agents, planning skills (brief, PRFAQ, PRD, UX, spec, architecture, epics, sprint…
SkillAFreshness: A★ 11Claude Code +9
Signals
- Stars
- 11
- Forks
- 5
- Open issues
- 25
- Last commit (this folder)
- Oct 16, 2026 (14 days ago)
From GitHub (fetched Oct 24, 2026).
Details
- License
- MIT
- Repository
- github.com/mouadja02/skills
- Website
- mouadja02.github.io/skills/
- First seen
- Oct 24, 2026
- Last checked
- Oct 24, 2026
- Source
- GitHubgithub-graphql
Same skill elsewhere
Copies of this SKILL.md published by others; search shows only one of them.
- 0.640score
latent-briefing
muratcankoylan
This skill should be used when the user asks to "share memory between agents", "KV cache compaction for multi-agent", "orchestrator worker context", "latent…
SkillCFreshness: C★ 18.2KClaude Code +9 - 0.325score
latent-briefing
guanyang
This skill should be used when the user asks to "share memory between agents", "KV cache compaction for multi-agent", "orchestrator worker context", "latent…
SkillCFreshness: C★ 980Claude Code +9
More from mouadja02
- 0.637score
python-pypi-package-builder
mouadja02
End-to-end skill for building, testing, linting, versioning, and publishing a production-grade Python library to PyPI.
SkillAFreshness: A★ 11Claude Code +9 - 0.637score
gdpr-compliant
mouadja02
Apply GDPR-compliant engineering practices across your codebase.
SkillAFreshness: A★ 11Claude Code +9 - 0.637score
eval-driven-dev
mouadja02
Improve AI application with evaluation-driven development.
SkillAFreshness: A★ 11Claude Code +9 - 0.637score
semantic-kernel
mouadja02
Create, update, refactor, explain, or review Semantic Kernel solutions using shared guidance plus language-specific references for .NET and Python.
SkillAFreshness: A★ 11Claude Code +9 - 0.637score
ai-team-orchestration
mouadja02
Bootstraps and runs a multi-agent development team with roles (dev, QA, DevOps), parallel work, and sprint plans that survive context resets.
SkillAFreshness: A★ 11Claude Code +9 - 0.634score
nano-banana-pro-openrouter
mouadja02
Generate or edit images via OpenRouter with the Gemini 3 Pro Image model.
SkillAFreshness: A★ 11Claude Code +9
Cite this page
latent-briefing skill. Agent Mart. https://agentmart.dev/skills/mouadja02-latent-briefing (last updated 2026-10-24)