Changelog¶
All notable changes to ContextSage are documented here. The format is based on Keep a Changelog, and the project follows Semantic Versioning.
Unreleased¶
1.0.0 - 2026-10-05¶
ContextSage 1.0 is a rewrite on top of parsefabric, LangChain and
langgraph-xai. Only the IntelligentSummarizationMiddleware class and its
LangChain-compatible arguments carry over from 0.1; there is no compatibility
layer for the 0.1 internals.
Added¶
- Content parsing with parsefabric:
every message is split into prose, JSON, log, table, code and stack-trace
units that tile the message exactly. The
routes,fence_routesandcode_languagesarguments add your own formats and choose the code-detection grammars. - Compaction of large tool results at any position in the history: runs of similar log lines collapse to their first and last line around a marker naming the omitted lines, identical JSON items and table rows are counted, and JSON is minified. Must-preserve content only receives lossless compaction.
- Facts that every rewritten history must keep: identifiers, user corrections, standing instructions and conflicting values. Missing facts are restated verbatim inside the summary message, each fact once. Facts are matched as whole words, ignoring case, whitespace and the apostrophe style, and each summary records its facts so that later summaries keep them too.
- A fallback when the summary model fails: the history is trimmed with
LangChain's
trim_messageswithout orphaning a tool result, and a notice restates the latest user request and the lost facts. - Provenance with langgraph-xai:
each summarized message is linked to its summary in a
ProvenanceStore(provenance_store), summaries record their generation, andalineagereturns the lineage of a summary across generations. SummarizationEventreports compaction, preservation, content kinds, token budget, validation and recovery for every rewrite, without message content.DEFAULT_IDENTIFIER_PATTERNS, so domain patterns can extend the built-in ones.- Summary-model tokens are kept out of
stream_events(version="v3")message streams. - Support for Python 3.14, offline and live examples with recorded output, benchmarks, and an Agent Skill for coding agents.
Changed¶
- Tokens are counted with the counter LangChain's
SummarizationMiddlewareuses for the model, calibrated by the usage the provider reports, instead of tiktoken. triggeraccepts every LangChain form, including clauses and lists, and defaults to summarizing when the history exceeds the token budget.keep=("fraction", f)is a share ofmaximum_context_tokens, so it also works for models without a LangChain profile.- The asynchronous hook analyzes the history in a worker thread instead of on the event loop.
observability_hookis a plain callable that receives aSummarizationEvent, and events are logged to thecontextsagelogger.- Configuration errors raise
ConfigurationError, which is aValueError, when the middleware is created.
Removed¶
- The 0.1 content-parser registry and the
parsers,severity_patternanderror_keywords_patternarguments; use parsefabricroutesandfence_routesinstead. - The
observability_enabledandprovenance_enabledarguments. Events are always logged, and provenance always goes to the configured store. - The tiktoken dependency.
0.1.0 - 2026-09-23¶
Added¶
- Initial public release of
contextsage. IntelligentSummarizationMiddleware: an information-aware replacement for LangChain'sSummarizationMiddleware.- Decomposition of a single message into independently classified regions.
- Pluggable structural content parsers for JSON, tables, code, logs and errors.
- Budget analysis, importance scoring, relationship tracking, preservation classification and deterministic transformation before LangChain's summarization call.
- Post-summarization validation and staged recovery.
- Summary lineage tracking and optional langgraph-xai provenance.
- Structured observability events through a pluggable hook.