Context
The new folder-per-day structure is already implemented for default notes (create_note_file_with_folders + build_folder_path_for_now), producing paths like:
<not_path>/<year>/<month>/<week>/<day>/<YYYY-MM-DD>.default.md
The existing start-work and end-work commands still rely on the legacy annotation system (annotations embedded in markdown files). The new work command must not use annotations — it uses the journal.json event system instead (.nost/journal.json). The annotation system is kept as-is for legacy compatibility.
Architecture
Two parallel systems coexist:
| System |
Storage |
Used by |
| Legacy |
Annotations in .md files |
start-work, end-work (unchanged) |
| New |
Events in .nost/journal.json |
work (new command) |
Event names remain: START_WORK and STOP_WORK (matching existing EventName enum).
Behaviour
nost work # alias: nost w
- Resolve the work file path using
build_folder_path_for_now, with type work:
<not_path>/<year>/<month>/<week>/<day>/<YYYY-MM-DD>.work.md
- Create the file (and folders) if they do not exist — reuse
create_note_file_with_folders("work").
- Check for an active session — read
journal.json and find the last START_WORK or STOP_WORK event:
- Last event is
START_WORK → close the session: record a StopWork event via record_event.
- Last event is
STOP_WORK or no work event found → open a session: record a StartWork event via record_event.
- Print a clear confirmation message indicating whether a session was opened or closed.
New module to add
src/events/find.rs — function find_last_work_event() -> Option<Event> that reads journal.json and returns the most recent event whose name is START_WORK or STOP_WORK.
Out of scope
- Stats refactoring (separate issue).
- The legacy
start-work / end-work commands remain untouched.
Acceptance criteria
Context
The new folder-per-day structure is already implemented for default notes (
create_note_file_with_folders+build_folder_path_for_now), producing paths like:The existing
start-workandend-workcommands still rely on the legacy annotation system (annotations embedded in markdown files). The newworkcommand must not use annotations — it uses thejournal.jsonevent system instead (.nost/journal.json). The annotation system is kept as-is for legacy compatibility.Architecture
Two parallel systems coexist:
.mdfilesstart-work,end-work(unchanged).nost/journal.jsonwork(new command)Event names remain:
START_WORKandSTOP_WORK(matching existingEventNameenum).Behaviour
build_folder_path_for_now, with typework:create_note_file_with_folders("work").journal.jsonand find the lastSTART_WORKorSTOP_WORKevent:START_WORK→ close the session: record aStopWorkevent viarecord_event.STOP_WORKor no work event found → open a session: record aStartWorkevent viarecord_event.New module to add
src/events/find.rs— functionfind_last_work_event() -> Option<Event>that readsjournal.jsonand returns the most recent event whose name isSTART_WORKorSTOP_WORK.Out of scope
start-work/end-workcommands remain untouched.Acceptance criteria
nost work(aliasnost w) creates<not_path>/…/<YYYY-MM-DD>.work.mdon first call.nost worktwice in a row opens then closes the session.nost workwhen a session is already open closes it.journal.json, not from annotations.