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 🙏

© 2026 – Pkg Stats / Ryan Hefner

@tyronerossjr/claude-code-debugger

v1.1.0

Published

Debugging memory system for Claude Code - never solve the same bug twice

Readme

Claude Memory

Never solve the same bug twice

A debugging memory system for Claude Code that automatically learns from past incidents and suggests solutions based on similar problems you've already solved.

Features

  • Incident Tracking: Store complete debugging incidents with symptoms, root causes, fixes, and verification
  • Pattern Recognition: Automatically detect recurring problems and extract reusable patterns
  • Smart Retrieval: Find similar incidents using keyword-based similarity matching
  • Audit Trail Mining: Recover incidents from .claude/audit files when manual storage is missed
  • Dual Storage Modes:
    • Local mode: Each project has its own .claude/memory/
    • Shared mode: All projects share ~/.claude-memory/ for cross-project learning
  • CLI Access: Command-line interface for quick memory operations
  • Programmatic API: Import and use in your TypeScript/JavaScript code

Installation

From GitHub Packages

First, configure npm to use GitHub Packages for this scope. Create or edit ~/.npmrc:

@YOUR_GITHUB_USERNAME:registry=https://npm.pkg.github.com
//npm.pkg.github.com/:_authToken=YOUR_GITHUB_TOKEN

Then install:

# Project-specific installation
npm install @YOUR_GITHUB_USERNAME/claude-memory

# Global installation for CLI access anywhere
npm install -g @YOUR_GITHUB_USERNAME/claude-memory

Get a GitHub Token

  1. Go to GitHub Settings → Developer settings → Personal access tokens → Tokens (classic)
  2. Generate new token with read:packages scope
  3. Add to ~/.npmrc as shown above

Quick Start

CLI Usage

# Check current configuration
claude-memory config

# Show memory statistics
claude-memory status

# Search memory before debugging
claude-memory debug "Search filters not working"

# Search for specific incidents
claude-memory search "react hooks"

# Suggest patterns to extract
claude-memory patterns

# Extract and store patterns
claude-memory patterns --extract

# Mine audit trail for missed incidents
claude-memory mine --days 30

# Store mined incidents
claude-memory mine --days 30 --store

Programmatic Usage

import {
  debugWithMemory,
  storeDebugIncident,
  checkMemory,
  extractPatterns,
  mineAuditTrail
} from '@YOUR_GITHUB_USERNAME/claude-memory';

// Before debugging: Check for similar incidents
const result = await debugWithMemory("Search filters not working", {
  min_confidence: 0.7
});

console.log('Session ID:', result.context_used.session_id);

// After fixing: Store the incident
await storeDebugIncident(sessionId, {
  root_cause: {
    description: "Missing useMemo dependency caused infinite re-renders",
    category: "react-hooks",
    confidence: 0.9
  },
  fix: {
    approach: "Added missing dependency to useMemo array",
    changes: ["components/SearchBar.tsx"],
    time_to_fix: 15
  },
  verification: {
    status: 'verified',
    regression_tests_passed: true,
    user_journey_tested: true,
    success_criteria_met: true
  }
});

// Search memory directly
const memory = await checkMemory("infinite render loop", {
  similarity_threshold: 0.5,
  max_results: 5
});

// Extract patterns from incidents
const patterns = await extractPatterns({
  min_incidents: 3,
  min_similarity: 0.7,
  auto_store: true
});

// Mine audit trail
const incidents = await mineAuditTrail({
  days_back: 30,
  auto_store: true,
  min_confidence: 0.7
});

Configuration

Storage Modes

Local Mode (default)

  • Each project has its own .claude/memory/ directory
  • Incidents and patterns are project-specific
  • Best for: Project-specific debugging context

Shared Mode

  • All projects share ~/.claude-memory/ globally
  • Learn across all your projects
  • Best for: Common patterns that appear in multiple projects

Switch Modes

# Use shared mode for this command
claude-memory status --shared

# Set shared mode via environment variable
export CLAUDE_MEMORY_MODE=shared
claude-memory status

