iachat/spec/enterprise/services
Rodribm10 6330bec857 fix(captain-memory): temporal memory model + aggressive dedup
User feedback revealed a fundamental design issue: the memory model was
accumulating contradictory "Prefere X" facts because a single choice was
being treated as a permanent preference. Result: 3 different
"Prefere suite X" entries coexisting, all at 90% confidence, with
reservation patterns over time (2hrs, 4hrs, pernoite) all claiming to be
the customer's "preferred" duration.

Corrections:

1. ExtractionService prompt — preferencia now requires EXPLICIT
  declaration words ("prefiro", "gosto mais de", "sempre escolho",
  "adoro", "favorita"). A mere choice in one conversation is NO LONGER
  extracted as preferencia — instead it goes to padrao_comportamental
  WITH THE DATE in the content (e.g. "Reservou Alexa para pernoite em
  23/05/2026"). This makes memory temporal and auditable instead of
  imposing fake consistency.

2. Reference date is passed to the LLM prompt via the latest message
  timestamp, used as the anchor date the LLM must embed in every
  padrao_comportamental content.

3. ContradictionCheckerService — dual threshold:
  - cosine < 0.15 → auto-supersede without LLM (pure duplicate)
  - 0.15 to 0.6 → ask LLM if contradicts, supersede if yes
  - > 0.6 → ignore, unrelated facts
  Previously only the middle band existed, so near-duplicate facts like
  two "aniversário 23/05" entries or three "prefere suite X" entries
  were never cleaned up.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-19 08:30:42 -03:00
..
captain fix(captain-memory): temporal memory model + aggressive dedup 2026-04-19 08:30:42 -03:00
cloudflare Merge branch 'main' into chore/merge-upstream-4.5.0 2025-08-20 11:20:31 -03:00
companies Chore/merge upstream 4.8.0 (#150) 2025-11-19 16:25:58 -03:00
contacts Chore/merge upstream 4.8.0 (#150) 2025-11-19 16:25:58 -03:00
enterprise Merge branch 'main' into chore/merge-upstream-4.11.0 2026-02-17 23:05:26 -03:00
internal Merge branch main into chore/merge-upstream 2025-12-20 12:44:31 -03:00
messages fix(messages): reduce audio transcription 400 retry noise (#13487) 2026-02-17 13:25:13 +05:30
sla chore: apply Rails/SaveBang cop (#15) 2025-04-03 23:29:24 -03:00
twilio feat(voice): Improved voice call creation flow [EE] (#12268) 2025-08-22 13:38:23 +02:00
voice feat(enterprise): add voice conference API (#13064) 2025-12-15 15:11:59 -08:00