# ADR-002: Workspace-First Architecture

**Decision**: Make workspaces the primary organizational unit for infrastructure.

## Context

Provisioning users manage infrastructure across multiple environments
(dev, staging, prod), providers (AWS, UpCloud, Hetzner), and projects.
Previous flat structure lacked organization.

## Decision

Workspaces become first-class entities containing:
- Infrastructure definitions (Nickel configs)
- Runtime state and history
- Secrets and credentials (vault)
- Custom schemas and extensions
- Deployment history and rollback points

## Structure

```text
workspace/
├── config/          # Nickel configurations
├── infra/           # Infrastructure definitions
├── schemas/         # Custom schemas
├── extensions/      # Custom extensions
├── .workspace/      # Metadata
├── state.json       # Current state
└── history/         # Deployment history
```

## Benefits

- **Isolation**: Complete separation between environments
- **Collaboration**: Team-based workspace permissions
- **Versioning**: Full deployment history per workspace
- **Flexibility**: Each workspace customizable

## Implementation

```bash
# Create workspace
provisioning workspace create production

# Switch context
provisioning workspace use production

# All operations scoped to workspace
provisioning infra apply
```

## Status

✅ **Accepted** - Implemented in v2.0.0+
