# PR-02 Workspace Init, Registry, and Identity Foundation

Domain Owner: `docs/packer`

## Briefing

Implement the packer-owned workspace control model and registry authority in `prometeu-packer`.

This PR turns the identity and workspace rules into executable code.

## Objective

Deliver `init_workspace`, registry load/store, identity allocation, and asset-root resolution as the stable foundation for all later packer operations.

## Dependencies

- [`./PR-01-packer-project-bootstrap-and-module-boundaries.md`](./PR-01-packer-project-bootstrap-and-module-boundaries.md)
- [`../specs/1. Domain and Artifact Boundary Specification.md`](../specs/1.%20Domain%20and%20Artifact%20Boundary%20Specification.md)
- [`../specs/2. Workspace, Registry, and Asset Identity Specification.md`](../specs/2.%20Workspace,%20Registry,%20and%20Asset%20Identity%20Specification.md)

## Scope

- implement `init_workspace`
- create and validate `assets/.prometeu/index.json`
- implement monotonic `asset_id` allocation and persisted allocator state
- model `asset_uuid` allocation and persistence
- implement root resolution utilities used by future read/write operations
- define structural registry errors and missing-root behavior

## Non-Goals

- no `asset.json` semantic validation beyond what registry ownership requires
- no Studio adapter yet
- no build artifacts yet

## Execution Method

1. Implement packer-owned registry models and codecs.
2. Add workspace bootstrap behavior for missing control directories.
3. Enforce identity invariants around `asset_id`, `asset_uuid`, and root uniqueness.
4. Expose internal services for lookup by `asset_id`, `asset_uuid`, and root path.

## Acceptance Criteria

- workspace initialization creates the minimum control structure deterministically
- registry state round-trips without losing allocator data
- duplicate or ambiguous identity-bearing entries fail clearly
- relocation can later update root location without changing identity fields

## Validation

- unit tests for registry round-trip and allocator monotonicity
- unit tests for duplicate-root and malformed-registry failures
- workspace-init fixture test

## Affected Artifacts

- `prometeu-packer/**`
- `assets/.prometeu/index.json` contract implementation
- packer fixture workspaces
