Daily notes and log entries #46

Closed
kayg wants to merge 0 commits from issue/8-daily-notes into dev
Owner

Closes #8

Daily notes and log entries (ADR 0026).

Server: the daily plugin (crates/daily)

  • daily.open {date?, tz?}: today on the caller's device (or a given day). It reuses an existing Notes/YYYY-MM-DD.md whatever its id (migrated days), else makes day-YYYY-MM-DD. Nothing is written until the first change.
  • daily.log-add {date?, tz?, text?}: inserts - HH:MM in time order, after the latest earlier entry and its children.
  • daily.log-close: turns the latest open entry into a range.
  • daily.entries {from, to?}: reads up to 62 days of entries, for the calendar and lifelog later.
  • Action names are one level (log-add) because the registry allows only plugin.name.
  • It changes text only through the notes API (Notes::create/get/edit with a base version).

Lenient log reading, twinned in Rust (crates/daily/src/log.rs) and TypeScript (packages/editor/src/daily/log.ts), and pinned by 15 shared cases in contracts/log-entries.json. Both sides run every case. It accepts:

  • any bullet or numbered list, and task boxes
  • H:MM, HH:MM, HH.MM, HH:MM:SS
  • ranges with -, – or —, with or without spaces
  • entries with no heading

Frontmatter and code blocks are never read as entries. Nothing is ever rewritten.

Notes fix: two creates of the same explicit id racing now return the first note, instead of making 2026-10-13 2.md. Added Notes::path_of and Notes::id_at.

Editor: the plusLog command.

  • It's the person's own change and always one undo step (it stops undo capture on both sides).
  • On an open entry under the caret it closes it as a range; anywhere else it inserts in time order with the caret ready for words.
  • Day and clock helpers follow the device timezone, DST included.

