@martian-engineering/lossless-claw 0.9.4 → 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.
- package/README.md +7 -3
- package/dist/index.js +66 -32
- package/docs/agent-tools.md +6 -6
- package/docs/architecture.md +17 -18
- package/docs/compaction-redesign-map.md +243 -0
- package/docs/configuration.md +40 -27
- package/docs/tui.md +8 -1
- package/doctor-contract-api.d.ts +29 -0
- package/doctor-contract-api.js +231 -0
- package/openclaw.plugin.json +54 -24
- package/package.json +8 -20
- package/skills/lossless-claw/references/config.md +114 -51
- package/skills/lossless-claw/references/recall-tools.md +6 -0
|
@@ -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
|
-
|
|
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
|
-
-
|
|
96
|
-
-
|
|
97
|
-
-
|
|
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
|
-
-
|
|
102
|
-
- `
|
|
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
|
-
-
|
|
111
|
-
-
|
|
112
|
-
-
|
|
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
|
-
|
|
128
|
+
Deprecated compatibility object. Automatic compaction now uses `leafChunkTokens` directly.
|
|
119
129
|
|
|
120
130
|
Why it matters:
|
|
121
131
|
|
|
122
|
-
-
|
|
123
|
-
-
|
|
124
|
-
-
|
|
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
|
-
### `
|
|
145
|
+
### `sweepMaxDepth`
|
|
136
146
|
|
|
137
|
-
Controls how far
|
|
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
|
|
|
@@ -242,6 +275,7 @@ Automatically rotates oversized LCM-managed session JSONL files.
|
|
|
242
275
|
Defaults:
|
|
243
276
|
|
|
244
277
|
- `enabled: true`
|
|
278
|
+
- `createBackups: false`
|
|
245
279
|
- `sizeBytes: 2097152`
|
|
246
280
|
- `startup: "rotate"`
|
|
247
281
|
- `runtime: "rotate"`
|
|
@@ -249,8 +283,8 @@ Defaults:
|
|
|
249
283
|
Why it matters:
|
|
250
284
|
|
|
251
285
|
- prevents very large OpenClaw session JSONL files from choking fallback/gateway startup while LCM owns the durable context
|
|
252
|
-
- runtime rotation
|
|
253
|
-
- 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
|
|
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`
|
|
254
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
|
|
255
289
|
- the preserved transcript tail follows the normal rotate behavior controlled by `freshTailCount`
|
|
256
290
|
|
|
@@ -290,6 +324,21 @@ Env override:
|
|
|
290
324
|
|
|
291
325
|
- `LCM_PROMPT_AWARE_EVICTION_ENABLED`
|
|
292
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
|
+
|
|
293
342
|
### `leafChunkTokens`
|
|
294
343
|
|
|
295
344
|
See high-impact settings above.
|
|
@@ -321,10 +370,30 @@ Why it matters:
|
|
|
321
370
|
- acts as the guardrail when normal fanout preferences cannot be met cleanly
|
|
322
371
|
- mostly useful for advanced tuning or pathological summary-tree shapes
|
|
323
372
|
|
|
324
|
-
### `
|
|
373
|
+
### `sweepMaxDepth`
|
|
325
374
|
|
|
326
375
|
See high-impact settings above.
|
|
327
376
|
|
|
377
|
+
Env override:
|
|
378
|
+
|
|
379
|
+
- `LCM_SWEEP_MAX_DEPTH`
|
|
380
|
+
|
|
381
|
+
### `summaryPrefixTargetTokens`
|
|
382
|
+
|
|
383
|
+
See high-impact settings above.
|
|
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
|
+
|
|
328
397
|
### `bootstrapMaxTokens`
|
|
329
398
|
|
|
330
399
|
Maximum raw parent-history tokens imported when a brand-new LCM conversation bootstraps.
|
|
@@ -398,16 +467,16 @@ Why it matters:
|
|
|
398
467
|
|
|
399
468
|
#### `cacheAwareCompaction.enabled`
|
|
400
469
|
|
|
401
|
-
|
|
470
|
+
Deprecated compatibility setting. It remains accepted by config loading but no longer changes automatic compaction behavior.
|
|
402
471
|
|
|
403
472
|
#### `cacheAwareCompaction.cacheTTLSeconds`
|
|
404
473
|
|
|
405
|
-
|
|
474
|
+
Deprecated compatibility setting. Threshold debt no longer waits for a prompt-cache TTL.
|
|
406
475
|
|
|
407
476
|
Why it matters:
|
|
408
477
|
|
|
409
|
-
-
|
|
410
|
-
-
|
|
478
|
+
- existing configs continue to load
|
|
479
|
+
- prompt-cache telemetry remains diagnostic only
|
|
411
480
|
|
|
412
481
|
Default:
|
|
413
482
|
|
|
@@ -415,16 +484,15 @@ Default:
|
|
|
415
484
|
|
|
416
485
|
#### `cacheAwareCompaction.maxColdCacheCatchupPasses`
|
|
417
486
|
|
|
418
|
-
|
|
487
|
+
Deprecated compatibility setting. Automatic cold-cache catch-up passes were removed.
|
|
419
488
|
|
|
420
489
|
#### `cacheAwareCompaction.hotCachePressureFactor`
|
|
421
490
|
|
|
422
|
-
|
|
491
|
+
Deprecated compatibility setting. Hot-cache raw-history pressure no longer drives automatic compaction.
|
|
423
492
|
|
|
424
493
|
Why it matters:
|
|
425
494
|
|
|
426
|
-
-
|
|
427
|
-
- lower values revert toward more eager incremental compaction
|
|
495
|
+
- use `contextThreshold`, `leafChunkTokens`, and fanout for active compaction tuning
|
|
428
496
|
|
|
429
497
|
Default:
|
|
430
498
|
|
|
@@ -432,12 +500,11 @@ Default:
|
|
|
432
500
|
|
|
433
501
|
#### `cacheAwareCompaction.hotCacheBudgetHeadroomRatio`
|
|
434
502
|
|
|
435
|
-
|
|
503
|
+
Deprecated compatibility setting. Hot-cache budget headroom no longer defers automatic threshold compaction.
|
|
436
504
|
|
|
437
505
|
Why it matters:
|
|
438
506
|
|
|
439
|
-
-
|
|
440
|
-
- lower values allow more hot-cache maintenance before real budget pressure exists
|
|
507
|
+
- threshold debt runs when the context threshold is crossed
|
|
441
508
|
|
|
442
509
|
Default:
|
|
443
510
|
|
|
@@ -445,12 +512,11 @@ Default:
|
|
|
445
512
|
|
|
446
513
|
#### `cacheAwareCompaction.coldCacheObservationThreshold`
|
|
447
514
|
|
|
448
|
-
|
|
515
|
+
Deprecated compatibility setting. Cold-cache streaks may still be observable telemetry, but they no longer trigger catch-up compaction.
|
|
449
516
|
|
|
450
517
|
Why it matters:
|
|
451
518
|
|
|
452
|
-
-
|
|
453
|
-
- explicit cache breaks still count as cold immediately
|
|
519
|
+
- cache state is not reliable enough to drive prompt-mutating compaction
|
|
454
520
|
|
|
455
521
|
Default:
|
|
456
522
|
|
|
@@ -458,17 +524,16 @@ Default:
|
|
|
458
524
|
|
|
459
525
|
#### `cacheAwareCompaction.criticalBudgetPressureRatio`
|
|
460
526
|
|
|
461
|
-
|
|
527
|
+
Deprecated compatibility setting. `contextThreshold` is now the only automatic compaction threshold.
|
|
462
528
|
|
|
463
529
|
Why it matters:
|
|
464
530
|
|
|
465
|
-
-
|
|
466
|
-
-
|
|
467
|
-
- 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
|
|
468
533
|
|
|
469
534
|
Default:
|
|
470
535
|
|
|
471
|
-
- `0.
|
|
536
|
+
- `0.90`
|
|
472
537
|
|
|
473
538
|
Env override:
|
|
474
539
|
|
|
@@ -478,7 +543,7 @@ Env override:
|
|
|
478
543
|
|
|
479
544
|
#### `dynamicLeafChunkTokens.enabled`
|
|
480
545
|
|
|
481
|
-
|
|
546
|
+
Deprecated compatibility setting. Automatic compaction uses `leafChunkTokens` directly.
|
|
482
547
|
|
|
483
548
|
Default:
|
|
484
549
|
|
|
@@ -486,7 +551,7 @@ Default:
|
|
|
486
551
|
|
|
487
552
|
#### `dynamicLeafChunkTokens.max`
|
|
488
553
|
|
|
489
|
-
|
|
554
|
+
Deprecated compatibility setting. The resolved value is still accepted and visible, but no longer changes automatic compaction.
|
|
490
555
|
|
|
491
556
|
Default:
|
|
492
557
|
|
|
@@ -518,12 +583,10 @@ Why it matters:
|
|
|
518
583
|
2. Set the context-engine slot to `lossless-claw`.
|
|
519
584
|
3. Start with conservative defaults.
|
|
520
585
|
4. Run `/lossless` after startup to confirm path, size, and summary health.
|
|
521
|
-
5. If
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
6. If recall feels weak, revisit `freshTailCount`, `leafChunkTokens`, and summarizer model quality before changing anything else.
|
|
526
|
-
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.
|
|
527
590
|
|
|
528
591
|
## Reading the status output
|
|
529
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.
|