@martian-engineering/lossless-claw 0.9.3 → 0.10.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.
@@ -72,6 +72,21 @@ Good default:
72
72
  - `false`
73
73
  - enable it only when topical older-context recall under tight budgets matters more than prompt-cache stability
74
74
 
75
+ ### `stubLargeToolPayloads`
76
+
77
+ Controls whether older, evictable tool-result rows that were backfilled into the `large_files` store are assembled as compact `[LCM Tool Output: file_xxx ...]` stubs instead of full inline payloads.
78
+
79
+ Why it matters:
80
+
81
+ - it reuses the existing `large_files` drilldown path for old tool output without changing the fresh tail
82
+ - it can recover substantially more historical context at the same token budget in tool-heavy sessions
83
+ - it should stay off until the operator has run `scripts/lcm-blob-migrate.mjs` for the target database
84
+
85
+ Good default:
86
+
87
+ - `false`
88
+ - enable it only after migration and live validation
89
+
75
90
  ### `leafChunkTokens`
76
91
 
77
92
  Caps how much raw material gets summarized into one leaf summary.
@@ -80,6 +95,7 @@ Why it matters:
80
95
 
81
96
  - Larger chunks reduce summarization frequency.
82
97
  - Smaller chunks create more summaries and more DAG fragmentation.
98
+ - The default is 20000 tokens.
83
99
 
84
100
  Use this when:
85
101
 
@@ -88,40 +104,34 @@ Use this when:
88
104
 
89
105
  ### `cacheAwareCompaction`
90
106
 
91
- Controls how strongly lossless-claw preserves a healthy prompt cache during incremental maintenance.
107
+ Deprecated compatibility object. Lossless still accepts and reports these settings, but automatic compaction no longer uses prompt-cache hot/cold state.
92
108
 
93
109
  Why it matters:
94
110
 
95
- - Hot cache now prefers to keep the cache intact instead of eagerly compacting old raw history.
96
- - Cold cache still allows bounded catch-up passes so stale sessions can converge.
97
- - The new defaults are intentionally more aggressive about preserving cache than earlier builds.
111
+ - Existing OpenClaw configs continue to load without schema errors.
112
+ - Operators can see that the settings are deprecated instead of silently losing familiar keys.
113
+ - Prompt-cache telemetry remains useful for diagnostics, but it no longer gates compaction.
98
114
 
99
115
  Good defaults:
100
116
 
101
- - `enabled: true`
102
- - `maxColdCacheCatchupPasses: 2`
103
- - `hotCachePressureFactor: 4`
104
- - `hotCacheBudgetHeadroomRatio: 0.2`
105
- - `coldCacheObservationThreshold: 3`
106
- - `criticalBudgetPressureRatio: 0.70`
117
+ - Leave existing values in place during migration.
118
+ - Do not tune these settings to affect automatic compaction; use `contextThreshold`, `leafChunkTokens`, and fanout instead.
107
119
 
108
120
  Operationally:
109
121
 
110
- - hot cache stretches the incremental leaf trigger to `dynamicLeafChunkTokens.max`
111
- - hot cache skips incremental maintenance entirely when the assembled context is comfortably below the real token budget
112
- - hot cache gets a short hysteresis window so a recent cache hit stays "hot" briefly unless telemetry shows a break
113
- - critical token-budget pressure bypasses hot-cache delay once the live prompt reaches `criticalBudgetPressureRatio * tokenBudget`
114
- - if hot-cache maintenance still runs, it stays leaf-only and suppresses follow-on condensed passes
122
+ - threshold debt does not wait for cache TTL
123
+ - cold-cache catch-up passes have been removed
124
+ - cache-aware raw-history pressure no longer triggers automatic maintenance
115
125
 
116
126
  ### `dynamicLeafChunkTokens`
117
127
 
118
- Controls the working leaf-trigger size used by incremental compaction.
128
+ Deprecated compatibility object. Automatic compaction now uses `leafChunkTokens` directly.
119
129
 
120
130
  Why it matters:
121
131
 
122
- - dynamic sizing is now enabled by default
123
- - busier sessions can use a larger working chunk without changing the static floor
124
- - hot cache uses the dynamic max as the working leaf trigger
132
+ - Existing config stays accepted.
133
+ - The resolved default still appears in status/config output.
134
+ - It no longer changes automatic compaction chunk size.
125
135
 
126
136
  Good defaults:
127
137
 
@@ -132,15 +142,36 @@ With the default `leafChunkTokens=20000`, that means:
132
142
 
133
143
  - `dynamicLeafChunkTokens.max = 40000`
134
144
 
135
- ### `incrementalMaxDepth`
145
+ ### `sweepMaxDepth`
136
146
 
137
- Controls how far automatic condensation cascades after leaf compaction.
147
+ Controls how far routine threshold full-sweep condensation tries to cascade after leaf compaction.
138
148
 
