[loop-cycle-2386] perf: optimize sovereignty loop performance (#1431) #1467
Reference in New Issue
Block a user
Delete Branch "refactor/sovereignty-loop-perf"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Changes
Optimizes
sovereignty_loop.pyfor issue #1431.Optimizations:
auto_crystallizerimports (crystallize_reasoning,get_rule_store) moved to module level. Previously imported insidesovereign_decide()on every call.narration.json. Previously read from disk on everysovereign_narrate()call when notemplate_storewas passed.get_metrics_store()call in@sovereignty_enforceddecorator — extractedsession_idonce and reusedstorereference instead of callingget_metrics_store()twice on the cache-miss path._crystallize_narration_templateupdates the in-memory cache after writing to disk, so subsequent reads skip I/O.Test results:
Closes #1431