@martian-engineering/lossless-claw 0.9.2 → 0.9.3

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.
@@ -55,9 +55,12 @@ Most installations only need to override a handful of keys. If you want a comple
55
55
  "proactiveThresholdCompactionMode": "deferred",
56
56
  "cacheAwareCompaction": {
57
57
  "enabled": true,
58
+ "cacheTTLSeconds": 300,
58
59
  "maxColdCacheCatchupPasses": 2,
59
60
  "hotCachePressureFactor": 4,
60
- "hotCacheBudgetHeadroomRatio": 0.2
61
+ "hotCacheBudgetHeadroomRatio": 0.2,
62
+ "coldCacheObservationThreshold": 3,
63
+ "criticalBudgetPressureRatio": 0.70
61
64
  },
62
65
  "dynamicLeafChunkTokens": {
63
66
  "enabled": true,
@@ -173,6 +176,7 @@ openclaw plugins install --link /path/to/lossless-claw
173
176
  | `cacheAwareCompaction.hotCachePressureFactor` | `number` | `4` | `LCM_HOT_CACHE_PRESSURE_FACTOR` | Multiplier applied to the hot-cache leaf trigger before raw-history pressure overrides cache preservation. |
174
177
  | `cacheAwareCompaction.hotCacheBudgetHeadroomRatio` | `number` | `0.2` | `LCM_HOT_CACHE_BUDGET_HEADROOM_RATIO` | Minimum fraction of the real token budget that must remain free before hot-cache incremental compaction is skipped entirely. |
175
178
  | `cacheAwareCompaction.coldCacheObservationThreshold` | `integer` | `3` | `LCM_COLD_CACHE_OBSERVATION_THRESHOLD` | Consecutive cold observations required before non-explicit cache misses are treated as truly cold. This dampens one-off routing noise and provider failover blips. |
179
+ | `cacheAwareCompaction.criticalBudgetPressureRatio` | `number` | `0.70` | `LCM_CRITICAL_BUDGET_PRESSURE_RATIO` | Fraction of the token budget at which deferred compaction bypasses hot-cache delay so prompt-mutating debt can run before overflow. Set to `1` to disable this bypass. |
176
180
 
177
181
  #### `dynamicLeafChunkTokens`
178
182
 
@@ -189,6 +193,7 @@ When cache-aware compaction is enabled:
189
193
  - hot cache skips incremental maintenance entirely when the assembled context is still comfortably below the real token budget
190
194
  - hot cache also gets a short hysteresis window so one ambiguous turn does not immediately discard a recently healthy cache signal
191
195
  - cold cache still allows bounded catch-up passes via `cacheAwareCompaction.maxColdCacheCatchupPasses`
196
+ - once `currentTokenCount >= criticalBudgetPressureRatio * tokenBudget`, deferred compaction bypasses hot-cache delay so prompt-mutating debt can run before emergency overflow handling
192
197
 
193
198
  When incremental leaf compaction still runs on a hot cache, follow-on condensed passes are suppressed so the maintenance cycle only pays for the leaf pass that was explicitly justified.
194
199
 
package/docs/tui.md CHANGED
@@ -245,8 +245,8 @@ Scans for genuinely truncated summaries and can rewrite them in place. This is n
245
245
  # Preview repairs for one conversation
246
246
  lcm-tui doctor 44 --show-diff
247
247
 
248
- # Apply repairs with an OpenAI-compatible backend
249
- lcm-tui doctor 44 --apply --provider openai --model gpt-5.3-codex --base-url https://proxy.example.com/openai
248
+ # Apply repairs through Codex CLI OAuth after `codex login`
249
+ lcm-tui doctor 44 --apply --provider openai-codex --model gpt-5.3-codex
250
250
 
251
251
  # Scan only across every conversation
252
252
  lcm-tui doctor --all
@@ -263,6 +263,8 @@ lcm-tui doctor --all
263
263
  | `--show-diff` | Show unified diff for each fix |
264
264
  | `--timestamps` | Inject timestamps into rewrite source text |
265
265
 
266
+ Use `--provider openai-codex` when you want ChatGPT Plus/Pro OAuth from the Codex CLI. Keep `--provider openai` for direct OpenAI-compatible HTTP calls with a raw `OPENAI_API_KEY`, including custom `--base-url` proxies.
267
+
266
268
  ### `lcm-tui repair`
267
269
 
268
270
  Finds and fixes corrupted summaries (those containing the `[LCM fallback summary]` marker from failed summarization attempts).
@@ -280,7 +282,10 @@ lcm-tui repair 44 --apply
280
282
  # Repair a specific summary
281
283
  lcm-tui repair 44 --summary-id sum_abc123 --apply
282
284
 
283
- # Repair through an OpenAI-compatible backend
285
+ # Repair through Codex CLI OAuth after `codex login`
286
+ lcm-tui repair 44 --apply --provider openai-codex --model gpt-5.3-codex
287
+
288
+ # Repair through a custom OpenAI-compatible proxy with a raw API key
284
289
  lcm-tui repair 44 --apply --provider openai --model gpt-5.3-codex --base-url https://proxy.example.com/openai
285
290
  ```
286
291
 
@@ -316,10 +321,10 @@ lcm-tui rewrite 44 --depth 0 --apply
316
321
  # Rewrite everything bottom-up
317
322
  lcm-tui rewrite 44 --all --apply --diff
318
323
 
319
- # Rewrite with OpenAI Responses API
320
- lcm-tui rewrite 44 --summary sum_abc123 --provider openai --model gpt-5.3-codex --apply
324
+ # Rewrite with Codex CLI OAuth after `codex login`
325
+ lcm-tui rewrite 44 --summary sum_abc123 --provider openai-codex --model gpt-5.3-codex --apply
321
326
 
322
- # Rewrite through a custom OpenAI-compatible proxy
327
+ # Rewrite through a custom OpenAI-compatible proxy with a raw API key
323
328
  lcm-tui rewrite 44 --summary sum_abc123 --provider openai --model gpt-5.3-codex --base-url https://proxy.example.com/openai --apply
324
329
 
325
330
  # Use custom prompt templates
@@ -412,10 +417,10 @@ lcm-tui backfill my-agent session_abc123 --apply --recompact --single-root
412
417
  # Import + compact + transplant into an active conversation
413
418
  lcm-tui backfill my-agent session_abc123 --apply --transplant-to 653
414
419
 
415
- # Backfill using OpenAI
416
- lcm-tui backfill my-agent session_abc123 --apply --provider openai --model gpt-5.3-codex
420
+ # Backfill using Codex CLI OAuth after `codex login`
421
+ lcm-tui backfill my-agent session_abc123 --apply --provider openai-codex --model gpt-5.3-codex
417
422
 
418
- # Backfill through a custom OpenAI-compatible proxy
423
+ # Backfill through a custom OpenAI-compatible proxy with a raw API key
419
424
  lcm-tui backfill my-agent session_abc123 --apply --provider openai --model gpt-5.3-codex --base-url https://proxy.example.com/openai
420
425
  ```
421
426
 
@@ -4,6 +4,14 @@
4
4
  "skills": [
5
5
  "skills/lossless-claw"
6
6
  ],
7
+ "contracts": {
8
+ "tools": [
9
+ "lcm_grep",
10
+ "lcm_describe",
11
+ "lcm_expand",
12
+ "lcm_expand_query"
13
+ ]
14
+ },
7
15
  "uiHints": {
8
16
  "enabled": {
9
17
  "label": "Enabled",
@@ -177,6 +185,10 @@
177
185
  "label": "Cold Cache Observation Threshold",
178
186
  "help": "Consecutive cold observations required before non-explicit cache misses are treated as truly cold"
179
187
  },
188
+ "cacheAwareCompaction.criticalBudgetPressureRatio": {
189
+ "label": "Critical Budget Pressure Ratio",
190
+ "help": "Fraction of token budget at which deferred compaction fires regardless of prompt-cache state. Defaults to 0.70 — set to 1 to disable the override and let cache-aware throttling fully control deferral."
191
+ },
180
192
  "dynamicLeafChunkTokens.enabled": {
181
193
  "label": "Dynamic Leaf Chunk Tokens",
182
194
  "help": "When enabled, incremental compaction uses a larger working leaf chunk in busy sessions and keeps the static floor in quieter sessions"
@@ -370,6 +382,11 @@
370
382
  "coldCacheObservationThreshold": {
371
383
  "type": "integer",
372
384
  "minimum": 1
385
+ },
386
+ "criticalBudgetPressureRatio": {
387
+ "type": "number",
388
+ "minimum": 0,
389
+ "maximum": 1
373
390
  }
374
391
  }
375
392
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@martian-engineering/lossless-claw",
3
- "version": "0.9.2",
3
+ "version": "0.9.3",
4
4
  "description": "Lossless Context Management plugin for OpenClaw — DAG-based conversation summarization with incremental compaction",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -31,28 +31,49 @@
31
31
  "LICENSE"
32
32
  ],
33
33
  "dependencies": {
34
- "@mariozechner/pi-agent-core": "0.66.1",
35
- "@mariozechner/pi-ai": "0.66.1",
36
- "@mariozechner/pi-coding-agent": "0.66.1",
37
34
  "@sinclair/typebox": "0.34.48"
38
35
  },
39
36
  "devDependencies": {
40
37
  "@changesets/changelog-github": "^0.6.0",
41
38
  "@changesets/cli": "^2.30.0",
39
+ "@mariozechner/pi-agent-core": "0.66.1",
40
+ "@mariozechner/pi-ai": "0.66.1",
41
+ "@mariozechner/pi-coding-agent": "0.66.1",
42
42
  "esbuild": "^0.28.0",
43
43
  "typescript": "^5.7.0",
44
44
  "vitest": "^3.0.0"
45
45
  },
46
46
  "peerDependencies": {
47
+ "@mariozechner/pi-agent-core": "*",
48
+ "@mariozechner/pi-ai": "*",
49
+ "@mariozechner/pi-coding-agent": "*",
47
50
  "openclaw": "*"
48
51
  },
52
+ "peerDependenciesMeta": {
53
+ "@mariozechner/pi-agent-core": {
54
+ "optional": true
55
+ },
56
+ "@mariozechner/pi-ai": {
57
+ "optional": true
58
+ },
59
+ "@mariozechner/pi-coding-agent": {
60
+ "optional": true
61
+ }
62
+ },
49
63
  "publishConfig": {
50
64
  "access": "public"
51
65
  },
52
66
  "openclaw": {
53
67
  "extensions": [
54
68
  "./dist/index.js"
55
- ]
69
+ ],
70
+ "compat": {
71
+ "pluginApi": ">=2026.2.17",
72
+ "minGatewayVersion": "2026.2.17"
73
+ },
74
+ "build": {
75
+ "openclawVersion": "2026.2.17"
76
+ }
56
77
  },
