diary

A command that creates a structured diary entry from the current coding session and stores it in the project repository.

In plain words
What is it for?
Use it at the end of a session to document the work, design choices, problems, and solutions in a dated diary file.
Why use it?
It preserves decisions, changes, errors, fixes, and user preferences so they can be reviewed later.

Command for Claude Code

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add commands/spideynolove/memory/diary
Clone the repo
git clone --depth 1 https://github.com/spideynolove/memory

Made for: Claude Code.

Per session 10 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 1,070 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00010 $0.01070
Opus 5 $0.00005 $0.00535
Sonnet 5 $0.00002 $0.00214
Haiku 4.5 $0.00001 $0.00107

Measured yesterday against content hash 4a4021e38641, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

diary scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured yesterday.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

.claude/commands/diary.md · 141 lines

How it starts

The opening of the file, as written. The whole thing — 141 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Create Diary Entry from Current Session

Create a structured diary entry documenting what happened in the current session. Entries are stored project-locally in .claude/diary/ and travel with the repository.

Storage

All diary entries go to: <project-root>/.claude/diary/YYYY-MM-DD-session-N.md

The project root is /home/hung/MCPs/memory (or wherever this repo is checked out).

Approach: Context-First Strategy

Primary method (use this first): Reflect on the conversation history loaded in this session. You have access to:

  • All user messages and requests
  • Your responses and tool invocations
  • Files read, edited, or written
  • Errors encountered and solutions applied
  • Design decisions discussed
  • User preferences expressed

JSONL fallback (only if context is insufficient):

SESSION_FILE=$(ls -t ~/.claude/projects/-$(echo "{{ cwd }}" | sed 's/\//-/g' | sed 's/^-//')/*.jsonl 2>/dev/null | head -1) && \
if [ -z "$SESSION_FILE" ]; then \
  echo "ERROR: No session file found"; \
else \
  echo "FOUND: $SESSION_FILE" && ls -lh "$SESSION_FILE"; \
fi

Extract metadata only when needed:

SESSION_FILE="[path-from-above]" && \
echo "=== TOOL COUNTS ===" && \
jq -r 'select(.message.content[]?.name) | .message.content[].name' "$SESSION_FILE" | sort | uniq -c && \
echo "=== FILES MODIFIED ===" && \
grep -o '"filePath":"[^"]*"' "$SESSION_FILE" | sort -u

Steps

1. Determine the entry filename

PROJECT_ROOT="/home/hung/MCPs/memory"
TODAY=$(date +%Y-%m-%d)
N=1
while [ -f "$PROJECT_ROOT/.claude/diary/${TODAY}-session-${N}.md" ]; do N=$((N+1)); done
DIARY_FILE="$PROJECT_ROOT/.claude/diary/${TODAY}-session-${N}.md"
echo "Will save to: $DIARY_FILE"

2. Create the diary entry

Write the entry using the Write tool (not bash echo). Template:

# Session Diary Entry

**Date**: [YYYY-MM-DD]
**Time**: [HH:MM]
**Session ID**: [from JSONL filename if available, else "unknown"]
**Project**: /home/hung/MCPs/memory
**Git Branch**: [run: git -C /home/hung/MCPs/memory branch --show-current]

## Task Summary
[2-3 sentences: what the user was trying to accomplish]

## Work Summary
- [bullet: features implemented]
- [bullet: bugs fixed]
- [bullet: refactoring done]

## Design Decisions Made
- [decision: why X was chosen over Y]

## Actions Taken
- Files edited: [list]
- Commands run: [list]
- Key tools used: [list]

## Code Review & PR Feedback
- [any feedback about code quality or style]

## Challenges Encountered
- [errors hit, failed approaches, debugging steps]

## Solutions Applied
- [how problems were resolved]

## User Preferences Observed

### Commit & PR Preferences:
- [patterns around commits, PRs]

### Code Quality Preferences:
- [testing, linting, style]

### Technical Preferences:
- [libraries, patterns, frameworks]

## Code Patterns and Decisions
[technical patterns used or established]

## Context and Technologies
[project type, languages, frameworks involved this session]

## Correction Events
[Scan the conversation for user corrections — any message where the user said "no", "wrong", "that's not right", "actually", "stop doing X", or gave explicit negative feedback about Claude's approach.]
- Correction detected: [yes/no]
- If yes: [what Claude did → what the user corrected → what the right approach was]

## Notes
[any other observations]

Read the full file on GitHub · 141 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. yesterday First seen · 141 lines · 10 tokens per session scan A 4a4021e38641

Subscribe to this mod's changes

diary is a command published in the GitHub repository spideynolove/memory (3 stars, last pushed 5mo ago), licensed MIT. It adds 10 tokens to every session and 1,070 once invoked, about $0.0001 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.