# Distillation (/docs/features/distill)



Distillation turns raw team knowledge — discussions, coding sessions, and GitHub activity — into structured memory that AI coworkers can use. It's the process that makes [Team Context](/docs/features/team-context) get smarter over time.

The problem distillation solves [#the-problem-distillation-solves]

Teams generate knowledge constantly: in recorded discussions, coding sessions, PR reviews, issue threads. Without distillation, AI coworkers only see the raw artifacts — long transcripts, individual commits, scattered PR comments.

Distillation extracts the signal: decisions made, patterns discovered, constraints learned. The result is layered memory that compounds over time, not a pile of unprocessed notes.

How it works [#how-it-works]

Three knowledge sources feed through fact extraction and temporal synthesis into Team Context memory.

<Mermaid
  chart="graph LR
    D[Discussions] --> E[Fact extraction]
    S[Sessions] --> E
    G[GitHub activity] --> E
    E --> Daily[Daily synthesis]
    Daily --> Weekly[Weekly synthesis]
    Weekly --> Monthly[Monthly synthesis]
    Monthly --> TC[Team Context memory]
    TC --> AI[AI coworker sessions]"
/>

Each source contributes different kinds of signal. The extraction stage pulls structured facts, then temporal synthesis layers compress and connect them over time.

Three knowledge sources [#three-knowledge-sources]

Discussions [#discussions]

Recorded team conversations. The LLM reads VTT transcripts and extracts decisions, action items, and observations. When server-generated summaries already exist, those are used directly — no redundant extraction.

Coding sessions [#coding-sessions]

Session summaries from the [Ledger](/docs/features/team-context). No LLM needed here — structured data (decisions, action items, open questions, aha moments) is mapped directly from `summary.json`. This is the cheapest and fastest source.

GitHub activity [#github-activity]

PRs, issues, and commits assembled from CodeDB. The LLM extracts what shipped, what's blocked, collaboration patterns, and review decisions. This captures knowledge that lives in code review threads and commit messages.

Temporal layers [#temporal-layers]

Distillation organizes memory into time-based layers. Each layer synthesizes the one below it, creating progressively higher-level insight.

| Layer       | Contains                                     | Example                                                                     |
| ----------- | -------------------------------------------- | --------------------------------------------------------------------------- |
| **Daily**   | Raw signal from today's work                 | "Team decided to use pgroll for all schema migrations"                      |
| **Weekly**  | Patterns and themes from the week            | "Authentication refactor dominated the week — three PRs, two design pivots" |
| **Monthly** | Strategic direction and compounding insights | "Team is converging on event-driven architecture for all async workflows"   |

The daily layer captures facts. The weekly layer spots patterns. The monthly layer reveals direction.

The compounding loop [#the-compounding-loop]

Distillation creates a virtuous cycle where team knowledge feeds forward into future work:

1. AI coworker works on code, discovers an insight
2. Session is captured to the Ledger
3. Distillation extracts the insight into memory
4. Next AI coworker session receives it via Team Context
5. That coworker applies the insight proactively

This means knowledge discovered in one session automatically benefits every future session — across your entire team.

Local-first architecture [#local-first-architecture]

Distillation runs on your machine using your AI coworker's CLI. This gives you:

* **Richer context** — local repo state, codebase knowledge, recent work
* **No SageOx inference cost** — uses your own LLM
* **Git-native output** — results committed directly to your Team Context repo

The server runs anti-entropy fallback workflows for missed distillations. If the CLI skips a run, the backend detects the gap and regenerates with whatever context it has.

Customize distillation [#customize-distillation]

Teams can customize how facts are extracted and synthesized using two guidance files in `memory/guidance/`:

| File         | Controls                                                                                                      |
| ------------ | ------------------------------------------------------------------------------------------------------------- |
| `EXTRACT.md` | How facts are extracted from sources — what to emphasize, what terminology to use, what patterns to watch for |
| `DISTILL.md` | How facts are synthesized into summaries — what level of detail, what structure, what to highlight            |

Run `ox doctor --fix` to create these files with sensible defaults. Edit them as your team develops preferences for what gets captured.

Run distillation [#run-distillation]

<Terminal>
  <TerminalComment>
    Sync sources and run distillation
  </TerminalComment>

  <TerminalCommand>
    ox distill --sync
  </TerminalCommand>
</Terminal>

This fetches the latest discussions, sessions, and GitHub activity, then runs extraction and synthesis for any new or updated sources.

What's next [#whats-next]

* [`ox distill` CLI reference](/docs/cli/distill) — all flags and options
* [Team Context](/docs/features/team-context) — the repo that distillation writes to
* [SageOx + OpenClaw](/docs/cookbooks/openclaw) — factory automation pattern using distillation
* [SageOx + Claude Code](/docs/developers/claude-code) — how distilled memory flows into coding sessions
