> ## Documentation Index
> Fetch the complete documentation index at: https://docs.zeus.agentspro.cn/llms.txt
> Use this file to discover all available pages before exploring further.

# 文件系统

> Zeus 文件系统架构

> Zeus Agent 的存储架构设计，包括 Checkpoint（状态持久化）和 Backend（文件存储）两大核心组件。

***

## 架构概览

```mermaid theme={null}
flowchart TB
    subgraph DeepAgent["DeepAgent"]
        FileTools["文件工具"]
        Memory["记忆 (自己实现)"]
        StateManager["状态管理"]
    end

    subgraph CloudDrive["CloudDriveBackend"]
        Redis["Redis Cache"]
        Supabase["Supabase Storage"]
        Redis <--> Supabase
        Paths["/workspace/ 产物文件\n/memory/ 长期记忆"]
    end

    subgraph Checkpoint["PostgresSaver"]
        CheckpointDB["Checkpoint (HITL/恢复)"]
    end

    FileTools --> CloudDrive
    Memory --> CloudDrive
    StateManager --> Checkpoint

    CloudDrive --> SupabaseStorage[("Supabase Storage\n用户云盘")]
    Checkpoint --> PostgreSQL[("PostgreSQL")]
```

***

## 核心组件

| 组件               | 用途                    | 存储位置             | 文档                            |
| ---------------- | --------------------- | ---------------- | ----------------------------- |
| **Checkpointer** | Agent 状态持久化、HITL 中断恢复 | PostgreSQL       | [Checkpoint.md](./Checkpoint) |
| **Backend**      | 文件系统操作、用户云盘           | Supabase Storage | [Backend.md](./Backend)       |
| **Memory**       | 长期记忆（自己实现）            | Supabase Storage | [Backend.md](./Backend)       |

***

## 快速对比

| 对比项      | Checkpointer           | Backend           | Memory           |
| -------- | ---------------------- | ----------------- | ---------------- |
| **存储内容** | Agent 执行状态             | 文件/产物             | 用户知识/偏好          |
| **粒度**   | 每步执行                   | 文件操作              | 概念级              |
| **生命周期** | 会话级                    | 用户级               | 永久               |
| **访问者**  | LangGraph 内部           | Agent 工具          | 自定义逻辑            |
| **当前实现** | DrizzleCheckpointSaver | StateBackend      | InMemoryStore    |
| **目标实现** | PostgresSaver          | CloudDriveBackend | Supabase Storage |

***

## 迁移优先级

1. **高优先级**：[Checkpoint](./Checkpoint) - 影响 HITL 功能稳定性
2. **中优先级**：[Backend](./Backend) - 影响产物持久化和用户体验
3. **低优先级**：Redis 缓存 - 性能优化，可后续添加

***

## 环境变量

需要配置以下环境变量：

* `DATABASE_URL` - PostgreSQL 连接地址（用于 Checkpointer）
* `SUPABASE_URL` - Supabase Storage URL（用于 Backend）
* `SUPABASE_SERVICE_KEY` - Supabase Service Key（用于 Backend）
* `REDIS_URL` - Redis 连接地址（可选，用于缓存）
