Strix (STRIX) — llm

docs / modules / llm

← all docs

Strix (STRIX) — llm

flowchart LR IN["IN: growing conversation\nhistory for one agent"] --> ACT["ACT: compact/summarize\nwhen approaching context limit"] ACT --> VAL["VAL: token-budget check\nbefore compacting"] VAL --> OUT["OUT: a shorter history that\nfits the model's context window"]

What this is

strix/llm keeps a long-running agent conversation from outgrowing its model's context window. As an agent runs many turns (reading files, running tools, reading output), its conversation history grows — this module decides when that history is getting too big and compresses it.

What flows through it

flowchart TD Budget["context_budget.py\ntracks token usage vs. limit"] -- "approaching limit" --> Compaction["compaction.py\nsummarizes older turns"] Compaction --> Session["shortened session history\n(strix/core/sessions.py)"]

Technical details

flowchart LR IN["IN: growing conversation\nhistory for one agent"] --> ACT["ACT: compact/summarize\nwhen approaching context limit"] ACT --> VAL["VAL: token-budget check\nbefore compacting"] VAL --> OUT["OUT: a shorter history that\nfits the model's context window"]

Package: strix/llm/ Depends on: strix.config (ContextSettings — compaction/tool-output caps). Depended on by: strix.core (the turn loop consults this before a cycle would otherwise exceed the model's context window).

Files at a glance

File Role
compaction.py Summarizes older turns in an agent's conversation history once it's grown large, keeping recent turns verbatim.
context_budget.py Tracks token usage against the model's context limit and ContextSettings, deciding when compaction should trigger.

Files & functions, explained

Deterministic bookkeeping (token counting, threshold checking) drives when compaction happens; the summarization step itself may call the model to produce a condensed version of older turns — a narrower, cheaper use of the LLM than the main agent reasoning loop, similar in spirit to report/dedupe.py's separate judgment call (see agentic-framework.md).

Related: STRIX — Architecture (HLD), core.md, ../design/agentic-framework.md.