Skip to content

Commit ebb3547

Browse files
committed
docs(i18n): translate Issue #17 code/docs to English
Rule: docs (README, CHANGELOG, FAQ) and all code comments/docstrings MUST be in English. French is reserved for: - the LLM SYSTEM_PROMPT (consistency with rules 1-7 from v1.9.0) - the literal `[inféré]` marker (contract with the French prompt) - legitimate test strings exercising French-aware detection Scope of this i18n pass: - CHANGELOG.md: section [2.0.0+] translated EN - .env.example: Issue #17 ENV var block translated EN - src/live_mem/config.py: docstrings/comments around the two new `consolidation_validation_*` settings translated EN - src/live_mem/core/consolidator.py: all Issue #17 additions (regex headers, _STATUS_KEYWORDS, helpers, validation pass) translated EN. SYSTEM_PROMPT untouched (stays FR). - tests/test_issue17_validation.py: 53 tests' docstrings and comments translated EN. FR strings kept verbatim in fixtures and parametrized cases (they exercise the French regex paths). Drive-by: rename GUIDE_INTEGRATION_CLINE.{md,fr.md} → CLINE_INTEGRATION_GUIDE.{md,fr.md} (filename consistency with the project's "ENGLISH_BEFORE_FRENCH" convention). No behavior change. Tests: 346/346 PASS (no regression).
1 parent a440336 commit ebb3547

6 files changed

Lines changed: 204 additions & 187 deletions

File tree

CHANGELOG.md

Lines changed: 42 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -5,57 +5,61 @@ Based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/).
55

66
---
77

8-
## [2.0.0+] — 2026-05-15 (post-2.0.0, branche `v2.0.0`)
8+
## [2.0.0+] — 2026-05-15 (post-2.0.0, branch `v2.0.0`)
99

10-
**🔬 Issue #17Backlog consolidateur** : implémentation des 2 mitigations
11-
laissées en backlog par v1.9.0 (validation post-pass `unattributed_claims_count`
12-
+ marker `[inféré]` pour la traçabilité des inférences). Aucun bump de version :
13-
ces ajouts sont **opt-in** (zéro impact pour les déploiements existants).
10+
**🔬 Issue #17Consolidator backlog** : implementation of the 2 mitigations
11+
left in backlog by v1.9.0 (post-pass validation `unattributed_claims_count`
12+
+ `[inféré]` marker for inference traceability). No version bump: these
13+
additions are **opt-in** (zero impact for existing deployments).
1414

1515
### Added
1616

