Skip to content

feat(core): add session history archive with History tab UI#23

Merged
ntd4996 merged 1 commit into
ntd4996:mainfrom
aiexkwan:main
Jun 16, 2026
Merged

feat(core): add session history archive with History tab UI#23
ntd4996 merged 1 commit into
ntd4996:mainfrom
aiexkwan:main

Conversation

@aiexkwan

Copy link
Copy Markdown
Contributor

Summary

  • Persist completed agent sessions to daily JSON files (~/.agentpet/history/YYYY-MM-DD.json) with automatic 90-day retention
  • Hook into SessionStore.prune() and apply() (isSessionEnd path) so both idle-timeout and normal agent-quit sessions are archived
  • Add a new History tab in Settings with Today / 7-day / 30-day filters, summary bar (session count + total duration + agent kind breakdown), and date-grouped session list
  • Add createdAt field to AgentSession for accurate session start time tracking
  • Thread-safe SessionArchiveStore with serial DispatchQueue, in-memory dedup Set (rebuilt on restart), and fail-soft error handling

Screenshots

History tab showing session records with summary bar and date-grouped list.

Test plan

  • SessionArchiveStoreTests — 10 test cases: encode/decode round-trip, dedup, daily-file naming, prune, restart dedup rebuild
  • SessionStoreArchiveTests — 9 test cases: idle prune archive, isSessionEnd archive, stale working archive, nil archiveStore compat, existing test regression, cross-cycle dedup
  • Full test suite: 167 tests, 0 failures
  • Manual: Open Settings → History tab → verify empty state shows "No sessions yet"
  • Manual: Run an agent session, wait for it to complete, verify it appears in History

🤖 Generated with Claude Code

Persist completed agent sessions to daily JSON files (~/.agentpet/history/)
and surface them in a new History tab in Settings. Includes:
- SessionArchive model + SessionArchiveStore with serial queue protection
- Archive hooks in SessionStore.prune() and apply() isSessionEnd path
- AgentSession.createdAt field for accurate start time tracking
- HistoryTabView with Today/7-day/30-day filters, summary bar, date-grouped list

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@ntd4996 ntd4996 merged commit 1a2157e into ntd4996:main Jun 16, 2026
1 check passed
@ntd4996

ntd4996 commented Jun 16, 2026

Copy link
Copy Markdown
Owner

Merged, thank you. A session history archive is something people have wanted, and this is a clean implementation, daily JSON files with 90-day retention, hooked into both the prune and agent-quit paths so nothing is missed, plus a thread-safe store with dedup and fail-soft handling. The History tab with Today/7/30-day filters and the summary bar is a nice touch, and the test coverage is excellent. 581 tests green. 🙏

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants