Technical Architecture
Named after Hangu Pass (函谷关)—the fortified chokepoint where a single pass held off coalition armies—Hangoo separates perimeter API deception from deterministic database commit verification across three components:
- Hangoo Edge Pass (Design-Partner Preview on Cloudflare Workers + SQLite Durable Objects): Performs in-memory OpenAPI 3.1 canary route and field injection, HMAC-SHA256
__Host-sg_sidsession cookies, UI route dwell checks (≥ 800ms), andHTTP 200 OKslow-drip tarpits. - Hangoo Policy PDP (Design-Partner Preview): Model-free TypeScript policy engine stripping untrusted prompt text (
ticket_body,llm_summary), enforcingX-Agent-Capability(kya.v1) scopes, and locking SMS/email OTP for72hafter contact edits. - Standalone Commit Verifier (
https://hangoo.io/verifier.ts— Open & Auditable Today): Zero-dependency WebCryptoEd25519+RFC 8785canonicalSHA-256verifier with RFC 8032 small-order subgroup guards and atomic single-usejtinonce consumption insideSELECT ... FOR UPDATE.
MandateV1 Wire Specification
Consequential mutations follow a deterministic 3-step handshake: POST /v1/evaluate returns 428 STEP_UP_REQUIRED (or mints immediately for low-tier autonomous KYA caps), step-up approval mints a 90-second MandateV1, and your backend burns jti atomically before committing.
{
"ver": "mandate.v1",
"jti": "019386b4-7c2a-7000-8a11-9f4c2e10b831",
"iat": 1796179500,
"exp": 1796179590,
"actor": {
"sub": "usr_94821",
"actor_type": "delegated_agent",
"agent_id": "agt_support_tier2",
"kya_scope": "propose_only"
},
"intent": {
"method": "POST",
"route": "/api/v1/payouts/destination",
"target_account": "acct_demo_88210",
"params_jcs_sha256": "38b58f24d1e2ef84b838c17a9f2f95d629d4781f9be9c8e18cf4a8c32a9d2210",
"pre_state_sha256": "8f434346648f6b96df89dda901c5176b10a6d83961dd3c1ac88b59b2dc327aa4"
},
"approval": {
"policy_rev": "2026-12-03.1",
"decision": "ALLOW_COMMIT",
"verified_channel": "pre_recovery_passkey",
"approver_sub": "usr_94821"
},
"sig": "ed25519:9d5a8b03c142f019e7a2b44c98e120f7b3a1c55d..."
}
Zero-Dependency Backend Commit Verifier
No unpublished npm packages or external supply-chain dependencies required. Vendor the standalone WebCrypto verifier (/verifier.ts) directly into your repository, lock the database row first via SELECT ... FOR UPDATE, and call verifyHangooMandate() before UPDATE:
// curl -fsSL https://hangoo.io/verifier.ts -o src/lib/hangoo-verifier.ts
import { verifyHangooMandate } from "../lib/hangoo-verifier.js";
export async function updatePayoutAccount(req: Request, dto: PayoutDto) {
return db.transaction(async (tx) => {
const [account] = await tx
.select()
.from(accounts)
.where(eq(accounts.id, dto.accountId))
.for("update");
await verifyHangooMandate({
mandateHeader: req.headers.get("x-action-mandate") ?? undefined,
pdpPublicKeyHex: process.env.HANGOO_PDP_PUBLIC_KEY_HEX!,
nonceStore: redisNonceStore, // SET hangoo:jti:<jti> 1 EX 300 NX
expectedMethod: "POST",
expectedRoute: "/api/v1/payouts/destination",
targetAccount: account.id,
canonicalParams: dto, // binds dto.newAccountNo & dto.bankBic
currentPreState: toCanonicalPreState(account),
});
return tx.update(accounts)
.set({ payoutDest: dto.newAccountNo })
.where(eq(accounts.id, account.id));
});
}
Coding Agent Integration Prompt
Paste this prompt into Claude Code, Cursor, or Codex to vendor /verifier.ts and wire your payout transaction gate with zero third-party packages:
# Hangoo 函谷 — Zero-Dependency Commit Gate Setup Read https://hangoo.io/llms.txt and https://hangoo.io/skill.md, then: 1. Vendor the standalone WebCrypto MandateV1 verifier (zero npm packages needed): mkdir -p src/lib && curl -fsSL https://hangoo.io/verifier.ts -o src/lib/hangoo-verifier.ts 2. Inside payout, withdrawal, and bank-detail database transactions: - Acquire SELECT ... FOR UPDATE on the target account row first. - Call await verifyHangooMandate(...) before executing UPDATE. - Catch HangooGateError with code "GATE_UNAVAILABLE_QUEUE_REVIEW" and return HTTP 202 (pending_mutations).
Allowlists, Recovery Locks & Outage Fail-Safes
Partner SDKs, Postman & Watermarks
Compiled production UIs only call documented routes, giving near-zero end-user noise. Automated schema readers (Postman imports, SDK generators, DAST scanners) bypass decoys via CIDR allowlists or signed X-Agent-Capability headers. Every synthetic tarpit stream embeds an explicit canary_trace_id so developers recognize decoy responses immediately in logs.
72h Post-Recovery Quarantine & Redis Outages
If contact_changed_at is within 72 hours, sms_otp and email_otp are stripped (403 UNTRUSTED_RECOVERY_CHANNEL), requiring a pre-recovery passkey or dual-control ops approval. If Redis drops in ENFORCE mode, reads stay live while writes queue safely as HTTP 202 PENDING_OUTAGE_REVIEW.
Measured Latency Benchmarks (0.187 ms p99)
Measured across 1,000 warm samples after 200 warmups on Apple M4 / Node.js v24.14.1 over localhost TCP Redis 7. Excludes application database row-lock contention and wide-area network RTT.
| Component | Store | p50 | p95 | p99 | Target Budget |
|---|---|---|---|---|---|
| Edge Pass (GET pass-through) | in-memory |
0.010 ms | 0.019 ms | 0.028 ms | ≤ 1.5 ms |
| Edge Pass (GET pass-through) | redis-tcp |
0.415 ms | 0.510 ms | 0.879 ms | ≤ 1.5 ms |
Policy PDP (/v1/evaluate + sign) |
redis-tcp |
0.237 ms | 0.281 ms | 0.321 ms | ≤ 8.0 ms |
Commit Verifier (verifyHangooMandate) |
in-memory |
0.067 ms | 0.081 ms | 0.095 ms | ≤ 1.5 ms |
Commit Verifier (verifyHangooMandate) |
redis-tcp |
0.145 ms | 0.166 ms | 0.187 ms | ≤ 1.5 ms |