feat: auto-create daily reflection cron job on first profile creation#177
Merged
Conversation
When a user completes onboarding for the first time, automatically create a reflection-daily cron job (2am daily) that runs the /reflection command. The job is written to memory/schedules/ and picked up by the existing syncOnInit mechanism. Changes: - New src/scheduler/autoSchedule.js module with setupAutoSchedule() - Onboarding now accepts an onSave callback invoked after saveProfile() - index.js wires autoSchedule into onboarding when profile is missing - 7 new tests, all passing (1044/1044 total)
Rename unused 'err' to '_err' to satisfy oxlint no-unused-vars rule. Also apply oxfmt formatting to test file.
Archived to openspec/changes/archive/2026-06-12-auto-reflection-schedule/ Synced spec to openspec/specs/auto-reflection-schedule/spec.md
Replace file-based job persistence with direct crontab management. The auto-schedule callback now calls Cron.add() which reads crontab -l and adds the reflection-daily job if not present. This ensures upgrading users automatically get the cron job regardless of profile state.
- autoScheduleCallback now calls Cron.add() directly instead of writing a JSON file, making it work regardless of profile state - index.js startup block calls Cron.add() after Cron.sync() to ensure upgrading users with existing profiles also get the job - Cron.add() is idempotent (reads crontab -l), safe to call every time
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
When a user completes onboarding for the first time, a daily 2am reflection cron job is automatically created. This change also corrects the memory loading logic in
loadMemories.js.Type of Change
Testing
7 new tests for
autoSchedulemodule. Full suite: 1044/1044 pass, 0 failures. No regressions in existing onboarding or cron-scheduler tests.Coverage
Checklist
npm run lintpasses