Skip to content

feat: auto-create daily reflection cron job on first profile creation#177

Merged
avoidwork merged 7 commits into
mainfrom
feat/auto-reflection-schedule
Jun 12, 2026
Merged

feat: auto-create daily reflection cron job on first profile creation#177
avoidwork merged 7 commits into
mainfrom
feat/auto-reflection-schedule

Conversation

@avoidwork

@avoidwork avoidwork commented Jun 11, 2026

Copy link
Copy Markdown
Owner

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

  • New feature (non-breaking change which adds functionality)
  • Bugfix (non-breaking change which fixes an issue)

Testing

7 new tests for autoSchedule module. Full suite: 1044/1044 pass, 0 failures. No regressions in existing onboarding or cron-scheduler tests.

Coverage

  • 100% line coverage maintained

Checklist

  • npm run lint passes
  • Tests pass with 100% line coverage
  • No forbidden patterns used
  • Conventional Commit style applied

@avoidwork avoidwork self-assigned this Jun 11, 2026
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)
@avoidwork avoidwork changed the title docs: add auto-reflection-schedule change proposal feat: auto-create daily reflection cron job on first profile creation Jun 11, 2026
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
@avoidwork avoidwork merged commit 24439d7 into main Jun 12, 2026
2 checks passed
@avoidwork avoidwork deleted the feat/auto-reflection-schedule branch June 12, 2026 00:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant