Teaching Your Agent Teams to Remember
Context compaction keeps a single session alive. Knowledge distillation makes an entire team's experience permanent — combining insights across agents and across sessions into structured documents that grow smarter over time.
Beyond Compaction
If you've used Claude Code, you're familiar with context compaction: when a conversation gets long, the system summarizes earlier messages so the agent can keep working within its context window. It's a useful mechanism for keeping a single session alive, but it has inherent limitations.
Compaction is a lossy compression of one agent's one session. It preserves enough to continue the current task, but it doesn't build anything that lasts.
When you're running a team of agents — a QA engineer, a backend developer, a DevOps specialist, an orchestrator coordinating them all — the knowledge that matters most isn't trapped inside any single session. It lives between agents: in the handoff protocols they've developed, the shared resources they've learned to coordinate around, the working patterns that emerged from days of collaboration. Compaction can't capture any of this because it never looks beyond one agent's own conversation.
Team Knowledge Distillation takes a fundamentally different approach.
Compact (Single Session)
- One agent, one session
- Automatic when context fills
- No cross-agent awareness
- Lost on restart
- Internal summary, not editable
- Stays in the session
Distill (Whole Team)
- All agents, all sessions
- On demand, when you want to capture state
- Maps collaboration, handoffs, conflicts
- Persists to disk, injected on every restart
- Structured markdown, fully editable
- Travels with team templates
Compaction asks: "What does this agent need to remember to finish its current task?" Distillation asks: "What has this entire team learned that should never be lost?"
What Makes Distillation Different
It combines information across your entire team
A team of six agents might collectively touch dozens of services, workflows, and tools. Each individual agent sees a slice. Distillation reads all of their transcripts and synthesizes a team-wide view: who depends on whom, which resources are shared, where coordination is needed. The result is a map of how your team actually operates, not just what each agent did in isolation.
It spans multiple sessions per agent
An agent that has been restarted three times over a week has three separate session transcripts. Compaction only ever sees the current one. Distillation reads the full history, merging knowledge across restarts. That deploy procedure your DevOps agent figured out on Tuesday and then lost to a restart on Wednesday? It's captured permanently.
It maps collaboration patterns
The second pass of the pipeline is specifically designed to find the relationships between agents. It identifies handoff protocols ("the backend developer signals QA when a PR is ready"), shared resources ("three agents write to the same config file"), and conflict zones ("the frontend and backend agents both modify the API schema"). This is knowledge that no single agent's compacted summary could ever contain, because it only exists in the space between them.
It distills working patterns, not just facts
Compaction preserves what happened. Distillation extracts how the agent prefers to work: which approaches it found effective, what it learned to avoid, what workflow sequences it refined through trial and error. These working patterns are the kind of institutional knowledge that makes a team better over time — and the kind that's hardest to reconstruct from code alone.
The Three-Pass Pipeline
Distillation runs in the background after you trigger it from the sidebar or the Team Knowledge tab. Each pass builds on the last, narrowing raw transcripts into precise, actionable documents.
The pipeline is role-aware. Coral infers whether an agent is an orchestrator or a specialist worker based on its system prompt, and tailors extraction accordingly. An orchestrator's knowledge emphasizes delegation patterns and team-wide workflows; a specialist's focuses on domain expertise and tooling.
What Gets Captured
The first pass targets five categories of institutional knowledge, each designed to surface things that are genuinely hard to reconstruct from code:
- Tools & Commands — Exact CLI invocations, flags, and scripts the agent uses regularly. Not "runs tests" but the actual
go test -race -count=1 ./...with its specific flags. - Processes & Procedures — Step-by-step sequences the agent has developed: release workflows, testing sequences, deployment checklists. The operational playbook that took sessions to refine.
- Keys, Configs & Environment — Environment variable names, config file locations, and credential sources. Names and locations only — never the actual secret values.
- Domain Knowledge — Technical decisions, architectural patterns, gotchas, and workarounds. The things an agent learned the hard way that would take another session to rediscover.
- Working Patterns — How the agent prefers to work. What approaches have been effective. What to avoid. The accumulated judgment that turns a fresh agent into a seasoned one.
The Output: OKF Documents
The final output uses structured markdown with YAML frontmatter and inter-agent links. Each agent gets its own document, and a team-wide index ties them together:
type: Agent Knowledge
title: qa-engineer
tags: [testing, integration, e2e]
timestamp: 2026-10-06T22:30:00Z
---
## Testing Infrastructure
The project uses
go test with race detection enabled.Integration tests require a separate data directory set via
CORAL_DATA_DIR=/tmp/coral-test to avoid corruptingthe production database at
~/.coral/sessions.db.## Coordination
Receives build artifacts from [lead-developer](./lead-developer.md)
before running the full test suite. Blocks release until
[devops-engineer](./devops-engineer.md) confirms staging
deployment is healthy.
The inter-agent links are navigable. In the Team Knowledge tab, clicking a link to another agent jumps directly to that agent's knowledge file, making it easy to trace collaboration paths across the team.
Browsing, Editing, and Re-distilling
Distilled knowledge lives in the Team Knowledge tab in the bottom panel, alongside Files, Browse, and Artifacts. The tab only appears when you're viewing a team — solo agents don't see it.
The overview page shows the team-wide index with links to each agent's knowledge. Click into an agent, read or edit their knowledge, and use the Home button to return. The toolbar provides a preview/edit toggle so you can refine what the LLM extracted, and a re-distill button to regenerate knowledge after new work.
Edits save immediately to disk. On restart, each agent's knowledge is automatically injected into its system prompt — so every agent picks up where the team left off, not where its own last session ended.
Knowledge travels with templates. When you save a team as a template or share it, the distilled knowledge comes along — together with working mode settings and workflow presets. Launch the template on a new project and every agent starts with the institutional knowledge from its predecessor. This is how you build teams that get smarter across deployments, not just within a single session.
Under the Hood
Distillation runs as a background goroutine, decoupled from the HTTP request lifecycle. Progress updates stream to the frontend via polling, showing which agent is being processed and which pass is running.
For each agent, Coral reads the session's JSONL log file and extracts conversation content, truncating to 50,000 characters to stay within LLM context limits. The system tries the team store first for agent metadata, then falls back to querying live sessions — so distillation works even for teams that exist only as running sessions.
Pass 1 runs once per agent. Pass 2 runs once for the whole team. Pass 3 runs once per agent again, incorporating cross-reference analysis. A team of six agents makes roughly 13 LLM calls total.
The output lands in ~/.coral/knowledge/<team-name>/ as individual markdown files per agent plus an index.md. Files are plain text and can be edited with any tool — the Team Knowledge tab is just one interface.
Getting Started
Update to Coral v1.3.30 or later. Open the sidebar menu on any running team and select Distill Knowledge. The process takes a minute or two depending on transcript length, and you can watch progress in the Team Knowledge tab.
Once distillation completes, the knowledge is live. Restart any agent and it will have its institutional knowledge injected automatically. Edit the knowledge to correct or supplement what the LLM extracted. Re-distill after significant new work to capture fresh context.
Compaction keeps the lights on for a single session. Distillation builds the institutional memory that makes your team better every time it runs.
Try Knowledge Distillation
Download Coral v1.3.30 and give your agent teams a permanent memory.
Download Coral