thedotmack/claude-mem · warning

DRIFT

DRIFT

Error message

DRIFT

What it means

A conflict record emitted by CcsAlignRulesWalker.walkRules with code DRIFT: a leaf (seat-level) line is close-but-not-exact to a house line, per detectDrift. It usually means the house text was updated and the seat copy still carries the old wording, so the two layers now disagree in a subtle way that exact-match shadow detection missed.

Source

Thrown at src/services/integrations/CcsAlignRulesWalker.ts:540

          line: trimmed,
          detail: shadow.matchedHouseLine
            ? `Leaf duplicates house line: "${shadow.matchedHouseLine}"`
            : 'Leaf starts with "House rule" — shadows the cascade',
          houseMatch: shadow.matchedHouseLine,
        });

        if (!shadowPatchesByFile.has(entry.file)) {
          shadowPatchesByFile.set(entry.file, new Set());
        }
        shadowPatchesByFile.get(entry.file)!.add(trimmed);
      }

      // DRIFT: leaf line is close-but-not-exact to a house line
      if (!shadow.isShadow) {
        const drift = detectDrift(trimmed, allHouseLines);
        if (drift.isDrift) {
          conflicts.push({
            code: 'DRIFT',
            layer: 'seat',
            file: entry.file,
            line: trimmed,
            detail: drift.matchedHouseLine
              ? `House text may have changed; leaf still has old wording. House: "${drift.matchedHouseLine}"`
              : 'Possible drift from house text',
          });
        }
      }

      // DENY_ALLOW: check seat line against house+project lines
      const denyAllow = detectDenyAllow(trimmed, houseProjectLines);
      if (denyAllow.isDenyAllow) {
        conflicts.push({
          code: 'DENY_ALLOW',
          layer: 'seat',
          file: entry.file,
          line: trimmed,

View on GitHub (pinned to 8bc631a71a)

Solutions

  1. Update the seat line to the current house wording, or delete it in favor of the house line
  2. Diff the flagged line against the reported house line (in the detail field) and reconcile intentionally
  3. If the similarity is coincidental, reword the seat line to break the fuzzy match
  4. Re-run the walker to confirm the DRIFT entry is gone

Example fix

// before (seat file)
Always run tests before committing.
// after
(run the full test suite before commit   <- matches updated house line)
// or simply delete the seat line
Defensive patterns

Strategy: validation

Validate before calling

// flag near-duplicates of house lines in seat files
function fuzzyEq(a: string, b: string): boolean {
  const norm = (s: string) => s.toLowerCase().replace(/[^a-z0-9 ]/g, '');
  return norm(a) === norm(b) || (norm(a).length > 0 && norm(b).includes(norm(a)));
}
seatLines.filter(s => houseLines.some(h => fuzzyEq(s, h) && s.trim() !== h.trim())).forEach(drifted);

Type guard

null

Try / catch

null

Prevention

When it happens

Trigger: walkRules finds a seat line that detectDrift scores as near-matching some house line (fuzzy similarity above threshold but not identical).

Common situations: House rules were reworded ('always run tests' -> 'run the full test suite before commit') but seat files pinned the old phrasing; manual edits touched only one of two synced copies.

Understand the failure class

Background: Schema validation failed / invalid input schema: payload rejected because its shape doesn't match the expected schema — this error's family across 28 libraries.

Related errors


AI-assisted analysis of thedotmack/claude-mem@8bc631a71a (2026-09-09). Data as JSON: /api/errors/ff2719aef5ef8ad1. Report an issue: GitHub.