npm package: @gitmaxd/ai-mem
Description: GitMaxd's AI-optimized memory and documentation system for Claude Code and other AI coding assistants
Author: GitMaxd
Latest version: 0.5.0

# AI Memory 🧠

[![npm version](https://badge.fury.io/js/@gitmaxd%2Fai-mem.svg)](https://badge.fury.io/js/@gitmaxd%2Fai-mem)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)

A comprehensive AI-optimized memory and documentation system designed for Claude Code and other AI coding assistants. Create a structured `memory-bank` directory that helps AI assistants understand your project's architecture, patterns, and current state.

**Created by [@GitMaxd](https://x.com/gitmaxd) for personal productivity and AI-assisted development.**

## Quick Start

### Global Installation

```bash
npm install -g @gitmaxd/ai-mem
```

### One-time Use (Recommended)

```bash
npx ai-mem init
```

This creates a `memory-bank` directory in your current project with a complete documentation structure optimized for AI assistants.

## Features

✅ **AI-Optimized Structure** - Documents organized for optimal AI comprehension  
✅ **Plug & Play** - Works immediately with Claude Code and other AI assistants  
✅ **Comprehensive Templates** - Pre-built templates for all common documentation needs  
✅ **Maintenance Automation** - Built-in prompts for keeping documentation current  
✅ **Cross-Platform** - Works on Windows, macOS, and Linux  

## Usage

### Initialize Memory Bank

```bash
# Create memory-bank directory (default)
npx ai-mem init

# Custom directory name
npx ai-mem init -d my-memory-bank

# Force overwrite existing directory
npx ai-mem init --force
```

### Update Existing Memory Bank

```bash
# Update templates and structure
npx ai-mem update
```

### Programmatic API

```javascript
const MemoryBank = require('@gitmaxd/ai-mem');

const memoryBank = new MemoryBank({ directory: 'memory-bank' });

// Initialize
await memoryBank.init();

// Update
await memoryBank.update();

// Check if exists
const exists = await memoryBank.exists();
```

## Directory Structure Created

```
memory-bank/
├── README.md                    # Navigation guide
├── INITIALIZATION_GUIDE.md      # Setup instructions
├── MAINTENANCE_GUIDE.md         # Ongoing maintenance
├── QUICK_START.md              # 1-minute setup guide
├── prompts/                    # AI prompts for various tasks
│   ├── PROJECT_ANALYSIS_PROMPT.md
│   ├── UPDATE_PROMPT.md
│   └── MAINTENANCE_PROMPT.md
├── templates/                  # Document templates
│   ├── metadata-header.yaml
│   ├── core/                  # Project fundamentals
│   ├── active/                # Current development
│   ├── patterns/              # Implementation patterns
│   ├── features/              # Feature documentation
│   └── technical/             # Technical learnings
├── active/                    # Current development state
├── core/                      # Fundamental project docs
├── patterns/                  # Implementation patterns
├── features/                  # Feature documentation
├── technical/                 # Technical learnings
└── archive/                   # Historical documentation
```

## AI Assistant Integration

### With Claude Code

After initializing, tell Claude Code:

```
Please initialize the memory bank for this project by:
1. Reading memory-bank/prompts/PROJECT_ANALYSIS_PROMPT.md
2. Analyzing the codebase following its instructions
3. Creating initial documentation in the appropriate directories
```

### Daily Workflow

1. **Start of session**: `"What's the current development context from the memory bank?"`
2. **During work**: AI references patterns and architecture from memory bank
3. **End of session**: `"Please update the memory bank using memory-bank/prompts/UPDATE_PROMPT.md"`

### Weekly Maintenance

```
Please perform weekly memory bank maintenance using memory-bank/prompts/MAINTENANCE_PROMPT.md
```

## Benefits

### For AI Assistants
- **Rapid Context Loading** - Structured navigation reduces search time
- **Consistent Understanding** - Standardized formats across projects  
- **Accurate Code Generation** - Current state and patterns always documented
- **Efficient Collaboration** - Clear handoff between sessions

### For Development Teams
- **Faster Onboarding** - New team members get complete project context
- **Better Documentation** - Living docs that evolve with code
- **Consistent Patterns** - Documented approaches across the codebase
- **Knowledge Retention** - Captures decisions and learnings over time

## CLI Commands

```bash
# Show help
ai-mem --help

# Initialize with options
ai-mem init --help

# Update with options  
ai-mem update --help
```

### Options

#### `init` command
- `-d, --directory <dir>` - Target directory name (default: 'memory-bank')
- `--force` - Overwrite existing directory

#### `update` command
- `-d, --directory <dir>` - Memory bank directory name (default: 'memory-bank')

## Requirements

- Node.js >= 14.0.0
- npm or yarn

## Author

**GitMaxd** - [@GitMaxd](https://x.com/gitmaxd)

## License

MIT © [GitMaxd](https://github.com/gitmaxd)

## Support

- 🐛 [Report bugs](https://github.com/gitmaxd/ai-mem/issues)
- 💡 [Request features](https://github.com/gitmaxd/ai-mem/issues)
- 📖 [Read the docs](https://github.com/gitmaxd/ai-mem#readme)

---

**Made by [@GitMaxd](https://x.com/gitmaxd) for AI-assisted development** 🤖❤️