Skip to content

feat: persist reflection-daily cron job JSON file on disk#179

Merged
avoidwork merged 1 commit into
mainfrom
feat/fix-reflection-daily-cron-persistence
Jun 12, 2026
Merged

feat: persist reflection-daily cron job JSON file on disk#179
avoidwork merged 1 commit into
mainfrom
feat/fix-reflection-daily-cron-persistence

Conversation

@avoidwork

@avoidwork avoidwork commented Jun 12, 2026

Copy link
Copy Markdown
Owner

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

  • Bugfix (non-breaking change which fixes an issue)

Testing

Ran the full test suite: 1067 tests pass. Added 2 new unit tests in `tests/unit/autoSchedule.test.js`:

  1. Writes `reflection-daily.json` to `memory/schedules/` with correct fields (name, cron, command, enabled, timestamps)
  2. Skips writing if the file already exists (idempotent)

Coverage

  • 100% line coverage maintained

Checklist

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

- 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).
@avoidwork avoidwork self-assigned this Jun 12, 2026
@avoidwork avoidwork merged commit f072ede into main Jun 12, 2026
3 checks passed
@avoidwork avoidwork deleted the feat/fix-reflection-daily-cron-persistence branch June 12, 2026 00:56
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