@martian-engineering/lossless-claw 0.7.0 → 0.8.1

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.
Files changed (54) hide show
  1. package/README.md +19 -3
  2. package/dist/index.js +19240 -0
  3. package/docs/agent-tools.md +9 -4
  4. package/docs/configuration.md +24 -5
  5. package/openclaw.plugin.json +27 -3
  6. package/package.json +7 -6
  7. package/skills/lossless-claw/SKILL.md +3 -2
  8. package/skills/lossless-claw/references/architecture.md +12 -0
  9. package/skills/lossless-claw/references/config.md +37 -0
  10. package/skills/lossless-claw/references/diagnostics.md +13 -0
  11. package/index.ts +0 -2
  12. package/src/assembler.ts +0 -1188
  13. package/src/compaction.ts +0 -1756
  14. package/src/db/config.ts +0 -345
  15. package/src/db/connection.ts +0 -141
  16. package/src/db/features.ts +0 -42
  17. package/src/db/migration.ts +0 -746
  18. package/src/engine.ts +0 -4306
  19. package/src/expansion-auth.ts +0 -365
  20. package/src/expansion-policy.ts +0 -303
  21. package/src/expansion.ts +0 -383
  22. package/src/integrity.ts +0 -600
  23. package/src/large-files.ts +0 -546
  24. package/src/lcm-log.ts +0 -37
  25. package/src/openclaw-bridge.ts +0 -22
  26. package/src/plugin/index.ts +0 -1960
  27. package/src/plugin/lcm-command.ts +0 -765
  28. package/src/plugin/lcm-doctor-apply.ts +0 -542
  29. package/src/plugin/lcm-doctor-shared.ts +0 -210
  30. package/src/plugin/shared-init.ts +0 -59
  31. package/src/prune.ts +0 -391
  32. package/src/retrieval.ts +0 -363
  33. package/src/session-patterns.ts +0 -23
  34. package/src/startup-banner-log.ts +0 -49
  35. package/src/store/compaction-telemetry-store.ts +0 -156
  36. package/src/store/conversation-store.ts +0 -929
  37. package/src/store/fts5-sanitize.ts +0 -50
  38. package/src/store/full-text-fallback.ts +0 -83
  39. package/src/store/full-text-sort.ts +0 -21
  40. package/src/store/index.ts +0 -39
  41. package/src/store/parse-utc-timestamp.ts +0 -25
  42. package/src/store/summary-store.ts +0 -1519
  43. package/src/summarize.ts +0 -1511
  44. package/src/tools/common.ts +0 -53
  45. package/src/tools/lcm-conversation-scope.ts +0 -127
  46. package/src/tools/lcm-describe-tool.ts +0 -245
  47. package/src/tools/lcm-expand-query-tool.ts +0 -831
  48. package/src/tools/lcm-expand-tool.delegation.ts +0 -580
  49. package/src/tools/lcm-expand-tool.ts +0 -453
  50. package/src/tools/lcm-expansion-recursion-guard.ts +0 -373
  51. package/src/tools/lcm-grep-tool.ts +0 -228
  52. package/src/transaction-mutex.ts +0 -136
  53. package/src/transcript-repair.ts +0 -301
  54. package/src/types.ts +0 -165
package/README.md CHANGED
@@ -34,12 +34,14 @@ The plugin now ships a bundled `lossless-claw` skill plus a small plugin command
34
34
 
35
35
  - `/lcm` shows version, enablement/selection state, DB path and size, summary counts, and summary-health status
36
36
  - `/lcm doctor` scans for broken or truncated summaries
37
+ - `/lcm doctor clean` shows read-only high-confidence junk diagnostics for archived subagents, cron sessions, and NULL-key orphaned subagent runs
37
38
  - `/lossless` is an alias for `/lcm` on supported native command surfaces
38
39
 
39
40
  These are plugin slash/native commands, not root shell CLI subcommands. Supported examples:
40
41
 
41
42
  - `/lcm`
42
43
  - `/lcm doctor`
44
+ - `/lcm doctor clean`
43
45
  - `/lossless`
44
46
 
45
47
  Not currently supported as root CLI commands:
@@ -125,8 +127,9 @@ Add a `lossless-claw` entry under `plugins.entries` in your OpenClaw config:
125
127
  "ignoreSessionPatterns": [
126
128
  "agent:*:cron:**"
127
129
  ],
128
- "summaryModel": "anthropic/claude-haiku-4-5",
129
- "expansionModel": "anthropic/claude-haiku-4-5",
130
+ "transcriptGcEnabled": false,
131
+ "summaryModel": "openai/gpt-5.4-mini",
132
+ "expansionModel": "openai/gpt-5.4-mini",
130
133
  "delegationTimeoutMs": 300000,