17-
- **Pass de validation post-consolidation** (`src/live_mem/core/consolidator.py`) :
18-
nouvelle fonction `_validate_unattributed_claims()` qui compare la bank
19-
avant/après chaque batch consolidé et compte les "claims" (faits chiffrés,
20-
dates, versions, refs PR/issue, statuts forts) qui ne sont ni sourcés dans
21-
les notes du batch ni explicitement marqués `[inféré]`. Approche
22-
**code-only** (regex + diff par ligne) : déterministe, zéro token LLM,
23-
observable via le champ `validation` du retour de `bank_consolidate`.
24-
- **Règle #8 du SYSTEM_PROMPT — Markers `[inféré]`** : le LLM consolidateur
25-
doit désormais annoter chaque fait produit par inférence transitive
26-
(règle #7) avec le marker `[inféré]`. Le marker sert d'attribution
27-
explicite et garantit que le pass de validation ne flagge pas ces lignes.
28-
- **Nouvelles ENV vars opt-in** (defaults sûrs, désactivé par défaut) :
29-
- `CONSOLIDATION_VALIDATION_ENABLED=false` — active la pass de validation
30-
et l'ajout du bloc `validation` dans la réponse MCP.
31-
- `CONSOLIDATION_VALIDATION_MAX_EXAMPLES=20` — borne le nombre d'exemples
32-
de claims non sourcés remontés (protège la taille du payload).
17+
- **Post-consolidation validation pass** (`src/live_mem/core/consolidator.py`):
18+
new `_validate_unattributed_claims()` function comparing the bank
19+
before/after each consolidated batch and counting "claims" (numeric
20+
metrics, dates, versions, PR/issue refs, strong status keywords) that
21+
are neither sourced from a batch note nor explicitly tagged `[inféré]`.
22+
**Code-only approach** (regex + per-line diff): deterministic, zero
23+
additional LLM tokens, observable via the `validation` field of the
24+
`bank_consolidate` response.
25+
- **SYSTEM_PROMPT rule #8`[inféré]` markers**: the LLM consolidator
26+
must now annotate every fact produced by transitive inference (rule #7)
27+
with the `[inféré]` marker. The marker serves as explicit attribution
28+
and ensures the validation pass does not flag those lines as unsourced.
29+
Note: the SYSTEM_PROMPT is kept in French for consistency with the
30+
7 other anti-hallucination rules already defined in French in v1.9.0.
31+
- **New opt-in ENV vars** (safe defaults, disabled by default):
32+
- `CONSOLIDATION_VALIDATION_ENABLED=false` — enables the validation pass
33+
and the addition of the `validation` block in the MCP response.
34+
- `CONSOLIDATION_VALIDATION_MAX_EXAMPLES=20` — bounds the number of
35+
unsourced-claim examples returned (protects the payload size).
3336

3437
### Tests
3538

36-
- **`tests/test_issue17_validation.py`** : 53 tests anti-complaisants
37-
couvrant les helpers (`_extract_claim_tokens`, `_has_strong_status_claim`,
38-
`_normalize_for_match`, `_INFERRED_MARKER_RE`), la fonction
39-
`_validate_unattributed_claims` (happy paths, détection d'hallucinations,
40-
bornage des exemples, diff-only), la présence de la règle #8 dans le
41-
SYSTEM_PROMPT, et la configuration opt-in.
42-
- **Suite globale** : **346/346 PASS** (293 existants + 53 nouveaux). Aucune
43-
régression sur `test_security_hardening_v2.py` (122 tests v2.0.0),
44-
`test_tokens.py`, `test_proxy.py`, ou les autres suites.
39+
- **`tests/test_issue17_validation.py`**: 53 non-complacent tests covering
40+
the helpers (`_extract_claim_tokens`, `_has_strong_status_claim`,
41+
`_normalize_for_match`, `_INFERRED_MARKER_RE`), the
42+
`_validate_unattributed_claims` function (happy paths, hallucination
43+
detection by counter-proof, example bounding, diff-only), the presence
44+
of rule #8 in the SYSTEM_PROMPT, and the opt-in configuration.
45+
- **Global suite**: **346/346 PASS** (293 existing + 53 new). No
46+
regression on `test_security_hardening_v2.py` (122 v2.0.0 tests),
47+
`test_tokens.py`, `test_proxy.py`, or other suites.
4548

4649
### Fixed
4750

48-
- **Regex `_METRIC_RE`** : ajout de `(?=\W|$)` pour matcher correctement
49-
les métriques se terminant par `%` (ex: `80%`), `\b` étant inopérant
50-
entre `%` et un espace. Ajout de `[.,/]\d+` dans le motif numérique pour
51-
matcher `171/171` comme une seule métrique.
52-
- **`_STATUS_KEYWORDS`** : enrichi des formes fléchies françaises (féminin
53-
singulier/pluriel : `fermée`, `résolue`, `mergée`, `publiée`, `déployée`,
54-
`validée`, etc.) car `\b` Python exige une frontière `\w↔non-\w` en fin
55-
de mot, ce qui ne fonctionne pas avec une racine accentuée suivie de `e`.
51+
- **`_METRIC_RE` regex**: added `(?=\W|$)` to correctly match metrics
52+
ending with `%` (e.g. `80%`), since `\b` is inoperative between `%`
53+
and a space. Added `[.,/]\d+` in the numeric pattern to match
54+
`171/171` as a single metric.
55+
- **`_STATUS_KEYWORDS`**: enriched with French inflected forms (feminine
56+
singular/plural: `fermée`, `résolue`, `mergée`, `publiée`, `déployée`,
57+
`validée`, etc.) because Python's `\b` requires a `\w↔non-\w` boundary
58+
at word-end, which does not work for accented roots followed by `e`.
5659

5760
---
5861

62+
5963
## [2.0.0] — 2026-05-15
6064

6165

File renamed without changes.
File renamed without changes.

src/live_mem/config.py

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -99,22 +99,25 @@ def _normalize_proxy_url(cls, v: str | None) -> str | None:
9999
# un flux de travail humain. Mettre à 0 pour désactiver (déconseillé).
100100
consolidation_cooldown_seconds: int = 60
101101

102-
# Issue #17 — Pass de validation post-consolidation (opt-in).
103-
# Quand activée, après chaque batch consolidé, on compte les "claims"
104-
# (faits/métriques/dates) du bank modifié qui n'apparaissent dans
105-
# AUCUNE note du batch. Ce compteur (`unattributed_claims_count`) est
106-
# remonté dans le résultat de bank_consolidate pour observabilité.
107-
# Approche code-only (regex + pattern matching) : pas de tokens LLM,
108-
# déterministe, simple à raisonner. Faux positifs possibles sur du
109-
# contenu structurel inchangé — voir _validate_unattributed_claims().
110-
# Par défaut désactivé pour ne pas alourdir les consolidations
111-
# existantes ; à activer en observabilité/CI.
102+
# Issue #17 — Post-consolidation validation pass (opt-in).
103+
# When enabled, after each consolidated batch the server counts the
104+
# "claims" (numeric facts, metrics, dates, refs) in the modified bank
105+
# that do NOT appear in any note of the batch. The counter
106+
# `unattributed_claims_count` is surfaced in the bank_consolidate
107+
# response for observability.
108+
# Code-only approach (regex + pattern matching): no LLM tokens spent,
109+
# deterministic, easy to reason about. Some false positives are
110+
# possible on structurally unchanged content — see
111+
# _validate_unattributed_claims() for the heuristic details.
112+
# Disabled by default to keep existing consolidations unaffected;
113+
# enable for observability/CI deployments.
112114
consolidation_validation_enabled: bool = False
113-
# Plafond de claims rapportés (les premiers détectés, pour borner
114-
# la taille du payload retourné au caller MCP).
115+
# Cap on reported claims (only the first few are returned, to bound
116+
# the payload size sent back to the MCP caller).
115117
consolidation_validation_max_examples: int = 20
116118

117119

120+
118121
# ─── Bank Compaction ──────────────────────────────────────
119122
# Compaction automatique des fichiers bank avant consolidation
120123
# quand le contexte total est trop gros pour le LLM.

0 commit comments

Comments
 (0)