night-shift: interest-trend detector over ingestion timestamps - #4
Merged
Conversation
Tier 4 item #33 (aliased Tier 9 item 77) - personal-llm: interest-trend detector over ingestion timestamps. - Add memory/interest_trends.py: detect_interest_trends(notes) buckets records into two adjacent, equal-length time windows (recent vs. the window right before it) and ranks keywords by frequency delta between them - rising interests (positive delta) and fading ones (negative delta) in one ranked list. Pure frequency counting, no model call, no personal_llm.router import, same "detect candidates, never interpret" contract as second-brain's near_dup.py/contradictions.py. - detect_interest_trends_in_store(store) wraps it over a real MemoryStore. - Wire a `trends` CLI command (window-days/k options), same shape as the existing `review` command. - 11 new tests in tests/test_interest_trends.py (keyword extraction incl. stopword/short-word filtering, rising/fading deltas, min_count filter, the 2x-window exclusion cutoff, the exact window-boundary edge, k limit, tie-breaking, and a real MemoryStore integration test). - README: document the `trends` command under "What it does", bump the test-count badge to 118. Verified: pytest tests/ -q -> 118 passed (was 107), offline, no API key needed (full requirements.txt install, Python 3.12 venv).
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
memory/interest_trends.py: an interest-trend detector over ingestiontimestamps, plus a
trendsCLI command and tests.detect_interest_trends(notes)buckets memory records into two adjacent,equal-length time windows - "recent" and the window right before it - and ranks
keywords by the frequency delta between them. A keyword said much more often
recently is a rising interest; one said much less is fading. Pure frequency
counting (regex tokenize + stopword filter), no clustering, no embeddings, no
model call.
detect_interest_trends_in_store(store)wraps it over a realMemoryStore.near_dup.py/contradictions.py; nopersonal_llm.routerimport, so it staysfully offline.
trendsCLI command (--window-days/-koptions), same shape as theexisting
reviewcommand.trendscommand under "What it does", bumps thetest-count badge to 118.
Why
PROJECT-GENESIS.md sec. 9 Tier 4 item #33 (aliased Tier 9 item 77): "personal-llm:
interest-trend detector over ingestion timestamps".
How verified
pytest tests/ -q-> 118 passed (was 107; 11 new tests covering keywordextraction including stopword/short-word filtering, rising/fading deltas, the
min_countfilter, the 2x-window exclusion cutoff, the exact window-boundaryedge case, the
klimit, tie-breaking, and a realMemoryStoreintegrationtest). Full
requirements.txtinstall on a Python 3.12 venv, fully offline, noAPI key needed.