Repository navigation
v0.3.0 — Trajectory, Feedback, Companion Dashboard
What's new
Contextual query construction
The hook no longer treats each prompt in isolation. build_contextual_query() blends the current message embedding with up to 5 recent query embeddings using exponential decay weighting. Context weight is capped (default 0.4, structural ≥60% current dominance) and adjusts based on trajectory signal — converging conversations narrow context, diverging ones widen it. Graceful fallback when insufficient history.
Semantic trajectory tracking
Frenet-Serret local curvature (delta-kappa) computed over accumulated query embeddings. Outputs a trajectory signal: converging, diverging, stable, or insufficient_data. Anti-entrainment override: when converging + narrow results, the diversity pool widens automatically. Trajectory persists across hook invocations via file-locked numpy buffer.
Relevance feedback and auto-labelling
Every result surfaced by the hook is auto-labelled (useful or noise) based on similarity threshold. Human corrections via the dashboard write corrected:<user> entries. Labels feed into Bayesian relevance weights (prior=2.0) with latest-wins semantics per (file, query) pair. Append-only storage preserves full audit trail.
Companion dashboard (SPEC-003)
Local web app (dashboard/serve.py + dashboard/index.html) on port 8111. No external dependencies beyond stdlib. Renders:
- Hit rate hero metric (session-scoped, colour-coded health thresholds)
- Query timeline with expandable results (file path, section, score, source type, label)
- Trajectory signal with delta-kappa values
- Feedback stream (auto-labels + human corrections)
Click any result label to correct it. Auto-starts/stops via Claude Code session hooks.
Hook unification
Discovered and fixed: two separate hooks (sense-auto-query.py and hook.py) maintained separate state files, leaving the SPEC-001/SPEC-003 pipeline dead for all Claude Code invocations. Single entry point sense-mcp-hook now handles everything via shared session state at /tmp/sense-session-state.json.
Audit fixes
- P0:
ro_connNameError in hook.py silently killed auto-labelling/trajectory/ambient search (swallowed byexcept Exception: pass) - COALESCE/GROUP BY mismatch in serve.py and feedback.py
- Per-line JSONDecodeError handling in trajectory reader
build_contextual_query()return signature changed to(embedding, metadata)tuple
Stats
- 188 tests, 0 failures
- 6 commits since v0.2.0
Full Changelog: v0.2.0...v0.3.0