@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.
- package/README.md +7 -3
- package/dist/index.js +70 -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 +53 -26
- 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 +102 -24
- package/package.json +14 -23
- package/skills/lossless-claw/references/config.md +138 -49
- 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
|
|
|
@@ -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
|
-
### `
|
|
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
|
-
|
|
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
|
-
|
|
474
|
+
Deprecated compatibility setting. Threshold debt no longer waits for a prompt-cache TTL.
|
|
380
475
|
|
|
381
476
|
Why it matters:
|
|
382
477
|
|
|
383
|
-
-
|
|
384
|
-
-
|
|
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
|
-
|
|
487
|
+
Deprecated compatibility setting. Automatic cold-cache catch-up passes were removed.
|
|
393
488
|
|
|
394
489
|
#### `cacheAwareCompaction.hotCachePressureFactor`
|
|
395
490
|
|
|
396
|
-
|
|
491
|
+
Deprecated compatibility setting. Hot-cache raw-history pressure no longer drives automatic compaction.
|
|
397
492
|
|
|
398
493
|
Why it matters:
|
|
399
494
|
|
|
400
|
-
-
|
|
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
|
-
|
|
503
|
+
Deprecated compatibility setting. Hot-cache budget headroom no longer defers automatic threshold compaction.
|
|
410
504
|
|
|
411
505
|
Why it matters:
|
|
412
506
|
|
|
413
|
-
-
|
|
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
|
-
|
|
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
|
-
-
|
|
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
|
-
|
|
527
|
+
Deprecated compatibility setting. `contextThreshold` is now the only automatic compaction threshold.
|
|
436
528
|
|
|
437
529
|
Why it matters:
|
|
438
530
|
|
|
439
|
-
-
|
|
440
|
-
-
|
|
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.
|
|
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
|
-
|
|
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
|
-
|
|
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
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
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.
|