131
134
  "summaryTimeoutMs": 60000
132
135
  }
@@ -164,16 +167,21 @@ Add a `lossless-claw` entry under `plugins.entries` in your OpenClaw config:
164
167
  | `LCM_SUMMARY_MODEL` | `""` | Model override for compaction summarization; falls back to OpenClaw's default model when unset |
165
168
  | `LCM_SUMMARY_PROVIDER` | `""` | Provider override for compaction summarization; falls back to `OPENCLAW_PROVIDER` or the provider embedded in the model ref |
166
169
  | `LCM_SUMMARY_BASE_URL` | *(from OpenClaw / provider default)* | Base URL override for summarization API calls |
167
- | `LCM_EXPANSION_MODEL` | *(from OpenClaw)* | Model override for `lcm_expand_query` sub-agent (e.g. `anthropic/claude-haiku-4-5`) |
170
+ | `LCM_EXPANSION_MODEL` | *(from OpenClaw)* | Model override for `lcm_expand_query` sub-agent (e.g. `openai/gpt-5.4-mini`) |
168
171
  | `LCM_EXPANSION_PROVIDER` | *(from OpenClaw)* | Provider override for `lcm_expand_query` sub-agent |
169
172
  | `LCM_DELEGATION_TIMEOUT_MS` | `120000` | Max time to wait for delegated `lcm_expand_query` sub-agent completion |
170
173
  | `LCM_SUMMARY_TIMEOUT_MS` | `60000` | Max time to wait for a single model-backed LCM summarizer call |
171
174
  | `LCM_PRUNE_HEARTBEAT_OK` | `false` | Retroactively delete `HEARTBEAT_OK` turn cycles from LCM storage |
175
+ | `LCM_TRANSCRIPT_GC_ENABLED` | `false` | Enable transcript rewrite GC during `maintain()` |
176
+
177
+ Transcript GC rewrites are disabled by default. Set `transcriptGcEnabled` or `LCM_TRANSCRIPT_GC_ENABLED` to turn them on explicitly.
172
178
 
173
179
  ### Expansion model override requirements
174
180
 
175
181
  If you want `lcm_expand_query` to run on a dedicated model via `expansionModel` or `LCM_EXPANSION_MODEL`, OpenClaw must explicitly trust the plugin to request sub-agent model overrides.
176
182
 
183
+ For most setups, `openai/gpt-5.4-mini` is a better starting point than Anthropic Haiku because it is cheap, fast, and does not depend on Anthropic quota remaining.
184
+
177
185
  Add a `subagent` policy under `plugins.entries.lossless-claw` and allowlist the canonical `provider/model` target you want the plugin to use:
178
186
 
179
187
  ```json
@@ -208,6 +216,7 @@ Plugin config equivalents:
208
216
  - `ignoreSessionPatterns`
209
217
  - `statelessSessionPatterns`
210
218
  - `skipStatelessSessions`
219
+ - `transcriptGcEnabled`
211
220
  - `newSessionRetainDepth`
212
221
  - `summaryModel`
213
222
  - `summaryProvider`
@@ -227,6 +236,8 @@ For compaction summarization, lossless-claw resolves the model in this order:
227
236
 
228
237
  If `summaryModel` already includes a provider prefix such as `anthropic/claude-sonnet-4-20250514`, `summaryProvider` is ignored for that choice. Otherwise, the provider falls back to the matching override, then `OPENCLAW_PROVIDER`, then the provider inferred by the caller.
229
238
 
239
+ Runtime-managed OAuth providers are supported here too. In particular, `openai-codex` and `github-copilot` auth profiles can be used for summary and expansion calls without a separate API key.
240
+
230
241
  ### Recommended starting configuration
231
242
 
232
243
  ```
@@ -234,6 +245,8 @@ LCM_FRESH_TAIL_COUNT=64
234
245
  LCM_LEAF_CHUNK_TOKENS=20000
235
246
  LCM_INCREMENTAL_MAX_DEPTH=1
236
247
  LCM_CONTEXT_THRESHOLD=0.75
248
+ LCM_SUMMARY_MODEL=openai/gpt-5.4-mini
249
+ LCM_EXPANSION_MODEL=openai/gpt-5.4-mini
237
250
  ```
238
251
 
239
252
  - **freshTailCount=64** protects the last 64 messages from compaction, giving the model more recent context for continuity.
@@ -392,6 +405,9 @@ For most long-lived LCM setups, a good starting point is:
392
405
  ## Development
393
406
 
394
407
  ```bash
408
+ # Build (bundles TypeScript to dist/index.js)
409
+ npm run build
410
+
395
411
  # Run tests
396
412
  npx vitest
397
413