Skip to content
You commented “AUTO”: here it is

Claude Self-Improvement Hooks: Two Scripts That Log and Learn

Install these two hook scripts and every Claude session logs itself, feeds forward, and sharpens future responses automatically.

Free Claude skill · copy-paste ready · built by the BrainVaultAI team

Claude doesn't improve automatically. Every session starts fresh. But you can build a compounding loop: log what Claude does, review the patterns weekly, and update your CLAUDE.md with what's working. Over time Claude gets faster because its context gets sharper. These two hook scripts automate the logging half. The Stop hook writes a session summary to a local log file after every conversation. A weekly review prompt (included below) reads the logs and surfaces what to add to CLAUDE.md. Install the hooks in your settings.json. Run the weekly review prompt on Sundays. Treat your CLAUDE.md like a product, it needs iteration, not just initial setup. This is a 15-minute weekly habit that compounds. Most founders skip it. The ones who don't end up with a Claude that feels like it actually knows them.

Stop hook: session logger (add to settings.json)
// Add to your ~/.claude/settings.json under "hooks":
{ "Stop": [ { "command": "node -e \"const fs=require('fs');const d=new Date().toISOString();const log={date:d,cwd:process.cwd(),session:'ended'};const f=process.env.HOME+'/claude-sessions.jsonl';fs.appendFileSync(f,JSON.stringify(log)+'\\n');console.log('Session logged: '+d);\"", "description": "Log session end to ~/claude-sessions.jsonl" } ]
} // For a richer log, replace the command with a script that:
// 1. Reads the last N lines of the session transcript
// 2. Extracts files touched, tasks completed, errors hit
// 3. Appends structured JSON to ~/claude-sessions.jsonl
Weekly review prompt: paste into Claude on Sundays
I'm doing my weekly Claude improvement review. Here are my session logs from this week: [paste contents of ~/claude-sessions.jsonl here] Also here is my current CLAUDE.md: [paste CLAUDE.md here] Do three things: 1. Identify the top 3 patterns in how I worked with you this week, what I asked for repeatedly, what you got wrong, what you had to ask clarifying questions about. 2. For each pattern, suggest a specific addition or edit to CLAUDE.md that would prevent that friction next week. Be specific, write the exact text to add, not a description of what to add. 3. Flag any CLAUDE.md rules that seem stale or contradicted by how I actually worked this week. Output: a patch list. CLAUDE.md line or section, proposed change, one-sentence reason.
PostToolUse hook: log file touches (add to settings.json)
// Add to your ~/.claude/settings.json under "hooks":
{ "PostToolUse": [ { "matcher": "Write|Edit", "command": "node -e \"const fs=require('fs');const input=process.argv[1];const log={ts:new Date().toISOString(),tool:'write_edit',file:process.env.FILE_PATH||'unknown'};fs.appendFileSync(process.env.HOME+'/claude-filetouches.jsonl',JSON.stringify(log)+'\\n');\"", "description": "Log every file Claude writes or edits" } ]
} // This builds a weekly record of exactly which files Claude touched.
// Feed it into the Sunday review prompt to get specific pattern analysis
// rather than general impressions.

Want the editable version?

We'll send the editable version of this asset, plus a short series of our highest-leverage AI plays for operators. No spam. Unsubscribe in one click.

Free. No spam. Unsubscribe in one click. By submitting you agree to receive emails from BrainVaultAI.

Go further

Want the full founder vault? 51 prompts, ready to run.

51 production-grade prompts (Operator, Climber, Independent)
Copy-paste ready, no theory
Lifetime updates
Today$47

One-time $47. Instant access. No subscription.

More free AI guides in the full library · follow @brainVaultAI