Web

  • / opens today; /day/YYYY-MM-DD opens a given day.
  • The title reads "Tuesday, 13 October".
    • Log button, plus ⌘⇧; / Ctrl+Shift+; (shortcut table, #39).
  • Offline, the editor works at once on the derived id and starts syncing when daily.open succeeds.

Tests

  • Rust, 15 in calternal-daily:
    • the shared cases, plus property tests at 512 cases each: + Log adds exactly one entry and changes no other; closing turns exactly one open entry into a range; any text is safe to plan
    • two offline devices starting the same day merge into one file with each line once
    • no file until the first change
    • an existing day file with a foreign id is reused
    • 8 parallel opens give one note
    • log then close makes a range
    • device offset decides today, with IST midnight and New York DST cases
    • bad input is refused
  • Editor, 24 new (72 total): shared cases, property loops, IST and DST days, + Log ordering, closing, one undo step, no typing transforms.
  • Browser, e2e/day.spec.ts, against the real binary in Chromium and WebKit at 1440 and 390:
    • opens on today
    • nothing on disk until typing
      • Log then type, then + Log closes the range
    • time order via the keyboard shortcut
  • Full suite: 56 passed, 8 skipped by design.
  • Workspace Rust tests, fmt and clippy -D warnings are clean.

Left for later

  • A persistent log index (daily.entries reads notes on demand for now).
  • Week, month and year notes.
  • Moving offline edits made under the derived id onto a day whose existing file has a different id. Migrated days use the derived id too, as agreed with the #12 agent, so this is rare.

🤖 Generated with Claude Code

https://claude.ai/code/session_018Yyy8fQGxPLkLa8v8NXz7T

Closes #8 Daily notes and log entries (ADR 0026). **Server: the `daily` plugin** (`crates/daily`) - `daily.open {date?, tz?}`: today on the caller's device (or a given day). It reuses an existing `Notes/YYYY-MM-DD.md` whatever its id (migrated days), else makes `day-YYYY-MM-DD`. Nothing is written until the first change. - `daily.log-add {date?, tz?, text?}`: inserts `- HH:MM ` in time order, after the latest earlier entry and its children. - `daily.log-close`: turns the latest open entry into a range. - `daily.entries {from, to?}`: reads up to 62 days of entries, for the calendar and lifelog later. - Action names are one level (`log-add`) because the registry allows only `plugin.name`. - It changes text only through the notes API (`Notes::create`/`get`/`edit` with a base version). **Lenient log reading**, twinned in Rust (`crates/daily/src/log.rs`) and TypeScript (`packages/editor/src/daily/log.ts`), and pinned by 15 shared cases in `contracts/log-entries.json`. Both sides run every case. It accepts: - any bullet or numbered list, and task boxes - `H:MM`, `HH:MM`, `HH.MM`, `HH:MM:SS` - ranges with `-`, `–` or `—`, with or without spaces - entries with no heading Frontmatter and code blocks are never read as entries. Nothing is ever rewritten. **Notes fix:** two creates of the same explicit id racing now return the first note, instead of making `2026-10-13 2.md`. Added `Notes::path_of` and `Notes::id_at`. **Editor:** the `plusLog` command. - It's the person's own change and always one undo step (it stops undo capture on both sides). - On an open entry under the caret it closes it as a range; anywhere else it inserts in time order with the caret ready for words. - Day and clock helpers follow the device timezone, DST included. **Web** - `/` opens today; `/day/YYYY-MM-DD` opens a given day. - The title reads "Tuesday, 13 October". - + Log button, plus ⌘⇧; / Ctrl+Shift+; (shortcut table, #39). - Offline, the editor works at once on the derived id and starts syncing when `daily.open` succeeds. **Tests** - Rust, 15 in `calternal-daily`: - the shared cases, plus property tests at 512 cases each: + Log adds exactly one entry and changes no other; closing turns exactly one open entry into a range; any text is safe to plan - two offline devices starting the same day merge into one file with each line once - no file until the first change - an existing day file with a foreign id is reused - 8 parallel opens give one note - log then close makes a range - device offset decides today, with IST midnight and New York DST cases - bad input is refused - Editor, 24 new (72 total): shared cases, property loops, IST and DST days, + Log ordering, closing, one undo step, no typing transforms. - Browser, `e2e/day.spec.ts`, against the real binary in Chromium and WebKit at 1440 and 390: - opens on today - nothing on disk until typing - + Log then type, then + Log closes the range - time order via the keyboard shortcut - Full suite: 56 passed, 8 skipped by design. - Workspace Rust tests, fmt and clippy `-D warnings` are clean. **Left for later** - A persistent log index (`daily.entries` reads notes on demand for now). - Week, month and year notes. - Moving offline edits made under the derived id onto a day whose existing file has a different id. Migrated days use the derived id too, as agreed with the #12 agent, so this is rare. 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_018Yyy8fQGxPLkLa8v8NXz7T
Daily notes and log entries (#8)
All checks were successful
CI / rust (pull_request) Successful in 1m1s
CI / web (pull_request) Successful in 1m21s
499781ecd2
- crates/daily: the `daily` plugin. daily.open finds a day by its file
  `Notes/YYYY-MM-DD.md` first (any id, e.g. migrated days), else makes
  `day-YYYY-MM-DD` without writing a file; daily.log-add inserts
  `- HH:MM ` in time order; daily.log-close turns the latest open entry
  into a range; daily.entries reads a range of days for later views.
- Lenient log reading, twinned in Rust and TypeScript and pinned by the
  shared cases in contracts/log-entries.json.
- notes: a racing second create of the same explicit id now returns the
  first note instead of making "2026-10-13 2.md"; path_of and id_at.
- editor: plusLog command (own change, one undo step; closes an open
  entry under the caret), day/clock helpers following the device timezone.
- web: `/` opens today, `/day/YYYY-MM-DD`, + Log button and ⌘⇧; / Ctrl+Shift+;.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018Yyy8fQGxPLkLa8v8NXz7T
Author
Owner

Reviewed by Claude: one log grammar shared by Rust and TS via contracts/log-entries.json; day ids derived from date with file lookup first (no second note per date); race on explicit-id create fixed; + Log is one undo step on own origin; tz edges tested. CI green. Merging.

Reviewed by Claude: one log grammar shared by Rust and TS via contracts/log-entries.json; day ids derived from date with file lookup first (no second note per date); race on explicit-id create fixed; + Log is one undo step on own origin; tz edges tested. CI green. Merging.
Author
Owner

Closing: this branch is already fully contained in dev (it landed through a merge train). Branch cleanup, 2026-10-15.

Closing: this branch is already fully contained in `dev` (it landed through a merge train). Branch cleanup, 2026-10-15.
kayg closed this pull request 2026-10-15 08:35:35 +00:00
All checks were successful
CI / rust (pull_request) Successful in 1m1s
CI / web (pull_request) Successful in 1m21s

Pull request closed

Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
kayg/calternal!46
No description provided.