Skip to content

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.

fix(wiki): stop the Stage-2 judge from starving the vault

Ruben Lütke3663a8a1063e
diff --git a/jarvis/core/config.py b/jarvis/core/config.py
index 316c2b8c6c..e1a1cc5a2f 100644
--- a/jarvis/core/config.py
+++ b/jarvis/core/config.py
@@ -974,8 +974,11 @@ class WikiCuratorConfig(BaseModel):
model: str = "" # "" = provider default model
max_input_tokens: int = 8000
# Headroom for a complete proposal; the streaming truncation guard
- # rejects any residual length-capped generation.
- max_output_tokens: int = 4000
+ # rejects any residual length-capped generation. The Stage-2 judge
+ # returns FULL page bodies per add/update, so a batched response
+ # needs several thousand tokens (live 2026-07-17: 4000 truncated on
+ # every provider and stalled the whole chain).
+ max_output_tokens: int = 8000
timeout_s: float = 90.0
diff --git a/jarvis/memory/wiki/consolidator.py b/jarvis/memory/wiki/consolidator.py
index e8e9057615..395efafb3c 100644
--- a/jarvis/memory/wiki/consolidator.py
+++ b/jarvis/memory/wiki/consolidator.py
@@ -135,7 +135,12 @@ class Consolidator:
search: VaultSearch | None,
vault_root: Path,
registry: BrainProviderRegistry | None = None,
- batch_limit: int = 20,
+ # A judged batch answers with FULL page bodies per add/update, so
+ # 20 candidates cannot fit any sane output budget — every provider
+ # truncated and the bisection retry burned the whole chain first
+ # (live 2026-07-17). Eight keeps the response inside
+ # ``[memory.wiki.curator] max_output_tokens`` on the first attempt.
+ batch_limit: int = 8,
k_nearest: int = 4,
on_run_complete: Any = None,
) -> None:
@@ -875,7 +880,37 @@ class Consolidator:
# The independent existence/preservation checks reject an
# unreadable update. Do not weaken this guard in the meantime.
pass
- return cls._numeric_values(proposed, ignore_schema_dates=True) - grounded
+ return {
+ value
+ for value in cls._numeric_values(proposed, ignore_schema_dates=True)
+ if not cls._numeric_value_grounded(value, grounded)
+ }
+
+ @staticmethod
+ def _numeric_value_grounded(value: str, grounded: set[str]) -> bool:
+ """Exact match, decimal-comma/dot equivalence, or a grounded range.
+
+ Two renderings carry no new numeric claim and must not be rejected
+ (live 2026-07-17: "5 to 6 million euros" evidence, "5-6" proposal —
+ the whole provider chain burned on a correct answer):
+
+ * locale decimal separators — "1,80" and "1.80" are the same value;
+ * hyphen ranges whose every endpoint is individually grounded —
+ "5-6" from grounded "5" and "6".
+
+ Everything else (new digits, new precision such as "5.6" from
+ grounded 5 and 6) stays rejected.
+ """
+ if value in grounded:
+ return True
+ canonical_grounded = {v.replace(",", ".") for v in grounded}
+ if value.replace(",", ".") in canonical_grounded:
+ return True
+ endpoints = value.rstrip("%").split("-")
+ return len(endpoints) > 1 and all(
+ part and part.replace(",", ".") in canonical_grounded
+ for part in endpoints
+ )
@staticmethod
def _numeric_values(
diff --git a/jarvis/memory/wiki/prompt.py b/jarvis/memory/wiki/prompt.py
index 8babc45c75..0b1dae9c23 100644
--- a/jarvis/memory/wiki/prompt.py
+++ b/jarvis/memory/wiki/prompt.py
@@ -487,7 +487,15 @@ Decision semantics:
enough to store (smalltalk, transient bodily/status chatter, weather,
assistant-only claims, commands with no separately asserted durable content,
or unsupported guesses).
- Stage 1 is deliberately recall-biased; you are the binding cleanliness gate.
+ "Already known" is strict: the fact appears in equivalent form on the page
+ where it belongs. A named durable entity (asset, vehicle, person,
+ organization, place) that only appears as a line on ANOTHER page — for
+ example the user's profile — is NOT already known; "add" its own entity
+ page and cross-link it instead of choosing "noop".
+ For an evidence-supported durable fact, prefer "add" or "update" over
+ "noop": the user can edit or archive an over-eager page, but cannot
+ recover a fact the wiki never stored. You are the binding cleanliness
+ gate for durability and evidence, not a brake on wiki growth.
Provide only "candidate_id", "decision", "reason".
- "invalidate": the fact CONTRADICTS a shown page so that page (or
statement) is now outdated. Provide "target" (the superseded page) and
@@ -518,7 +526,10 @@ Linking rules:
use them verbatim and never infer a personal name.
- Create an entity page for a durable, individually identifiable owned asset
or vehicle. Ownership can identify it even before a proper name is known
- (for example, the user's yacht). Link it bidirectionally to its owner.
+ (for example, the user's yacht). Link it bidirectionally to its owner. A
+ mention on the owner's profile page does not replace the entity page: when
+ the profile already carries the fact but the entity page is missing, "add"
+ the entity page in this batch.
- Never write credentials or secrets. No prose outside the JSON array.
"""
diff --git a/tests/unit/memory/wiki/test_consolidator.py b/tests/unit/memory/wiki/test_consolidator.py
index 76c7271169..7102c5df10 100644
--- a/tests/unit/memory/wiki/test_consolidator.py
+++ b/tests/unit/memory/wiki/test_consolidator.py
@@ -15,6 +15,7 @@ import os
import time
from collections.abc import AsyncIterator
from pathlib import Path
+from types import SimpleNamespace
from typing import Any
import pytest
@@ -730,6 +731,102 @@ async def test_numeric_value_already_in_existing_page_remains_valid(stack) -> No
assert "installed in the desktop" in content
+async def test_range_rendering_of_grounded_endpoints_is_accepted(stack) -> None:
+ """"5 to 6 million" evidence grounds a "5-6 million" page rendering.
+
+ Live 2026-07-17: the guard parsed "5-6" as ONE unknown value and burned
+ the whole provider chain on a correct answer.
+ """
+ vault_root, _curator, journal = stack
+ journal.append(
+ [
+ CandidateFact(
+ fact=(
+ "The user's company pays 5 to 6 million euros in "
+ "holiday pay."
+ ),
+ subjects=("user-company",),
+ evidence_turn_id="cost-turn",
+ evidence_excerpt=(
+ "Evidence user turn [cost-turn]: holiday pay costs us "
+ "5 to 6 million euros a year."
+ ),
+ )
+ ],
+ source_label="voice:range-grounding",
+ turn_hash="range-grounding",
+ )
+ cid = journal.pending()[0].id
+ today = dt.date.today().isoformat()
+ body = (
+ "---\n"
+ "type: entity\n"
+ "entity_kind: organization\n"
+ "slug: user-company\n"
+ "aliases: [the user's company]\n"
+ f"created: {today}\n"
+ f"updated: {today}\n"
+ "---\n\n"
+ "# User Company\n\n"
+ "## Summary\n\nThe user's company.\n\n"
+ "## Facts\n\n- Holiday pay costs 5-6 million euros a year.\n\n"
+ "## Relationships\n\n- Owned by the user.\n\n"
+ "## Sources\n\n- conversation\n"
+ )
+ brain = FakeBrain(
+ [
+ _judge_json(
+ [
+ {
+ "candidate_id": cid,
+ "decision": "add",
+ "target": "entities/user-company.md",
+ "new_body": body,
+ "reason": "new organization",
+ }
+ ]
+ )
+ ]
+ )
+
+ label = await _consolidator(stack, brain).run_once()
+
+ assert label == "journal-batch:1"
+ content = (
+ vault_root / "entities" / "user-company.md"
+ ).read_text(encoding="utf-8")
+ assert "5-6 million euros" in content
+
+
+def test_numeric_guard_accepts_locale_decimal_equivalence() -> None:
+ row = SimpleNamespace(
+ fact="The user is 1,80 m tall.",
+ evidence_excerpt="Evidence user turn [t1]: I am 1,80 m tall.",
+ subjects=("user",),
+ )
+ unsupported = Consolidator._unsupported_numeric_values(
+ "## Facts\n\n- Height: 1.80 m.\n",
+ row=row,
+ existing_path=None,
+ )
+ assert unsupported == set()
+
+
+def test_numeric_guard_still_rejects_new_precision() -> None:
+ row = SimpleNamespace(
+ fact="Costs are 5 to 6 million euros.",
+ evidence_excerpt="Evidence user turn [t1]: 5 to 6 million euros.",
+ subjects=(),
+ )
+ unsupported = Consolidator._unsupported_numeric_values(
+ "## Facts\n\n- Costs 5.6 million euros.\n",
+ row=row,
+ existing_path=None,
+ )
+ assert unsupported == {"5.6"}
+
+
@pytest.mark.asyncio
async def test_today_and_current_year_are_grounded_time_context(stack) -> None:
vault_root, _curator, journal = stack