gabriel / muse public
feat patch feat/53-symlog-analytics #1 / 1
AI Agent gabriel · 12 hours ago · Oct 22, 2026 · Diff

feat: muse#53 item 1 — muse symlog hotspots and coupling

Adds two zero-scan analytics commands reading purely from the already-written symlog journal (no commit-history walk), always up to date unlike their `muse code` counterparts:

- `muse symlog hotspots [--top N] [--file path] [--json]` — ranks symbols by churn (count of symbol-modified entries; creation/ deletion/rename don't count toward ongoing-edit churn). - `muse symlog coupling [--file path] [--min N] [--top N] [--json]` — finds symbol pairs whose journals share commit IDs (a commit touched both), ranked by shared-commit count. Default --min 2 excludes the near-universal single-shared-commit case (e.g. both symbols created in the same initial commit) as noise, mirroring `muse code coupling`'s own --min default.

Core additions in muse/core/symlog.py: compute_symlog_hotspots() and compute_symlog_coupling(), both O(symbols × entries) reading read_symlog() per symbol — no AST diffing or object-store reads needed since only commit_id/operation fields matter here (unlike `symlog grep`'s body reconstruction).

Covered by tests/test_cmd_symlog_analytics.py (8 cases: hotspots ranks by modification count correctly, creation-only symbols excluded, --file scoping, --top limiting; coupling finds a pair that changed together, below---min pairs excluded, --min lowers the threshold, empty repo reports zero). Confirmed genuine RED by reverting both changed files and re-running (all 8 failed with JSONDecodeError, since neither 'hotspots' nor 'coupling' were recognized dispatch keywords), then GREEN with the fix restored plus the full symlog regression suite (249 tests, zero regressions). Live-verified via muse-dev against a disposable /tmp sandbox (hotspots correctly ranked both modified symbols; coupling correctly found their 2-shared-commit pairing).

Co-Authored-By: Claude Sonnet 5 <[email protected]>

sha256:27434566e7da9dcad9f8462bfaaedc20c606ee91864783bbda6c28b7380f77de sha
+33 ~18 symbols
4 changed · 1238 in snapshot files
sha256:a5d4fdeb52584df14ef97ea542ca3dd998a0c85fc08879c72c8918544dd32bb7 snapshot
+33
symbols added
~18
symbols modified
4
files changed
1238
files in snapshot
0
dead code introduced
Semantic Changes 51 symbols
~ tests/test_cmd_symlog_analytics.py .py 23 symbols added
+ TestSymlogCoupling class class TestSymlogCoupling L129–182
+ test_below_min_threshold_excluded method method test_below_min_threshold_excluded L153–164
+ test_finds_symbols_that_change_together method method test_finds_symbols_that_change_together L130–151
+ test_min_flag_lowers_threshold method method test_min_flag_lowers_threshold L166–176
+ test_no_coupling_in_empty_repo method method test_no_coupling_in_empty_repo L178–182
+ TestSymlogHotspots class class TestSymlogHotspots L61–126
+ test_creation_only_excluded method method test_creation_only_excluded L90–97
+ test_file_scoping method method test_file_scoping L99–111
+ test_ranks_by_modification_count method method test_ranks_by_modification_count L62–88
+ test_top_limits_results method method test_top_limits_results L113–126
+ _commit function function _commit L39–49
+ _init_repo function function _init_repo L28–30
+ _invoke function function _invoke L19–25
+ _make_repo function function _make_repo L52–54
+ _symlog function function _symlog L57–58
+ _write_file function function _write_file L33–36
+ CliRunner import import CliRunner L14–14
+ annotations import import annotations L7–7
+ json import import json L9–9
+ os import import os L10–10
+ pathlib import import pathlib L11–11
+ textwrap import import textwrap L12–12
+ runner variable variable runner L16–16
~ muse/cli/commands/symlog.py .py 8 symbols added, 15 symbols modified
+ _CouplingPairJson class class _CouplingPairJson L209–212
+ _HotspotEntryJson class class _HotspotEntryJson L195–197
+ _HotspotsJson class class _HotspotsJson L200–206
+ _SymlogCouplingJson class class _SymlogCouplingJson L215–222
+ compute_symlog_coupling import import compute_symlog_coupling L88–88
+ compute_symlog_hotspots import import compute_symlog_hotspots L88–88
+ run_coupling function function run_coupling L1033–1093
+ run_hotspots function function run_hotspots L973–1025
~ run
~ muse/core/symlog.py .py 2 symbols added
+ compute_symlog_coupling function function compute_symlog_coupling L809–856
+ compute_symlog_hotspots function function compute_symlog_hotspots L767–806
Files Changed
+1 ~3
1238 in snapshot
← Older Oldest on feat/53-symlog-analytics
All commits
Newer → Latest on feat/53-symlog-analytics

0 comments

No comments yet. Be the first to start the discussion.

To add a comment, use the Muse CLI: muse hub commit comment sha256:27434566e7da9dcad9f8462bfaaedc20c606ee91864783bbda6c28b7380f77de --body "your comment"