feat(rank): personalized ranking that learns from your clicks (D1)#65
Merged
Conversation
Initialize OpenSpec for the desktop repo (config.yaml with the project context, Claude commands/skills) and scaffold the validated add-click-personalization change (proposal, design, specs, tasks) for the adaptive click-personalized ranking feature. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Add an opt-in, on-device learning layer that nudges ranking from the owner's own result clicks and improves the more they search, while honoring the store-nothing, owner-safe privacy posture. - engines/rank/personalize.py: a Beta-Bernoulli per-domain and per-(query-term x domain) click model fed by the position-bias-resistant "clicked over skipped-above" signal. Bounded multiplicative boost (clamped 0.5x to 2x), epsilon-greedy exploration, cold-start gates, and time decay so it never collapses result diversity or acts on weak evidence. Serializes to a portable JSON model (beta_bernoulli_v1) shared with the Android app. - data/personalization_store.py: persists the model encrypted in the vault (key ranking.personalization), fail-soft and absent under a locked or zero-knowledge vault, like ranking rules. - Apply pass runs between sort_results and apply_ranking, so explicit pin/raise/lower/block rules always win. In the served path it applies only for the loopback owner; network visitors get the un-personalized order and never train the model. The MCP scope is untouched. - Native GUI clicks train the model via a new ResultsView.resultActivated signal and the displayed result order. - Opt-in and recommended: a setup-wizard step and a Result-ranking settings toggle, plus Export / Import / Reset of the portable model. - The setup wizard now re-appears once after a feature update (framed as "What's new") via an onboarding_version gate, so existing users discover new opt-in features. Gate green: ruff + ruff format + mypy + 547 pytest. Scaffolds the add-click-personalization OpenSpec change (desktop repo adopts OpenSpec). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Adds an opt-in, on-device learning layer that nudges ranking from the owner's own result clicks and gets better the more they search, without breaking the store-nothing, owner-safe privacy posture or parity with the Android app. This is PR D1 of the feature (core model + native-app learning + opt-in UI); a follow-up D2 adds owner-only learning from the served browser page, then the Android parity PRs.
This PR also adopts OpenSpec for the desktop repo and scaffolds the validated
add-click-personalizationchange (proposal / design / specs / tasks).Algorithm
beta_bernoulli_v1) with byte-identical keys/floats so it interops with the upcoming Android port.Privacy / safety
ranking.personalization); absent without error under a locked or zero-knowledge vault, like ranking rules.Also
onboarding_versiongate, so existing users discover new opt-in features instead of only fresh installs seeing them.Tests
ruff+ruff format+mypyclean; 547 pytest passed (25 new: model math/skip-above/decay/caps/clamp/cold-start/epsilon/JSON round-trip, vault store round-trip, settings + wizard persistence, and a served-route owner-vs-network gating test).🤖 Generated with Claude Code