Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 44 additions & 0 deletions osiris_cli/claims.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,10 @@
_DUR46 = r"(?<![\d.,])46(?:\.(?:0+|9\d*))?\s*(?:[µμ]s(?:ec)?|us|micro-?\s?seconds?|microsec)\b"
_CTX46 = r"(?:τ|\btau|revival|anomal\w*|oscillat\w*|period|phase|φ)"
_TAU46 = rf"{_CTX46}[^\n;]{{0,40}}?{_DUR46}|{_DUR46}[^\n;]{{0,40}}?{_CTX46}"
# OSIRIS_ON_QPU: OSIRIS (or "the model", "the core") as the subject, quantum hardware as the object.
_SELF = r"\b(?:the osiris model|osiris|the model|the core|nclm)\b"
_QHW = r"(?:\b\d+[\s-]*qubits?\b|quantum (?:computer|hardware|processor|computing engine)s?|\bibm heron\b|" \
r"\bheron r2\b|\bqpu\b)"


@dataclass(frozen=True)
Expand Down Expand Up @@ -391,6 +395,20 @@ def standing(self) -> str:
(r"\bnclm\b", r"(core|osiris)[^.\n]{0,30}\blearn\w*", r"living (language )?model"),
testable="A confirmatory run that replicates the training run (about 4 runs for a 0.05 "
"bits/byte minimum effect), not only held-out items."),
# The voice's own most frequent invention (2026-11-09, qwen2.5:1.5b): "OSIRIS operates on a quantum
# computer with 156 qubits", "IBM Heron ... utilized in the model's training".
Claim("OSIRIS_ON_QPU", "OSIRIS (its language model) runs on, is trained on, or is integrated with quantum "
"hardware", "OVERCLAIM",
"OSIRIS's core (osiris.nclm) is a small NumPy transformer trained on this computer's CPU by "
"osiris train; its voice is a local Ollama model. Quantum hardware appears only in separate, "
"recorded experiments that OSIRIS's tools submitted (for example staggered dynamical decoupling on "
"ibm_marrakesh). No OSIRIS model has been trained or run on a quantum processor.",
(("file", "osiris_cli/train.py", "the core's trainer: NumPy on the local CPU, no quantum backend"),
("doi", "10.5281/zenodo.23967473", "the Heron r2 decoupling campaign: an experiment, not the model")),
(_SELF + r"[^.\n]{0,60}?\b(?:operates? on|runs? on|running on|(?:is |was |been )?trained (?:on|with|"
r"using)|integrated with|built on|powered by|works? with|utiliz\w+|executes? on)\b[^.\n]{0,60}?" + _QHW,
_QHW + r"[^.\n]{0,80}?\b(?:utiliz\w*|used|employed)\b[^.\n]{0,20}?\b(?:in|for) (?:the model'?s|"
r"osiris'?s?|its) training")),
Claim("NCLM_MECHANICS", "The NCLM core is a non-causal, physics-based model: pilot-wave non-local attention, "
"torsion-locked attention and phase-conjugate positional encoding", "NOT_MEASURED",
"Ordinary transformer parts under physics names (osiris/nclm). The core is a causal decoder: it masks "
Expand Down Expand Up @@ -518,6 +536,32 @@ def match(text: str, limit: Optional[int] = None) -> List[Claim]:
return out[:limit] if limit else out


# A reply is flagged for a claim it brings up only when the register says the claim is not legit or
# has nothing behind it; pilots and untested proposals are open questions, not errors.
FLAG_STANDINGS = ("not supported", "not legit", "not legit as worded")


def flagged_in_reply(reply: str, already: Sequence[Claim] = ()) -> List[Claim]:
"""Not-legit (or evidence-free) claims a model's reply brings up that the user's message did not.

Like match(), this finds references, not endorsements: a reply saying a claim was refuted is
flagged too. The flag shows the register's verdict next to the reply and keeps the reply out
of training; it does not say the reply was wrong."""
seen = {c.id for c in already}
return [c for c in match(reply) if c.id not in seen
and (c.standing() in FLAG_STANDINGS or c.verdict == "NO_EVIDENCE")]


def reply_block(claims: Sequence[Claim]) -> str:
"""Shown under a reply: the register's verdicts on claims the voice brought up."""
lines = []
for c in claims:
standing, meaning = VERDICTS[c.verdict]
lines.append(f" {MARK[standing]} {c.id}: {c.verdict} -- {standing}: {meaning}. /legit {c.id}")
return ("Claims register, on the reply (the voice brought these up; checked by OSIRIS's code):\n"
+ "\n".join(lines) + "\n")


def by_id(claim_id: str) -> Optional[Claim]:
return next((c for c in REGISTER if c.id.lower() == claim_id.lower()), None)

Expand Down
17 changes: 15 additions & 2 deletions osiris_cli/living.py
Original file line number Diff line number Diff line change
Expand Up @@ -1080,6 +1080,7 @@ def converse(self, text: str, learnable: bool = True,
sent_user = None
incomplete = ""
looped = False
flagged_claims: list = []
force_core = getattr(self, "force_core_voice", None)
use_core_voice = bool(force_core) if force_core is not None else (os.environ.get("OSIRIS_CORE_VOICE", "1") != "0")
if gate["open"] and self.core is not None and use_core_voice:
Expand Down Expand Up @@ -1157,11 +1158,21 @@ def converse(self, text: str, learnable: bool = True,
if incomplete:
self.out(f" …[incomplete: {incomplete}]")
self.out("\n")
if not interrupted and reply:
try:
from osiris_cli import claims as claims_mod
flagged_claims = claims_mod.flagged_in_reply(reply, self._claims_hit)
except Exception: # noqa: BLE001 - a broken register must not lose the reply
flagged_claims = []
if flagged_claims:
self.out(claims_mod.reply_block(flagged_claims))
idx = self.stats["exchanges"]
if interrupted:
note = "not learned: interrupted"
elif incomplete:
note = "not learned: incomplete reply"
elif flagged_claims:
note = "not learned: the reply brings up claims the register marks not legit"
elif effective_learnable and self.core is None:
note = "recorded; no core is loaded, so nothing is learned"
elif effective_learnable and idx % HELDOUT_EVERY == 0:
Expand Down Expand Up @@ -1209,7 +1220,8 @@ def converse(self, text: str, learnable: bool = True,
"t": time.strftime("%Y-%m-%dT%H:%M:%S"),
"voice": voice,
"heldout": heldout,
"learnable": effective_learnable and not interrupted and not incomplete,
"learnable": effective_learnable and not interrupted and not incomplete and not flagged_claims,
"flagged_claims": [c.id for c in flagged_claims] or None,
"incomplete": incomplete or None,
"user": text,
"reply": reply,
Expand All @@ -1225,7 +1237,8 @@ def converse(self, text: str, learnable: bool = True,
if (resolved_transport in ("bracketed_paste", "unknown")) or not effective_learnable:
self.last_paste = dict(rec_data, hash=key)
self._save_stats()
if effective_learnable and not interrupted and not incomplete and voice != "core" and self.core is not None:
if effective_learnable and not interrupted and not incomplete and not flagged_claims \
and voice != "core" and self.core is not None:
self._after(lesson, reply, heldout, key, idx)
return reply

Expand Down
56 changes: 56 additions & 0 deletions tests/test_claims.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""The claims register and physics checks: OSIRIS deciding what is legit, by code, before a model speaks."""
import json
import math
import re
from pathlib import Path
Expand Down Expand Up @@ -396,3 +397,58 @@ def model(self):
o.converse("does a Poynting asymmetry give propellantless thrust?")
text = "".join(out)
assert "RULED_OUT" in text and "no mentor model is reachable" in text


# ── the reply: code checks what the voice brought up ─────────────────────────

@pytest.mark.parametrize("text", [
"OSIRIS operates on a quantum computer with 156 qubits, utilizing the hash-chained ledger.",
"OSIRIS is designed to work with quantum hardware, such as the IBM Heron r2 with 156 qubits, which has "
"been utilized in the model's training.",
"OSIRIS is integrated with IBM Heron hardware, specifically the r2 version with 156 qubits.",
])
def test_the_voices_own_quantum_inventions_are_registered(text):
# all three said by qwen2.5:1.5b on 2026-11-09
assert [c.id for c in claims.flagged_in_reply(text)] == ["OSIRIS_ON_QPU"]


@pytest.mark.parametrize("text", [
"OSIRIS ran the staggered decoupling experiment on ibm_marrakesh.",
"The core is a small transformer trained on this computer.",
"Quantum computers with 156 qubits exist today.",
"The model runs on your CPU with Ollama.",
])
def test_true_statements_about_osiris_and_hardware_are_not_flagged(text):
assert claims.flagged_in_reply(text) == []


def test_pilots_and_untested_claims_are_not_flagged():
assert "NCLM_CORE" in [c.id for c in claims.match("OSIRIS is a living language model")]
assert claims.flagged_in_reply("OSIRIS is a living language model") == []


def test_a_reply_bringing_up_a_not_legit_claim_shows_the_verdict_and_is_not_learned(tmp_path):
mentor = ScriptedMentor(reply="OSIRIS operates on a quantum computer with 156 qubits.")
o, out = make(tmp_path, mentor)
o.converse("tell me about yourself")
text = "".join(out)
assert text.index("156 qubits") < text.index("Claims register, on the reply")
assert "OSIRIS_ON_QPU: OVERCLAIM" in text and "/legit OSIRIS_ON_QPU" in text
assert "not learned: the reply brings up claims the register marks not legit" in text
assert o.core.learned == []
row = json.loads(open(tmp_path / "exchanges.jsonl").read().splitlines()[-1])
assert row["learnable"] is False and row["flagged_claims"] == ["OSIRIS_ON_QPU"]


def test_a_claim_the_user_raised_is_not_flagged_again_on_the_reply(tmp_path):
mentor = ScriptedMentor(reply="It was refuted: theta lock 51.843 showed no resonance.")
o, out = make(tmp_path, mentor)
o.converse("is the 51.843 theta lock real?")
text = "".join(out)
assert "REFUTED" in text and "Claims register, on the reply" not in text


def test_an_ordinary_reply_is_not_flagged(tmp_path):
o, out = make(tmp_path)
o.converse("hello osiris")
assert "on the reply" not in "".join(out)
Loading