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.
npx agentmods add commands/spideynolove/memory/diarygit clone --depth 1 https://github.com/spideynolove/memoryWhat 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.
| Model | Per session | Once 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 |
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.
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]
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.
- yesterday First seen · 141 lines · 10 tokens per session scan A 4a4021e38641
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.
Other commands, from other repositories
handoff
Update memory-bank/handoff.md to pause or switch models.
save-context
Write a phase-completion summary and update the Memory Bank.
start-task
Plan a task with minimal context before coding.
add-project
在 Obsidian vault 里新增一个项目。自动检测 vault(不存在则 inline 初始化)、分析代码结构生成架构草稿、写入 CLAUDE.md。通常是接触新项目时唯一需要运行的命令。.
update-memory
全量对账 Code ↔ Obsidian ↔ auto-memory 三方,找漂移并让用户逐项决定如何修。地图 vs 地形原则的工程兜底。.
commit
智能 git 提交:自动生成 commit message、提交代码、然后调用 /sync-docs 同步到 Obsidian。.