Open
Conversation
Contributor
kimlimjustin
commented
Mar 24, 2026
- Replace per-call JSON disk reads with mtime-based immutable snapshot cache in ProfileStore._read() — callers get the same dict reference instead of a copy.deepcopy clone
- Add indexed get_todo() that normalizes only the matched item instead of all todos
- Cache normalized todo list per snapshot version so list_todos() skips re-normalization across 15+ calls per autopilot cycle
- Skip re-normalizing all 2000 existing audit entries in record_audit() — only normalize the new entry
- Batch audit lookup in process_supervisor_review_queue() — one scan builds a set, replacing N per-todo 200-entry scans with O(1) membership checks
Replace copy.deepcopy in _read() with an mtime-based immutable snapshot cache that returns the same dict reference on cache hits, eliminating O(n) deep copies on every access. Update _write() to refresh the cache after writes and invalidate the normalized todo cache. Rename dead-code list_todos to _list_todos_unlocked (fixing missing method bug) and add a per-snapshot normalized todo cache that avoids re-normalizing all todos on repeated list_todos calls within the same snapshot. Replace _get_todo_unlocked with a direct linear scan that normalizes only the matched item, avoiding full-list normalization for single lookups.
Stop calling normalize_audit_entry on every existing audit log entry when appending a new one. Only the new entry needs normalization; existing entries were already normalized when they were first recorded. Reduces record_audit from O(n) normalization passes to O(1).
Replace per-todo audit lookups in process_supervisor_review_queue with a single batch query that builds a set of already-reviewed todo IDs upfront. This reduces audit log reads from O(n) per completed todo to a single O(1) set-membership check, eliminating redundant list_audit_logs calls in the autopilot loop.
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.