Lossless Claw — LCM (Lossless Context Management) plugin for OpenClaw
This report summarizes scanner evidence for Martian-Engineering/lossless-claw, a TypeScript project with 4,903 GitHub stars. SynthScan examined 167,930 lines of code across 348 source files, recording 680 pattern matches distributed across 9 syntactic categories. The legacy adjusted pattern signal is 5.9 (Moderate pattern signal); it is not an authorship estimate.
Use the findings to ask whether maintainers can explain intent, verify dependencies, simplify unnecessary scaffolding, and focus review effort. Risk Payload v1 adds ownership, supply-chain, over-engineering, and review-effort vectors when available. These are prompts for human verification, not probabilities, security findings, or measured maintenance costs.
Use each vector to guide manual verification of the underlying findings.
Can maintainers explain intent, assumptions, and trade-offs? 540 finding(s).
Are imports declared and package/API names verified? 5 finding(s).
Are wrappers, guards, and repeated structures necessary? 643 finding(s).
Which changes need focused human review? 680 finding(s).
This chart tracks the legacy adjusted pattern score across scan runs. Changes can reflect source changes, scan coverage, or detector/scoring versions; they do not measure AI adoption or prove that a team refactored code. Compare runs only when their scoring versions are compatible. The dashed line tracks the raw pattern-hit count.
Groups findings by configured severity weight. Severity is not a confidence estimate, security rating, or proof that a package is missing. Verify imports against the project's manifests and inspect each finding in its local design context.
This horizontal bar chart shows where configured pattern scores accumulate across directories. Treat the bars as locations to inspect, not as evidence of authorship or code quality. Use the file-level findings to decide whether a directory needs a focused ownership, dependency, complexity, or review check.
The scanner identified 680 distinct pattern matches across 9 syntactic categories. Each entry below represents a discrete location in the source code where the engine recorded a detector match to inspect in context. Expand any category row to inspect the individual file paths, line numbers, code snippets, and the lexical context (CODE, COMMENT, or STRING) in which each match was detected.
Reading the findings table: The Severity column indicates the configured finding weight (CRITICAL / HIGH / MEDIUM / LOW). The Context column identifies whether the match occurred inside executable code, an inline comment, or a string literal — legacy comment-context matches receive a ×1.5 score weight. The ⚡ bolt icon marks clustered matches: three or more patterns within a 10-line window, each receiving an additional ×1.5 density multiplier under the legacy scoring model.
| Severity | File | Line | Snippet | Context |
|---|---|---|---|---|
| LOW⚡ | doctor-contract-api.d.ts | 21 | export function normalizeCompatibilityConfig(params: { cfg: unknown }): { | CODE |
| LOW⚡ | doctor-contract-api.d.ts | 26 | export function collectLosslessRuntimeLlmModelRefs(cfg: unknown): { | CODE |
| LOW⚡ | doctor-contract-api.d.ts | 31 | export function collectLosslessSubagentModelRefs(cfg: unknown): { | CODE |
| LOW | doctor-contract-api.js | 47 | function toProviderPrefixedModelRef(provider, model) { | CODE |
| LOW | doctor-contract-api.js | 81 | function collectLosslessRuntimeLlmModelRefs(cfg) { | CODE |
| LOW | doctor-contract-api.js | 155 | function collectLosslessSubagentModelRefs(cfg) { | CODE |
| LOW | doctor-contract-api.js | 188 | function collectMissingPolicyEntries(cfg) { | CODE |
| LOW | doctor-contract-api.js | 203 | function collectMissingSubagentPolicyEntries(cfg) { | CODE |
| LOW | doctor-contract-api.js | 268 | function cloneRootWithLosslessEntry(cfg) { | CODE |
| LOW | doctor-contract-api.js | 287 | function applyModelOverridePolicyRepair({ policy, issues, changes, policyPath, subject }) { | CODE |
| LOW | doctor-contract-api.js | 321 | export function normalizeCompatibilityConfig({ cfg }) { | CODE |
| LOW | test/manifest.test.ts | 63 | function extractRegisterToolFactoryCallSites(): RegisterToolFactoryCallSite[] { | CODE |
| LOW | test/helpers.ts | 131 | export function withProductionTranscriptRouting(deps: LcmDependencies): LcmDependencies { | CODE |
| LOW | test/helpers.ts | 289 | export function createEngineWithDepsOverrides(overrides: Partial<LcmDependencies>): LcmContextEngine { | CODE |
| LOW | test/helpers.ts | 303 | export function createEngineWithDepsOverridesAndDb( | CODE |
| LOW | test/helpers.ts | 323 | export function createEngineAtDatabasePath(databasePath: string): LcmContextEngine { | CODE |
| LOW | test/helpers.ts | 355 | export function writeLeafTranscriptMessages(sessionFile: string, messages: AgentMessage[]): void { | CODE |
| LOW | test/helpers.ts | 474 | export function corruptSessionFilePreservingObservedStats(sessionFile: string): void { | CODE |
| LOW | test/helpers.ts | 481 | export function estimateAssembledPayloadTokens(messages: AgentMessage[]): number { | CODE |
| LOW | test/helpers.ts | 496 | export async function ingestAndReadStoredContent(params: { | CODE |
| LOW | test/transcript-delta-engine.test.ts | 493 | async function legacyConversationFromMessages( | CODE |
| LOW | test/circuit-breaker.test.ts | 145 | function makeCircuitBreakerMessages(count: number): AgentMessage[] { | CODE |
| LOW | test/migration.test.ts | 29 | function legacyRawMessageIdentityHash(role: string, content: string): string { | CODE |
| LOW | test/migration.test.ts | 37 | function openClawInboundMetadataContent(params: { | CODE |
| LOW | test/migration.test.ts | 63 | function legacyCanonicalOpenClawIdentityContentWithRecap(params: { | CODE |
| LOW | test/engine-compaction.test.ts | 44 | function projectContextEngineHostParams( | CODE |
| LOW | test/live-turn-structural-supersede.test.ts | 608 | function decoratedMemoryFirstMetadataFace(body: string): string { | CODE |
| LOW | test/message-identity.test.ts | 332 | function openClawInboundMetadataContent(params: { | CODE |
| LOW | test/prune.test.ts | 103 | async function seedConversationWithSummary( | CODE |
| LOW | test/bounded-assemble.test.ts | 86 | function makeHeavyToolResultMessage(index: number, payloadChars: number): AgentMessage { | CODE |
| LOW | test/same-turn-body-collapse.test.ts | 26 | function metadataWrappedWithHistory( | CODE |
| LOW | test/same-turn-body-collapse.test.ts | 73 | function metadataWrappedWithContextAndRecap(recap: string, body: string): string { | CODE |
| LOW | test/same-turn-body-collapse.test.ts | 86 | function metadataWrappedWithReplyContext(replyBody: string, body: string): string { | CODE |
| LOW | test/same-turn-body-collapse.test.ts | 356 | function metadataWrappedWithLineRecap(recap: string, body: string): string { | CODE |
| LOW | test/same-turn-body-collapse.test.ts | 527 | function metadataWrappedWithHeaderLineRecap( | CODE |
| LOW | test/doctor-archive-cause-skip.test.ts | 51 | async function seedConversationWithMessage( | CODE |
| LOW | test/plugin-config-registration.test.ts | 170 | function compactionAndDefaultModelConfig(params: { | CODE |
| LOW | test/integration-helpers.ts | 24 | export function createMockConversationStore() { | CODE |
| LOW | test/lcm-command.test.ts | 77 | function writeOpenClawInstallRecord(params: { | CODE |
| LOW | test/lcm-command.test.ts | 109 | async function createRolloverConversationData( | CODE |
| LOW | test/message-signatures.test.ts | 146 | function openClawInboundMetadataContent(messageId: string, text: string): string { | CODE |
| LOW | specs/depth-aware-prompts-and-rewrite.md | 62 | function buildCondensedSummaryPrompt(params: { | CODE |
| LOW | scripts/e2e/pending-summary-compaction-proof.ts | 67 | export async function runPendingSummaryStaleRecoveryProof(): Promise<PendingSummaryStaleRecoveryProofReport> { | CODE |
| LOW | scripts/e2e/pending-summary-compaction-proof.ts | 194 | export async function runPendingSummaryCompactionProof(): Promise<PendingSummaryCompactionProofReport> { | CODE |
| LOW | src/expansion-policy.ts | 95 | export function detectBroadTimeRangeIndicator(query?: string): boolean { | CODE |
| LOW | src/expansion-policy.ts | 192 | export function classifyExpansionTokenRisk(input: { estimatedTokens: number; tokenCap: number }): { | CODE |
| LOW | src/expansion-policy.ts | 217 | export function decideLcmExpansionRouting( | CODE |
| LOW | src/transcript-delta-sync.ts | 232 | function isTranscriptReadFenceError(error: unknown): boolean { | CODE |
| LOW | src/lcm-log.ts | 73 | function readRuntimeConfigCandidates(api: OpenClawPluginApi): Record<string, unknown>[] { | CODE |
| LOW | src/lcm-log.ts | 88 | function readOpenClawRedactionConfig(api: OpenClawPluginApi): IndependentLogRedactionConfig { | CODE |
| LOW | src/lcm-log.ts | 102 | function shouldWriteIndependentDebug(api: OpenClawPluginApi): boolean { | CODE |
| LOW | src/transaction-mutex.ts | 30 | function getOrCreateMutex(db: DatabaseSync): MutexState { | CODE |
| LOW | src/transaction-mutex.ts | 104 | export async function acquireTransactionLockWithTimeout( | CODE |
| LOW | src/lcm-file-log.ts | 71 | function resolvePreferredOpenClawTmpDir(): string { | CODE |
| LOW | src/lcm-file-log.ts | 109 | function isTrustedExistingOpenClawTmpDir(stat: fs.Stats, uid: number | "user"): boolean { | CODE |
| LOW | src/lcm-file-log.ts | 143 | function getCurrentRegularLogFileBytes(file: string): number | undefined { | CODE |
| LOW | src/lcm-file-log.ts | 223 | function fallbackRedactSensitiveText( | CODE |
| LOW | src/lcm-file-log.ts | 286 | export function createIndependentLcmFileLogger( | CODE |
| LOW | src/batch-dedup.ts | 610 | function storedMessageIdentityHash(stored: StoredMessage): string { | CODE |
| LOW | src/batch-dedup.ts | 625 | function extractExternalizedReferences(content: string): ExternalizedReference[] { | CODE |
| 448 more matches not shown… | ||||
| Severity | File | Line | Snippet | Context |
|---|---|---|---|---|
| MEDIUM | test/expansion-auth.test.ts | 55 | // ── createGrant ────────────────────────────────────────────────────────── | COMMENT |
| MEDIUM | test/expansion-auth.test.ts | 102 | // ── getGrant ───────────────────────────────────────────────────────────── | COMMENT |
| MEDIUM | test/expansion-auth.test.ts | 146 | // ── revokeGrant ────────────────────────────────────────────────────────── | COMMENT |
| MEDIUM | test/expansion-auth.test.ts | 171 | // ── validateExpansion ──────────────────────────────────────────────────── | COMMENT |
| MEDIUM | test/expansion-auth.test.ts | 342 | // ── cleanup ────────────────────────────────────────────────────────────── | COMMENT |
| MEDIUM | test/expansion-auth.test.ts | 782 | // ── describeAndExpand ────────────────────────────────────────────────── | COMMENT |
| MEDIUM | test/lcm-integration-retrieval.test.ts | 459 | // ═════════════════════════════════════════════════════════════════════════════ | COMMENT |
| MEDIUM | test/lcm-integration-retrieval.test.ts | 461 | // ═════════════════════════════════════════════════════════════════════════════ | COMMENT |
| MEDIUM | test/assembler-empty-content.test.ts | 19 | // ═══════════════════════════════════════════════════════════════════════════════ | COMMENT |
| MEDIUM | test/assembler-empty-content.test.ts | 21 | // ═══════════════════════════════════════════════════════════════════════════════ | COMMENT |
| MEDIUM | test/assembler-empty-content.test.ts | 65 | // ═══════════════════════════════════════════════════════════════════════════════ | COMMENT |
| MEDIUM | test/assembler-empty-content.test.ts | 67 | // ═══════════════════════════════════════════════════════════════════════════════ | COMMENT |
| MEDIUM | test/assembler-empty-content.test.ts | 110 | // ═══════════════════════════════════════════════════════════════════════════════ | COMMENT |
| MEDIUM | test/assembler-empty-content.test.ts | 112 | // ═══════════════════════════════════════════════════════════════════════════════ | COMMENT |
| MEDIUM | test/assembler-empty-content.test.ts | 166 | // ═══════════════════════════════════════════════════════════════════════════════ | COMMENT |
| MEDIUM | test/assembler-empty-content.test.ts | 168 | // ═══════════════════════════════════════════════════════════════════════════════ | COMMENT |
| MEDIUM | test/assembler-blocks.test.ts | 33 | // ═══════════════════════════════════════════════════════════════════════════════ | COMMENT |
| MEDIUM | test/assembler-blocks.test.ts | 35 | // ═══════════════════════════════════════════════════════════════════════════════ | COMMENT |
| MEDIUM | test/assembler-blocks.test.ts | 183 | // ═══════════════════════════════════════════════════════════════════════════════ | COMMENT |
| MEDIUM | test/assembler-blocks.test.ts | 185 | // ═══════════════════════════════════════════════════════════════════════════════ | COMMENT |
| MEDIUM | test/assembler-blocks.test.ts | 279 | // ═══════════════════════════════════════════════════════════════════════════════ | COMMENT |
| MEDIUM | test/assembler-blocks.test.ts | 281 | // ═══════════════════════════════════════════════════════════════════════════════ | COMMENT |
| MEDIUM | test/assembler-blocks.test.ts | 596 | // ─── Regression: #158 — tool call id backfill from metadata.raw ────────── | COMMENT |
| MEDIUM | test/assembler-blocks.test.ts | 596 | // ─── Regression: #158 — tool call id backfill from metadata.raw ────────── | COMMENT |
| MEDIUM | test/assembler-blocks.test.ts | 716 | // ═══════════════════════════════════════════════════════════════════════════════ | COMMENT |
| MEDIUM | test/assembler-blocks.test.ts | 718 | // ═══════════════════════════════════════════════════════════════════════════════ | COMMENT |
| MEDIUM | test/assembler-blocks.test.ts | 864 | // ═══════════════════════════════════════════════════════════════════════════════ | COMMENT |
| MEDIUM | test/assembler-blocks.test.ts | 866 | // ═══════════════════════════════════════════════════════════════════════════════ | COMMENT |
| MEDIUM | test/assembler-blocks.test.ts | 890 | // ═══════════════════════════════════════════════════════════════════════════════ | COMMENT |
| MEDIUM | test/assembler-blocks.test.ts | 892 | // ═══════════════════════════════════════════════════════════════════════════════ | COMMENT |
| MEDIUM | test/engine-compaction.test.ts | 469 | // ── Compact token budget plumbing ─────────────────────────────────────────── | COMMENT |
| MEDIUM | test/lcm-integration-compaction.test.ts | 2426 | // ═════════════════════════════════════════════════════════════════════════════ | COMMENT |
| MEDIUM | test/lcm-integration-compaction.test.ts | 2428 | // ═════════════════════════════════════════════════════════════════════════════ | COMMENT |
| MEDIUM | test/lcm-integration-assemble.test.ts | 626 | // ═════════════════════════════════════════════════════════════════════════════ | COMMENT |
| MEDIUM | test/lcm-integration-assemble.test.ts | 628 | // ═════════════════════════════════════════════════════════════════════════════ | COMMENT |
| MEDIUM | test/lcm-integration-roundtrip.test.ts | 252 | // ═════════════════════════════════════════════════════════════════════════════ | COMMENT |
| MEDIUM | test/lcm-integration-roundtrip.test.ts | 254 | // ═════════════════════════════════════════════════════════════════════════════ | COMMENT |
| MEDIUM | test/lcm-integration-roundtrip.test.ts | 456 | // ═════════════════════════════════════════════════════════════════════════════ | COMMENT |
| MEDIUM | test/lcm-integration-roundtrip.test.ts | 458 | // ═════════════════════════════════════════════════════════════════════════════ | COMMENT |
| MEDIUM | test/lcm-integration-roundtrip.test.ts | 656 | // ═════════════════════════════════════════════════════════════════════════════ | COMMENT |
| MEDIUM | test/lcm-integration-roundtrip.test.ts | 658 | // ═════════════════════════════════════════════════════════════════════════════ | COMMENT |
| MEDIUM | test/lcm-integration-sweep-bounds.test.ts | 252 | // ═════════════════════════════════════════════════════════════════════════════ | COMMENT |
| MEDIUM | test/lcm-integration-sweep-bounds.test.ts | 254 | // ═════════════════════════════════════════════════════════════════════════════ | COMMENT |
| MEDIUM | test/lcm-integration-sweep-bounds.test.ts | 488 | // ═════════════════════════════════════════════════════════════════════════════ | COMMENT |
| MEDIUM | test/lcm-integration-sweep-bounds.test.ts | 490 | // ═════════════════════════════════════════════════════════════════════════════ | COMMENT |
| MEDIUM | test/engine-assemble.test.ts | 2828 | // ── #639 Mode 2 — deferred-compaction wedge regression ──────────────────────── | COMMENT |
| MEDIUM | test/engine-assemble.test.ts | 2828 | // ── #639 Mode 2 — deferred-compaction wedge regression ──────────────────────── | COMMENT |
| MEDIUM | test/integration-helpers.ts | 22 | // ── Mock Store Factories ───────────────────────────────────────────────────── | COMMENT |
| MEDIUM | test/integration-helpers.ts | 224 | // ── Context items ─────────────────────────────────────────────────── | COMMENT |
| MEDIUM | test/integration-helpers.ts | 367 | // ── Summary CRUD ──────────────────────────────────────────────────── | COMMENT |
| MEDIUM | test/integration-helpers.ts | 416 | // ── Lineage ───────────────────────────────────────────────────────── | COMMENT |
| MEDIUM | test/integration-helpers.ts | 522 | // ── Search ────────────────────────────────────────────────────────── | COMMENT |
| MEDIUM | test/integration-helpers.ts | 560 | // ── Large files ───────────────────────────────────────────────────── | COMMENT |
| MEDIUM | test/integration-helpers.ts | 588 | // ── Internal helpers for the mock ──────────────────────────────────── | COMMENT |
| MEDIUM | test/integration-helpers.ts | 604 | // ── Helpers ────────────────────────────────────────────────────────────────── | COMMENT |
| MEDIUM | test/integration-helpers.ts | 693 | // ── Default compaction config ──────────────────────────────────────────────── | COMMENT |
| MEDIUM | test/integration-helpers.ts | 762 | // ═════════════════════════════════════════════════════════════════════════════ | COMMENT |
| MEDIUM | test/integration-helpers.ts | 764 | // ═════════════════════════════════════════════════════════════════════════════ | COMMENT |
| MEDIUM | test/engine-lifecycle.test.ts | 1223 | // ── Ingest content extraction ─────────────────────────────────────────────── | COMMENT |
| MEDIUM | test/engine-lifecycle.test.ts | 1251 | // ── Bootstrap ─────────────────────────────────────────────────────────────── | COMMENT |
| 75 more matches not shown… | ||||
| Severity | File | Line | Snippet | Context |
|---|---|---|---|---|
| CRITICAL | test/engine-foreground-compaction.test.ts | 288 | expect(unavailable.log.info.mock.calls.flat().join("\n")).toContain("reduced=false reachedTarget=false pending=true | CODE |
| CRITICAL | test/engine-foreground-compaction.test.ts | 300 | expect(bounded.log.info.mock.calls.flat().join("\n")).toContain("reduced=true reachedTarget=false pending=true reaso | CODE |
| Severity | File | Line | Snippet | Context |
|---|---|---|---|---|
| LOW | tui/transplant.go | 1115 | // Step 1: Shift all existing ordinals up to make room for inserts without | COMMENT |
| LOW | tui/transplant.go | 1139 | // Step 2: Insert transplanted summaries into the free low-ordinal range. | COMMENT |
| LOW | tui/transplant.go | 1156 | // Step 3: Move all summaries out of the final low-ordinal range before | COMMENT |
| LOW | tui/transplant.go | 1172 | // Step 4: Reorder all summary context items by depth DESC, then created_at ASC. | COMMENT |
| LOW | tui/transplant.go | 1194 | // Step 5: Reorder message context items to follow after all summaries. | COMMENT |
| LOW | src/assembler.ts | 1506 | // Step 1: Get all context items ordered by ordinal | COMMENT |
| LOW | src/assembler.ts | 1517 | // Step 2: Resolve each context item into a ResolvedItem, then apply any | COMMENT |
| LOW | src/assembler.ts | 1534 | // Step 3: Split into evictable prefix and protected fresh tail | COMMENT |
| LOW | src/assembler.ts | 1568 | // Step 4: Budget-aware selection | COMMENT |
| Severity | File | Line | Snippet | Context |
|---|---|---|---|---|
| LOW | tui/transplant.go | 1115 | // Step 1: Shift all existing ordinals up to make room for inserts without | COMMENT |
| LOW | tui/transplant.go | 1139 | // Step 2: Insert transplanted summaries into the free low-ordinal range. | COMMENT |
| LOW | tui/transplant.go | 1156 | // Step 3: Move all summaries out of the final low-ordinal range before | COMMENT |
| LOW | tui/transplant.go | 1172 | // Step 4: Reorder all summary context items by depth DESC, then created_at ASC. | COMMENT |
| LOW | tui/transplant.go | 1194 | // Step 5: Reorder message context items to follow after all summaries. | COMMENT |
| LOW | src/assembler.ts | 1506 | // Step 1: Get all context items ordered by ordinal | COMMENT |
| LOW | src/assembler.ts | 1517 | // Step 2: Resolve each context item into a ResolvedItem, then apply any | COMMENT |
| LOW | src/assembler.ts | 1534 | // Step 3: Split into evictable prefix and protected fresh tail | COMMENT |
| LOW | src/assembler.ts | 1568 | // Step 4: Budget-aware selection | COMMENT |
| Severity | File | Line | Snippet | Context |
|---|---|---|---|---|
| LOW | test/reasoning-half-fix.test.ts | 1 | import { describe, expect, it, vi } from "vitest"; | COMMENT |
| LOW | test/live-turn-structural-supersede.test.ts | 1 | // The live current turn (the decorated, model-facing copy OpenClaw delivers) | COMMENT |
| LOW | test/stub-tier.test.ts | 301 | tokenBudget: 200_000, | COMMENT |
| LOW | test/integration-helpers.ts | 761 | COMMENT | |
| LOW | specs/env-config-extraction.md | 21 | COMMENT | |
| LOW | src/retrieval.ts | 261 | // `expandFileMaxBytes`. Files over the cap return the head | COMMENT |
| LOW | src/engine.ts | 2321 | const thresholdSweepExhaustedOverTarget = | COMMENT |
| LOW | src/assembler.ts | 621 | const rawRecord = metadata.raw as Record<string, unknown>; | COMMENT |
| LOW | src/openclaw-inbound-metadata.ts | 41 | const OPENCLAW_INBOUND_HISTORY_RECAP_BLOCK_RE = new RegExp( | COMMENT |
| LOW | src/openclaw-inbound-metadata.ts | 61 | /^[A-Za-z]{3} \d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2} \S+ /; | COMMENT |
| Severity | File | Line | Snippet | Context |
|---|---|---|---|---|
| MEDIUM | CHANGELOG.md | 1258 | - [#592](https://github.com/Martian-Engineering/lossless-claw/pull/592) [`e0dbd09`](https://github.com/Martian-Engineeri | CODE |
| MEDIUM | CHANGELOG.md | 1258 | - [#592](https://github.com/Martian-Engineering/lossless-claw/pull/592) [`e0dbd09`](https://github.com/Martian-Engineeri | CODE |
| MEDIUM | README.md | 573 | types.ts # Core type definitions (dependency injection contracts) | CODE |
| Severity | File | Line | Snippet | Context |
|---|---|---|---|---|
| LOW | openclaw.plugin.json | 242 | "placeholder": "Auto (at least 6000)" | CODE |
| LOW | openclaw.plugin.json | 415 | "placeholder": "Auto (2 × Leaf Chunk Tokens)" | CODE |
| LOW | test/engine-ingest.test.ts | 644 | const longBody = "lorem ipsum ".repeat(2_000); | CODE |
| Severity | File | Line | Snippet | Context |
|---|---|---|---|---|
| MEDIUM | tui/doctor_test.go | 25 | ('sum_new_false', 1, 'leaf', 0, '%s520 tokens] was mentioned earlier in this summary body and then the text continued | CODE |