Dodaios is an open-source agent OS for your desktop: it runs your coding agents, browser and apps by voice or chat, on your own machine. Formerly Personal Jarvis.
Python agent-orchestrationai-agentai-coding-assistantclaude-codecoding-agentcomputer-usedesktop-applocal-firstmcppersonal-jarvisvoice-assistantvoice-coding
feat(wiki): evidence-tiered Stage-1 extraction with personal-salience floor
Personal Jarvis Maintainer00e36c6144b7
diff --git a/jarvis/core/config.py b/jarvis/core/config.pyindex 68f4e01539..a855e4617a 100644--- a/jarvis/core/config.py+++ b/jarvis/core/config.py@@ -1131,6 +1131,14 @@ class ExtractorConfig(BaseModel):min_user_chars: int = 12max_output_tokens: int = 800timeout_s: float = 30.0+ # Personal-salience floor (1-5): candidates the model scores below this+ # are dropped in Stage 1. 3 keeps peripheral personal facts and drops+ # world-knowledge trivia; raise it for a leaner vault.+ min_salience: int = 3+ # Rollback switch to the pre-basis regime: when False, behavioral+ # (lived-experience) grounding is treated as ungrounded and only+ # explicit assertions survive.+ behavioral_inference: bool = Trueclass WikiMemoryConfig(BaseModel):@@ -2789,9 +2797,16 @@ def _ensure_keyring_backend() -> None:elif sys.platform == "darwin" and not getattr(current_backend, "_jarvis_platform_wrapper", False):- from .keychain_bundle import DarwinBundleKeyringBackend+ from .keychain_bundle import (+ DarwinBundleKeyringBackend,+ darwin_security_cli_vault,+ )- keyring.set_keyring(DarwinBundleKeyringBackend(current_backend))+ keyring.set_keyring(+ DarwinBundleKeyringBackend(+ current_backend, cli=darwin_security_cli_vault()+ )+ )except Exception: # noqa: BLE001, S110 -- a missing keyring must never break bootpass@@ -2836,9 +2851,14 @@ def _try_restore_platform_keyring_backend() -> bool:if sys.platform == "darwin" and not getattr(candidate, "_jarvis_platform_wrapper", False):- from .keychain_bundle import DarwinBundleKeyringBackend+ from .keychain_bundle import (+ DarwinBundleKeyringBackend,+ darwin_security_cli_vault,+ )- candidate = DarwinBundleKeyringBackend(candidate)+ candidate = DarwinBundleKeyringBackend(+ candidate, cli=darwin_security_cli_vault()+ )keyring_mod.set_keyring(candidate)# A read-only probe was insufficient on Windows: WinVault could read andiff --git a/jarvis/memory/wiki/extractor.py b/jarvis/memory/wiki/extractor.pyindex dd2574c420..adaea2649b 100644--- a/jarvis/memory/wiki/extractor.py+++ b/jarvis/memory/wiki/extractor.py@@ -39,7 +39,7 @@ from jarvis.memory.wiki.curator_llm import (_resolve_provider_and_model,instantiate_curator_brain,)-from jarvis.memory.wiki.grounding import is_unsupported_user_interest_claim+from jarvis.memory.wiki.grounding import classify_user_attitude_evidencefrom jarvis.memory.wiki.journal import CandidateFact, normalise_subjectsfrom jarvis.memory.wiki.residence import detect_residence_slugfrom jarvis.memory.wiki.secret_guard import contains_secret@@ -73,10 +73,14 @@ _MAX_EVIDENCE_TURN_ID_CHARS = 80# the user turn has a durable first-person/relationship/project signal. The# binding Stage-2 judge still decides whether anything reaches the vault._DURABLE_CUE_RE = re.compile(- r"(?i)\b(?:my|our|i\s+(?:am|own|prefer|love|hate|work|live|decided|plan)"+ r"(?i)\b(?:my|our|i\s+(?:am|own|prefer|love|hate|work|live|decided|plan"+ r"|play|go|train|meet)"+ r"|every\s+(?:day|week|weekend|morning|evening)"r"|mein(?:e|er|en|em|es)?|unser(?:e|er|en|em|es)?"- r"|ich\s+(?:bin|habe|besitze|mag|liebe|hasse|arbeite|wohne|plane)"+ r"|ich\s+(?:bin|habe|besitze|mag|liebe|hasse|arbeite|wohne|plane"+ r"|spiele|gehe|trainiere|treffe)|jede[nrs]?"r"|mi|mis|nuestro|nuestra|soy|tengo|prefiero|trabajo|vivo"+ r"|juego|voy|entreno|cada"r"|friend|partner|wife|husband|boss|mother|father"r"|freund|partnerin|ehefrau|ehemann|chef|mutter|vater"r"|amigo|amiga|pareja|esposa|esposo|jefe|madre|padre"@@ -89,6 +93,7 @@ _KNOWN_KINDS = frozenset({"identity","preference",+ "activity","person","project","decision",@@ -104,32 +109,59 @@ _KNOWN_KINDS = frozenset(_GRAPH_SUBJECT_KINDS = frozenset({"place"})+def _candidate_salience(item: dict[str, Any]) -> int:+ """Model-scored 1-5 personal salience, clamped; missing/garbage -> 3."""+ try:+ salience = int(item.get("salience", 3))+ except (TypeError, ValueError):+ return 3+ return max(1, min(5, salience))++_SYSTEM_PROMPT = """\You extract durable personal-memory facts from one FOCUS USER TURN. Earlierturns and assistant replies are context for resolving references only.Return ONLY a JSON array. Each element: {"fact": "<one self-contained-sentence>", "kind": "<identity|preference|person|project|decision|event|asset|-place|organization|relationship|other>", "subjects":-["<lowercase-kebab-slug>", ...], "evidence_turn_id": "<focus turn id>"}.+sentence>", "kind": "<identity|preference|activity|person|project|decision|+event|asset|place|organization|relationship|other>", "subjects":+["<lowercase-kebab-slug>", ...], "evidence_turn_id": "<focus turn id>",+"basis": "<explicit|behavioral>", "salience": <integer 1-5>}.Rules:-- A fact must still be useful weeks later: identity, preferences, people,- relationships, owned assets or vehicles, places, organizations, projects,- decisions, plans, and biographical events. Rephrase it so it stands alone.+- A fact must still be useful weeks later: identity, preferences, recurring+ activities and habits, people, relationships, owned assets or vehicles,+ places, organizations, projects, decisions, plans, and biographical events.+ Rephrase it so it stands alone.- Explicit ownership or naming is durable even when phrased briefly, forexample "I own the yacht" or "My yacht is named Aurora".-- A topic mention, one-off question, or request for information is NOT evidence- of the user's lasting interest, preference, habit, plan, intent, identity, or- ownership. "What are the benefits of Vitamin D?" yields []; do not infer a- supplement interest or plan. "Tell me about Monaco." yields []; do not infer- interest in Monaco, travel plans, attendance, residence, or preference.-- Store a user relationship to a topic only when the user explicitly asserts- or confirms it. "I own a yacht." and "I plan to attend Monaco." are durable- self-disclosures. If a question also contains a self-disclosure, extract only- the disclosed fact and never invent a reason for the question.-- Recall-biased applies only after the user has grounded a durable fact; it- never permits turning topic choice into a personal-memory claim.+- "basis" grades the evidence. "explicit": the user directly asserted the+ fact ("I own a yacht.", "Golf is my favourite sport."). "behavioral": the+ user described first-person lived experience — doing, practicing, or+ enjoying something — without naming it as a preference or habit. "I love+ being out on golf courses with my buddies, playing this sport actively"+ grounds {"fact": "The user plays golf actively with friends and enjoys+ it", "kind": "activity", "basis": "behavioral"}. Habitual markers ("every+ Saturday", "again", "as usual") in a first-person report count as+ behavioral grounding. Never label a lived-experience inference "explicit".+- "salience" scores how central the fact is to the USER's own life:+ 5 = core identity, close people, health. 4 = possessions, recurring habits+ and activities, active projects. 3 = peripheral personal facts. 2 = world+ knowledge loosely tied to the user. 1 = trivia. Score user-centrality,+ never interestingness.+- A topic mention, one-off question, or request for information grounds+ NOTHING — no basis rescues it. "What are the benefits of Vitamin D?"+ yields []; do not infer a supplement interest or plan.+ "Tell me about Monaco." yields []; do not infer interest in Monaco,+ travel plans, attendance, residence, or preference. Never manufacture a+ personal connection from curiosity.+- If a question also contains a self-disclosure, extract only the disclosed+ fact and never invent a reason for the question.+- Quality bar: you feed a curated map of the user's life, not a transcript+ archive. For facts the user explicitly asserted about themselves, their+ people, possessions, health, habits, and projects, forgetting is the worse+ failure. For everything else, writing junk is the worse failure — when in+ doubt about a fact with no strong personal anchor, return [].- Return [] for smalltalk, pure questions, commands without durable content,fleeting bodily/status chatter, or turns that only concern the immediatetask. "I need the bathroom" is not durable memory.@@ -140,9 +172,9 @@ Rules:- "subjects" names who/what the fact is about (e.g. ["person-name"],["personal-jarvis"]). The caller supplies the speaker's exact user slug.For a first-person fact about a named place, person, organization, project,- asset, or vehicle, include BOTH the exact user slug and the named topic slug.- Example: "I live in San Francisco" uses kind "place" and subjects- ["<user-slug>", "san-francisco"].+ asset, vehicle, or recurring activity, include BOTH the exact user slug and+ the named topic slug. Example: "I live in San Francisco" uses kind "place"+ and subjects ["<user-slug>", "san-francisco"].- Never include credentials, API keys, passwords, or tokens in a fact.- No prose outside the JSON array."""@@ -153,9 +185,10 @@ Extract durable personal-memory facts that individual-turn review may havemissed because the meaning emerged across several turns.Return ONLY a JSON array. Each element: {"fact": "<one self-contained-sentence>", "kind": "<identity|preference|person|project|decision|event|asset|-place|organization|relationship|other>", "subjects":-["<lowercase-kebab-slug>", ...], "evidence_turn_id": "<exact user turn id>"}.+sentence>", "kind": "<identity|preference|activity|person|project|decision|+event|asset|place|organization|relationship|other>", "subjects":+["<lowercase-kebab-slug>", ...], "evidence_turn_id": "<exact user turn id>",+"basis": "<explicit|behavioral>", "salience": <integer 1-5>}.Rules:- Use only statements asserted or explicitly confirmed by the USER as facts.@@ -163,23 +196,38 @@ Rules:- Every fact must cite the exact user turn that supports it. If no user turnsupports a claim, omit it.- Preserve durable identity, people, relationships, ownership and names of- assets or vehicles, places, organizations, projects, preferences, decisions,- plans, and biographical events that remain useful weeks later.-- A topic mention, one-off question, or request for information is NOT evidence- of the user's lasting interest, preference, habit, plan, intent, identity, or- ownership. "What are the benefits of Vitamin D?" yields []; do not infer a- supplement interest or plan. "Tell me about Monaco." yields []; do not infer- interest in Monaco, travel plans, attendance, residence, or preference.-- Store a user relationship to a topic only when the user explicitly asserts- or confirms it. "I own a yacht." and "I plan to attend Monaco." are durable- self-disclosures. If a question also contains a self-disclosure, extract only- the disclosed fact and never invent a reason for the question.+ assets or vehicles, places, organizations, projects, preferences, recurring+ activities, decisions, plans, and biographical events that remain useful+ weeks later.+- "basis" grades the evidence. "explicit": the user directly asserted the+ fact. "behavioral": the user described first-person lived experience —+ doing, practicing, or enjoying something — without naming it as a+ preference or habit; habitual markers ("every Saturday", "again", "as+ usual") in a first-person report count as behavioral grounding. Never+ label a lived-experience inference "explicit".+- "salience" scores how central the fact is to the USER's own life:+ 5 = core identity, close people, health. 4 = possessions, recurring habits+ and activities, active projects. 3 = peripheral personal facts. 2 = world+ knowledge loosely tied to the user. 1 = trivia. Score user-centrality,+ never interestingness.+- A topic mention, one-off question, or request for information grounds+ NOTHING — no basis rescues it. "What are the benefits of Vitamin D?"+ yields []; do not infer a supplement interest or plan.+ "Tell me about Monaco." yields []; do not infer interest in Monaco,+ travel plans, attendance, residence, or preference.+- If a question also contains a self-disclosure, extract only the disclosed+ fact and never invent a reason for the question.+- Quality bar: you feed a curated map of the user's life, not a transcript+ archive. For facts the user explicitly asserted about themselves, their+ people, possessions, health, habits, and projects, forgetting is the worse+ failure. For everything else, writing junk is the worse failure — when in+ doubt about a fact with no strong personal anchor, omit it.- Resolve pronouns and follow-up clarifications across turns. Prefer onecomplete fact over several fragments.- For a first-person fact about a named place, person, organization, project,- asset, or vehicle, include BOTH the exact user slug and the named topic slug.- A residence in San Francisco uses kind "place" and subject- "san-francisco" alongside the exact user slug.+ asset, vehicle, or recurring activity, include BOTH the exact user slug and+ the named topic slug. A residence in San Francisco uses kind "place" and+ subject "san-francisco" alongside the exact user slug.- Return [] for greetings, questions, commands without durable content,transient bodily/status chatter, weather talk, and immediate-task details.- Never include credentials, API keys, passwords, or tokens.@@ -981,6 +1029,7 @@ class ConversationFactExtractor:secret_count = 0unsupported_interest_count = 0incomplete_subject_count = 0+ low_salience_count = 0usable = Falsefor item in parsed[:max_facts]:if not isinstance(item, dict):@@ -1011,14 +1060,17 @@ class ConversationFactExtractor:):incomplete_subject_count += 1continue- if is_unsupported_user_interest_claim(+ if self._effective_basis(fact=fact,subjects=subjects,evidence_excerpt=evidence_text_by_id.get(evidence, ""),- user_slug=self._user_entity_slug,- ):+ claimed_basis=item.get("basis"),+ ) is None:unsupported_interest_count += 1continue+ if _candidate_salience(item) < self._min_salience():+ low_salience_count += 1+ continueusable = Trueif secret_count:telemetry.inc("wiki_candidates_blocked_secret", secret_count)@@ -1032,6 +1084,11 @@ class ConversationFactExtractor:"wiki_candidates_blocked_incomplete_subjects",incomplete_subject_count,)+ if low_salience_count:+ telemetry.inc(+ "wiki_candidates_blocked_low_salience",+ low_salience_count,+ )return usabledef _coerce_facts(@@ -1095,17 +1152,25 @@ class ConversationFactExtractor:"complete user and topic subjects")continue- if is_unsupported_user_interest_claim(+ basis = self._effective_basis(fact=fact,subjects=subjects,evidence_excerpt=evidence_excerpt,- user_slug=self._user_entity_slug,- ):+ claimed_basis=item.get("basis"),+ )+ if basis is None:log.info("ConversationFactExtractor: dropped unsupported user-interest ""candidate")continue+ salience = _candidate_salience(item)+ if salience < self._min_salience():+ log.info(+ "ConversationFactExtractor: dropped low-salience candidate "+ "(%d < %d)", salience, self._min_salience(),+ )+ continuefacts.append(CandidateFact(fact=fact.strip(),@@ -1113,10 +1178,54 @@ class ConversationFactExtractor:subjects=subjects,evidence_turn_id=evidence,evidence_excerpt=evidence_excerpt,+ basis=basis,+ salience=salience,))return facts+ def _min_salience(self) -> int:+ """Configured Stage-1 personal-salience floor, clamped to 1..5."""+ try:+ configured = int(getattr(self._cfg, "min_salience", 3))+ except (TypeError, ValueError):+ configured = 3+ return max(1, min(5, configured))++ def _effective_basis(+ self,+ *,+ fact: str,+ subjects: tuple[str, ...],+ evidence_excerpt: str,+ claimed_basis: object,+ ) -> str | None:+ """Deterministic floor under the model's claimed evidence basis.++ Returns the effective basis, or ``None`` when the claim is ungrounded+ (or behavioral inference is disabled). The classifier can DOWNGRADE a+ claimed "explicit" to "behavioral" — the model must never launder a+ lived-experience inference into an explicit assertion — but a model+ that honestly labels its own output "behavioral" keeps that label.+ """+ graded = classify_user_attitude_evidence(+ fact=fact,+ subjects=subjects,+ evidence_excerpt=evidence_excerpt,+ user_slug=self._user_entity_slug,+ )+ if graded is None:+ return None+ claimed = str(claimed_basis or "").strip().lower()+ basis = claimed if claimed in {"explicit", "behavioral"} else "explicit"+ if graded == "behavioral":+ basis = "behavioral"+ if basis == "behavioral" and not bool(+ getattr(self._cfg, "behavioral_inference", True)+ ):+ return None+ return basis+def _graph_subjects_complete(self,*,diff --git a/jarvis/memory/wiki/grounding.py b/jarvis/memory/wiki/grounding.pyindex f709209982..ed020a8359 100644--- a/jarvis/memory/wiki/grounding.py+++ b/jarvis/memory/wiki/grounding.py@@ -142,7 +142,7 @@ _FIRST_PERSON_EXPERIENCE_RE = re.compile(# de folded: "ich spiele/gehe/fahre...", "wir spielen...", "ich war/bin",# "ich ... gern(e)", "jeden Samstag", "ich ... immer/oft"r"\bich\s+(?:spiele|gehe|fahre|laufe|trainiere|treffe|besuche|" # i18n-allow: input vocabulary- r"verbringe|koche|sammle|male|wandere|schwimme|klettere|war|bin)\b|" # i18n-allow: input vocabulary+ r"verbringe|koche|sammle|male|wandere|schwimme|klettere|war|bin)\b|" # i18n-allow: input vocabr"\bwir\s+(?:spielen|gehen|fahren|treffen|trainieren)\b|" # i18n-allow: input vocabularyr"\bich\s+[^.!?;,\n]{0,60}\bgerne?\b|" # i18n-allow: input vocabularyr"\bich\s+[^.!?;,\n]{0,60}\b(?:immer|meistens|oft|staendig)\b|" # i18n-allow: input vocabularydiff --git a/jarvis/memory/wiki/telemetry.py b/jarvis/memory/wiki/telemetry.pyindex 742b2bdade..b5f241c762 100644--- a/jarvis/memory/wiki/telemetry.py+++ b/jarvis/memory/wiki/telemetry.py@@ -62,6 +62,7 @@ DEFAULT_COUNTERS: tuple[str, ...] = (# Wave-2 two-stage curator quality counters (B8). Decision names follow# constants.CURATOR_DECISIONS (parity-tested)."wiki_candidates_extracted",+ "wiki_candidates_blocked_low_salience","wiki_consolidator_add","wiki_consolidator_update","wiki_consolidator_noop",diff --git a/tests/unit/memory/wiki/test_extractor.py b/tests/unit/memory/wiki/test_extractor.pyindex 30fd383230..301f3656cd 100644--- a/tests/unit/memory/wiki/test_extractor.py+++ b/tests/unit/memory/wiki/test_extractor.py@@ -413,10 +413,13 @@ async def test_turn_prompt_blocks_topic_question_personal_inferences(assert journal.pending() == []system = brain.received_requests[0].systemassert "topic mention, one-off question, or request for information" in system- assert '"What are the benefits of Vitamin D?" yields []' in system- assert '"Tell me about Monaco." yields []' in system- assert '"I own a yacht." and "I plan to attend Monaco."' in system- assert "never permits turning topic choice into a personal-memory claim" in system+ assert "no basis rescues it" in system+ assert '"What are the benefits of Vitamin D?"' in system+ assert '"Tell me about Monaco."' in system+ assert "personal connection from curiosity" in system+ assert 'lived-experience inference "explicit"' in system+ assert "Score user-centrality" in system+ assert "writing junk is the worse failure" in system@pytest.mark.parametrize(@@ -718,9 +721,12 @@ async def test_session_sweep_prompt_blocks_topic_to_plan_inference(assert count == 0assert journal.pending() == []system = brain.received_requests[0].system- assert '"What are the benefits of Vitamin D?" yields []' in system- assert '"Tell me about Monaco." yields []' in system- assert '"I own a yacht." and "I plan to attend Monaco."' in system+ assert "topic mention, one-off question, or request for information" in system+ assert "no basis rescues it" in system+ assert '"What are the benefits of Vitamin D?"' in system+ assert '"Tell me about Monaco."' in system+ assert 'lived-experience inference "explicit"' in system+ assert "writing junk is the worse failure" in system@pytest.mark.asyncio@@ -842,3 +848,256 @@ async def test_session_chunk_boundary_keeps_user_reference_context(evidence = journal.pending()[0].evidence_excerptassert "Prior user context [turn-16]: I own a yacht." in evidenceassert "Evidence user turn [turn-17]: It is called Aurora." in evidence+++# ---------------------------------------------------------------------------+# Evidence-tiered extraction: basis, salience floor, and the behavioral path+# ---------------------------------------------------------------------------++_GOLF_TURN = (+ "I love being out on golf courses with my buddies, "+ "playing this sport actively."+)+++def _config_with_extractor(**overrides: Any) -> JarvisConfig:+ from jarvis.core.config import ExtractorConfig++ return JarvisConfig(+ brain=BrainConfig(+ primary="gemini",+ providers={"gemini": BrainProviderConfig(model="gemini-3.1-pro-preview")},+ ),+ memory=MemoryConfig(+ wiki=WikiMemoryConfig(extractor=ExtractorConfig(**overrides))+ ),+ )+++async def test_behavioral_lived_experience_yields_behavioral_candidate(+ journal: CandidateJournal,+) -> None:+ turn_id = "golf-behavioral"+ brain = FakeBrain(+ json.dumps(+ [+ {+ "fact": "The user plays golf actively with friends and enjoys it.",+ "kind": "activity",+ "subjects": ["user", "golf"],+ "evidence_turn_id": turn_id,+ "basis": "behavioral",+ "salience": 4,+ }+ ]+ )+ )+ extractor = ConversationFactExtractor(+ config=_config(), journal=journal, registry=FakeRegistry(brain),+ )++ count = await extractor.extract_and_journal(+ _GOLF_TURN,+ "Sounds like a great weekend.",+ source_label="realtime:golf",+ turn_hash=turn_id,+ )++ assert count == 1+ row = journal.pending()[0]+ assert row.fact == "The user plays golf actively with friends and enjoys it."+ assert row.kind == "activity"+ assert row.basis == "behavioral"+ assert row.salience == 4+++async def test_model_claimed_explicit_basis_is_downgraded_to_behavioral(+ journal: CandidateJournal,+) -> None:+ turn_id = "golf-downgrade"+ brain = FakeBrain(+ json.dumps(+ [+ {+ "fact": "The user plays golf regularly with friends.",+ "kind": "activity",+ "subjects": ["user", "golf"],+ "evidence_turn_id": turn_id,+ "basis": "explicit",+ "salience": 4,+ }+ ]+ )+ )+ extractor = ConversationFactExtractor(+ config=_config(), journal=journal, registry=FakeRegistry(brain),+ )++ count = await extractor.extract_and_journal(+ "I was out on the golf course again on Saturday with my buddies.",+ "Nice.",+ source_label="realtime:golf-downgrade",+ turn_hash=turn_id,+ )++ assert count == 1+ # The evidence is a lived-experience report, not a literal assertion:+ # the model must not launder the inference into an explicit basis.+ assert journal.pending()[0].basis == "behavioral"+++async def test_low_salience_world_trivia_is_dropped(+ journal: CandidateJournal,+) -> None:+ from jarvis.memory.wiki.telemetry import telemetry++ turn_id = "trivia"+ blocked_before = telemetry.get("wiki_candidates_blocked_low_salience")+ registry = ScriptedRegistry(+ {+ "gemini": json.dumps(+ [+ {+ "fact": "The Eiffel Tower is located in Paris.",+ "kind": "other",+ "subjects": ["eiffel-tower"],+ "evidence_turn_id": turn_id,+ "basis": "explicit",+ "salience": 1,+ }+ ]+ ),+ "openrouter": "[]",+ }+ )+ extractor = ConversationFactExtractor(+ config=_config(), journal=journal, registry=registry,+ )++ count = await extractor.extract_and_journal(+ "We talked about the Eiffel Tower being in Paris for my project notes.",+ "Indeed it is.",+ source_label="realtime:trivia",+ turn_hash=turn_id,+ )++ assert count == 0+ assert journal.pending() == []+ assert telemetry.get("wiki_candidates_blocked_low_salience") > blocked_before+++async def test_min_salience_floor_is_configurable(+ journal: CandidateJournal,+) -> None:+ turn_id = "salience-floor"+ brain = FakeBrain(+ json.dumps(+ [+ {+ "fact": "The user keeps project notes about Paris landmarks.",+ "kind": "project",+ "subjects": ["user"],+ "evidence_turn_id": turn_id,+ "basis": "explicit",+ "salience": 2,+ }+ ]+ )+ )+ extractor = ConversationFactExtractor(+ config=_config_with_extractor(min_salience=1),+ journal=journal,+ registry=FakeRegistry(brain),+ )++ count = await extractor.extract_and_journal(+ "I keep project notes about Paris landmarks.",+ "Noted.",+ source_label="realtime:salience-floor",+ turn_hash=turn_id,+ )++ assert count == 1+ assert journal.pending()[0].salience == 2+++async def test_behavioral_inference_flag_off_restores_blocking(+ journal: CandidateJournal,+) -> None:+ turn_id = "golf-flag-off"+ registry = ScriptedRegistry(+ {+ "gemini": json.dumps(+ [+ {+ "fact": "The user plays golf regularly with friends.",+ "kind": "activity",+ "subjects": ["user", "golf"],+ "evidence_turn_id": turn_id,+ "basis": "behavioral",+ "salience": 4,+ }+ ]+ ),+ "openrouter": "[]",+ }+ )+ extractor = ConversationFactExtractor(+ config=_config_with_extractor(behavioral_inference=False),+ journal=journal,+ registry=registry,+ )++ count = await extractor.extract_and_journal(+ "I was out on the golf course again on Saturday with my buddies.",+ "Nice.",+ source_label="realtime:golf-flag-off",+ turn_hash=turn_id,+ )++ assert count == 0+ assert journal.pending() == []+++async def test_monaco_question_never_gains_behavioral_basis(+ journal: CandidateJournal,+) -> None:+ """A topic question grounds nothing even when the model claims behavioral."""+ turn_id = "monaco-behavioral-claim"+ registry = ScriptedRegistry(+ {+ "gemini": json.dumps(+ [+ {+ "fact": "The user is interested in Monaco.",+ "kind": "preference",+ "subjects": ["user", "monaco"],+ "evidence_turn_id": turn_id,+ "basis": "behavioral",+ "salience": 4,+ }+ ]+ ),+ "openrouter": "[]",+ }+ )+ extractor = ConversationFactExtractor(+ config=_config(), journal=journal, registry=registry,+ )++ count = await extractor.extract_and_journal(+ "Tell me about Monaco.",+ "Monaco is a city-state on the French Riviera.",+ source_label="realtime:monaco-behavioral-claim",+ turn_hash=turn_id,+ )++ assert count == 0+ assert registry.tried == ["gemini", "openrouter"]+ assert journal.pending() == []