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

# Fleet Pi project structure

> Tour of the Fleet Pi monorepo — apps/web TanStack Start routes, agent-workspace layout, Pi runtime modules, key dependencies, and the runtime data flow.

Auto-generated overview of the monorepo workspace. Start with the [Introduction](/fleet-pi/introduction) and [Quickstart](/fleet-pi/quickstart) if you are new to Fleet Pi.

## Workspace layout

```text theme={null}
fleet-pi/
├── .codex/                   # Codex local environment and bootstrap scripts
├── .pi/                      # Committed Pi config, skills, and built-in extensions
├── agent-workspace/          # Durable agent memory, plans, skills, artifacts, and installs
├── apps/web/                 # TanStack Start application
│   ├── src/routes/           # File-based API and page routes
│   ├── src/lib/pi/           # Pi runtime integration (server.ts, plan-mode.ts, chat-protocol)
│   ├── src/lib/workspace/    # agent-workspace tree and file helpers
│   ├── src/lib/pii/          # PII sanitization module
│   ├── src/lib/logger.ts     # Pino logger with redaction
│   └── src/routes/           # Route-local components live alongside their routes
├── packages/hax-design/      # @workspace/hax-design — single source of truth for UI
│   └── src/components/
│       ├── agent-elements/   # Reusable chat and tool UI
│       ├── fleet-pi/         # Fleet Pi chat and workspace surfaces
│       └── openui/           # OpenUI kit
├── docs/                     # Generated and hand-written documentation
├── scripts/                  # Build and utility scripts
└── .github/workflows/        # CI/CD automation
```

## Key dependencies

| Package                              | Purpose                                |
| ------------------------------------ | -------------------------------------- |
| @tanstack/react-start                | Full-stack React framework             |
| @earendil-works/pi-coding-agent      | Pi coding-agent runtime                |
| @earendil-works/pi-ai                | Pi AI primitives                       |
| Amazon Bedrock                       | Primary LLM provider                   |
| pino + pino-pretty                   | Structured logging                     |
| opossum                              | Circuit breaker pattern                |
| zod + @asteasolutions/zod-to-openapi | Schema validation & OpenAPI generation |
| vitest + @playwright/test            | Testing frameworks                     |
| husky + lint-staged                  | Pre-commit hooks                       |

## Data flow

1. The **browser** sends a user message to `/api/chat` via NDJSON stream.
2. The **server route** sanitizes input (PII), logs with correlation IDs, and creates or resumes a Pi session.
3. The **Pi server module** invokes Amazon Bedrock through a circuit breaker.
4. Streaming events (`start`, `delta`, `tool`, `done`, `error`) flow back to the client.
5. The **client** hydrates messages from the Pi session file on reload and opens supporting resources/workspace panels on demand.
6. Supporting endpoints expose models, resources, workspace files, sessions, and health checks.
7. Durable agent context lives in `agent-workspace/`, including project memory, plans, artifacts, and workspace-installed Pi resources.
