npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

@alucardeht/claude-memory

v2.0.1

Published

Automatic context persistence for Claude Code

Readme

claude-memory

Automatic, invisible memory for Claude Code. Never lose context after /compact again.

What it does

claude-memory automatically:

  1. Saves conversations before /compact clears context
  2. Injects relevant context into every prompt based on what you're working on
  3. Works invisibly - install once, forget about it

Installation

npm install -g @alucardeht/claude-memory

Note: The claude-memory install command runs automatically after npm install.

That's it. The installer automatically:

  • Downloads the correct binary for your platform
  • Configures Claude Code hooks
  • Creates the memory database

How it works

┌─ Session Start ─────────────────────────────────┐
│ Loads project core memory                       │
│ → "You're working on X, preferences are Y..."   │
└─────────────────────────────────────────────────┘
                        ↓
┌─ Every Prompt ──────────────────────────────────┐
│ 1. Extracts entities (files, functions, errors) │
│ 2. Searches for relevant past context           │
│ 3. Injects as system message (~4000 tokens)     │
│ Performance: <5ms total                         │
└─────────────────────────────────────────────────┘
                        ↓
┌─ Before /compact ───────────────────────────────┐
│ Saves entire conversation with importance scores│
│ → Context preserved for future sessions         │
└─────────────────────────────────────────────────┘

What gets saved

Both your messages AND Claude's responses are saved, including:

  • Files and functions mentioned
  • Errors discussed
  • Decisions made

What gets injected

On each prompt, the system searches your past conversations and injects relevant context. Example of what Claude sees:

## Relevant History
[user, 3 days ago]
How do I fix the auth bug?
Files: auth/login.go

[assistant, 3 days ago]
The issue is in line 45, the token wasn't being validated...
Decisions: Use JWT instead of sessions

In practice

  • You mention auth/login.go → System finds past discussions about that file
  • You ask "what was that bug?" → System finds error-related conversations
  • You start fresh session → Claude already has context from days ago

Context Budget

Claude-memory automatically manages context size to prevent token overflow:

| Component | Token Budget | Max Size | |-----------|--------------|----------| | Core Memory | 500 tokens | ~2KB | | Retrieved Context | 3500 tokens | ~14KB | | Total | 4000 tokens | ~16KB |

Safety features:

  • Automatic truncation when limits are exceeded
  • Warning logs via slog when approaching limits
  • Hard safety net at 20KB (user prompts) / 10KB (session start)

This is transparent and requires no configuration.

Privacy

All data stays local in ~/.claude-memory/. No cloud, no sync, no network calls.

Commands

# Install hooks (done automatically on npm install)
claude-memory install

# Uninstall hooks
claude-memory install --uninstall

# Search your memory manually
claude-memory search "auth bug"
claude-memory search "database migration" --project /path/to/project

# Show version
claude-memory --version

Search options

claude-memory search [query] [flags]

Flags:
  -n, --limit int      Maximum results (default 10)
  -p, --project path   Search specific project
  -s, --scores         Show relevance scores

How scoring works

| Content Type | Score Boost | |--------------|-------------| | File mentions (src/auth.go) | +3 | | Function mentions (validateToken) | +2 | | Error patterns | +3 | | Decision phrases ("vamos usar", "let's use") | +2 | | Short/filler messages ("ok", "got it") | -2 |

Recency also matters:

  • Last hour: 2x boost
  • Last day: 1.5x boost
  • Last week: 1.2x boost
  • Older than month: 0.8x penalty

Storage

Memory is stored in ~/.claude-memory/memory.db (SQLite with FTS5).

Each project has isolated memory based on its absolute path.

Performance

| Operation | Target | Actual | |-----------|--------|--------| | Entity extraction | <1ms | ~170µs | | FTS search | <1ms | ~200µs | | Context injection | <5ms | ~160µs | | Session start | <1ms | ~30µs |

Requirements

  • Claude Code CLI
  • Node.js 16+ (for npm installation)
  • macOS, Linux, or Windows

Windows Support

claude-memory has full support for Windows 10 and Windows 11.

Installation (same as other platforms)

npm install -g @alucardeht/claude-memory
claude-memory install

Windows-specific paths

| Data | Location | |------|----------| | Claude settings | %APPDATA%\Claude\settings.json | | claude-memory database | %APPDATA%\claude-memory\memory.db | | claude-memory config | %APPDATA%\claude-memory\config.json |

Note: On Windows, %APPDATA% typically resolves to C:\Users\YourUsername\AppData\Roaming\

Requirements for Windows

  • Node.js 16+ (download from nodejs.org)
  • Git for Windows (recommended, includes Git Bash)
  • Claude Code CLI installed and configured

Troubleshooting

If you encounter issues:

  1. Binary not found: Try reinstalling with npm install -g @alucardeht/claude-memory
  2. Permission errors: Run PowerShell/CMD as Administrator
  3. Path issues: Ensure %APPDATA%\npm is in your system PATH

Uninstall

npm uninstall -g @alucardeht/claude-memory

This removes the CLI and hooks. Memory database remains in ~/.claude-memory/.

License

MIT