139
149
  Why it matters:
140
150
 
141
151
  - `0` keeps only leaf summaries moving automatically.
142
152
  - `1` is a practical default for long-running sessions.
143
153
  - `-1` allows unlimited cascading, which can be useful for very long histories but is more aggressive.
154
+ - This is a preferred depth, not an absolute cap. Pressure sweeps may go deeper when summarized context remains too large.
155
+
156
+ ### `summaryPrefixTargetTokens`
157
+
158
+ Optional target for summarized-prefix tokens after a full sweep.
159
+
160
+ Why it matters:
161
+
162
+ - Gives Lossless an escape hatch when too many summaries at the preferred depth still leave the prompt near full.
163
+ - When unset, Lossless derives a target from `contextThreshold`, the active token budget, and `leafChunkTokens`.
164
+ - Sweeps first exhaust eligible raw-message leaf chunks, then honor `sweepMaxDepth`; pressure condensation can go deeper only when summary-prefix pressure remains.
165
+
166
+ ### `incrementalMaxDepth`
167
+
168
+ Deprecated alias for `sweepMaxDepth`.
169
+
170
+ Why it matters:
171
+
172
+ - Existing OpenClaw configs continue to load.
173
+ - New config should use `sweepMaxDepth`.
174
+ - If both aliases are set in the same source, `sweepMaxDepth` wins.
144
175
 
145
176
  ### `summaryModel` and `summaryProvider`
146
177
 
@@ -155,6 +186,8 @@ Guidance:
155
186
 
156
187
  - Pick a cheaper model only if it remains reliably structured and faithful.
157
188
  - `summaryProvider` only matters when `summaryModel` is a bare model name rather than a canonical provider/model ref.
189
+ - Summary calls go through OpenClaw's `api.runtime.llm.complete`; Lossless does not resolve provider credentials directly.
190
+ - Explicit summary model overrides require `plugins.entries.lossless-claw.llm.allowModelOverride` plus matching `allowedModels` entries, or `openclaw doctor --fix` to add them.
158
191
 
159
192
  ### `expansionModel` and `expansionProvider`
160
193
 
@@ -235,6 +268,33 @@ Why it matters:
235
268
  - `/lossless status` and `/lcm status` surface pending/running/last-failure maintenance state so operators can see when compaction is queued
236
269
  - background `maintain()` can still do non-prompt-mutating work, but prompt-mutating debt is consumed pre-assembly once cache is cold or the next turn is already approaching overflow
237
270
 
271
+ ### `autoRotateSessionFiles`
272
+
273
+ Automatically rotates oversized LCM-managed session JSONL files.
274
+
275
+ Defaults:
276
+
277
+ - `enabled: true`
278
+ - `createBackups: false`
279
+ - `sizeBytes: 2097152`
280
+ - `startup: "rotate"`
281
+ - `runtime: "rotate"`
282
+
283
+ Why it matters:
284
+
285
+ - prevents very large OpenClaw session JSONL files from choking fallback/gateway startup while LCM owns the durable context
286
+ - runtime rotation only creates or replaces the rolling `rotate-latest` DB backup when `createBackups` is `true`; manual `/lossless rotate` / `/lcm rotate` always keeps its backup-backed behavior
287
+ - startup scans OpenClaw's current indexed session stores for configured agents, intersects those candidates with active LCM bootstrap state, and creates one pre-rotation DB backup for the startup batch only when `createBackups` is `true`
288
+ - only runs for active, writable LCM conversations; ignored sessions, stateless sessions, sessions outside the indexed startup candidate set, and sessions without active LCM state are skipped
289
+ - the preserved transcript tail follows the normal rotate behavior controlled by `freshTailCount`
290
+
291
+ Operational logging:
292
+
293
+ - every decision is logged with the prefix `[lcm] auto-rotate:`
294
+ - startup emits one compact `action=summary` line with `scanned`, `eligible`, `rotated`, `warned`, `skipped`, `durationMs`, and `bytesRemoved`
295
+ - rotate logs include `phase`, `action`, `sessionId`, `sessionKey`, `sessionFile`, `sizeBytes`, `thresholdBytes`, `durationMs`, `backupPath`, `bytesRemoved`, `preservedTailMessageCount`, and `checkpointSize`
296
+ - real warning logs include the same available context plus `reason` or `error`; quiet startup skips such as missing files, missing bootstrap mappings, and below-threshold files are counted in the summary instead of logged per candidate
297
+
238
298
  ## Compaction timing and shape
239
299
 
240
300
  ### `contextThreshold`
@@ -264,6 +324,21 @@ Env override:
264
324
 
265
325
  - `LCM_PROMPT_AWARE_EVICTION_ENABLED`
266
326
 
