All revisions published to the LM Studio Hub as rootmonster/context-compressor.
v0.7.0 β first published at Hub revision 21
Universal thinking-model support: reasoning markers from all major
families are stripped (<think>, [THINK], βthinkβ·, <reasoning>,
gpt-oss Harmony channels), including unterminated blocks; the engine's
parsed non-reasoning content is preferred when available, so a summarizer
reply that truncated mid-reasoning can no longer be cached as a chunk
summary (previously it was cached permanently). /no_think now targets
qwen3/QwQ/SmolLM3 (/no_think) and GLM (/nothink) instead of any
identifier containing "qwen" β qwen2.5 no longer receives a stray suffix.
Assistant reasoning in history is stripped before summarization.
No-system-role models (Gemma-style): a one-time per-model probe
detects templates that reject system messages; the compressed view and
all internal summarizer prompts then fold the system text into the first
user message instead of crashing. Template render failures now surface
as a warning instead of silently disabling exact prompt-fit verification.
Small context windows: keep-recent/chunk/reserved-output/
summarizer-max are auto-scaled to the model's context length (with a
one-time notice), so compaction actually fires on 4k-8k models instead
of never triggering.
Silent failures surfaced: unknown context length now warns
(auto-compaction can't run without it); models not trained for tool use
get tools disabled WITH a visible notice (previously silent, and session
tools could crash strict templates); hitting the 24-pass safety cap now
says so.
Summarizer prompts: agentic-workspace instructions are included only
when the chunk actually contains agentic-workspace/v1 tool results.
A summarizerPromptMode setting (auto/full/compact) lets the shorter
compact variant be forced by hand; bench evidence (2026-08-24, two
models) showed the full 10-section prompt beating compact on recall at
both 3B and 18B, so auto now always uses full β compact remains
available as a manual override and as the automatic rescue prompt when
a model's reasoning runs away mid-summary.
Honest token accounting: estimates now count message text rather
than internal JSON serialization (so /usage numbers and savings
percentages are accurate), and CJK/base64-heavy tool results are
truncated by a character-class-aware estimate instead of a flat
4-chars-per-token rule (previously up to ~4x under-truncation).
Fixes: canceled-compaction message reported one fewer saved chunk than
reality; reasoning-only replies were rendered twice when promoted to
visible text; malformed tool calls no longer return undefined to the
engine; per-model state is now bounded and no longer leaks between
chats (tool-schema token counts, one-time warnings).
Cache schema 2 β 3: previously cached summaries regenerate on the next
compaction (one-time cost).
The source suite grew from 150 to 272 test cases.
Live-validated: bench matrix run 2026-08-24 against 8 live model
families in LM Studio, zero plugin failures. This run drove three live
fixes: the truncation-headroom retry, the structural-digest fallback for
compaction that must never hard-fail, and the compact-prompt rescue for
a model whose reasoning runs away mid-summary.
Revision 21 (v0.6.0)
Revision 19 (v0.5.0)
Attachment memory: before compressing past an attachment, its content
is preserved β documents become fact-sheets via parseDocument (exact
values verbatim), images get described by vision models. Extracted once
per file identifier, cached at ~/.lm-context-compressor/attachments.json
(LRU 500, atomic writes); failures degrade to an explicit
"content not retained" marker and are never persisted. Toggle:
"Attachment memory" (default on). /usage reports preserved files.
Benchmark suite: bench/ with deterministic fixtures (coding agent,
research, contradictory updates, tool spam), seeded-fact recall after
compaction and after forced consolidation, reduction, latency, structural
and cache-determinism checks. npm run bench:static (model-free) and
(against the local server); results committed in
bench/results/.
Revision 18 (v0.4.0)
Bounded summary growth: when accumulated chunk summaries exceed the
new summary budget (default 12000 tokens), the oldest are consolidated
into one denser summary (rolling L1) with provenance and verbatim
identifiers preserved. Summaries can no longer swallow the context β the
field failure where a 528k chat plateaued at 63% prompt usage is fixed;
/compress heals an already-stuck chat immediately.
Floor reachability: the compact-down-to floor is clamped at runtime to
what the summary budget + kept-verbatim + system prompt actually allow,
with a one-time warning when the configured floor is unreachable.
The exact-fit safety loop tries consolidation before chunk-compaction
(compacting more chunks ADDS summary tokens when summaries dominate).
Transient engine failures ("terminated", connection resets) get one
automatic retry, gated to passes with provably zero tool executions and
zero visible output β exactly-once side effects preserved. Chunk
summarization and consolidation retry unconditionally (no side effects).
Revision 17 (v0.3.0)
Tool definitions are now measured and included in context budgeting; a
"Tool definitions" line appears in /usage and the usage tool.
Hard stop with an actionable message when the prompt (incl. tool schemas)
cannot fit the context at all β no more cryptic engine 400s.
Tool-session initialization failure is surfaced visibly instead of
silently proceeding without external tools.
Aggregate tool-output budget per reply (default 20000 tokens) as a second
line of defense after the per-result cap.
Side-effect boundary tests added to the testing protocol; version bumped
to 0.3.0.
License change: MIT β Context Compressor Community License 1.0
(free for personal + internal professional use; commercial embedding
requires a separate license). Revisions 1β15 remain MIT.
Revision 15
Mid-task compaction: agentic turns run in capped tool-round passes
(default 6); between passes the grown context is measured and compacted,
then the task continues. Marathon tool loops can no longer overflow the
context window.
Reasoning promoted into replies is sanitized of internal LM Studio markers.
Revision 14
Aborted or crashed /compact runs can no longer render an empty reply:
the report block is created before the work starts and upgraded in place.
Revision 13
Chunk summarization skips hidden reasoning on qwen-family models
(/no_think), cutting compaction wall time substantially.
Revision 12
Chunk-granular resume made visible ((N cached chunks reused), cancel
message notes saved progress); empty assistant messages from canceled
replies are filtered from the model's view.
Revision 11
Compact-to-floor hysteresis (default 55% of context).
contextOverflowPolicy: stopAtLimit everywhere β the engine's own
truncation could drop the only user message and crash strict templates.
Exact templated-prompt verification with reserved output tokens and up to
three safety compaction rounds; meter and /usage report the rendered
count.
SDK 1.4.0 β 1.5.0; tool results correlated by ToolCallContext.callId.
Summarizer hardening: excerpts treated as untrusted data with provenance;
repeated file reads deduplicated to latest version + change note.
Revision 10
Cache persistence serialized and coalesced (concurrent-write race found
in external review, reproduced with an injected-latency test, fixed).
Revisions 1β9
Initial release and hardening: prediction-loop-handler architecture,
chunked byte-stable summaries with a content-addressed persistent cache,
/compressΒ·/compactΒ·/usage commands, get_context_usage tool,
task-aware summary schema, tool passthrough with result capping, live
progress bar and prompt meter, template compatibility fixes (single
system message, synthetic user message), tool-error feedback, empty-reply
fallbacks, crash-proof top-level guard.
Changelog
All revisions published to the LM Studio Hub as rootmonster/context-compressor.
v0.7.0 β first published at Hub revision 21
Universal thinking-model support: reasoning markers from all major
families are stripped (<think>, [THINK], βthinkβ·, <reasoning>,
gpt-oss Harmony channels), including unterminated blocks; the engine's
parsed non-reasoning content is preferred when available, so a summarizer
reply that truncated mid-reasoning can no longer be cached as a chunk
summary (previously it was cached permanently). /no_think now targets
qwen3/QwQ/SmolLM3 (/no_think) and GLM (/nothink) instead of any
identifier containing "qwen" β qwen2.5 no longer receives a stray suffix.
Assistant reasoning in history is stripped before summarization.
No-system-role models (Gemma-style): a one-time per-model probe
detects templates that reject system messages; the compressed view and
all internal summarizer prompts then fold the system text into the first
user message instead of crashing. Template render failures now surface
as a warning instead of silently disabling exact prompt-fit verification.
Small context windows: keep-recent/chunk/reserved-output/
summarizer-max are auto-scaled to the model's context length (with a
one-time notice), so compaction actually fires on 4k-8k models instead
of never triggering.
Silent failures surfaced: unknown context length now warns
(auto-compaction can't run without it); models not trained for tool use
get tools disabled WITH a visible notice (previously silent, and session
tools could crash strict templates); hitting the 24-pass safety cap now
says so.
Summarizer prompts: agentic-workspace instructions are included only
when the chunk actually contains agentic-workspace/v1 tool results.
A summarizerPromptMode setting (auto/full/compact) lets the shorter
compact variant be forced by hand; bench evidence (2026-08-24, two
models) showed the full 10-section prompt beating compact on recall at
both 3B and 18B, so auto now always uses full β compact remains
available as a manual override and as the automatic rescue prompt when
a model's reasoning runs away mid-summary.
Honest token accounting: estimates now count message text rather
than internal JSON serialization (so /usage numbers and savings
percentages are accurate), and CJK/base64-heavy tool results are
truncated by a character-class-aware estimate instead of a flat
4-chars-per-token rule (previously up to ~4x under-truncation).
Fixes: canceled-compaction message reported one fewer saved chunk than
reality; reasoning-only replies were rendered twice when promoted to
visible text; malformed tool calls no longer return undefined to the
engine; per-model state is now bounded and no longer leaks between
chats (tool-schema token counts, one-time warnings).
Cache schema 2 β 3: previously cached summaries regenerate on the next
compaction (one-time cost).
The source suite grew from 150 to 272 test cases.
Live-validated: bench matrix run 2026-08-24 against 8 live model
families in LM Studio, zero plugin failures. This run drove three live
fixes: the truncation-headroom retry, the structural-digest fallback for
compaction that must never hard-fail, and the compact-prompt rescue for
a model whose reasoning runs away mid-summary.
Revision 21 (v0.6.0)
Revision 19 (v0.5.0)
Attachment memory: before compressing past an attachment, its content
is preserved β documents become fact-sheets via parseDocument (exact
values verbatim), images get described by vision models. Extracted once
per file identifier, cached at ~/.lm-context-compressor/attachments.json
(LRU 500, atomic writes); failures degrade to an explicit
"content not retained" marker and are never persisted. Toggle:
"Attachment memory" (default on). /usage reports preserved files.
Benchmark suite: bench/ with deterministic fixtures (coding agent,
research, contradictory updates, tool spam), seeded-fact recall after
compaction and after forced consolidation, reduction, latency, structural
and cache-determinism checks. npm run bench:static (model-free) and
(against the local server); results committed in
bench/results/.
Revision 18 (v0.4.0)
Bounded summary growth: when accumulated chunk summaries exceed the
new summary budget (default 12000 tokens), the oldest are consolidated
into one denser summary (rolling L1) with provenance and verbatim
identifiers preserved. Summaries can no longer swallow the context β the
field failure where a 528k chat plateaued at 63% prompt usage is fixed;
/compress heals an already-stuck chat immediately.
Floor reachability: the compact-down-to floor is clamped at runtime to
what the summary budget + kept-verbatim + system prompt actually allow,
with a one-time warning when the configured floor is unreachable.
The exact-fit safety loop tries consolidation before chunk-compaction
(compacting more chunks ADDS summary tokens when summaries dominate).
Transient engine failures ("terminated", connection resets) get one
automatic retry, gated to passes with provably zero tool executions and
zero visible output β exactly-once side effects preserved. Chunk
summarization and consolidation retry unconditionally (no side effects).
Revision 17 (v0.3.0)
Tool definitions are now measured and included in context budgeting; a
"Tool definitions" line appears in /usage and the usage tool.
Hard stop with an actionable message when the prompt (incl. tool schemas)
cannot fit the context at all β no more cryptic engine 400s.
Tool-session initialization failure is surfaced visibly instead of
silently proceeding without external tools.
Aggregate tool-output budget per reply (default 20000 tokens) as a second
line of defense after the per-result cap.
Side-effect boundary tests added to the testing protocol; version bumped
to 0.3.0.
License change: MIT β Context Compressor Community License 1.0
(free for personal + internal professional use; commercial embedding
requires a separate license). Revisions 1β15 remain MIT.
Revision 15
Mid-task compaction: agentic turns run in capped tool-round passes
(default 6); between passes the grown context is measured and compacted,
then the task continues. Marathon tool loops can no longer overflow the
context window.
Reasoning promoted into replies is sanitized of internal LM Studio markers.
Revision 14
Aborted or crashed /compact runs can no longer render an empty reply:
the report block is created before the work starts and upgraded in place.
Revision 13
Chunk summarization skips hidden reasoning on qwen-family models
(/no_think), cutting compaction wall time substantially.
Revision 12
Chunk-granular resume made visible ((N cached chunks reused), cancel
message notes saved progress); empty assistant messages from canceled
replies are filtered from the model's view.
Revision 11
Compact-to-floor hysteresis (default 55% of context).
contextOverflowPolicy: stopAtLimit everywhere β the engine's own
truncation could drop the only user message and crash strict templates.
Exact templated-prompt verification with reserved output tokens and up to
three safety compaction rounds; meter and /usage report the rendered
count.
SDK 1.4.0 β 1.5.0; tool results correlated by ToolCallContext.callId.
Summarizer hardening: excerpts treated as untrusted data with provenance;
repeated file reads deduplicated to latest version + change note.
Revision 10
Cache persistence serialized and coalesced (concurrent-write race found
in external review, reproduced with an injected-latency test, fixed).
Revisions 1β9
Initial release and hardening: prediction-loop-handler architecture,
chunked byte-stable summaries with a content-addressed persistent cache,
/compressΒ·/compactΒ·/usage commands, get_context_usage tool,
task-aware summary schema, tool passthrough with result capping, live
progress bar and prompt meter, template compatibility fixes (single
system message, synthetic user message), tool-error feedback, empty-reply
fallbacks, crash-proof top-level guard.
Never published to the Hub on its own: the Hub still served revision 20
(v0.5.1) while 0.6.0 was in flight. This entry ships together with 0.7.0 in
the next push.
Native Agentic Workspace protocol compaction: added a parser for
agentic-workspace/v1 object and JSON-string tool results. Before generic
head/tail truncation it removes payloads named by
retention.omit_when_summarizing while preserving summaries, retention
facts, artifacts, IDs, statuses, hashes, URLs, paths, counts, evidence,
next actions, task text/dependencies, and command verification fields.
Tool-result capping now applies protocol-aware reduction before its generic
truncation path, substantially reducing the chance that recovery IDs are
cut out of large diffs, web pages, listings, or command output.
Summary and consolidation prompts now include Durable workflow state,
Verification & evidence, Research findings, and Source ledger sections and
explicitly retain transaction/run/job/todo/item/checkpoint/research/query/
source IDs, report/state paths, URLs, hashes, fetched-source provenance,
blockers, and next-actionable work.
Search-result snippets are explicitly distinguished from fetched source
evidence so a compacted deep-research run does not promote discovery text
into sourced fact.
Added protocol tests covering object/string envelopes, omit hints, artifact
recovery, bounded rendering, task next actions, dependencies, and command
exit evidence. The source suite now contains 150 test cases.
The changed summarizer prompt participates in the existing content-addressed
cache namespace, so older cached summaries are automatically segregated.
npm run bench
summarizeChunk exported behind a minimal SummarizeCtl interface (no
behavior change) so the bench drives the real pipeline.
/usage and the usage tool report consolidation ("incl. 1 consolidated
from N earlier chunks").
Tool-result truncation keeps head and tail; command lines stripped from
mixed messages; cache hash chain namespaced by model/prompt/settings;
tests are now typechecked.
Never published to the Hub on its own: the Hub still served revision 20
(v0.5.1) while 0.6.0 was in flight. This entry ships together with 0.7.0 in
the next push.
Native Agentic Workspace protocol compaction: added a parser for
agentic-workspace/v1 object and JSON-string tool results. Before generic
head/tail truncation it removes payloads named by
retention.omit_when_summarizing while preserving summaries, retention
facts, artifacts, IDs, statuses, hashes, URLs, paths, counts, evidence,
next actions, task text/dependencies, and command verification fields.
Tool-result capping now applies protocol-aware reduction before its generic
truncation path, substantially reducing the chance that recovery IDs are
cut out of large diffs, web pages, listings, or command output.
Summary and consolidation prompts now include Durable workflow state,
Verification & evidence, Research findings, and Source ledger sections and
explicitly retain transaction/run/job/todo/item/checkpoint/research/query/
source IDs, report/state paths, URLs, hashes, fetched-source provenance,
blockers, and next-actionable work.
Search-result snippets are explicitly distinguished from fetched source
evidence so a compacted deep-research run does not promote discovery text
into sourced fact.
Added protocol tests covering object/string envelopes, omit hints, artifact
recovery, bounded rendering, task next actions, dependencies, and command
exit evidence. The source suite now contains 150 test cases.
The changed summarizer prompt participates in the existing content-addressed
cache namespace, so older cached summaries are automatically segregated.
npm run bench
summarizeChunk exported behind a minimal SummarizeCtl interface (no
behavior change) so the bench drives the real pipeline.
/usage and the usage tool report consolidation ("incl. 1 consolidated
from N earlier chunks").
Tool-result truncation keeps head and tail; command lines stripped from
mixed messages; cache hash chain namespaced by model/prompt/settings;
tests are now typechecked.