Integrity Engine.

The Integrity Engine reconciles memory, changed files, and dependency risk so stale notes do not silently become the next session ground truth.

Practical use.

Integrity checks are most valuable when stored memory and the current repository have changed independently. The practical outcome should be a visible conflict to resolve, not a quiet preference for whichever source is older.

What it carries.

  • Fresh scan before handoff
  • Stale memory reconciliation
  • Changed-file verification
  • Risk notes before the next AI edits code

How it fits ShardStitch.

This feature checks whether a proposed continuation agrees with the project evidence instead of silently treating an old transcript as authoritative.

What the check changes.

Before a handoff, compare remembered decisions with the current branch, diff, and relevant files. If a note conflicts with disk evidence, the conflict stays visible instead of silently becoming an instruction. That is useful after a long chat, a partial revert, or a tool switch where the old session may describe a state that no longer exists.

The Integrity Engine does not certify that code is correct. It makes the evidence boundary explicit so the next action can be verified deliberately.

Resolve memory-versus-disk conflicts explicitly.

If a saved decision says one thing and the current code or configuration says another, preserve both statements and identify which evidence is newer before carrying either into the next handoff.

  1. Locate the remembered note and the file, branch, or diff it describes.
  2. Compare timestamps and repository history, then record whether the note still applies or has been superseded.
  3. If the conflict remains ambiguous, mark it unresolved and ask the next session to inspect it before editing.

Worked example.

Suppose memory says a configuration key was removed, but the current file still contains it. Check the note date, the current branch, and the commits touching that file. If the change was reverted, mark the note as superseded; if no evidence resolves the conflict, preserve both statements as unresolved and ask for review rather than choosing silently.

Limits and verification.

A consistency check cannot infer intent from a diff alone. A code change may be accidental, experimental, or incomplete. Keep unresolved conflicts visible and avoid turning a plausibility signal into an instruction.