|
| 1 | +# Architecture research notes |
| 2 | + |
| 3 | +This directory holds **exploratory plans** that informed AgentKeys' Stage 7+ architecture decisions. They're versioned with the repo so the *why* of any future code lands has a paper trail. |
| 4 | + |
| 5 | +These are research artifacts, not authoritative specs. The authoritative specs live in [`../spec/`](../spec/). When a research plan locks in, the corresponding spec doc is what changes. |
| 6 | + |
| 7 | +## Contents |
| 8 | + |
| 9 | +| File | Topic | Status | |
| 10 | +|---|---|---| |
| 11 | +| [`option-a-port-dexs-backend.md`](./option-a-port-dexs-backend.md) | Port [dexs-backend](https://github.com/dexs-k/dexs-backend)'s wallet-sig + email + OAuth flows into `agentkeys-broker-server`; minimal patch to Heima TEE worker for `CLIENT_ID_AGENTKEYS`. | Researched, not chosen yet | |
| 12 | +| [`option-a-vs-b-port-vs-greenfield.md`](./option-a-vs-b-port-vs-greenfield.md) | Side-by-side comparison: port dexs-backend (A) vs greenfield broker designed around AgentKeys' problem domain (B). | Comparison artifact | |
| 13 | +| [`option-c-pluggable-attestation-audit.md`](./option-c-pluggable-attestation-audit.md) | **Pluggable** auth / wallet-provisioning / audit-anchoring. Heima becomes one plug-in among several (Solana, Ethereum L2, AWS Nitro, S3 Object Lock, etc.). Zero Heima dependency in v0. | Researched, recommended for net-new branch | |
| 14 | + |
| 15 | +## Background |
| 16 | + |
| 17 | +The three plans grew out of a single question — *"what does `agentkeys init` actually do?"* — that surfaced a chain of architecture decisions: |
| 18 | + |
| 19 | +1. AgentKeys' broker doesn't have a real auth backend yet (mock-server stub). |
| 20 | +2. The natural reference is wildmeta's `dexs-backend` (Go-zero microservices stack) because it solves a similar shape. |
| 21 | +3. But `dexs-backend` and Heima TEE worker are tightly coupled — porting one drags in assumptions from the other. |
| 22 | +4. Heima TEE worker is single-tenant today (`client_id == CLIENT_ID_WILDMETA` hardcoded in [`tee-worker/omni-executor/rpc-server/src/methods/omni/user_login.rs`](https://github.com/litentry/heima/blob/main/tee-worker/omni-executor/rpc-server/src/methods/omni/user_login.rs)). Multi-tenant support requires an upstream patch. |
| 23 | +5. The patch cost is asymmetric across Options A / B / C. |
| 24 | +6. [`docs/spec/architecture.md` §11](../spec/architecture.md#11-audit-destination-is-pluggable) already established that **audit anchoring is pluggable**. Option C extends the same principle to two more layers. |
| 25 | + |
| 26 | +## Tracking issues |
| 27 | + |
| 28 | +Each plan has a corresponding issue tracking next steps. See: |
| 29 | + |
| 30 | +- OIDC federation deployment (deferred): the federation half of Stage 7 ships in a follow-up issue once an operator wants the cloud-enforced PrincipalTag isolation. |
| 31 | +- Auth implementation (Option A path): port `walletloginlogic.go` + `emailloginlogic.go` + `googleoauthcallbacklogic.go` to Rust in `agentkeys-broker-server`; coordinate the Heima `CLIENT_ID_AGENTKEYS` patch with Litentry. |
| 32 | +- Option C zero-Heima broker: explore on a separate branch — different architecture from main; not a drop-in for the current broker. |
| 33 | + |
| 34 | +(Issue numbers will be added once the issues are filed.) |
0 commit comments