Skip to content

night-shift: interest-trend detector over ingestion timestamps - #4

Merged
syzayd merged 1 commit into
masterfrom
night-shift/2026-07-16
Jul 19, 2026
Merged

night-shift: interest-trend detector over ingestion timestamps#4
syzayd merged 1 commit into
masterfrom
night-shift/2026-07-16

Conversation

@syzayd

@syzayd syzayd commented Jul 17, 2026

Copy link
Copy Markdown
Owner

What

Adds memory/interest_trends.py: an interest-trend detector over ingestion
timestamps, plus a trends CLI 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 real MemoryStore.
  • Same "detect candidates, never interpret" contract as second-brain's
    near_dup.py/contradictions.py; no personal_llm.router import, so it stays
    fully offline.
  • Wires a trends CLI command (--window-days/-k options), same shape as the
    existing review command.
  • README: documents the trends command under "What it does", bumps the
    test-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 keyword
extraction including stopword/short-word filtering, rising/fading deltas, the
min_count filter, the 2x-window exclusion cutoff, the exact window-boundary
edge case, the k limit, tie-breaking, and a real MemoryStore integration
test). Full requirements.txt install on a Python 3.12 venv, fully offline, no
API key needed.

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).
@syzayd
syzayd merged commit 4e2fa5d into master Jul 19, 2026
1 check passed
@syzayd
syzayd deleted the night-shift/2026-07-16 branch July 19, 2026 09:25
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