feat: persist reflection-daily cron job JSON file on disk#179
Merged
Conversation
- Write memory/schedules/reflection-daily.json when Cron.add() succeeds in autoSchedule callback (after profile creation) - Write the same JSON file during startup in index.js (covers upgrading users who never went through onboarding) - Idempotency guard: skip writing if file already exists - Update autoSchedule.test.js with 2 new tests for JSON persistence Fixes: spec requirement that reflection-daily.json be written to memory/schedules/ on first-time profile creation (tasks 1.3 & 1.5).
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.
Description
Per `openspec/specs/auto-reflection-schedule/spec.md`, the system SHALL write `memory/schedules/reflection-daily.json` on first-time profile creation. This was declared done in tasks but never implemented — `autoSchedule.js` only called `Cron.add()` to write to the system crontab. The JSON file was never persisted, meaning `Cron.sync()` had nothing to read on restart.
This change implements the missing persistence: both the auto-schedule callback (after profile creation) and the startup flow (for upgrading users) now write the job definition as a JSON file.
Type of Change
Testing
Ran the full test suite: 1067 tests pass. Added 2 new unit tests in `tests/unit/autoSchedule.test.js`:
Coverage
Checklist