guardrail/docs/adr/0003-twak-only-execution.md
caelum0x 2d2b15c7fe feat: full guardrail-alpha system + CLI modularization + Vercel deploy config
- Rust engine: real bootstrap/wiring preflight (guardrail-agent), execution layer (retry/router/pre-trade/post-trade/reconciliation), guardrail-doctor diagnostics with allowlist-drift guard.

- guardrail-cli: extracted pure helpers into util.rs (split in progress).

- 6 Track-2 skills + ensemble; python-lab analytics (regime/drawdown/montecarlo/dossier/ensemble/journal/seed); clients (ts/py/go/mcp/langchain/web-lite/proof-verifier); alert relay; scenarios; helm/k8s/compose; docs.

- dashboard/vercel.json + docs/VERCEL_DEPLOY.md for Vercel deployment.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-15 11:02:22 +03:00

32 lines
1.2 KiB
Markdown

# ADR 0003 — All execution flows through TWAK (self-custody)
- Status: Accepted
- Date: 2026-06-13
## Context
Track 1 requires self-custody and execution via the Trust Wallet Agent Kit
(TWAK). The agent must never hold raw private keys in process.
## Decision
`twak-client` is the only component that can produce a signature or an on-chain
trade, behind a single `TwakExecutor` trait (`wallet_address`, `portfolio`,
`quote_swap`, `execute_swap`, `register_competition`). The execution flow is
strictly: `OrderIntent → pre-trade risk → TWAK quote → final risk → TWAK execute
→ receipt → portfolio reconcile → event`. `policy.execution_layer = "twak_only"`
and `bypass_twak` is a forbidden action.
For x402-gated data (e.g. CMC premium), the client builds the payment
authorization but **TWAK signs it** (`twak-client::x402::sign_authorization`) —
keys stay with the wallet.
## Consequences
- Paper mode uses `MockTwakClient` (deterministic, no keys/network) so the full
pipeline runs offline and reproducibly.
- Swapping the live transport (MCP/REST/CLI) is a single trait implementation;
no caller changes.
- The dashboard, API, and Python analytics are physically incapable of
executing — they don't depend on `twak-client`.