feat(sona): complete state persistence — loadState() restores patterns (#274)#285
Merged
feat(sona): complete state persistence — loadState() restores patterns (#274)#285
Conversation
#274) Completes #274 by adding the load path for SONA state persistence: - ReasoningBank.insert_pattern(): directly insert a pattern (for restore) - LoopCoordinator.load_state(json): deserialize and restore patterns - NAPI loadState(stateJson): binding for Node.js - TypeScript loadState(stateJson): wrapper with return count Full save/load cycle now works: const state = engine.saveState(); // serialize patterns to JSON // ... restart ... const restored = engine.loadState(state); // restore N patterns serialize_state() now includes full pattern data (centroids, quality, cluster sizes) not just counts. Co-Authored-By: claude-flow <ruv@ruv.net>
ruvnet
added a commit
that referenced
this pull request
Mar 23, 2026
- 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
Completes #274 by implementing the load path for SONA state persistence.
What was missing
PR #284 added
saveState()but noloadState(). SONA could serialize its learned patterns but couldn't restore them after a restart.What this PR adds
insert_pattern()load_state(json)serialize_state()loadState(stateJson)loadState(stateJson)Full save/load cycle
What's still needed (follow-up)
Files Changed
crates/sona/src/reasoning_bank.rsinsert_pattern()crates/sona/src/loops/coordinator.rsserialize_state()+load_state()crates/sona/src/napi.rsloadState()NAPI bindingnpm/packages/ruvector/src/core/sona-wrapper.tsloadState()wrapperCloses #274
🤖 Generated with claude-flow