57
78
  "repository": {
58
79
  "type": "git",
@@ -103,12 +103,14 @@ Good defaults:
103
103
  - `hotCachePressureFactor: 4`
104
104
  - `hotCacheBudgetHeadroomRatio: 0.2`
105
105
  - `coldCacheObservationThreshold: 3`
106
+ - `criticalBudgetPressureRatio: 0.70`
106
107
 
107
108
  Operationally:
108
109
 
109
110
  - hot cache stretches the incremental leaf trigger to `dynamicLeafChunkTokens.max`
110
111
  - hot cache skips incremental maintenance entirely when the assembled context is comfortably below the real token budget
111
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`
112
114
  - if hot-cache maintenance still runs, it stays leaf-only and suppresses follow-on condensed passes
113
115
 
114
116
  ### `dynamicLeafChunkTokens`
@@ -428,6 +430,24 @@ Default:
428
430
 
429
431
  - `3`
430
432
 
433
+ #### `cacheAwareCompaction.criticalBudgetPressureRatio`
434
+
435
+ Fraction of the token budget at which deferred compaction bypasses hot-cache delay.
436
+
437
+ Why it matters:
438
+
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
442
+
443
+ Default:
444
+
445
+ - `0.70`
446
+
447
+ Env override:
448
+
449
+ - `LCM_CRITICAL_BUDGET_PRESSURE_RATIO`
450
+
431
451
  ### `dynamicLeafChunkTokens`
432
452
 
433
453
  #### `dynamicLeafChunkTokens.enabled`