@martian-engineering/lossless-claw 0.9.3 → 0.9.4
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/dist/index.js +10 -6
- package/docs/configuration.md +14 -0
- package/openclaw.plugin.json +48 -0
- package/package.json +10 -7
- package/skills/lossless-claw/references/config.md +26 -0
package/docs/configuration.md
CHANGED
|
@@ -53,6 +53,12 @@ Most installations only need to override a handful of keys. If you want a comple
|
|
|
53
53
|
"circuitBreakerCooldownMs": 1800000,
|
|
54
54
|
"fallbackProviders": [],
|
|
55
55
|
"proactiveThresholdCompactionMode": "deferred",
|
|
56
|
+
"autoRotateSessionFiles": {
|
|
57
|
+
"enabled": true,
|
|
58
|
+
"sizeBytes": 2097152,
|
|
59
|
+
"startup": "rotate",
|
|
60
|
+
"runtime": "rotate"
|
|
61
|
+
},
|
|
56
62
|
"cacheAwareCompaction": {
|
|
57
63
|
"enabled": true,
|
|
58
64
|
"cacheTTLSeconds": 300,
|
|
@@ -117,9 +123,17 @@ openclaw plugins install --link /path/to/lossless-claw
|
|
|
117
123
|
| `pruneHeartbeatOk` | `boolean` | `false` | `LCM_PRUNE_HEARTBEAT_OK` | Retroactively removes `HEARTBEAT_OK` turn cycles from persisted storage. |
|
|
118
124
|
| `transcriptGcEnabled` | `boolean` | `false` | `LCM_TRANSCRIPT_GC_ENABLED` | Enables transcript rewrite GC during `maintain()`; disabled by default so transcript rewrites stay opt-in. |
|
|
119
125
|
| `proactiveThresholdCompactionMode` | `"deferred" \| "inline"` | `"deferred"` | `LCM_PROACTIVE_THRESHOLD_COMPACTION_MODE` | Controls whether proactive threshold compaction is deferred into maintenance debt by default or run inline for legacy behavior. |
|
|
126
|
+
| `autoRotateSessionFiles.enabled` | `boolean` | `true` | `LCM_AUTO_ROTATE_SESSION_FILES_ENABLED` | Enables automatic rotation for oversized LCM-managed session JSONL files. |
|
|
127
|
+
| `autoRotateSessionFiles.sizeBytes` | `integer` | `2097152` | `LCM_AUTO_ROTATE_SESSION_FILES_SIZE_BYTES` | Byte threshold that triggers automatic session-file rotation. |
|
|
128
|
+
| `autoRotateSessionFiles.startup` | `"rotate" \| "warn" \| "off"` | `"rotate"` | `LCM_AUTO_ROTATE_SESSION_FILES_STARTUP` | Startup behavior for oversized indexed OpenClaw session transcripts that also have active LCM bootstrap state. |
|
|
129
|
+
| `autoRotateSessionFiles.runtime` | `"rotate" \| "warn" \| "off"` | `"rotate"` | `LCM_AUTO_ROTATE_SESSION_FILES_RUNTIME` | Runtime behavior after `afterTurn()` and `maintain()` check the current transcript size. |
|
|
120
130
|
|
|
121
131
|
> **Multi-profile note:** `OPENCLAW_STATE_DIR` (set by the host OpenClaw gateway) controls where state is stored. When two gateways run on the same host (e.g. separate bot personas), each gateway sets its own `OPENCLAW_STATE_DIR` and lossless-claw automatically uses that directory for the database, large-file payloads, auth-profile lookups, and legacy secrets — no per-profile plugin config is needed.
|
|
122
132
|
|
|
133
|
+
Automatic session-file rotation uses the same safe path as `/lcm rotate`: runtime rotation replaces the rolling `rotate-latest` SQLite backup, rewrites only the live session transcript, keeps the active LCM conversation and durable history intact, and refreshes the bootstrap checkpoint. Startup rotation first scans OpenClaw's current indexed session stores for configured agents, then intersects those candidates with active LCM conversations and matching bootstrap file mappings. If multiple startup candidates need rotation, one pre-rotation LCM database backup is created for the batch before any transcript is rewritten. Rotation never runs for ignored sessions, stateless sessions, or sessions without active LCM state. The preserved JSONL tail follows the existing rotate behavior, which is controlled by `freshTailCount`.
|
|
134
|
+
|
|
135
|
+
Every automatic decision emits grep-able log lines prefixed with `[lcm] auto-rotate:`. Startup emits one compact summary line with `phase=startup`, `action=summary`, `scanned`, `eligible`, `rotated`, `warned`, `skipped`, `durationMs`, `bytesRemoved`, and backup fields when a batch backup was created; quiet skips such as missing files, missing bootstrap mappings, and below-threshold files are counted there instead of producing one line per candidate. Rotation detail lines include `phase`, `action`, `sessionId`, `sessionKey`, `sessionFile`, `sizeBytes`, `thresholdBytes`, `durationMs`, `backupPath`, `bytesRemoved`, `preservedTailMessageCount`, and `checkpointSize`; real warning lines include the same available context plus `reason` or `error`.
|
|
136
|
+
|
|
123
137
|
### Compaction thresholds and summary sizing
|
|
124
138
|
|
|
125
139
|
| Key | Type | Default | Env override | Purpose |
|
package/openclaw.plugin.json
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"id": "lossless-claw",
|
|
3
3
|
"kind": "context-engine",
|
|
4
|
+
"activation": {
|
|
5
|
+
"onStartup": true
|
|
6
|
+
},
|
|
4
7
|
"skills": [
|
|
5
8
|
"skills/lossless-claw"
|
|
6
9
|
],
|
|
@@ -213,6 +216,22 @@
|
|
|
213
216
|
"label": "Proactive Threshold Compaction Mode",
|
|
214
217
|
"help": "Choose deferred compaction debt by default or keep legacy inline proactive compaction"
|
|
215
218
|
},
|
|
219
|
+
"autoRotateSessionFiles.enabled": {
|
|
220
|
+
"label": "Auto-Rotate Session Files",
|
|
221
|
+
"help": "Automatically rotate oversized LCM-managed session JSONL files after startup and runtime checks"
|
|
222
|
+
},
|
|
223
|
+
"autoRotateSessionFiles.sizeBytes": {
|
|
224
|
+
"label": "Auto-Rotate Size Bytes",
|
|
225
|
+
"help": "Session JSONL byte threshold for automatic rotation (default: 2097152)"
|
|
226
|
+
},
|
|
227
|
+
"autoRotateSessionFiles.startup": {
|
|
228
|
+
"label": "Startup Auto-Rotate",
|
|
229
|
+
"help": "Startup behavior for oversized indexed OpenClaw session files with active LCM state: rotate, warn, or off"
|
|
230
|
+
},
|
|
231
|
+
"autoRotateSessionFiles.runtime": {
|
|
232
|
+
"label": "Runtime Auto-Rotate",
|
|
233
|
+
"help": "Runtime behavior for oversized current LCM session files: rotate, warn, or off"
|
|
234
|
+
},
|
|
216
235
|
"fallbackProviders": {
|
|
217
236
|
"label": "Fallback Providers",
|
|
218
237
|
"help": "Explicit fallback provider/model pairs for compaction summarization (e.g., [{\"provider\": \"anthropic\", \"model\": \"claude-haiku-4-5\"}])"
|
|
@@ -419,6 +438,35 @@
|
|
|
419
438
|
"inline"
|
|
420
439
|
]
|
|
421
440
|
},
|
|
441
|
+
"autoRotateSessionFiles": {
|
|
442
|
+
"type": "object",
|
|
443
|
+
"additionalProperties": false,
|
|
444
|
+
"properties": {
|
|
445
|
+
"enabled": {
|
|
446
|
+
"type": "boolean"
|
|
447
|
+
},
|
|
448
|
+
"sizeBytes": {
|
|
449
|
+
"type": "integer",
|
|
450
|
+
"minimum": 1
|
|
451
|
+
},
|
|
452
|
+
"startup": {
|
|
453
|
+
"type": "string",
|
|
454
|
+
"enum": [
|
|
455
|
+
"rotate",
|
|
456
|
+
"warn",
|
|
457
|
+
"off"
|
|
458
|
+
]
|
|
459
|
+
},
|
|
460
|
+
"runtime": {
|
|
461
|
+
"type": "string",
|
|
462
|
+
"enum": [
|
|
463
|
+
"rotate",
|
|
464
|
+
"warn",
|
|
465
|
+
"off"
|
|
466
|
+
]
|
|
467
|
+
}
|
|
468
|
+
}
|
|
469
|
+
},
|
|
422
470
|
"databasePath": {
|
|
423
471
|
"description": "Path to LCM SQLite database (preferred key; alias of dbPath, default: <OPENCLAW_STATE_DIR>/lcm.db)",
|
|
424
472
|
"type": "string"
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@martian-engineering/lossless-claw",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.4",
|
|
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",
|
|
@@ -44,10 +44,10 @@
|
|
|
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": "
|
|
50
|
-
"openclaw": "
|
|
47
|
+
"@mariozechner/pi-agent-core": ">=0.66 <1",
|
|
48
|
+
"@mariozechner/pi-ai": ">=0.66 <1",
|
|
49
|
+
"@mariozechner/pi-coding-agent": ">=0.66 <1",
|
|
50
|
+
"openclaw": ">=2026.2.17 <2026.6.0"
|
|
51
51
|
},
|
|
52
52
|
"peerDependenciesMeta": {
|
|
53
53
|
"@mariozechner/pi-agent-core": {
|
|
@@ -68,8 +68,11 @@
|
|
|
68
68
|
"./dist/index.js"
|
|
69
69
|
],
|
|
70
70
|
"compat": {
|
|
71
|
-
"pluginApi": ">=2026.2.17",
|
|
72
|
-
"minGatewayVersion": "2026.2.17"
|
|
71
|
+
"pluginApi": ">=2026.2.17 <2026.6.0",
|
|
72
|
+
"minGatewayVersion": "2026.2.17",
|
|
73
|
+
"tested": [
|
|
74
|
+
"2026.5.2"
|
|
75
|
+
]
|
|
73
76
|
},
|
|
74
77
|
"build": {
|
|
75
78
|
"openclawVersion": "2026.2.17"
|
|
@@ -235,6 +235,32 @@ Why it matters:
|
|
|
235
235
|
- `/lossless status` and `/lcm status` surface pending/running/last-failure maintenance state so operators can see when compaction is queued
|
|
236
236
|
- 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
237
|
|
|
238
|
+
### `autoRotateSessionFiles`
|
|
239
|
+
|
|
240
|
+
Automatically rotates oversized LCM-managed session JSONL files.
|
|
241
|
+
|
|
242
|
+
Defaults:
|
|
243
|
+
|
|
244
|
+
- `enabled: true`
|
|
245
|
+
- `sizeBytes: 2097152`
|
|
246
|
+
- `startup: "rotate"`
|
|
247
|
+
- `runtime: "rotate"`
|
|
248
|
+
|
|
249
|
+
Why it matters:
|
|
250
|
+
|
|
251
|
+
- prevents very large OpenClaw session JSONL files from choking fallback/gateway startup while LCM owns the durable context
|
|
252
|
+
- runtime rotation uses the same backup-backed safe path as `/lossless rotate` / `/lcm rotate`
|
|
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
|
|
254
|
+
- 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
|
+
- the preserved transcript tail follows the normal rotate behavior controlled by `freshTailCount`
|
|
256
|
+
|
|
257
|
+
Operational logging:
|
|
258
|
+
|
|
259
|
+
- every decision is logged with the prefix `[lcm] auto-rotate:`
|
|
260
|
+
- startup emits one compact `action=summary` line with `scanned`, `eligible`, `rotated`, `warned`, `skipped`, `durationMs`, and `bytesRemoved`
|
|
261
|
+
- rotate logs include `phase`, `action`, `sessionId`, `sessionKey`, `sessionFile`, `sizeBytes`, `thresholdBytes`, `durationMs`, `backupPath`, `bytesRemoved`, `preservedTailMessageCount`, and `checkpointSize`
|
|
262
|
+
- 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
|
|
263
|
+
|
|
238
264
|
## Compaction timing and shape
|
|
239
265
|
|
|
240
266
|
### `contextThreshold`
|