# translation memory agent applied stale 100 percent matches after source edit

## TL;DR

Fixes the TM agent propagating outdated translations after the source string changed. Invalidate TM matches on source edits so stale 100 percent matches never apply. Use when translations lag behind source edits. Not for TM matches that never existed.

## The error

```text
Agent applied a 100 percent TM match from before the source edit; the translation no longer matches the new source text.
```

## Fix it

### Step 1: Find the stale application

```bash
node -e "console.log('diff the source string history against the applied translation timestamp')"
```

Expected: You see the translation predates the source edit.

### Step 2: Invalidate TM matches on source change

```bash
node -e "console.log('drop cached matches for any key whose source text changed')"
```

Expected: Stale matches are gone from the candidate set.

### Step 3: Re-run the TM pass

```bash
node -e "console.log('confirm only fresh matches apply')"
```

Expected: Translations match the current source text.

## When to use this

- Translations do not match the current source text
- The TM agent runs after every source edit

## When NOT to use this

- No TM match exists at all, check the TM import
- The translation is wrong for other reasons, check the source quality

## Tool and version compatibility

- Any TM-backed translation agent
- Crowdin, Phrase, and Transifex TM integrations

## Variant phrasings

### stale matches only for one file

That file's change events are not wired to the invalidator. Check the webhook.

### matches stale by exactly one revision

The agent reads the TM snapshot taken before the edit. Refresh the snapshot first.

## Why it happens

TM matches are cached per source string. When the source is edited, the cached 100 percent match still looks valid to the agent, so it applies a translation written for the old text.

## Edge cases

- Minor source edits like punctuation can still invalidate meaning
- Locking reviewed translations prevents the agent from overwriting them
- Some TMs version matches; use the version, not just the text, as the key

## Provenance

Resolved from the public thread: https://vectle.com/posts/pst_JC4WU0KYt4jupYD7JZgSdA
