@martian-engineering/lossless-claw 0.11.3 → 0.13.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -10,6 +10,7 @@ Lossless Context Management plugin for [OpenClaw](https://github.com/openclaw/op
10
10
  - [Commands And Skill](#commands-and-skill)
11
11
  - [Documentation](#documentation)
12
12
  - [Development](#development)
13
+ - [Security](#security)
13
14
  - [License](#license)
14
15
 
15
16
  ## What it does
@@ -65,7 +66,7 @@ The bundled skill focuses on configuration, diagnostics, architecture, and recal
65
66
  - Node.js 22+
66
67
  - An LLM provider configured in OpenClaw (used for summarization)
67
68
 
68
- > **Compatibility:** `lossless-claw@0.10.0` and newer require OpenClaw `2026.5.12` or newer. These releases call OpenClaw's `api.runtime.llm.complete` capability for summarization, which is unavailable in older OpenClaw builds. If you cannot upgrade OpenClaw yet, stay on `lossless-claw@0.9.4` and remove `0.10.x`-only config such as `sweepMaxDepth`.
69
+ > **Compatibility:** `lossless-claw@0.10.0` and newer require OpenClaw `2026.5.12` or newer for OpenClaw's `api.runtime.llm.complete` summarization capability. Releases that include context-engine memory supplement support require OpenClaw `2026.5.28` or newer for `buildMemorySystemPromptAddition`. If you cannot upgrade OpenClaw yet, stay on `lossless-claw@0.9.4` and remove `0.10.x`-only config such as `sweepMaxDepth`.
69
70
 
70
71
  ### Install the plugin
71
72
 
@@ -139,6 +140,18 @@ Add a `lossless-claw` entry under `plugins.entries` in your OpenClaw config:
139
140
  "leafChunkTokens": 80000,
140
141
  "newSessionRetainDepth": 2,
141
142
  "contextThreshold": 0.75,
143
+ "contextThresholdOverrides": [
144
+ {
145
+ "name": "large-context-models",
146
+ "match": { "modelContextWindowMin": 900000 },
147
+ "contextThreshold": 0.15
148
+ },
149
+ {
150
+ "name": "telegram-sessions",
151
+ "match": { "sessionPattern": "agent:*:telegram:**" },
152
+ "contextThreshold": 0.3
153
+ }
154
+ ],
142
155
  "incrementalMaxDepth": 1,
143
156
  "cacheAwareCompaction": {
144
157
  "enabled": true,
@@ -152,7 +165,10 @@ Add a `lossless-claw` entry under `plugins.entries` in your OpenClaw config:
152
165
  "summaryModel": "openai/gpt-5.4-mini",
153
166
  "expansionModel": "openai/gpt-5.4-mini",
154
167
  "delegationTimeoutMs": 300000,
155
- "summaryTimeoutMs": 60000
168
+ "summaryTimeoutMs": 60000,
169
+ "summaryCallWindowMs": 600000,
170
+ "summaryMaxCallsPerWindow": 24,
171
+ "summarySpendBackoffMs": 1800000
156
172
  }
157
173
  }
158
174
  }
@@ -160,7 +176,7 @@ Add a `lossless-claw` entry under `plugins.entries` in your OpenClaw config:
160
176
  }
161
177
  ```
162
178
 
163
- `leafChunkTokens` controls how many source tokens can accumulate in a leaf compaction chunk before summarization is triggered. The default is `20000`, but quota-limited summary providers may benefit from a larger value to reduce compaction frequency. `summaryModel` and `summaryProvider` let you request a cheaper or faster compaction model through OpenClaw's `api.runtime.llm.complete` capability; OpenClaw still owns provider dispatch and auth. Explicit summary model requests require `llm.allowModelOverride` and matching `llm.allowedModels` policy entries for `lossless-claw`. `expansionModel` does the same for `lcm_expand_query` sub-agent calls (drilling into summaries to recover detail). `delegationTimeoutMs` controls how long `lcm_expand_query` waits for that delegated sub-agent to finish before returning a timeout error; it defaults to `120000` (120s). `summaryTimeoutMs` controls the per-call timeout for model-backed LCM summarization; it defaults to `60000` (60s). When unset, the model settings still fall back to OpenClaw's configured default model/provider. See [Expansion model override requirements](#expansion-model-override-requirements) for the required `subagent` trust policy when using `expansionModel`.
179
+ `leafChunkTokens` controls how many source tokens can accumulate in a leaf compaction chunk before summarization is triggered. The default is `20000`, but quota-limited summary providers may benefit from a larger value to reduce compaction frequency. `summaryModel` and `summaryProvider` let you request a cheaper or faster compaction model through OpenClaw's `api.runtime.llm.complete` capability; OpenClaw still owns provider dispatch and auth. Explicit summary model requests require `llm.allowModelOverride` and matching `llm.allowedModels` policy entries for `lossless-claw`. `expansionModel` does the same for `lcm_expand_query` sub-agent calls (drilling into summaries to recover detail). `delegationTimeoutMs` controls how long `lcm_expand_query` waits for that delegated sub-agent to finish before returning a timeout error; it defaults to `120000` (120s). `summaryTimeoutMs` controls the per-call timeout for model-backed LCM summarization; it defaults to `60000` (60s). `summaryMaxCallsPerWindow`, `summaryCallWindowMs`, and `summarySpendBackoffMs` bound repeated non-auth summarization spend per session. When unset, the model settings still fall back to OpenClaw's configured default model/provider. See [Expansion model override requirements](#expansion-model-override-requirements) for the required `subagent` trust policy when using `expansionModel`.
164
180
 
165
181
  ### Environment variables
166
182
 
@@ -192,6 +208,9 @@ Add a `lossless-claw` entry under `plugins.entries` in your OpenClaw config:
192
208
  | `LCM_EXPANSION_PROVIDER` | *(from OpenClaw)* | Provider override for `lcm_expand_query` sub-agent |
193
209
  | `LCM_DELEGATION_TIMEOUT_MS` | `120000` | Max time to wait for delegated `lcm_expand_query` sub-agent completion |
194
210
  | `LCM_SUMMARY_TIMEOUT_MS` | `60000` | Max time to wait for a single model-backed LCM summarizer call |
211
+ | `LCM_SUMMARY_CALL_WINDOW_MS` | `600000` | Rolling window used by the per-session summarization spend guard |
212
+ | `LCM_SUMMARY_MAX_CALLS_PER_WINDOW` | `24` | Max model-backed summarization calls per session/window before spend backoff opens |
213
+ | `LCM_SUMMARY_SPEND_BACKOFF_MS` | `1800000` | Cooldown after the summarization spend guard opens |
195
214
  | `LCM_PRUNE_HEARTBEAT_OK` | `false` | Retroactively delete `HEARTBEAT_OK` turn cycles from LCM storage |
196
215
  | `LCM_TRANSCRIPT_GC_ENABLED` | `false` | Enable transcript rewrite GC during `maintain()` |
197
216
  | `LCM_PROACTIVE_THRESHOLD_COMPACTION_MODE` | `deferred` | Choose whether proactive threshold compaction is deferred into maintenance debt or kept inline for legacy behavior |
@@ -278,6 +297,7 @@ LCM_EXPANSION_MODEL=openai/gpt-5.4-mini
278
297
  - **leafChunkTokens=20000** limits how large each leaf compaction chunk can grow before LCM summarizes it. Increase this when your summary provider is quota-limited and frequent leaf compactions are exhausting that quota.
279
298
  - **incrementalMaxDepth=1** runs one condensed pass after each leaf compaction by default. Set to `0` for leaf-only behavior, a larger positive integer for a deeper cap, or `-1` for unlimited cascading.
280
299
  - **contextThreshold=0.75** triggers compaction when context reaches 75% of the model's window, leaving headroom for the model's response.
300
+ - **contextThresholdOverrides** optionally picks a different threshold for matching model ids, model context-window ranges, or session patterns. If no rule matches, LCM falls back to `contextThreshold`.
281
301
 
282
302
  ### Session exclusion patterns
283
303
 
@@ -293,7 +313,7 @@ For large sessions, neither command is a perfect “keep my live agent context,
293
313
  - `/new` keeps writing into the same active LCM conversation row.
294
314
  - `/reset` changes OpenClaw session flow, which is heavier than users often want when their real problem is just LCM row size.
295
315
 
296
- `/lcm rotate` fills that gap. It replaces one rolling `rotate-latest` SQLite backup, rewrites the current session transcript down to the preserved live tail plus current session settings, and refreshes the bootstrap frontier on the same active LCM conversation so dropped transcript history is not replayed. Existing summaries, context items, and conversation identity stay in place; only the transcript backing is compacted. If you want additional timestamped snapshots instead, run `/lcm backup`.
316
+ `/lcm rotate` fills that gap. Before trimming the transcript, it forces leaf-only compaction for raw context outside the preserved live tail so older transcript messages are represented by LCM summaries. It then replaces one rolling `rotate-latest` SQLite backup, rewrites the current session transcript down to the preserved live tail plus current session settings, and refreshes the bootstrap frontier on the same active LCM conversation so dropped transcript history is not replayed. Existing durable messages, summaries, context items, and conversation identity stay in place; only the transcript backing is compacted. If you want additional timestamped snapshots instead, run `/lcm backup`.
297
317
 
298
318
  `newSessionRetainDepth` (or `LCM_NEW_SESSION_RETAIN_DEPTH`) controls how much summary structure survives `/new`:
299
319
 
@@ -307,6 +327,8 @@ Lossless-claw applies `/new` pruning through `before_reset` and uses `session_en
307
327
 
308
328
  Use `ignoreSessionPatterns` or `LCM_IGNORE_SESSION_PATTERNS` to keep low-value sessions completely out of LCM. Matching sessions do not create conversations, do not store messages, and do not participate in compaction or delegated expansion grants.
309
329
 
330
+ Cron scheduler keys (`agent:<agent>:cron:<job>...`) are isolated automatically when OpenClaw reuses the same `sessionKey` for a new runtime `sessionId`: lossless-claw archives the prior active run and creates a fresh LCM conversation for the new run. Leave cron sessions out of `ignoreSessionPatterns` when they need in-run LCM compaction.
331
+
310
332
  Pattern rules:
311
333
 
312
334
  - `*` matches any characters except `:`
@@ -315,7 +337,7 @@ Pattern rules:
315
337
 
316
338
  Examples:
317
339
 
318
- - `agent:*:cron:**` excludes cron sessions for any agent, including isolated run sessions like `agent:main:cron:daily-digest:run:run-123`
340
+ - `agent:*:cron:**` excludes cron sessions for any agent when you want to bypass LCM entirely
319
341
  - `agent:main:subagent:**` excludes all main-agent subagent sessions
320
342
  - `agent:ops:**` excludes every session under the `ops` agent id
321
343
 
@@ -497,6 +519,11 @@ tui/ # Interactive terminal UI (Go)
497
519
  .goreleaser.yml # GoReleaser config for TUI binary releases
498
520
  ```
499
521
 
522
+ ## Security
523
+
524
+ Please report suspected vulnerabilities privately. See [SECURITY.md](SECURITY.md)
525
+ for the supported disclosure process and response expectations.
526
+
500
527
  ## License
501
528
 
502
529
  MIT