session-memory
Team collective memory plugin for Claude Code.
Auto-capture tool usage → promote to knowledge cards → share via git.
What is this?
session-memory is a Claude Code plugin that gives your team a shared knowledge base that grows automatically as you work.
- Individual: Like claude-mem, it records tool usage and injects context into new sessions
- Knowledge: Events get promoted to Cards — reusable lessons with context
- Team: Cards live in git, so
git push shares knowledge with the entire team
Quick Start
# Install the plugin
/plugin install session-memory
# Or load locally for testing
claude --plugin-dir /path/to/claude-session-memory
That's it. Zero config. The plugin starts capturing automatically.
How It Works
You work normally with Claude Code
│
▼
PostToolUse hook captures events (Edit, Write, Bash)
│
├──→ Micro-inject: editing a file? Related cards injected instantly
│
▼
Events accumulate in .claude/memory/events/ (local, gitignored)
│
▼
Patterns detected → Card auto-created (with secret scanning)
│
├──→ Existing card? Evidence appended + importance bumped
│
▼
Cards saved to .claude/memory/cards/ (git committed, team shared)
│
▼
Next session → relevant cards auto-injected (scored by recency/importance/file overlap)
Key Concepts
Events (temporary, local)
Raw tool usage logs. Stored per-user in JSONL format. Gitignored by default.
Cards (permanent, shared)
Knowledge units with structure: type, importance, files, tags.
Markdown with YAML frontmatter. Git committed for team sharing.
Card types (ADR-lite):
| Type | Purpose | Example |
|---|
decision | Why we chose this | "PostgreSQL over MongoDB" |
constraint | Can't change this | "API rate limit 100/min" |
gotcha | Watch out for this | "req.user can be null" |
runbook | How to do this | "DB migration steps" |
onboarding | New member guide | "Dev environment setup" |
Evidence Accumulation
Cards are living knowledge. When the same pattern recurs, evidence is automatically appended to the matching card, and its importance is bumped. Cards get stronger over time.
Summaries (archived, shared)
Session summaries stored per-session. Useful for timeline view and onboarding.
Features
| Feature | Description |
|---|
| Auto-capture | PostToolUse hooks record Edit/Write/Bash events |
| Smart injection | Multi-signal scoring (git diff + interest + git log) with token budget |
| Micro-injection | Edit a file → related card TL;DR injected instantly |
| Auto-promotion | Patterns trigger card creation (3+ edits, error→fix, high importance) |
| Evidence accumulation | Recurring patterns strengthen existing cards |
| Secret scanning | Cards scanned for API keys, tokens, DB URLs before creation |
| Issue link extraction | Branch names and commit messages → card refs (GH-123, JIRA-456) |
| Onboarding | Role-based card packages for new team members |
| Web viewer | Static HTML dashboard for cards and timeline |
Skills
| Skill | Description |
|---|
/session-memory:status | Show memory status and injection preview |
/session-memory:timeline | Chronological session history |
/session-memory:search | Search cards (keyword + structured: tag:auth type:gotcha file:src/) |
/session-memory:card | Manually create a card (--type, --importance) |
/session-memory:prune | Clean up old events, detect duplicate cards |
/session-memory:onboard | Role-based onboarding (frontend, backend, devops, etc.) |
/session-memory:viewer | Generate static HTML viewer for cards and timeline |
Storage Layout
.claude/memory/
├── config.json # Project settings (optional)
├── events/ # Local only (gitignored)
│ ├── [email protected]
│ └── .interest.jsonl # File access signals
├── cards/ # Team shared (git committed)
│ └── mem_20260309_a1b2c3.md
├── summaries/ # Session archives (git committed)
│ └── 2026-03-09__abc123.md
└── viewer.html # Generated web viewer (optional)
Configuration
Create .claude/memory/config.json to customize (all optional):
{
"maxInjectTokens": 2000,
"maxMicroInjectTokens": 200,
"maxDaysToKeep": 30,
"autoPromote": true,
"autoEvidence": true,
"secretScanning": true
}
See lib/defaults.json for all available options.
Git Integration
Auto-shared via git: cards/ and summaries/ are committed, events/ are gitignored.
Merge strategy (add to your .gitattributes):
.claude/memory/cards/*.md merge=union
.claude/memory/summaries/*.md merge=union
Pre-commit hook (optional): templates/pre-commit-hook.sh scans cards for secrets before commit.
Dependencies