327
+ ### `stubLargeToolPayloads`
328
+
329
+ Boolean toggle for assemble-time stub substitution of migrated tool-result payloads outside the protected fresh tail.
330
+
331
+ Why it matters:
332
+
333
+ - only affects rows whose `messages.large_content` sidecar points at a `file_xxx` record
334
+ - the fresh tail is still emitted verbatim
335
+ - drilldown uses `lcm_describe(id=file_xxx, expandFile=true)`
336
+ - `scripts/lcm-blob-migrate.mjs` defaults to the same storage root as runtime LCM: `LCM_LARGE_FILES_DIR` or `${OPENCLAW_STATE_DIR}/lcm-files`
337
+
338
+ Env override:
339
+
340
+ - `LCM_STUB_LARGE_TOOL_PAYLOADS`
341
+
267
342
  ### `leafChunkTokens`
268
343
 
269
344
  See high-impact settings above.
@@ -295,10 +370,30 @@ Why it matters:
295
370
  - acts as the guardrail when normal fanout preferences cannot be met cleanly
296
371
  - mostly useful for advanced tuning or pathological summary-tree shapes
297
372
 
298
- ### `incrementalMaxDepth`
373
+ ### `sweepMaxDepth`
374
+
375
+ See high-impact settings above.
376
+
377
+ Env override:
378
+
379
+ - `LCM_SWEEP_MAX_DEPTH`
380
+
381
+ ### `summaryPrefixTargetTokens`
299
382
 
300
383
  See high-impact settings above.
301
384
 
385
+ Env override:
386
+
387
+ - `LCM_SUMMARY_PREFIX_TARGET_TOKENS`
388
+
389
+ ### `incrementalMaxDepth`
390
+
391
+ Deprecated alias for `sweepMaxDepth`.
392
+
393
+ Env override:
394
+
395
+ - `LCM_INCREMENTAL_MAX_DEPTH`
396
+
302
397
  ### `bootstrapMaxTokens`
303
398
 
304
399
  Maximum raw parent-history tokens imported when a brand-new LCM conversation bootstraps.
@@ -372,16 +467,16 @@ Why it matters:
372
467
 
373
468
  #### `cacheAwareCompaction.enabled`
374
469
 
375
- Defers incremental leaf compaction more aggressively when prompt-cache telemetry indicates a hot cache.
470
+ Deprecated compatibility setting. It remains accepted by config loading but no longer changes automatic compaction behavior.
376
471
 
377
472
  #### `cacheAwareCompaction.cacheTTLSeconds`
378
473
 
379
- Fallback cache TTL used when deferred Anthropic compaction has provider/model telemetry but no explicit runtime cache-retention window.
474
+ Deprecated compatibility setting. Threshold debt no longer waits for a prompt-cache TTL.
380
475
 
381
476
  Why it matters:
382
477
 
383
- - lets cache-safe deferred compaction stay conservative even when the host only knows that the turn was Anthropic-family, not the exact retention tier
384
- - keeps prompt-mutating debt pending until the cached prefix is likely cold
478
+ - existing configs continue to load
479
+ - prompt-cache telemetry remains diagnostic only
385
480
 
386
481
  Default:
387
482
 
@@ -389,16 +484,15 @@ Default:
389
484
 
390
485
  #### `cacheAwareCompaction.maxColdCacheCatchupPasses`
391
486
 
392
- Maximum bounded catch-up passes allowed in one maintenance cycle when cache telemetry is cold.
487
+ Deprecated compatibility setting. Automatic cold-cache catch-up passes were removed.
393
488
 
394
489
  #### `cacheAwareCompaction.hotCachePressureFactor`
395
490
 
396
- Multiplier applied to the hot-cache leaf trigger before raw-history pressure overrides cache preservation.
491
+ Deprecated compatibility setting. Hot-cache raw-history pressure no longer drives automatic compaction.
397
492
 
398
493
  Why it matters:
399
494
 
400
- - higher values preserve hot cache longer
401
- - lower values revert toward more eager incremental compaction
495
+ - use `contextThreshold`, `leafChunkTokens`, and fanout for active compaction tuning
402
496
 
403
497
  Default:
404
498
 
@@ -406,12 +500,11 @@ Default:
406
500
 
407
501
  #### `cacheAwareCompaction.hotCacheBudgetHeadroomRatio`
408
502
 
409
- Minimum fraction of the real token budget that must remain free before hot-cache incremental compaction is skipped entirely.
503
+ Deprecated compatibility setting. Hot-cache budget headroom no longer defers automatic threshold compaction.
410
504
 
411
505
  Why it matters:
412
506
 
413
- - higher values make hot-cache skip behavior stricter
414
- - lower values allow more hot-cache maintenance before real budget pressure exists
507
+ - threshold debt runs when the context threshold is crossed
415
508
 
