feat(phase5): sentiment tagging + adaptive sleep intelligence#136
Merged
Conversation
- Memory Sentiment Tagging (F6): infer urgency/sentiment/session_type from content at add and consolidation time. New context_signals JSONB column on hot_tier and warm_tier. During consolidation, signals from all contributing hot rows are merged: urgency = max, sentiment = majority, session_type = majority. query() returns context_signals on each QueryResult. New types UrgencyLevel, SentimentTag, SessionType, ContextSignals. - Adaptive Sleep Intelligence (F5): per-phase telemetry in new sleep_phase_analytics table. Two new methods on SleepCycleEngine: recordPhaseAnalytics() and shouldSkipPhase() (skips phases whose last 3 runs had zero changes_made). Index + RLS policy included. Migration: schema/migration-v3.8.sql (idempotent ADD COLUMN IF NOT EXISTS) Tests: 29 sentiment + 18 adaptive-sleep (unit/integration/migration) Split from #129 (PR-A). Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This was referenced May 21, 2026
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.
Summary
First of six PRs splitting #129 into per-feature units. Ships two independent additive features from Phase 5:
urgency,sentiment,session_typefrom content at write time. Newcontext_signals JSONBcolumn onhot_tierandwarm_tier. Signals merge during consolidation (urgency = max, sentiment/session_type = majority vote).sleep_phase_analyticstable + two public helpers onSleepCycleEngine:recordPhaseAnalytics()andshouldSkipPhase(). Helpers are NOT yet wired into therun()loop — that's a deliberate follow-up so this PR delivers a stable, tested API surface first.Migration:
schema/migration-v3.8.sql.What this is part of
Splitting #129 (Phase 5 mega-PR, 1,348 LOC, no integration tests) into 6 reviewable units. Order:
#129 will be closed as superseded after all six merge.
Test plan
npm run type-check— 0 errorsnpm run build— cleannpm run lint— cleannpm run test:sentiment-tagging— 29/29 pass (18 unit + 4 integration + 2 e2e + 5 migration)npm run test:adaptive-sleep— 18/18 pass (10 unit + 2 integration + 6 migration)npm audit --omit=dev— 0 vulnerabilitiesKnown follow-ups
shouldSkipPhase()+recordPhaseAnalytics()into therun()loop (tracked separately).🤖 Generated with Claude Code