# In code
import { getConfig } from '@YOUR_GITHUB_USERNAME/claude-memory';

const config = getConfig({
  storageMode: 'shared'
});

Environment Variables

# Storage mode: 'local' or 'shared'
CLAUDE_MEMORY_MODE=shared

# Custom memory path (overrides mode defaults)
CLAUDE_MEMORY_PATH=/custom/path/to/memory

How It Works

1. Incident Structure

Each incident captures:

  • Symptom: What the bug looked like
  • Root Cause: Why it happened (with confidence score)
  • Fix: How it was resolved (approach + file changes)
  • Verification: Testing status
  • Quality Gates: Security and review status
  • Tags: For categorization and search

2. Pattern Extraction

When 3+ similar incidents are detected:

  • Automatically extract common characteristics
  • Create reusable pattern with solution template
  • Track success rate and usage history
  • Include caveats for edge cases

3. Retrieval Strategy

Pattern-First Approach:

  1. Try to match against known patterns (90% confidence)
  2. If no pattern matches, search incidents (70% confidence)
  3. Use keyword-based Jaccard similarity
  4. Prefer recent incidents (90-day window)

4. Audit Trail Mining

Recover incidents from .claude/audit/ files:

  • Parses root cause analysis documents
  • Extracts error tracking logs
  • Converts fix reports into incidents
  • Filters duplicates and low-confidence entries

CLI Commands Reference

debug <symptom>

Check memory for similar incidents before debugging.

claude-memory debug "Search filters not working"
claude-memory debug "API timeout" --threshold 0.6
claude-memory debug "Infinite render loop" --shared

Options:

  • --shared: Use shared memory mode
  • --threshold <number>: Similarity threshold (0-1, default: 0.5)

status

Show memory system statistics.

claude-memory status
claude-memory status --shared

config

Display current configuration.

claude-memory config

search <query>

Search memory for incidents matching a query.

claude-memory search "react hooks"
claude-memory search "API error" --threshold 0.6

Options:

  • --shared: Use shared memory mode
  • --threshold <number>: Similarity threshold (default: 0.5)

patterns

Suggest or extract patterns from incidents.

# Preview patterns that could be extracted
claude-memory patterns

# Extract and store patterns
claude-memory patterns --extract

Options:

  • --extract: Extract and store patterns (vs just preview)
  • --shared: Use shared memory mode

mine

Mine audit trail for incidents not manually stored.

# Preview what would be mined
claude-memory mine --days 30

# Mine and store incidents
claude-memory mine --days 30 --store

Options:

  • --days <number>: Days to look back (default: 30)
  • --store: Store mined incidents (vs just preview)
  • --shared: Use shared memory mode

API Reference

Core Functions

debugWithMemory(symptom, options)

Check memory before debugging and prepare for storage.

const result = await debugWithMemory("symptom description", {
  agent: 'coder',
  auto_store: true,
  min_confidence: 0.7
});

Returns: DebugResult with session ID and memory context

storeDebugIncident(sessionId, incidentData)

Store incident after debugging is complete.

await storeDebugIncident(sessionId, {
  root_cause: { ... },
  fix: { ... },
  verification: { ... }
});

checkMemory(symptom, config)

Search memory for similar incidents.

const memory = await checkMemory("symptom", {
  similarity_threshold: 0.5,
  max_results: 5,
  temporal_preference: 90,
  memoryConfig: { storageMode: 'shared' }
});

Returns: RetrievalResult with patterns and/or incidents

extractPatterns(options)

Extract reusable patterns from incidents.

const patterns = await extractPatterns({
  min_incidents: 3,
  min_similarity: 0.7,
  auto_store: true,
  config: { storageMode: 'shared' }
});

mineAuditTrail(options)

Recover incidents from audit trail.

const incidents = await mineAuditTrail({
  days_back: 30,
  auto_store: true,
  min_confidence: 0.7,
  config: { storageMode: 'shared' }
});

Storage Operations

