# leWOOOgo Data

> Memory Provider Abstraction Layer for AWOOOI 2.0

## Overview

leWOOOgo Data 是 AWOOOI 智能運維平台的資料抽象層積木，負責：

- **Working Memory**: Redis 快取 (7 天 TTL)
- **Episodic Memory**: PostgreSQL/SQLite 永久保存
- **Dual Memory**: 雙層同步寫入

## Installation

```bash
# 在 apps/api 中使用
pip install -e ../../packages/lewooogo-data

# 如需 PostgreSQL 支援
pip install -e "../../packages/lewooogo-data[pg]"
```

## Usage

```python
from lewooogo_data.interfaces import IMemoryProvider
from lewooogo_data.providers import RedisMemory, PgMemory, DualMemory

# 使用雙層記憶體
memory = DualMemory(
    working=RedisMemory(redis_url="redis://localhost:6379"),
    episodic=PgMemory(database_url="postgresql://...")
)

# 載入 Incident
incident = await memory.load(f"incident:{incident_id}")
```

## Modules

| Module | Description |
|--------|-------------|
| `interfaces/` | ABC 定義 |
| `providers/` | 具體實作 |

## ADR Reference

- [ADR-008: Python 模組化獨立積木架構](../../docs/adr/ADR-008-python-modular-packages.md)
