123 lines
4.5 KiB
Markdown
123 lines
4.5 KiB
Markdown
---
|
|
name: daily-note-cleanup
|
|
description: Tidy a day's Obsidian daily note — create that day's note and the next day's from the template when missing, fill in the weather, and other cleanup tasks. Use when asked to clean up, tidy, or process yesterday's or a given day's daily note, or on a scheduled end-of-day run.
|
|
---
|
|
|
|
# daily-note-cleanup — tidy a day's daily note
|
|
|
|
The subject is one daily note: **yesterday's by default**, or a date the user names. Every step below reads and edits that note, plus the **next day's** note as the one place carried-forward work lands. Nothing here touches the vault's other notes.
|
|
|
|
The notes live at `<vault>/daily/<YYYY-MM-DD>.md`. The template is `<vault>/templates/daily.md`; its only placeholder is `{{date}}`.
|
|
|
|
Do the steps in order. Each edits the note in place — touch only what a step names and leave prose, ordering, and embeds exactly as they are. The vault syncs live from other devices, so a wholesale rewrite is a sync conflict waiting to happen: make targeted edits.
|
|
|
|
## 1. Resolve the two dates
|
|
|
|
```
|
|
date -d "yesterday" +%F # subject day, when the user names none
|
|
date -d "<subject> +1 day" +%F # the next day
|
|
```
|
|
|
|
## 2. Create either note if it is missing
|
|
|
|
For a note that does not exist, read `<vault>/templates/daily.md`, replace `{{date}}` with that note's own date, and write it to `<vault>/daily/<date>.md`. A note that already exists is left untouched here — it may already hold a day's writing.
|
|
|
|
## 3. Carry pending tasks forward
|
|
|
|
Under the subject note's `## Work`, find the `Pending tasks:` line and the bullet list right under it. The block runs from that label to the next header or the next non-bullet, non-blank line. Move the whole block — label and bullets — into the **next day's** note under its `## Work`:
|
|
|
|
- Fresh next-day note: drop the block straight under `## Work`.
|
|
- Next-day `## Work` already carries a `Pending tasks:` list: append the bullets to it, don't add a second label.
|
|
|
|
Then delete the block from the subject note. If that empties `## Work`, step 6 removes the header.
|
|
|
|
No `Pending tasks:` under `## Work` means nothing to carry — skip.
|
|
|
|
## 4. Fill in the weather
|
|
|
|
If the subject note's frontmatter has no weather keys (`temp_high` and the rest), invoke the **weather** skill for the subject date; it owns reading the station and writing those keys. Already present — the scheduled run often fills yesterday — and you skip it. If weather refuses the day (a station gap, partial coverage, or a date that hasn't ended), leave the keys absent and move on.
|
|
|
|
## 5. Remove empty frontmatter fields
|
|
|
|
Delete any frontmatter line whose value is blank — `work_mood:` with nothing after the colon. Keep every field that has a value. If no frontmatter fields remain, remove the `---` fences.
|
|
|
|
## 6. Remove empty headers
|
|
|
|
Work from the deepest headers outward. Remove a header when nothing lives under it — everything from it to the next same-or-higher header is blank — and no sub-header of it survives. Removing an empty leaf can empty its parent, so re-check the parent.
|
|
|
|
Two kinds of header stay even when they look bare:
|
|
|
|
- **Embeds are content.** A header whose body is only `![[...]]` embed links stays (`## Articles`, `## Tasks`).
|
|
- **Structure is content.** A header with a surviving sub-header stays, even when its own lines are blank (`## Notes` over a `### ...` that has bullets).
|
|
|
|
Never remove the `# <date>` title. Collapse the blank lines a removed section leaves behind to a single blank between the headers that remain.
|
|
|
|
## What it looks like
|
|
|
|
A subject note the morning after, with empty template sections, blank moods, no weather yet, and a pending list under Work:
|
|
|
|
```markdown
|
|
---
|
|
work_mood:
|
|
general_mood:
|
|
weight:
|
|
---
|
|
# 2026-08-27
|
|
|
|
## Articles
|
|
|
|
![[Articles.base#Added Today]]
|
|
|
|
## Timeline
|
|
|
|
|
|
## Journal
|
|
|
|
|
|
## Notes
|
|
|
|
|
|
## Work
|
|
|
|
|
|
Pending tasks:
|
|
|
|
- Deploy the account server again.
|
|
- Refactor ReviewRequestTypes.
|
|
|
|
## Tasks
|
|
|
|
![[Daily Note Tasks.base#Completed Today]]
|
|
```
|
|
|
|
After — moods removed, weather filled (step 4 succeeded here), the pending block carried into 2026-08-28, and Timeline/Journal/Notes/Work gone (Work emptied by the carry) while Articles and Tasks stay on their embeds:
|
|
|
|
```markdown
|
|
---
|
|
temp_high: 78.1
|
|
temp_low: 55.6
|
|
gdd_base50: 14.4
|
|
solar_energy_kwh_m2: 7.02
|
|
---
|
|
# 2026-08-27
|
|
|
|
## Articles
|
|
|
|
![[Articles.base#Added Today]]
|
|
|
|
## Tasks
|
|
|
|
![[Daily Note Tasks.base#Completed Today]]
|
|
```
|
|
|
|
The next day's note gains, under its `## Work`:
|
|
|
|
```markdown
|
|
## Work
|
|
|
|
Pending tasks:
|
|
|
|
- Deploy the account server again.
|
|
- Refactor ReviewRequestTypes.
|
|
```
|