From memstack
Generates markdown diary entries for coding sessions, capturing accomplishments, files changed, git commits, decisions, next steps, and handoffs. Triggers on 'save diary', 'log session', or 'wrapping up'.
npx claudepluginhub cwinvestments/memstack --plugin memstackThis skill uses the workspace's default tool permissions.
*Document what was accomplished in each CC session for future recall.*
Generates and saves Markdown session logs capturing objectives, file changes, referenced materials, technical notes, future plans, open items, and metrics to resume project work across conversations.
Documents development sessions into daily .agents/SESSIONS/YYYY-MM-DD.md files using /start and /end commands. Tracks decisions, file changes, mistakes, next steps, and generates Mermaid flowcharts.
Logs accomplishments from Claude Code sessions to dated markdown files at session end, context checkpoints, self-improve triggers, or user request.
Share bugs, ideas, or general feedback.
Document what was accomplished in each CC session for future recall.
When this skill activates, output:
๐ Diary โ Logging session...
Then execute the protocol below.
| Context | Status | Priority |
|---|---|---|
| User says "save diary", "log session", "write diary" | ACTIVE โ write diary | P1 |
| User explicitly says they're done ("that's it", "wrapping up") | ACTIVE โ suggest diary if work was done | P2 |
| Multi-agent session (Builder/Reviewer role) | DORMANT โ Manager handles diary | โ |
| Mid-session, user is actively coding | DORMANT โ don't interrupt flow | โ |
| Casual conversation, no code changes made | DORMANT โ nothing to log | โ |
| User asks to recall past sessions ("what did we do") | DORMANT โ Echo handles recall, not Diary | โ |
| User says "save project" or "handoff" | DORMANT โ Project skill handles this | โ |
| Session just started, no work yet | DORMANT โ nothing to log | โ |
When the user asks to save a diary, keep these in mind:
| Temptation | Why it matters |
|---|---|
| "Nothing important happened" | Even small decisions have context worth capturing. |
| "Commits capture everything" | Commits don't capture decisions, blockers, or next steps. |
| "Skip the handoff section" | Handoffs are the most valuable part for session continuity. |
Summarize the session:
Check git log for commits:
git log --oneline -10
Format the diary entry:
# Session Diary โ {project} โ {date}
## Accomplished
- Item 1...
## Files Changed
- path/to/file.ts โ description
## Commits
- abc1234 Message
## Decisions
- Decision: reason
## Next Steps
- What to do next
## Session Handoff
**In Progress:** [what was actively being worked on when session ended]
**Uncommitted Changes:** [list any unstaged/uncommitted work, or "None"]
**Pick Up Here:** [exact instruction for next session โ specific enough to start cold]
**Session Context:** [anything important that isn't captured elsewhere โ temp decisions, debugging state, gotchas discovered]
Save to SQLite database (primary storage):
python "$MEMSTACK_PATH/db/memstack-db.py" add-session '{"project":"<name>","date":"<YYYY-MM-DD>","accomplished":"<bullets>","files_changed":"<bullets>","commits":"<bullets>","decisions":"<bullets>","problems":"<bullets>","next_steps":"<bullets>","duration":"<estimate>","raw_markdown":"<full text>"}'
Also save decisions as insights for cross-project search:
python "$MEMSTACK_PATH/db/memstack-db.py" add-insight '{"project":"<name>","type":"decision","content":"<decision>","context":"Session <date>","tags":"<project>"}'
Update project context with last session date:
python "$MEMSTACK_PATH/db/memstack-db.py" set-context '{"project":"<name>","last_session_date":"<YYYY-MM-DD>"}'
Also save markdown copy to memory/sessions/{date}-{project}.md (export format, human-readable backup)
The 500-line limit on markdown files is no longer a concern since SQLite is the source of truth.
Markdown files in memory/sessions/ are now just human-readable exports.
Old markdown files are preserved but not the primary storage.
User: "save diary"
๐ Diary โ Logging session...
Saved: memory/sessions/2026-02-18-adminstack.md
Project: AdminStack | Duration: ~2 hours
Accomplished: Built CC Monitor page, API routes, setup guide
Commits: 4 (45b4c42, d1c7e11, f6c8e18, f0e793f)
Files changed: 8
This session is now searchable via Echo.
The diary system includes an automatic PreCompact hook that fires before Claude Code compresses the context window. This closes the gap where session context could be lost during long conversations.
.claude/diary/{date}-compaction.md โ one file per day, appends on multiple compactionsCOMPACTION_INTERRUPTED so the next session knows context was cut| Data | Source |
|---|---|
| Uncommitted changes | git status --short |
| Recent commits | git log --oneline -5 |
| Recent shell commands | Shell history (last 5) |
| Recently modified files | Files modified since last git operation |
| Branch and project | Git branch + directory name |
| Manual Diary | PreCompact Diary | |
|---|---|---|
| Trigger | User says "save diary" | Automatic before compaction |
| Content | Full narrative with decisions, handoff | Snapshot of working state |
| Storage | SQLite + memory/sessions/ | .claude/diary/ only |
| Purpose | Session documentation | Context recovery after compaction |
When resuming after compaction, check .claude/diary/ for entries with today's date. The COMPACTION_INTERRUPTED flag signals that the previous context was truncated and these files contain the lost state.
Hook is registered in .claude/settings.json under PreCompact. Script lives at .claude/hooks/pre-compact.sh. Always exits 0 โ must never block compaction.
The Diary skill is part of a broader hook system that automates session lifecycle, security, and observability. All hooks follow the same defensive pattern: set -uo pipefail, SCRIPT_DIR resolution, all external commands wrapped with fallbacks, guaranteed exit 0.
| Event | Script | Matcher | Timeout | Purpose |
|---|---|---|---|---|
| PreToolUse | pre-tool-notify.sh | Write|Edit|MultiEdit|Bash | 10s | TTS voice alert before approval prompts |
| PreToolUse | pre-push.sh | Bash (git push) | 60s | Build verification + secrets scan before push |
| PostToolUse | post-commit.sh | Bash (git commit) | 10s | Debug artifact + secrets scan after commit |
| PostToolUse | post-tool-monitor.sh | Write|Edit|MultiEdit|Bash | 10s | Observation capture โ logs tool calls to .claude/observations/ |
| SessionStart | session-start.sh | (all) | 10s | Headroom proxy start, CLAUDE.md indexing, monitoring ping |
| SessionStart | session-context-load.sh | (all) | 15s | Context injection โ last 3 diary + observation summaries โ .claude/session-context.md |
| Stop | session-end.sh | (all) | 10s | Monitoring API session-complete ping |
| PreCompact | pre-compact.sh | (all) | 15s | Auto-save diary snapshot before context compaction |
settings.json, giving it its own timeout budget.claude/observations/YYYY-MM-DD.md โ daily files, append-only.claude/session-context.md on each new session.claude/observations/ and .claude/session-context.md are in .gitignore (ephemeral runtime output).claude/hooks/ and use ${CLAUDE_PROJECT_DIR} for portable path resolution.claude/rules/diary.md), always-on session logging awareness without skill file read. (Origin: MemStack v3.0-beta, Feb 2026)