You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat(hooks): Replace SessionStart file-list loop with ranker (#78)
* feat(hooks): Replace SessionStart file-list loop with ranker
Replace the per-file list_decisions loop in on_session_start_decisions
with a single rank_related_decisions call that uses all five signals:
file paths, uncommitted diff (truncated 8192 bytes), recent commit SHAs,
recent assessment IDs (configurable lookback window), and quality score.
Add _get_uncommitted_diff and _get_recent_commit_shas helpers. Score
breakdown is included in Markdown via _format_decision_entry. No
fallback — ranker has internal padding via _MIN_CANDIDATE_THRESHOLD.
New config key: decisions.assessment_lookback_hours (default 48).
Refs GH-72
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* fix(hooks): Normalize file paths before passing to ranker
Git-relative paths (e.g. src/app.py) must be normalized via
_normalize_path before passing to rank_related_decisions, which uses
exact/proximity matching against stored decision_files paths. Without
normalization, decisions linked with absolute or ./-prefixed paths
would not match.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* docs(test): Update stale docstring for ranker-based SessionStart
The docstring referenced the removed per-file list_decisions loop
and its 10-row cap. Updated to describe the current rank_related_decisions
behavior with include_contradicted=False.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Copy file name to clipboardExpand all lines: CHANGELOG.md
+1Lines changed: 1 addition & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -13,6 +13,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
13
13
14
14
### Added
15
15
16
+
-**Relevance-based SessionStart reactivation** (#72) — SessionStart hook now uses `rank_related_decisions()` with full multi-signal ranking (file paths, uncommitted diff, recent commit SHAs, assessment IDs) instead of the per-file `list_decisions()` loop. Score breakdown is included in Markdown output. Assessment signal lookback is configurable via `decisions.assessment_lookback_hours` (default 48).
16
17
-**Retrieval telemetry completeness** (#70) — PostToolUse and SessionStart hooks now record per-decision `retrieval_selections` rows alongside the existing `retrieval_events` row, threading `selection_id` into Markdown fallback files. `record_retrieval_event` and `record_retrieval_selection` in `core/telemetry.py` accept a `commit` parameter (default `True`) so hook callers can defer commits for atomicity.
17
18
-**Extraction noise gate and confidence threshold** (#71) — `maybe_extract_decisions` now checks session quality before launching the extraction worker: sessions must have at least 1 checkpoint OR a configurable minimum number of turns with `files_touched` (`decisions.noise_gate_min_turns_with_files`, default 3). Additionally, `run_extraction` filters candidates below `decisions.candidate_min_confidence` (raised from 0.0 to 0.35) before persistence, preventing low-quality session-source candidates with no rationale or alternatives from entering the candidate pipeline.
18
19
-**Contract-sync drift guards** — `tests/test_contract_sync.py` asserts `mcp/server.__all__` matches what `register_tools()` actually registers (driven by AST extraction of `server.py`'s module tuple, not a hardcoded copy), that every `ec_*` tool is present in the README `### Available Tools` section bidirectionally (catches stale rows as well as missing rows), that `decision_hooks` fallback filename constants are documented in README, and that the current `SCHEMA_VERSION` is cross-referenced in a CHANGELOG paragraph that also mentions "schema". Replaces `tests/test_mcp_registration.py`, whose hardcoded expected set had silently drifted (its registration loop omitted `tools.decision_candidates` and its expected set omitted the four candidate tools, so it passed via symmetric drift — the exact failure mode the v0.2.0 retrospective finding #2 named).
0 commit comments