Calendar operations

Add

  • If the target date file does not exist, create it with the date heading and the new activity block.
  • Include ### Goal and ### Reasoning when creating any new activity block.
  • If the target date file exists, append the new activity in the correct format without rewriting unaffected activities.
  • Do not duplicate an activity that is clearly the same calendar object under a different wording.

Edit

  • Read the current live day file first.
  • When revising an activity materially, update ### Goal and ### Reasoning too if the training purpose or the planning logic changed.
  • Replace stale metadata or section content in place.
  • Keep the same Id when the activity is still the same object after revision.
  • If the activity changed so much that it is no longer the same object, delete the obsolete block and create a new one with a new title and Id.

Delete

  • Remove only the activity blocks that are no longer part of the current plan.
  • Do not leave contradictory remnants behind.
  • Do not leave an active day file empty. If all activities are removed and the day still needs an active planning object, replace the file content with an explicit rest-day object.

Move

  • Read both the source and destination live day files first when both exist.
  • Remove the activity from the source date.
  • Add the activity to the destination date using the destination file date in the Id.
  • Preserve the activity content unless the move instruction also changes the session itself.
  • If the source file becomes empty after the move, either archive it or replace it with an explicit rest-day object, depending on the requested plan state.

Rewrite a day

  • Use a full rewrite only when the day changed materially and piecemeal edits would leave stale or misleading content.
  • Preserve the top-level date heading.
  • Replace the full live day content with the new current planned state.

Archive

  • Archive only when the file should be retained for reference but removed from the active calendar set.
  • Move the file from athlete/calendar/ to athlete/calendar/archives/.
  • Preserve the file content structure.
  • If a same-name file already exists in archives/, rename the moved file with an incremented suffix such as YYYY-MM-DD-1.md, YYYY-MM-DD-2.md, and so on.
  • Archived files are reference artifacts and should be ignored by default in normal calendar reads and writes.