416
509
  Default:
417
510
 
@@ -419,12 +512,11 @@ Default:
419
512
 
420
513
  #### `cacheAwareCompaction.coldCacheObservationThreshold`
421
514
 
422
- Consecutive cold observations required before non-explicit cache misses are treated as truly cold.
515
+ Deprecated compatibility setting. Cold-cache streaks may still be observable telemetry, but they no longer trigger catch-up compaction.
423
516
 
424
517
  Why it matters:
425
518
 
426
- - prevents a single OpenRouter routing miss or provider failover blip from immediately triggering cold-cache catch-up
427
- - explicit cache breaks still count as cold immediately
519
+ - cache state is not reliable enough to drive prompt-mutating compaction
428
520
 
429
521
  Default:
430
522
 
@@ -432,17 +524,16 @@ Default:
432
524
 
433
525
  #### `cacheAwareCompaction.criticalBudgetPressureRatio`
434
526
 
435
- Fraction of the token budget at which deferred compaction bypasses hot-cache delay.
527
+ Deprecated compatibility setting. `contextThreshold` is now the only automatic compaction threshold.
436
528
 
437
529
  Why it matters:
438
530
 
439
- - lets prompt-mutating deferred compaction run before the runtime falls back to emergency overflow handling
440
- - preserves cache-aware throttling below the pressure threshold
441
- - can be set to `1` to disable this pressure bypass
531
+ - the hot-cache delay gate has been removed
532
+ - overflow recovery still uses explicit budget-targeted compaction
442
533
 
443
534
  Default:
444
535
 
445
- - `0.70`
536
+ - `0.90`
446
537
 
447
538
  Env override:
448
539
 
@@ -452,7 +543,7 @@ Env override:
452
543
 
453
544
  #### `dynamicLeafChunkTokens.enabled`
454
545
 
455
- Enables dynamic working leaf chunk sizes for busier sessions.
546
+ Deprecated compatibility setting. Automatic compaction uses `leafChunkTokens` directly.
456
547
 
457
548
  Default:
458
549
 
@@ -460,7 +551,7 @@ Default:
460
551
 
461
552
  #### `dynamicLeafChunkTokens.max`
462
553
 
463
- Upper bound for the dynamic working chunk size. The static `leafChunkTokens` value remains the floor.
554
+ Deprecated compatibility setting. The resolved value is still accepted and visible, but no longer changes automatic compaction.
464
555
 
465
556
  Default:
466
557
 
@@ -492,12 +583,10 @@ Why it matters:
492
583
  2. Set the context-engine slot to `lossless-claw`.
493
584
  3. Start with conservative defaults.
494
585
  4. Run `/lossless` after startup to confirm path, size, and summary health.
495
- 5. If hot-cache turns still compact too often, inspect the decision logs before changing anything else:
496
- - `reason=hot-cache-budget-headroom` means the new skip path is working.
497
- - `reason=hot-cache-defer` means raw-history pressure is below the configured hot-cache factor.
498
- - `allowCondensedPasses=false` on hot-cache turns is expected.
499
- 6. If recall feels weak, revisit `freshTailCount`, `leafChunkTokens`, and summarizer model quality before changing anything else.
500
- 7. Touch advanced knobs like fanout, large-file thresholds, custom instructions, and assembly caps only after a concrete symptom appears.
586
+ 5. If threshold sweeps happen too often, tune `contextThreshold`, `leafChunkTokens`, `summaryPrefixTargetTokens`, and fanout before adding new mechanisms.
587
+ 6. If threshold sweeps happen too often, try a larger `leafChunkTokens` value such as 30000 before adding new mechanisms.
588
+ 7. If recall feels weak, revisit `freshTailCount`, `leafChunkTokens`, and summarizer model quality before changing anything else.
589
+ 8. Touch advanced knobs like fanout, large-file thresholds, custom instructions, and assembly caps only after a concrete symptom appears.
501
590
 
502
591
  ## Reading the status output
503
592
 
@@ -50,6 +50,12 @@ Treat as a specialized sub-agent flow, not the default first step.
50
50
  2. Use `lcm_describe` when you have a summary or file ID.
51
51
  3. Use `lcm_expand_query` when the answer requires precise recovery rather than a high-level summary.
52
52
 
53
+ ## Conversation scope
54
+
55
+ When `conversationId` is omitted, recall tools use the current session family: the active conversation plus archived segments that share the same stable session identity. This preserves recall across session rotation and `/reset` replacement rows.
56
+
57
+ Use `conversationId` only when you need one specific physical conversation. Use `allConversations: true` for broad discovery across unrelated sessions.
58
+
53
59
  ## Important guardrail
54
60
 
55
61
  Do not infer exact details from summaries alone when the user needs evidence. Expand first or state that the answer still needs expansion.