gabriel / muse public
refactor BREAKING harmony task/harmony-decompose #8 / 13
AI Agent gabriel · 113 days ago · May 22, 2026 · Diff

refactor(harmony): Phase 5 — extract resolutions.py

Move resolution CRUD and GC out of the harmony god-object into a focused muse/core/harmony/resolutions.py.

- resolutions.py: _MAX_RESOLUTION_BYTES, _resolution_to_dict, _dict_to_resolution, save_resolution, load_resolution, list_resolutions, increment_applied_count, best_resolution, gc_stale (250 lines) - __init__.py: re-exports all extracted symbols; duplicated bodies removed

707/707 harmony tests green.

sha256:1878da37bc07f1961cafe0f911bd4d538d1572cd18db3222e50d884612f4960e sha
+45 −9 symbols
sha256:5bb9a9314954a88975054754e89e7bae0dec860ce46b8ecbf931a188730ccd96 snapshot
+45
symbols added
−9
symbols removed
0
dead code introduced
Semantic Changes 54 symbols
~ muse/core/harmony/resolutions.py .py 36 symbols added
+ _MAX_RESOLUTION_BYTES variable variable _MAX_RESOLUTION_BYTES L40–40 ← moved from muse/core/harmony/__init__.py
+ _dict_to_resolution function function _dict_to_resolution L61–79 ← moved from muse/core/harmony/__init__.py
+ _resolution_to_dict function function _resolution_to_dict L46–59 ← moved from muse/core/harmony/__init__.py
+ best_resolution function function best_resolution L254–266
+ gc_stale function function gc_stale L272–310
+ AgentProvenance import import AgentProvenance L30–30
+ JsonValue import import JsonValue L18–18
+ Mapping import import Mapping L15–15
+ Resolution import import Resolution L30–30
+ ResolutionStrategy import import ResolutionStrategy L30–30
+ _BARE_HEX64_RE import import _BARE_HEX64_RE L21–21
+ _PATTERN_FILE import import _PATTERN_FILE L21–21
+ _ResolutionDict import import _ResolutionDict L30–30
+ _now_utc import import _now_utc L20–20
+ _parse_dt import import _parse_dt L20–20
+ _pattern_entry_dir import import _pattern_entry_dir L21–21
+ _resolution_path import import _resolution_path L21–21
+ _resolutions_dir import import _resolutions_dir L21–21
+ _validate_id import import _validate_id L21–21
+ _write_atomic import import _write_atomic L29–29
+ annotations import import annotations L9–9
+ datetime import import datetime L11–11
+ dc_replace import import dc_replace L16–16
+ forget_pattern import import forget_pattern L29–29
+ json import import json L12–12
+ list_patterns import import list_patterns L29–29
+ load_json_file import import load_json_file L18–18
+ logging import import logging L13–13
+ long_id import import long_id L18–18
+ pathlib import import pathlib L14–14
+ short_id import import short_id L18–18
+ increment_applied_count function function increment_applied_count L224–252
+ list_resolutions function function list_resolutions L182–222
+ load_resolution function function load_resolution L132–180
+ logger variable variable logger L37–37
+ save_resolution function function save_resolution L85–130 ← moved from muse/core/harmony/__init__.py
~ muse/core/harmony/__init__.py .py 9 symbols added, 9 symbols removed
_MAX_RESOLUTION_BYTES variable variable _MAX_RESOLUTION_BYTES L183–183 → moved to muse/core/harmony/resolutions.py
_dict_to_resolution function function _dict_to_resolution L219–237 → moved to muse/core/harmony/resolutions.py
_resolution_to_dict function function _resolution_to_dict L204–217 → moved to muse/core/harmony/resolutions.py
best_resolution function function best_resolution L460–473
gc_stale function function gc_stale L479–519
increment_applied_count function function increment_applied_count L430–458
list_resolutions function function list_resolutions L387–428
load_resolution function function load_resolution L338–385
save_resolution function function save_resolution L291–336 → moved to muse/core/harmony/resolutions.py
+ _MAX_RESOLUTION_BYTES import import _MAX_RESOLUTION_BYTES L125–125
+ _dict_to_resolution import import _dict_to_resolution L125–125
+ _resolution_to_dict import import _resolution_to_dict L125–125
+ best_resolution import import best_resolution L125–125
+ gc_stale import import gc_stale L125–125
+ increment_applied_count import import increment_applied_count L125–125
+ list_resolutions import import list_resolutions L125–125
+ load_resolution import import load_resolution L125–125
+ save_resolution import import save_resolution L125–125

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:1878da37bc07f1961cafe0f911bd4d538d1572cd18db3222e50d884612f4960e --body "your comment"