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.

chore: auto-save WIP via Claude stop-hook safety net (2026-06-30 12:08)

Ruben Lütkeaa2b7cb2bc08
diff --git a/.githooks/pre-push b/.githooks/pre-push
index 585f6082b3..ca36ec29c6 100755
--- a/.githooks/pre-push
+++ b/.githooks/pre-push
@@ -117,6 +117,23 @@ if [ -f "$docgen_gate" ]; then
fi
fi
+# --- 5) DOCS PRIVACY gate (FAIL-CLOSED) ---------------------------------------
+# Personal data must never leave the machine inside a documentation file:
+# the maintainer's real name, private email/handle, personal Windows paths,
+# machine/account ids. This is the docs-content half the privacy_pre_push gate
+# above does NOT cover (it checks commit author emails + real secrets, not the
+# name/path text inside docs/). Same canonical manifest the ship-public-release
+# scrub uses (.claude/skills/ship-public-release/references/pii-scrub.tsv), so
+# the two never drift. Read-only scan over tracked docs/; exit 1 on any hit.
+docs_privacy_gate="scripts/ci/docs_privacy_scan.py"
+if [ -f "$docs_privacy_gate" ]; then
+ "$PY" "$docs_privacy_gate" </dev/null
+ if [ "$?" -ne 0 ]; then
+ status=1
+ docs_privacy_hit=1
+ fi
+fi
+
rm -f "$refs_file"
if [ "$status" -ne 0 ]; then
@@ -136,6 +153,12 @@ if [ "$status" -ne 0 ]; then
echo "pre-push BLOCKED: CLI DOCGEN drift (jarvis-cli-reference.md out of date)."
echo " Run: python scripts/ci/gen_cli_reference.py and commit the result."
fi
+ if [ "${docs_privacy_hit:-0}" -ne 0 ]; then
+ echo "pre-push BLOCKED: DOCS PRIVACY gate (personal data in docs/)."
+ echo " See the findings above. Fix with:"
+ echo " python scripts/ci/docs_privacy_scan.py --fix <file>"
+ echo " or run the docs-privacy-reviewer sub-agent for a semantic pass."
+ fi
echo "Bypass once with: git push --no-verify (layer-3 CI is the backstop)."
fi
exit "$status"
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index a5f417e995..3203d4fbe7 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -269,3 +269,31 @@ jobs:
env:
PRIVACY_PRIVATE_EMAILS: ${{ vars.PRIVACY_PRIVATE_EMAILS }}
run: python scripts/ci/privacy_scan_ci.py --base "${{ github.event.pull_request.base.sha }}"
+
+ # Docs privacy gate (layer-3 backstop for the .githooks/pre-push docs scan,
+ # which `--no-verify` can skip). Scans the tracked docs/ tree for the
+ # maintainer's real name, private email/handle, personal Windows paths, and
+ # machine/account ids, using the SAME manifest the ship-public-release scrub
+ # uses (.claude/skills/ship-public-release/references/pii-scrub.tsv) so the two
+ # never drift. Unlike privacy-gate above, this DOES check the real name — but
+ # ONLY inside docs/, where (maintainer decision 2026-06-29) it must never
+ # appear, so it cannot false-positive on code where the name lives
+ # legitimately. stdlib + git only, no pip install. BLOCKING, PR-only.
+ docs-privacy:
+ name: docs-privacy (no personal data in docs/)
+ if: github.event_name == 'pull_request'
+ runs-on: ubuntu-latest
+ timeout-minutes: 5
+ steps:
+ - name: Checkout
+ uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
+ with:
+ persist-credentials: false
+
+ - name: Set up Python 3.11
+ uses: actions/setup-python@0b93645e9fea7318ecaed2b359559ac225c90a2b # v5.3.0
+ with:
+ python-version: "3.11"
+
+ - name: Docs privacy gate (BLOCKING - name / email / paths / ids in docs/)
+ run: python scripts/ci/docs_privacy_scan.py
diff --git a/jarvis/brain/model_catalog.py b/jarvis/brain/model_catalog.py
index 3073627e74..6bc9b113c8 100644
--- a/jarvis/brain/model_catalog.py
+++ b/jarvis/brain/model_catalog.py
@@ -455,6 +455,88 @@ def _family_rank(model_id: str) -> int:
return 0
+# ----------------------------------------------------------------------
+# Presentation-only model classification — the picker's filter chips + star
+# ----------------------------------------------------------------------
+# These tag a model for the API-Keys picker's "Free / Frontier / Best value"
+# chips and the maintainer's star. They are PRESENTATION ONLY (AP-21): a tag
+# never changes which model is pinned, how it is gated, or what the brain does.
+# The two quality bands REUSE ``_family_rank`` (the one source of truth for list
+# order) so the chips can never drift from the ordering — Frontier is the
+# flagship band, Best value the strong price/performance band.
+
+# Rank floors that split ``_family_rank``'s band into the two quality chips.
+# Frontier ≥ 33 = flagship families (Opus/Fable/Sonnet/GPT-5/Gemini-3/Grok-4/
+# o3-o4/Haiku); 20 ≤ value < 33 = popular price/performance families (DeepSeek/
+# Kimi/GLM/Qwen/Llama-4/Mistral-large.../gpt-oss/command-r).
+FRONTIER_RANK_FLOOR = 33
+VALUE_RANK_FLOOR = 20
+
+
+def _squash(text: str) -> str:
+ """Lowercase ``text`` stripped of every non-alphanumeric character.
+
+ Mirrors the picker's separator-insensitive search so a star pattern matches
+ an id regardless of vendor-prefix punctuation: ``anthropic/claude-opus-4.8``
+ and the direct ``claude-opus-4-8`` both squash to ``claudeopus48``.
+ """
+ return re.sub(r"[^a-z0-9]", "", text.lower())
+
+
+# Maintainer's hand-picked "best models" — they get a star in the picker. Matched
+# on the SQUASHED id tail (vendor prefix + a ``:free``/``:nitro`` variant suffix
+# stripped) so the same pick is starred whether it comes from a direct provider
+# (``claude-opus-4-8``) or OpenRouter (``anthropic/claude-opus-4.8``). Extend
+# freely — this is a curated favourites list, presentation only.
+STARRED_MODELS: frozenset[str] = frozenset({
+ _squash("claude-opus-4.8"), # Opus 4.8
+ _squash("gpt-5.5"), # GPT-5.5
+ _squash("gemini-3.5-flash"), # Gemini 3.5 Flash
+ _squash("claude-fable-5"), # Fable 5
+ _squash("glm-5.2"), # GLM-5.2
+})
+
+
+def is_free_model(model_id: str, label: str = "") -> bool:
+ """True for a zero-cost model. OpenRouter marks these with a ``:free`` id
+ suffix and a ``(free)`` label; both are checked so the flag survives whichever
+ signal a future catalog keeps."""
+ return ":free" in model_id.lower() or "(free)" in label.lower()
+
+
+def is_starred_model(model_id: str) -> bool:
+ """True if ``model_id`` is one of the maintainer's starred picks."""
+ tail = model_id.lower().rsplit("/", 1)[-1]
+ tail = tail.split(":", 1)[0] # drop a ``:free``/``:nitro`` variant suffix
+ return _squash(tail) in STARRED_MODELS
+
+
+@dataclass(frozen=True, slots=True)
+class ModelTags:
+ """Presentation-only classification of one model for the picker's filters.
+
+ Four independent booleans (a model can be both ``value`` and ``free``), so
+ there is no enum to drift across the Python↔TS boundary — just flags the UI
+ renders as chips/stars. None of them gate behavior (AP-21)."""
+
+ free: bool
+ frontier: bool
+ value: bool
+ starred: bool
+
+
+def classify_model(model_id: str, label: str = "") -> ModelTags:
+ """Tag a model for the picker's filter chips + star, REUSING the family
+ relevance ranking so the chips never drift from the displayed list order."""
+ rank = _family_rank(model_id)
+ return ModelTags(
+ free=is_free_model(model_id, label),
+ frontier=rank >= FRONTIER_RANK_FLOOR,
+ value=VALUE_RANK_FLOOR <= rank < FRONTIER_RANK_FLOOR,
+ starred=is_starred_model(model_id),
+ )
+
+
# Variant markers that demote a model WITHIN its family — smaller/cheaper or
# special-purpose siblings rarely wanted as the default pick. The full flagship
# (incl. ``-pro``) is NOT demoted.
diff --git a/jarvis/ui/web/provider_routes.py b/jarvis/ui/web/provider_routes.py
index 41154ed891..00c2d84ed7 100644
--- a/jarvis/ui/web/provider_routes.py
+++ b/jarvis/ui/web/provider_routes.py
@@ -25,7 +25,7 @@ from pydantic import BaseModel, Field
from jarvis.brain import provider_test as _provider_test
from jarvis.brain import section_health as _section_health
-from jarvis.brain.model_catalog import catalog_spec
+from jarvis.brain.model_catalog import ModelInfo, catalog_spec, classify_model
from jarvis.codex_auth import CodexAuthService
from jarvis.core import config as cfg_mod
from jarvis.core.events import SecretConfigured
@@ -121,6 +121,15 @@ CatalogSourceLiteral = Literal["live", "cache", "static", "curated"]
class BrainModelInfo(BaseModel):
id: str
label: str
+ # Presentation-only classification for the picker's filter chips + star
+ # (jarvis.brain.model_catalog.classify_model). Independent booleans — never
+ # gate behavior (AP-21). ``free`` = zero-cost (OpenRouter ``:free``);
+ # ``frontier`` = flagship band; ``value`` = strong price/performance band;
+ # ``starred`` = a maintainer-picked favourite.
+ free: bool = False
+ frontier: bool = False
+ value: bool = False
+ starred: bool = False
class BrainModelsResponse(BaseModel):
@@ -868,6 +877,20 @@ def _current_selection(cfg: Any, provider_id: str, cat: Any) -> str:
return ""
+def _brain_model_info(m: ModelInfo) -> BrainModelInfo:
+ """Wire a catalog ``ModelInfo`` into the API model, attaching the
+ presentation-only filter/star tags from ``classify_model``."""
+ tags = classify_model(m.id, m.label)
+ return BrainModelInfo(
+ id=m.id,
+ label=m.label,
+ free=tags.free,
+ frontier=tags.frontier,
+ value=tags.value,
+ starred=tags.starred,
+ )
+
+
@router.get("/providers/{provider_id}/models")
async def list_brain_models(
provider_id: str, request: Request, refresh: bool = False
@@ -892,7 +915,7 @@ async def list_brain_models(
return BrainModelsResponse(
provider=provider_id,
current_model=current,
- models=[BrainModelInfo(id=m.id, label=m.label) for m in result.models],
+ models=[_brain_model_info(m) for m in result.models],
source=result.source,
fetched_at=result.fetched_at,
selects=result.selects,
diff --git a/tests/unit/brain/test_model_catalog.py b/tests/unit/brain/test_model_catalog.py
index f881555a66..f3470d25e2 100644
--- a/tests/unit/brain/test_model_catalog.py
+++ b/tests/unit/brain/test_model_catalog.py
@@ -24,7 +24,10 @@ from jarvis.brain.model_catalog import (
ModelCatalog,
ModelInfo,
catalog_spec,
+ classify_model,
filter_brain_models,
+ is_free_model,
+ is_starred_model,
parse_models_response,
sort_models,
)
@@ -581,3 +584,60 @@ class TestListModels:
"gemini",
"openrouter",
}
+
+
+# ----------------------------------------------------------------------
+# Presentation-only classification — the picker's filter chips + star
+# ----------------------------------------------------------------------
+
+class TestModelClassification:
+ def test_free_model_detected_by_id_suffix(self) -> None:
+ assert is_free_model("nvidia/nemotron-3-ultra:free") is True
+ assert is_free_model("openai/gpt-5.5") is False
+
+ def test_free_model_detected_by_label(self) -> None:
+ # Some catalogs only mark "(free)" in the human label.
+ assert is_free_model("vendor/x", "Vendor X (free)") is True
+
+ def test_starred_matches_across_provider_id_shapes(self) -> None:
+ # The same pick is starred whether it is a direct-provider id or an
+ # OpenRouter namespaced id — separator/punctuation differences and all.
+ assert is_starred_model("claude-opus-4-8") is True
+ assert is_starred_model("anthropic/claude-opus-4.8") is True
+ assert is_starred_model("claude-fable-5") is True
+ assert is_starred_model("openai/gpt-5.5") is True
+ assert is_starred_model("gemini-3.5-flash") is True
+ assert is_starred_model("z-ai/glm-5.2") is True
+
+ def test_starred_is_exact_so_siblings_are_not_starred(self) -> None:
+ # Only the named base picks are starred — not their mini/pro siblings.
+ assert is_starred_model("openai/gpt-5.5-pro") is False
+ assert is_starred_model("openai/gpt-5.5-mini") is False
+ assert is_starred_model("z-ai/glm-4.6") is False
+
+ def test_starred_survives_a_free_variant_suffix(self) -> None:
+ assert is_starred_model("z-ai/glm-5.2:free") is True
+
+ def test_classify_flagship_is_frontier_not_value(self) -> None:
+ tags = classify_model("anthropic/claude-opus-4.8", "Claude Opus 4.8")
+ assert tags.frontier is True
+ assert tags.value is False
+ assert tags.starred is True
+ assert tags.free is False
+
+ def test_classify_strong_value_family_is_value_not_frontier(self) -> None:
+ tags = classify_model("deepseek/deepseek-v3.2", "DeepSeek V3.2")
+ assert tags.value is True
+ assert tags.frontier is False
+
+ def test_classify_free_and_value_are_independent(self) -> None:
+ # A model can be BOTH a value-band family AND free at once.
+ tags = classify_model("z-ai/glm-5.2:free", "Z.AI: GLM 5.2 (free)")
+ assert tags.free is True
+ assert tags.value is True
+
+ def test_classify_unknown_family_has_no_band(self) -> None:
+ tags = classify_model("sao10k/some-community-finetune")
+ assert tags.frontier is False
+ assert tags.value is False
+ assert tags.starred is False