{
  "id": "lossless-claw",
  "kind": "context-engine",
  "skills": [
    "skills/lossless-claw"
  ],
  "uiHints": {
    "enabled": {
      "label": "Enabled",
      "help": "Enable or disable lossless-claw without uninstalling it"
    },
    "contextThreshold": {
      "label": "Context Threshold",
      "help": "Fraction of context window that triggers compaction (0.0–1.0)"
    },
    "incrementalMaxDepth": {
      "label": "Incremental Max Depth",
      "help": "How deep incremental compaction goes (0 = leaf only, -1 = unlimited)"
    },
    "freshTailCount": {
      "label": "Fresh Tail Count",
      "help": "Number of recent messages protected from compaction"
    },
    "freshTailMaxTokens": {
      "label": "Fresh Tail Max Tokens",
      "help": "Optional token cap for the protected fresh tail; the newest message is always preserved"
    },
    "promptAwareEviction": {
      "label": "Prompt-Aware Eviction",
      "help": "When enabled, budget-constrained assembly keeps older context by prompt relevance instead of pure chronology. This can improve recall under tight budgets, but it can also reduce provider prompt-cache hit rates because the preserved prefix changes as prompts change."
    },
    "leafChunkTokens": {
      "label": "Leaf Chunk Tokens",
      "help": "Maximum source tokens per leaf compaction chunk before summarization"
    },
    "bootstrapMaxTokens": {
      "label": "Bootstrap Max Tokens",
      "help": "Maximum raw parent-history tokens imported into a brand-new conversation bootstrap; oldest turns are dropped first"
    },
    "newSessionRetainDepth": {
      "label": "New Session Retain Depth",
      "help": "Context retained after /new (-1 keeps all context, 2 keeps d2+)"
    },
    "leafTargetTokens": {
      "label": "Leaf Target Tokens",
      "help": "Target token count for leaf summaries"
    },
    "condensedTargetTokens": {
      "label": "Condensed Target Tokens",
      "help": "Target token count for condensed summaries"
    },
    "maxExpandTokens": {
      "label": "Max Expand Tokens",
      "help": "Token cap for lcm_expand_query expansion calls"
    },
    "leafMinFanout": {
      "label": "Leaf Min Fanout",
      "help": "Minimum number of raw messages required before a leaf compaction pass runs"
    },
    "condensedMinFanout": {
      "label": "Condensed Min Fanout",
      "help": "Number of same-depth summaries required before condensation is attempted"
    },
    "condensedMinFanoutHard": {
      "label": "Condensed Min Fanout Hard",
      "help": "Hard floor for condensation grouping during maintenance and repair flows"
    },
    "dbPath": {
      "label": "Database Path",
      "help": "Path to LCM SQLite database (default: <OPENCLAW_STATE_DIR>/lcm.db; falls back to ~/.openclaw/lcm.db)"
    },
    "databasePath": {
      "label": "Database Path",
      "help": "Path to LCM SQLite database (preferred key; alias of dbPath, default: <OPENCLAW_STATE_DIR>/lcm.db)"
    },
    "largeFilesDir": {
      "label": "Large Files Directory",
      "help": "Directory for persisting large-file text payloads (default: <stateDir>/lcm-files). Uses OPENCLAW_STATE_DIR when set."
    },
    "largeFilesDir": {
      "label": "Large Files Directory",
      "help": "Directory for externalized large files and inline-image payloads (default: ~/.openclaw/lcm-files)"
    },
    "ignoreSessionPatterns": {
      "label": "Ignored Sessions",
      "help": "Glob patterns for session keys to exclude from LCM storage"
    },
    "statelessSessionPatterns": {
      "label": "Stateless Sessions",
      "help": "Glob patterns for session keys that can read from LCM but never write to it"
    },
    "skipStatelessSessions": {
      "label": "Skip Stateless Sessions",
      "help": "When enabled, matching stateless session keys skip LCM persistence and grant writes"
    },
    "largeFileThresholdTokens": {
      "label": "Large File Threshold Tokens",
      "help": "Token threshold that routes text attachments into large-file summarization"
    },
    "largeFileTokenThreshold": {
      "label": "Large File Threshold Tokens",
      "help": "Legacy alias of largeFileThresholdTokens"
    },
    "summaryModel": {
      "label": "Summary Model",
      "help": "Model override for LCM summarization (e.g., 'gpt-5.4' to reuse the session provider, or 'openai-resp/gpt-5.4' for a full cross-provider ref)"
    },
    "summaryProvider": {
      "label": "Summary Provider",
      "help": "Provider override used only when summaryModel is a bare model name (e.g., 'openai-resp')"
    },
    "largeFileSummaryModel": {
      "label": "Large File Summary Model",
      "help": "Model override for large-file summarization"
    },
    "largeFileSummaryProvider": {
      "label": "Large File Summary Provider",
      "help": "Provider override for large-file summarization"
    },
    "expansionModel": {
      "label": "Expansion Model",
      "help": "Model override for lcm_expand_query sub-agent (e.g., 'anthropic/claude-haiku-4-5')"
    },
    "expansionProvider": {
      "label": "Expansion Provider",
      "help": "Provider override for lcm_expand_query sub-agent (e.g., 'anthropic')"
    },
    "delegationTimeoutMs": {
      "label": "Delegation Timeout (ms)",
      "help": "Maximum time to wait for delegated lcm_expand_query sub-agent completion before timing out"
    },
    "summaryTimeoutMs": {
      "label": "Summary Timeout (ms)",
      "help": "Maximum time to wait for a single model-backed LCM summarizer call before timing out"
    },
    "maxAssemblyTokenBudget": {
      "label": "Max Assembly Token Budget",
      "help": "Hard ceiling for assembly token budget — caps runtime-provided and fallback budgets. Set for smaller context-window models (e.g., 30000 for 32k models)"
    },
    "summaryMaxOverageFactor": {
      "label": "Summary Max Overage Factor",
      "help": "Maximum allowed overage factor for summaries relative to target tokens (default 3). Summaries exceeding this are deterministically truncated."
    },
    "customInstructions": {
      "label": "Custom Instructions",
      "help": "Natural language instructions injected into all summarization prompts (e.g., formatting rules, tone control)"
    },
    "circuitBreakerThreshold": {
      "label": "Circuit Breaker Threshold",
      "help": "Consecutive auth failures before the summarization circuit breaker trips"
    },
    "circuitBreakerCooldownMs": {
      "label": "Circuit Breaker Cooldown (ms)",
      "help": "Cooldown before the summarization circuit breaker auto-resets"
    },
    "cacheAwareCompaction.enabled": {
      "label": "Cache-Aware Compaction",
      "help": "When enabled, hot prompt cache defers incremental compaction while cold cache allows bounded catch-up passes"
    },
    "cacheAwareCompaction.cacheTTLSeconds": {
      "label": "Short Cache TTL (seconds)",
      "help": "Treat short-lived prompt-cache entries as hot for this many seconds before deferred compaction may rewrite the prompt"
    },
    "cacheAwareCompaction.maxColdCacheCatchupPasses": {
      "label": "Cold Cache Catch-Up Passes",
      "help": "Maximum incremental leaf passes allowed in one maintenance cycle when prompt cache is cold"
    },
    "cacheAwareCompaction.hotCachePressureFactor": {
      "label": "Hot Cache Pressure Factor",
      "help": "Multiplier applied to the hot-cache leaf trigger before raw-history pressure overrides cache preservation"
    },
    "cacheAwareCompaction.hotCacheBudgetHeadroomRatio": {
      "label": "Hot Cache Budget Headroom",
      "help": "Fraction of the real token budget that must remain free before hot-cache incremental compaction is skipped entirely"
    },
    "cacheAwareCompaction.coldCacheObservationThreshold": {
      "label": "Cold Cache Observation Threshold",
      "help": "Consecutive cold observations required before non-explicit cache misses are treated as truly cold"
    },
    "dynamicLeafChunkTokens.enabled": {
      "label": "Dynamic Leaf Chunk Tokens",
      "help": "When enabled, incremental compaction uses a larger working leaf chunk in busy sessions and keeps the static floor in quieter sessions"
    },
    "dynamicLeafChunkTokens.max": {
      "label": "Dynamic Leaf Chunk Max",
      "help": "Maximum working leaf chunk target for dynamic incremental compaction. The static leafChunkTokens value remains the floor."
    },
    "timezone": {
      "label": "Timezone",
      "help": "IANA timezone used for summary timestamps"
    },
    "pruneHeartbeatOk": {
      "label": "Prune HEARTBEAT_OK",
      "help": "Retroactively delete HEARTBEAT_OK turn cycles from LCM storage"
    },
    "transcriptGcEnabled": {
      "label": "Transcript GC",
      "help": "Enable transcript rewrite GC during maintain(); disabled by default"
    },
    "proactiveThresholdCompactionMode": {
      "label": "Proactive Threshold Compaction Mode",
      "help": "Choose deferred compaction debt by default or keep legacy inline proactive compaction"
    },
    "fallbackProviders": {
      "label": "Fallback Providers",
      "help": "Explicit fallback provider/model pairs for compaction summarization (e.g., [{\"provider\": \"anthropic\", \"model\": \"claude-haiku-4-5\"}])"
    }
  },
  "configSchema": {
    "type": "object",
    "additionalProperties": false,
    "properties": {
      "enabled": {
        "type": "boolean"
      },
      "contextThreshold": {
        "type": "number",
        "minimum": 0,
        "maximum": 1
      },
      "incrementalMaxDepth": {
        "type": "integer",
        "minimum": -1
      },
      "freshTailCount": {
        "type": "integer",
        "minimum": 1
      },
      "freshTailMaxTokens": {
        "type": "integer",
        "minimum": 0
      },
      "promptAwareEviction": {
        "type": "boolean"
      },
      "leafChunkTokens": {
        "type": "integer",
        "minimum": 1
      },
      "bootstrapMaxTokens": {
        "type": "integer",
        "minimum": 1
      },
      "newSessionRetainDepth": {
        "type": "integer",
        "minimum": -1
      },
      "leafTargetTokens": {
        "type": "integer",
        "minimum": 1
      },
      "condensedTargetTokens": {
        "type": "integer",
        "minimum": 1
      },
      "maxExpandTokens": {
        "type": "integer",
        "minimum": 1
      },
      "leafMinFanout": {
        "type": "integer",
        "minimum": 2
      },
      "condensedMinFanout": {
        "type": "integer",
        "minimum": 2
      },
      "condensedMinFanoutHard": {
        "type": "integer",
        "minimum": 2
      },
      "dbPath": {
        "type": "string"
      },
      "largeFilesDir": {
        "type": "string"
      },
      "ignoreSessionPatterns": {
        "type": "array",
        "items": {
          "type": "string"
        }
      },
      "statelessSessionPatterns": {
        "type": "array",
        "items": {
          "type": "string"
        }
      },
      "skipStatelessSessions": {
        "type": "boolean"
      },
      "largeFileThresholdTokens": {
        "type": "integer",
        "minimum": 1000
      },
      "largeFileTokenThreshold": {
        "type": "integer",
        "minimum": 1000
      },
      "summaryModel": {
        "type": "string"
      },
      "summaryProvider": {
        "type": "string"
      },
      "largeFileSummaryModel": {
        "type": "string"
      },
      "largeFileSummaryProvider": {
        "type": "string"
      },
      "expansionModel": {
        "type": "string"
      },
      "expansionProvider": {
        "type": "string"
      },
      "delegationTimeoutMs": {
        "type": "integer",
        "minimum": 1
      },
      "summaryTimeoutMs": {
        "type": "integer",
        "minimum": 1
      },
      "maxAssemblyTokenBudget": {
        "type": "integer",
        "minimum": 1000
      },
      "summaryMaxOverageFactor": {
        "type": "number",
        "minimum": 1
      },
      "customInstructions": {
        "type": "string"
      },
      "circuitBreakerThreshold": {
        "type": "integer",
        "minimum": 1
      },
      "circuitBreakerCooldownMs": {
        "type": "integer",
        "minimum": 1
      },
      "cacheAwareCompaction": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "enabled": {
            "type": "boolean"
          },
          "cacheTTLSeconds": {
            "type": "integer",
            "minimum": 1
          },
          "maxColdCacheCatchupPasses": {
            "type": "integer",
            "minimum": 1
          },
          "hotCachePressureFactor": {
            "type": "number",
            "minimum": 1
          },
          "hotCacheBudgetHeadroomRatio": {
            "type": "number",
            "minimum": 0,
            "maximum": 0.95
          },
          "coldCacheObservationThreshold": {
            "type": "integer",
            "minimum": 1
          }
        }
      },
      "dynamicLeafChunkTokens": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "enabled": {
            "type": "boolean"
          },
          "max": {
            "type": "integer",
            "minimum": 1
          }
        }
      },
      "timezone": {
        "type": "string"
      },
      "pruneHeartbeatOk": {
        "type": "boolean"
      },
      "transcriptGcEnabled": {
        "type": "boolean"
      },
      "proactiveThresholdCompactionMode": {
        "type": "string",
        "enum": [
          "deferred",
          "inline"
        ]
      },
      "databasePath": {
        "description": "Path to LCM SQLite database (preferred key; alias of dbPath, default: <OPENCLAW_STATE_DIR>/lcm.db)",
        "type": "string"
      },
      "largeFilesDir": {
        "description": "Directory for persisting large-file text payloads (default: <OPENCLAW_STATE_DIR>/lcm-files)",
        "type": "string"
      },
      "fallbackProviders": {
        "type": "array",
        "items": {
          "type": "object",
          "properties": {
            "provider": { "type": "string" },
            "model": { "type": "string" }
          },
          "required": ["provider", "model"],
          "additionalProperties": false
        }
      }
    }
  }
}
