Skip to content

Fix: journal today only sees the daily file — must aggregate all of a day's notes (project notes, transcripts) - #60

Merged
ericmann merged 1 commit into
mainfrom
agent/issue-55
Jun 25, 2026
Merged

ericmann merged 1 commit into
mainfrom
agent/issue-55

Conversation

@claude

@claude claude Bot commented Jun 25, 2026

Copy link
Copy Markdown
Contributor

🤖 Agent-Generated PR

Closes #55
Agent Used: Claude Code
Complexity: medium


Summary

journal today reported empty even when notes were captured — as long as those notes landed somewhere other than daily/YYYY/MM/YYYY-MM-DD.md. This fix rewrites the Notes section of gatherToday() to query the store for all note chunks from today instead of reading a single hard-coded path.

Implementation Notes

  • Followed the existing pattern for decisions/meetings: open the store, query with a store.Filter, render results. The decisions/todos/meetings sections were already store-driven; only Notes was reading a raw file.
  • Added gatherNoteMD() helper (opens store, queries Filter{Source: store.SourceNote, Since: midnight}) and buildNotesMD() (assembles aggregated Markdown with daily chunks first, then project note chunks labelled with their source path).
  • midnight is now computed once at the top of gatherToday() and shared with the meetings section (previously the meetings section computed it separately).
  • journal://today resource (option a): left as the literal daily file. The resource maps to a file; the aggregated view is the today tool. The description is unchanged — it already says "Corresponds to daily/YYYY/MM/YYYY-MM-DD.md". The issue discussion explicitly recommends (a).
  • The MCP today tool (mcpToday) routes through gatherToday() so it inherits the fix at zero extra cost.

Changes

  • cmd/show.go: Replace single-file read in gatherToday() with store query; add gatherNoteMD() and buildNotesMD() helpers; update todayReport.Notes field comment.
  • cmd/show_test.go: Two new tests — TestGatherTodayAggregatesAllSources (daily + project note + transcript: both notes in Notes, transcript only in Meetings, project source attributed) and TestGatherTodayProjectOnlyNotEmpty (project-note-only day is not empty).
  • docs/USAGE.md: Clarified that today aggregates all sources; noted the journal://today resource/tool distinction.
  • book/src/daily-use.md: Updated the "morning" section description.
  • CHANGELOG.md: Added Fixed entry under [Unreleased].

Testing

Automated:

  • Unit tests added/updated
  • All existing tests pass (make test green, all 11 packages pass)

Manual testing performed:

  • make fmt vet clean
  • make build succeeds
  • make test green (serial -p 1)

Review Checklist

Correctness

  • Code actually solves the issue
  • Acceptance criteria are met (store query replaces file read; project-only day non-empty; MCP tool fixed for free; source attribution in output; journal://today resource unchanged per option a)
  • Edge cases handled (empty store → "No notes yet today" placeholder; transcripts excluded by Source filter)

Code Quality

  • Follows existing codebase patterns (store query pattern matches decisions/meetings)
  • Follows project coding standards
  • No unnecessary complexity

Tests

  • Tests actually test behavior
  • Edge cases covered (project-only, multi-source, transcript exclusion)

The Notes section of gatherToday previously read only the daily file
(daily/YYYY/MM/YYYY-MM-DD.md), so a day with notes captured via
--project was incorrectly reported as empty.

Now queries the store for all note chunks with source=note and
created_at >= midnight, rendering them grouped by source. Project note
sections are labelled with their path. Transcripts remain excluded from
Notes (they appear under Meetings via the existing recentMeetings path).

The MCP today tool inherits the fix automatically (it routes through
gatherToday). The journal://today resource is kept as the literal daily
file per option (a) in the issue discussion.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@claude claude Bot added the agent-generated PR was created by an AI agent label Jun 25, 2026
@ericmann
ericmann merged commit 56f9614 into main Jun 25, 2026
4 checks passed
@ericmann
ericmann deleted the agent/issue-55 branch June 25, 2026 20:03
@claude

claude Bot commented Jun 25, 2026

Copy link
Copy Markdown
Contributor Author

Retro: no durable lesson (merged clean / one-off).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agent-generated PR was created by an AI agent

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Fix: journal today only sees the daily file — must aggregate all of a day's notes (project notes, transcripts)

1 participant