import {
  storeIncident,
  loadIncident,
  loadAllIncidents,
  storePattern,
  loadPattern,
  loadAllPatterns,
  getMemoryStats
} from '@YOUR_GITHUB_USERNAME/claude-memory';

Configuration

import { getConfig, getMemoryPaths } from '@YOUR_GITHUB_USERNAME/claude-memory';

const config = getConfig({
  storageMode: 'shared',
  autoMine: false,
  defaultSimilarityThreshold: 0.7
});

const paths = getMemoryPaths(config);
// paths.incidents, paths.patterns, paths.sessions

TypeScript Types

All TypeScript types are exported:

import type {
  Incident,
  Pattern,
  RootCause,
  Fix,
  Verification,
  QualityGates,
  RetrievalResult,
  MemoryConfig
} from '@YOUR_GITHUB_USERNAME/claude-memory';

Directory Structure

Local Mode

your-project/
└── .claude/
    └── memory/
        ├── incidents/     # Individual incident JSON files
        ├── patterns/      # Extracted pattern JSON files
        └── sessions/      # Temporary debug session files

Shared Mode

~/.claude-memory/
├── incidents/    # All incidents from all projects
├── patterns/     # All patterns from all projects
└── sessions/     # Temporary session files

Integration with Claude Code

Prompt for Agents

Include in your agent prompts:

Before debugging, check memory:
- Run: `npx claude-memory debug "symptom description"`
- Review similar incidents and patterns
- Apply known solutions if confidence is high

After fixing:
- Store incident with: `npx claude-memory store`
- Or use programmatic API from TypeScript

Automated Mining

Set up periodic audit mining:

# Weekly cron job to mine audit trail
0 0 * * 0 cd /path/to/project && npx claude-memory mine --days 7 --store

Best Practices

1. Always Check Before Debugging

claude-memory debug "symptom" --threshold 0.7

2. Store Complete Incidents

Include all fields for maximum reuse:

  • Root cause with confidence score
  • Complete fix description
  • Verification status
  • Quality gates

3. Extract Patterns Regularly

# Weekly pattern extraction
claude-memory patterns --extract

4. Mine Audit Trail

# Monthly audit mining
claude-memory mine --days 30 --store

5. Use Shared Mode for Common Issues

export CLAUDE_MEMORY_MODE=shared

Development

Build from Source

git clone https://github.com/YOUR_GITHUB_USERNAME/claude-memory.git
cd claude-memory
npm install
npm run build

Run Tests

npm test

Watch Mode

npm run watch

Publishing

Prepare Release

# Update version in package.json
npm version patch|minor|major

# Build
npm run build

# Publish to GitHub Packages
npm publish

Version Management

This package uses semantic versioning:

  • Patch (1.0.x): Bug fixes
  • Minor (1.x.0): New features, backward compatible
  • Major (x.0.0): Breaking changes

Troubleshooting

"Cannot find module"

  • Ensure package is installed: npm list @YOUR_GITHUB_USERNAME/claude-memory
  • Check import paths match package exports

"No incidents found"

  • Verify memory directory exists
  • Check storage mode (local vs shared)
  • Run claude-memory status to see statistics

"Permission denied"

  • Ensure directory permissions for .claude/memory/
  • For shared mode: Check ~/.claude-memory/ permissions

"Invalid token" when installing

  • Verify GitHub token has read:packages scope
  • Check .npmrc configuration
  • Ensure token is not expired

Publishing

See PUBLISHING-GUIDE.md for detailed instructions on:

  • Setting up GitHub repository
  • Generating access tokens
  • Publishing to GitHub Packages
  • Version management
  • Updating the package

Contributing

Contributions welcome! Please:

  1. Fork the repository
  2. Create a feature branch
  3. Add tests for new features
  4. Submit a pull request

License

MIT

Support

  • Issues: https://github.com/YOUR_GITHUB_USERNAME/claude-memory/issues
  • Discussions: https://github.com/YOUR_GITHUB_USERNAME/claude-memory/discussions

Never solve the same bug twice. 🧠