8000 feat(timeline): a For you order learned from each person's reactions, comments and marks, each item saying why by adeelahmad · Pull Request #631 · adeelahmad/lense · GitHub
[go: up one dir, main page]

Skip to content

feat(timeline): a For you order learned from each person's reactions, comments and marks, each item saying why - #631

Merged
adeelahmad merged 2 commits into
mainfrom
claude/project-thread-pf8kii
Oct 18, 2026
Merged

adeelahmad merged 2 commits into
mainfrom
claude/project-thread-pf8kii

Conversation

@adeelahmad
Copy link
Copy Markdown
Owner

Requested by Adeel · project thread

Description

Before: the timeline had one order, newest first. Someone who reacts to a few sources and hides others still read everything in the order it came, and nothing in Lens learned from what they did.

After: next to Latest, the Timeline page has a For you order that puts what you care for most first, learned from your own reactions (+1), comments (+2), important marks (+2) and hidden marks (−3), each summed over the actor, the kind and the tagged entities of the item it was on. An item's score is its recency (halving every two days) times 1 + tanh(affinity ÷ 4), so a strong affinity doubles its score and a strongly negative one halves it. A line under each item it placed says why ("You often react to Work Gmail", "About St Mary's School, which you often react to", "You hid items from Dropbox before"). Latest stays the default; the choice lives in the address (?order=for_you) like a filter, and with no signals yet the page says For you is the same as Latest. Nobody else's signals touch your order, no model is called, and nothing is stored.

How: domain/for_you.py reads the person's most recent 200 signals of each kind in three small queries, looks the activities up once (events.get_many), sums the weights per actor, kind and entity, and scores a page's worth of the newest items (the 200 newest from before on, the best limit shown; next moves past the window). GET /api/v1/activities?order=for_you returns why by id; the MCP timeline tool and the assistant's timeline take order too, the assistant listing each item's why. The Timeline page gets the Latest / For you segmented control, the why line under rows, and carries why through the "N new" pill.

Motivation and Context

Step 6 of the activity stream design (thread above): "For you ranking learned cheaply from reactions, comments and marks, explainable, with a Latest toggle". Follows #570, #622 and #627.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change; ! in the title)

Checklist:

  • The title is a Conventional Commit.
  • My code follows the code style of this project (make hooks checks it on commit).
  • I added or updated tests.
  • My change requires documentation updates, and I have updated docs/ accordingly.
  • Users need more than the title to understand it, so I wrote it as a fragment in changelog.d/ (for-you.md).

Done questions (AGENTS.md)

  • Goal: a For you order people and agents can read, explained per item, with Latest unchanged; merged on green CI.
  • Agents: order=for_you on GET /api/v1/activities, on the MCP timeline tool and on the assistant's timeline, with why.
  • Zero setup: learned from what the person already does; nothing to configure.
  • Fewest clicks: one click on For you, remembered in the address with the filters; nothing to rate or train.
  • Configurable: n/a, no new setting; the weights and half-life are constants in for_you.py (refine later: a setting if anyone asks).
  • Light: three small queries, one activity look-up and arithmetic per page; no model call.
  • Private and secure: each person's order comes from their own reactions, comments and marks alone, which only they can see, over activities they can already read. No new surface for the threat model.
  • Cost: no model call; nothing in the ledger to log.
  • User decides: n/a, nothing acts; Latest stays the default and hidden items stay out of the page as before.
  • Upgrades: nothing stored; no migration.
  • Honest: docs/timeline.md's status table lists For you as built with how it is scored; the README's built line names it; the page says when it is still the same as Latest.
  • Tested and documented: test_timeline_for_you.py (ranking, why, hidden sinks, paging, MCP, assistant), jest timeline-model.test.ts (order as a view) and timeline-ui.test.tsx (toggle, why line, default); docs timeline.md (For you section), mcp.md, assistant.md, requirements.md, changelog.d; make openapi regenerated the client.
  • Open standards: the same Activity Streams 2.0 page; no new dependency.
  • Reported: result goes back in the thread; refine later: count opens, cache affinity for a minute, per-source mute.
  • Reuse: events.page and get_many, the marks, reactions and comments tables as they are, the page's filters-in-the-address and the Segmented control; no new machinery.

Local CI (ci/local-ci.sh) on this head: see the thread; CI on the PR decides the merge.


Generated by Claude Code

… comments and marks, each item saying why

Latest stays the default; order=for_you on GET /api/v1/activities, the MCP timeline tool and the assistant reorders the 200 newest items by recency times the person's own affinity for each item's actor, kind and entities, with why by id, and the Timeline page gets a Latest / For you toggle with the why line under each placed item. No model call, nothing stored.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Ln25ykE6uBDqx21WBU94SX
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

0