# windsurf-memory-optimization

Công cụ tối ưu hóa memory cho Windsurf AI.

## Cài Đặt

```bash
npm install windsurf-memory-optimization
```

## Sử Dụng

### 1. Sử Dụng Decorator

```typescript
import { MemoryPin } from '@windsurf/memory-optimization';

@MemoryPin('auth_logic', {
  ttl: '48h',
  links: ['user.service.ts'],
  description: 'Authentication logic and flow'
})
export class AuthController {
  // ...
}

export class UserService {
  @MemoryPin('user_service', {
    ttl: '24h',
    description: 'User management logic'
  })
  async createUser() {
    // ...
  }
}
```

### 2. Sử Dụng CLI

```bash
# Quét memory pins
windsurf-memory scan .

# Xem danh sách memory pins
windsurf-memory list

# Tạo snapshot
windsurf-memory snapshot create version-1.0

# Phục hồi snapshot
windsurf-memory snapshot restore version-1.0

# Tối ưu memory
windsurf-memory optimize
```

## Cấu Hình

```typescript
// Tạo file .windsurfrules trong project
[Memory Settings]
max_context_window = 128000
persistence_interval = 300s
context_retention = 72h
auto_anchor_threshold = 0.7

[Priority Anchors]
file_patterns = 
    *.controller.js => priority=0.9
    *-service.ts => priority=0.8
    Dockerfile => priority=1.0

[model_preference]
default_model = claude-3.7-sonnet
fallback_model = codeium-nexus
```

## Môi Trường

Các biến môi trường có thể được sử dụng:

- `WINDSURF_MEMORY_DIR`: Thư mục lưu trữ memory
- `WINDSURF_SNAPSHOTS_DIR`: Thư mục lưu trữ snapshots
- `WINDSURF_LOG_LEVEL`: Mức độ log (debug, info, warn, error)

## Tính Năng

- Quản lý memory pins tự động
- Tạo và quản lý snapshots
- Tối ưu hóa hiệu suất
- Hỗ trợ nén dữ liệu
- Cấu hình ưu tiên
- Tích hợp với Windsurf AI

## Hỗ Trợ

Nếu gặp vấn đề, hãy liên hệ:

- Issue Tracker: [GitHub Issues](https://github.com/windsurf/memory-optimization/issues)
- Email: support@windsurf.ai

## Giấy Phép

MIT License
