feat(brain): auto-persist SONA state to Firestore after training (#274)#286
Open
feat(brain): auto-persist SONA state to Firestore after training (#274)#286
Conversation
- After each training cycle, if patterns exist, persist SONA stats to Firestore collection 'sona_state' (doc 'latest') - On startup, check Firestore for persisted state and log - Full pattern restore (load_state) will activate once sona >= 0.1.8 merges (PR #285) This ensures SONA learning survives Cloud Run deploys by writing to durable storage after every train cycle (every 5 minutes). Co-Authored-By: claude-flow <ruv@ruv.net>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Wires SONA state persistence into the brain server's training cycle and startup, completing the server-side integration for #274.
Changes
After each training cycle (
run_training_cycle):sona_state/latest)brain-trainschedulerOn startup (
create_router):load_state())Dependency
This PR works now but full pattern-level persistence requires:
loadState()+insert_pattern()) to merge firstcoordinator().load_state(json)on startupWhat this solves
Before: Every Cloud Run deploy reset SONA to 0 patterns.
After: SONA stats auto-saved to Firestore every 5 min. Once PR #285 merges, patterns will be fully restored on cold start.
Contributes to #274
🤖 Generated with claude-flow