HarshKhamkar
Back toAll projects
Cloak402
Privacy

Cloak402

Privacy-Preserving Orchestration Layer for AI Agents

The rise of AI agents has introduced a massive privacy loophole: agents that keep secrets. When an AI agent interacts with Web3 protocols or traditional APIs — flight searches, DeFi trades, hotel bookings — on your behalf, it emits a massive amount of metadata. Even without a persistent account, every API call, x402 payment, or contract interaction leaves a trail: observers can deanonymize the human behind the agent through on-chain graph analysis (clustering funding flows and gas sources) and off-chain logs (IP addresses, request headers, timing correlations).

Cloak402 solves this by acting as a privacy-preserving orchestration layer for AI agents. Using an autonomous travel-booking agent as a real-world implementation, it proves agents can carry out complex, multi-step commerce without doxxing the user.

Relationship anonymity via ephemeral wallets: instead of a single hot wallet, Cloak402 generates a fresh, single-use keypair in memory for every API call.

Breaking the funding graph: a naive ephemeral wallet is useless if funded directly by the user, so CloakPool — an intermediate shared pool — breaks the on-chain link between the user's main funding wallet and the ephemeral payment addresses.

Defeating heuristics: to prevent clustering, funding amounts are randomized in 0.03–0.09 USDC bands with a 1.5–6 second timing jitter, breaking the correlation between off-chain API logs and on-chain settlements.

Policy-driven disclosure puts the human back in control. In the travel-agent demo, OpenClaw enforces strict disclosure policies: searching for flights happens with absolute anonymity, while booking one selectively discloses only the minimum required data — name and email — with the financial footprint kept hidden throughout.

The result: anyone can use AI agents for sensitive tasks — from booking travel to executing private DeFi strategies — without letting service providers, MEV searchers, or on-chain sleuths build a profile on them.

Challenges I ran into

The "naive ephemeral wallet" trap: generating a fresh viem private key for every API call looked sufficient at first, but it only achieved credential minimization, not anonymity — a trivial on-chain graph analysis could still link every ephemeral wallet back to the control wallet that was funding it for gas and x402 payments. Fixing this meant pivoting the architecture to add CloakPool as a foundational layer: routing funds through a shared pool and randomizing USDC top-ups between 0.03 and 0.09 USDC broke the 1:1 on-chain funding link.

Off-chain timing correlations: even with the funding graph broken, an observer watching the mempool and the API provider's HTTP logs could match the timestamp of a flight-search request to the timestamp of the x402 settlement, since agents execute tasks fast enough for the two to line up almost exactly. The fix was a ghostPay privacy wrapper that introduces randomized timing jitter — 1.5 to 6 seconds — before fulfilling the x402 payment, decorrelating request timing from on-chain execution.

Taming the LLM agent's urge to share data: LLMs naturally want to pass everything they know into a tool call, and early on OpenClaw would accidentally leak passenger identities during the anonymous flight-search phase just because the user had given their name earlier in the chat. Fixing it took strict, code-level separation between tools — distinct search_flights.ts and book_flight.ts CLI tools plus rigorous skill-level rules in SKILL.md that prohibit the LLM from passing PII into the search tool — backed by middleware that drops any payload violating the policy before the x402 payment ever fires.

Managing the ephemeral lifecycle: orchestrating a wallet's creation, funding, x402 handshake, data retrieval, and memory wipe within a single synchronous HTTP request cycle was prone to race conditions, especially against testnet RPC limits. The ghostPay.ts wrapper was hardened to handle those async steps robustly, so even if a step fails — like an airline API timeout — the ephemeral private key is still guaranteed to be destroyed rather than left as a dangling hot wallet.

Screens

3 images

Architecture

Next projectPriceFlow