By DivByZeroIT
Offline learning for Claude Code: scan ~/.claude/projects logs, find repeated failures and the fixes that resolved them, and propose lean rules to add to CLAUDE.md / MEMORY.md. Local-only, no API key. Inspired by headroom's `learn`.
A small, focused Claude Code skill
that turns your past sessions into better context. It scans your local Claude Code
logs, finds recurring failures and the fixes that resolved them (plus the
corrections you gave the agent), and proposes concrete rules to add to your
CLAUDE.md / MEMORY.md — so the same mistakes stop wasting tokens.
It never auto-edits anything: it shows you the proposed learnings and asks for approval before writing.
Inspired by headroom. Headroom is a broad context-optimization toolkit (a compression proxy, MCP tools, cross-agent memory, and an offline
learncommand). This project deliberately does one thing: it extracts only the "learn from past sessions" idea and makes it lean — a single skill, no proxy, no API key, no background services. If you want the full platform, use headroom. If you just want session-drivenCLAUDE.mdsuggestions with zero infrastructure, use this.
learnheadroom learn | learn-from-sessions | |
|---|---|---|
| Footprint | Python package + LiteLLM + optional proxy | one skill (SKILL.md + a ~300-line scan.py) |
| The analysis LLM | external model via API key or a CLI subprocess | the Claude agent you're already talking to |
| Writing | auto-writes marker blocks into your files | proposes, you approve, then it writes |
| Scope | Claude Code, Codex, Gemini | Claude Code only |
| Network / keys | needs an LLM backend | none — fully local |
The deterministic half is a faithful port of headroom's scanner + digest builder
(headroom/learn/plugins/claude.py + analyzer._build_digest): parse the JSONL
logs in ~/.claude/projects/, normalize and error-classify every tool call, and
build a token-budgeted digest of the chronological event stream (tool calls,
USER: messages, interruptions, subagent summaries). The LLM step and the
auto-writer are what this project intentionally drops.
/plugin marketplace add DivByZeroIT/learn-from-sessions
/plugin install learn-from-sessions@dbz-skills
Then, from any project:
/learn-from-sessions
Or just ask: "learn from my sessions in this project."
Copy the skill into your personal skills directory:
git clone https://github.com/DivByZeroIT/learn-from-sessions
cp -r learn-from-sessions/plugins/learn-from-sessions/skills/learn-from-sessions \
~/.claude/skills/learn-from-sessions
scan.py reads the current project's logs from
~/.claude/projects/<encoded-path>/*.jsonl and emits a compact digest
(80k-token budget) of the session event stream.CLAUDE.md / MEMORY.md
(and any prior learned block) so it refines instead of duplicating.-> OK done differently, or your USER:
correction) and turns that into an actionable "use X instead of Y" rule.CLAUDE.md, evolving preferences → MEMORY.md) with evidence counts and
estimated tokens saved. Nothing is written yet.<!-- learn-from-sessions:start --> … <!-- learn-from-sessions:end --> block.Re-runs only analyze new or changed sessions. A session counts as "analyzed"
only after you approve and it's committed (scan.py --commit), so aborting before
review re-surfaces the same sessions next time. Use --full to re-analyze
everything. Accumulated rules live in your CLAUDE.md / MEMORY.md, so skipping
old sessions never loses past learnings.
Everything runs locally. scan.py only reads ~/.claude/projects/*.jsonl, makes
no network calls, and starts no subprocess LLM. The only "model" involved is the
Claude Code agent you are already using.
scan.py # digest for the current working directory's project
scan.py --project /path # a specific project
scan.py --list # list discovered projects
scan.py --full # ignore incremental state, scan all sessions
scan.py --commit # mark the last scan's sessions as analyzed
scan.py --max-tokens N # digest budget (default 80000)
MIT © 2026 Massimo Chieruzzi
Own this plugin?
Verify ownership to unlock analytics, metadata editing, and a verified badge. GitHub access is read-only (username + org membership).
Sign in to claimOwn this plugin?
Verify ownership to unlock analytics, metadata editing, and a verified badge. GitHub access is read-only (username + org membership).
Sign in to claimBased on adoption, maintenance, documentation, and repository signals. Not a security audit or endorsement.
npx claudepluginhub divbyzeroit/dbz-skills --plugin learn-from-sessionsMemory compression system for Claude Code - persist context across sessions
Editorial "Web Designer" bundle for Claude Code from Antigravity Awesome Skills.
Ultra-compressed communication mode. Cuts ~75% of tokens while keeping full technical accuracy by speaking like a caveman.
Frontend design skill for UI/UX implementation
Comprehensive UI/UX design plugin for mobile (iOS, Android, React Native) and web applications with design systems, accessibility, and modern patterns
Marketing skills for AI agents — conversion optimization, copywriting, SEO, paid ads, ad creative, and growth