Basic Usage Guide - robwhite4/claude-memory GitHub Wiki
Basic Usage Guide
Claude Memory works automatically in the background, but you can also use manual commands to enhance your project's memory. This guide covers the essential commands and workflows.
Automatic Features
Claude Memory handles these tasks automatically:
- Session Management: Rotates every 4 hours by time of day
- Auto-Backups: Saves after every 10 actions
- Token Optimization: Keeps context under 3K tokens
- Context Generation: Updates CLAUDE.md continuously
Essential Commands
1. Check Project Status
# See what Claude knows about your project
cmem stats
# Output shows:
# - Current session
# - Active tasks
# - Recent decisions
# - Memory usage
2. Task Management
# Add a new task (priority: high, medium, low)
cmem task add "Implement user authentication" --priority high
# List all tasks
cmem task list
# Complete a task
cmem task complete abc123 "Added JWT authentication"
# List tasks by status (optional: all, open, completed, in-progress)
cmem task list open
3. Decision Tracking
# Document important decisions
cmem decision "Use PostgreSQL" "Need ACID compliance" "MongoDB,DynamoDB"
# Format: decision "choice" "reasoning" "alternatives considered"
4. Pattern Management
# Add a development pattern
cmem pattern add "API-first design" "Build APIs before UI" --effectiveness 0.9 --priority high
# List patterns
cmem pattern list
# Search patterns
cmem pattern search "API"
# Resolve a pattern (mark as addressed)
cmem pattern resolve pattern-id "Implemented REST API structure"
5. Knowledge Base
# Store project knowledge
cmem knowledge add "API_KEY_LOCATION" "Environment variables in .env" --category security
# Retrieve knowledge
cmem knowledge get "API_KEY_LOCATION"
# List all knowledge
cmem knowledge list
# List by category
cmem knowledge list security
6. Search Everything
# Search across all memory
cmem search "authentication"
# Returns matches from:
# - Tasks
# - Decisions
# - Patterns
# - Knowledge
# - Sessions
v1.10.0 Features: Data Management
7. Bulk Task Operations
# Import multiple tasks from JSON file
cmem task add-bulk tasks.json
# Export tasks to JSON format
cmem task export json > backup.json
# Export tasks for GitHub issues (copy-paste ready)
cmem task export github pending > github-issues.md
8. Enhanced Export & Import
# Export data in different formats
cmem export backup.json # JSON (default)
cmem export report.yaml --format yaml # YAML format
cmem export data.csv --format csv # CSV for spreadsheets
cmem export summary.md --format markdown # Markdown documentation
# Filter exports by type and date
cmem export --types tasks,patterns # Only tasks and patterns
cmem export --from 2024-01-01 --to 2024-12-31 # Date range
cmem export --types decisions --from 2024-06-01 # Recent decisions only
# Import data (merge mode by default)
cmem import backup.json # Add new items, skip duplicates
cmem import data.yaml --mode replace # Replace all existing data
cmem import --types tasks backup.json # Import only specific types
cmem import data.json --dry-run # Preview without changes
9. Report Generation
# Generate different report types
cmem report summary # Project overview
cmem report tasks # Task breakdown
cmem report patterns # Pattern analysis
cmem report decisions # Decision log
cmem report progress # Progress timeline
cmem report sprint # 2-week activity summary
# Output formats and file saving
cmem report --format json # JSON format
cmem report summary project-status.md # Save to specific file
cmem report --save # Auto-save with timestamp
cmem report sprint --save --save-dir ./reports # Custom directory
# Date filtering for focused reports
cmem report tasks --from 2024-01-01 # Tasks since date
cmem report sprint --from 2024-06-01 --to 2024-06-14 # Specific range
Common Workflows
Starting Your Day
# Check where you left off
cmem stats
cmem task list pending
# The automatic session will show you:
# - What you were working on
# - Active tasks
# - Recent completions
Making Progress
# As you work, track completions
cmem task complete task-123 "Fixed login bug"
# Document discoveries
cmem pattern add "State race condition" "Use useEffect cleanup" --priority high
# Record decisions
cmem decision "Refactor auth module" "Code duplication" "Keep as-is"
Debugging Issues
# Search for related patterns
cmem pattern search "bug"
# Check past decisions
cmem search "error handling"
# Add new pattern when you find the fix
cmem pattern add "Memory leak in hooks" "Always cleanup subscriptions" --effectiveness 1.0
Team Handoffs
# Generate handoff summary
cmem handoff
# Creates a comprehensive summary including:
# - Active session
# - In-progress tasks
# - Recent decisions
# - Key patterns
CLI Flags
Control behavior with global flags:
# Preview without making changes
cmem task add "New feature" --dry-run
# Skip confirmations
cmem session cleanup --force
# Get detailed debug info
cmem stats --debug
# Output as JSON
cmem task list --output json
# Suppress non-essential output
cmem backup --quiet
Integration with Claude
When using Claude or any AI assistant, the CLAUDE.md file provides context automatically. The AI will know:
- Your current tasks
- Recent decisions
- Project patterns
- Session history
No need to explain your project repeatedly!
Best Practices
- Let automation work: Don't manually manage sessions
- Document decisions: Future you will appreciate it
- Track patterns: Helps identify recurring issues
- Use categories: Organize knowledge effectively
- Search before asking: Check if the answer is already in memory
Advanced Usage
For more advanced features, see:
- Multi-Machine-Setup - Work across multiple computers
- Team-Collaboration - Share memory with your team
- Advanced-Configuration - Customize behavior
- Architecture - Understand how it works
Quick Reference Card
cmem stats # Check status
cmem task add "..." # Add task
cmem task complete <id> # Complete task
cmem decision "..." "..." "..." # Track decision
cmem pattern add "..." "..." # Add pattern
cmem search "..." # Search everything
cmem handoff # Generate summary