zc2 0.0.49

P2P compute broker with yen-denominated billing, WAL, and broker mesh support
# Architecture Decision Records (zc)

An ADR records one decision: the context, the choice, the alternatives rejected and the consequences. It does not restate what code or tooling already enforces. ADRs describe what is live at the default branch tip (Accepted) or what is proposed but not decided or built (Proposed).

## ID prefixes

| Prefix | Repository | Layer |
|---|---|---|
| ZC | zc | broker |
| MKT | zak-marketplace | hub |
| ZAK | zakuro-internal | sdk / framework |
| SAK | sakura-internal | framework |
| GET | zak-get | install |
| DOCS | zak-docs | docs |
| INFRA | zakuro-infra | deploy |
| IMG | zakuro-image | image / environment isolation |
| FORGE | zak-forge | runner (GPU training, quantization, evaluation) |

## Status lifecycle

Proposed, then Accepted when merged live at the default branch, then Superseded by a later ADR. An Accepted ADR is never rewritten to change the decision; it gets `Superseded by PREFIX-NNNN` and the new ADR lists it under `Supersedes / corrects`.

## Adding or superseding an ADR

1. Copy the template from any existing ADR; take the next free number (`NNNN-kebab-title.md`, heading `# ZC-NNNN: Title`).
2. Include an Evidence section with repo-relative paths, and commits or issues only if seen.
3. Add a row to the index below in the same change.
4. To supersede: set the old ADR's status line and link both ways.

## Cross-repo changes

A change that spans layers gets an epic issue with one sub-issue per affected layer, in dependency order (ADR, hub/broker, sdk, install, deploy, docs). Each sub-issue names its ADR IDs. Track them on https://github.com/orgs/zakuro-ai/projects/3.

A bare repo prefix (for example `ZC` or `INFRA`) in a Related list means the decision is relevant but not yet recorded as an ADR in that repo.

## Index

| ID | Title | Status | Layer | Related |
|---|---|---|---|---|
| ZC-0001 | Route per worker through one selection layer; peers are a fallback tier | Accepted | broker | ZC-0003, ZC-0011 |
| ZC-0002 | Bounded axum/tokio frontend, not thread-per-request | Accepted | broker | ZC-0004 |
| ZC-0003 | Discovery: config, hub roster, signed gossip | Accepted | broker | ZC-0001, ZC-0007 |
| ZC-0004 | WireGuard overlay, QUIC for peer offers, Tailscale removed | Accepted | broker | ZC-0003, ZC-0007 |
| ZC-0005 | Hub is the balance authority; local WAL | Accepted | broker | ZC-0006 |
| ZC-0006 | Hub-signed vouchers verified offline | Accepted | broker | ZC-0005, ZC-0012 |
| ZC-0007 | Ed25519 node identity, `zc://node-<fp>`, signed /peer/* | Accepted | broker | ZC-0003, ZC-0012 |
| ZC-0008 | API key and enrollment model | Accepted | broker | ZC-0006, ZC-0007 |
| ZC-0009 | Opaque forwarding; wire schema in `zakuro-wire` | Accepted | broker | ZC-0010 |
| ZC-0010 | Release flow and crate split | Accepted | broker | ZC-0009, ZC-0015 |
| ZC-0011 | Adaptive scheduler: built parts and promotion | Proposed | broker | ZC-0001, ZC-0013 |
| ZC-0012 | End state for node-signature and voucher enforcement | Proposed | broker | ZC-0006, ZC-0007 |
| ZC-0013 | Worker QUIC and async peer client wiring (decision: remove worker QUIC) | Accepted | broker | ZC-0004, ZC-0011 |
| ZC-0014 | Plain-HTTP config fetches: trust and integrity | Proposed | install | ZC-0015 |
| ZC-0015 | Two distribution paths for the binary | Accepted | install | ZC-0010, ZC-0014 |
| ZC-0016 | Mesh placement policy and the returned routing decision | Accepted | broker | ZC-0001 |
| ZC-0017 | One sharing policy per node, owned by the agent | Proposed | broker / agent | ZC-0016, ZC-0018, ZC-0019, MKT |
| ZC-0018 | The sandbox is the allocation (Lima on macOS, LXC on Linux, Docker as fallback) | Proposed | broker / runtime | ZC-0017, IMG |
| ZC-0019 | Agent API v2: one local control point for the app, the widget and the CLI | Proposed | agent | ZC-0017, ZC-0018, ZC-0020 |
| ZC-0020 | `zakuro://` deep links: hub-signed actions, confirmed on the desktop | Proposed | agent / desktop | ZC-0006, ZC-0008, ZC-0019, MKT |
| ZC-0021 | Submitted jobs have an id, a durable outbox and a result store | Proposed | agent | ZC-0019, ZC-0022, ZC-0026, MKT |
| ZC-0022 | Upstreams: the brokers a node takes work from and sends work to | Proposed | agent / broker | ZC-0003, ZC-0017, ZC-0021, ZC-0025 |
| ZC-0023 | The agent supervises the tunnel, the intake and the outbox | Proposed | agent | ZC-0004, ZC-0019, ZC-0021, ZC-0022 |
| ZC-0024 | Money between brokers is bound to a job, a requester and a hub instrument | Proposed | broker | ZC-0005, ZC-0006, ZC-0012, MKT |
| ZC-0025 | The broker works for its owner: no eligible capacity idle while matching work waits | Proposed | broker / agent | ZC-0011, ZC-0016, ZC-0017, ZC-0022 |
| ZC-0026 | The node verifies receipts: the hub's offline, a peer's before it pays | Proposed | broker / CLI | ZC-0006, ZC-0021, ZC-0024, MKT |