# RetrieX Shop Query Context Anchor Fix

Patch-only fix for referential shop follow-up questions such as:

- `was kostet der indikator`
- `was kostet das reagenz`
- `suche im shop` after a prior product/parameter question

## Problem

The shop query optimizer could reduce a referential price follow-up to a too generic query, for example:

```text
indikator
```

Even when the previous RAG answer contained a precise anchor such as:

```text
Indikatortyp 300
```

The shop result could still be correct by chance, but the query was less robust than the previously confirmed stable behavior.

## Fix

The optimized query is now enriched generically from recent conversation context when all conditions match:

- the optimized shop query is short/generic,
- the current prompt/query contains a configured accessory/reagent trigger term,
- the recent context contains a configured type/code anchor such as `Indikatortyp 300`.

Expected example:

```text
indikator + history anchor Indikatortyp 300
=> indikatortyp 300 indikator
```

## Design constraints

- No Retriever changes.
- No vector/scoring changes.
- No Testomat-808/Testomat-2000/Tritromat special case.
- Product/type/code detection is configurable in `config/retriex/agent.yaml`.
- PHP defaults remain as fallback.

## Files

- `config/retriex/agent.yaml`
- `src/Agent/AgentRunner.php`
- `src/Config/AgentRunnerConfig.php`
- `src/Config/RetriexEffectiveConfigProvider.php`

## After applying

Run:

```bash
php bin/console cache:clear
php bin/console mto:agent:config:validate
php bin/console mto:agent:regression:test
```
