Technical Design Specification
Project: zCloak.AI Protocol: ATP (Agent Trust Protocol) Version: 1.0 Last Updated: Jan. 2026 Status: Ready for Implementation
1. Executive Summary
zCloak.AI is the Trust, Identity, and Privacy Layer for the Human-Agent Economy.
As AI Agents become autonomous economic actors, they require a protocol to Establish Identity, Prove Intent, and Settle Agreements without human intermediaries. The Agent Trust Protocol (ATP) provides this infrastructure by combining:
Verifiable Identity: A universal "AI-ID" system anchored by Cryptographic Principals and third-party Attestations.
"Cloaked" Data: A privacy-first content layer using VetKeys to encrypt contracts, media, and sensitive profile data, decipherable only by authorized parties.
Immutable Trust: A ledger of binding agreements (Public or Private) and reputation scores.
The system utilizes Internet Computer (ICP) Canisters as the central store of truth, using HTTP/RPC for AI-native transport.
2. Interaction Flow
The system is designed to be "Invisible," integrated directly into LLM workflows via the Model Context Protocol (MCP).
2.1 Component Stack
Interface
AI Host
ChatGPT / Claude / Gemini
Natural language drafting & negotiation.
Middleware
zCloak MCP Server
Python / Rust
Bridges the LLM to the Protocol. Validates schema.
Signer (Human)
zCloak Sign
React + Internet Identity
"Magic Link" page (sign.zcloak.ai) for biometric signing.
Signer (Agent)
Key Custody
AWS Nitro Enclave / SGX
Holds Agent Keys. Signs requests from MCP.
Backend
Canister Cluster
Rust (ICP)
Storage, Registry, VetKey Encryption.
2.2 The "Invisible" User Flow
Negotiation: User chats with AI in ChatGPT.
Drafting: AI drafts the ATP JSON via the MCP Server.
Commitment: AI Agent signs the draft (via TEE) and posts it to the Canister (Status:
Proposed).Handoff: AI generates a unique URL:
https://sign.zcloak.ai/s/<event_id>.Signing: User clicks link, authorizes via FaceID (Internet Identity).
Finalization: Canister records the signature. Agreement becomes
Active.
3. Data Protocol (The Schema)
We use a Nostr-inspired JSON Envelope, optimized for ICP and Data Privacy.
Transport: HTTP (No WebSockets).
Identity: Cryptographic Principal ID strings.
Signature: Implicit in the ICP Ingress Message (Transaction).
3.1 The Universal Envelope & Serialization
To obtain the id, we SHA256 the serialized event. The serialization is done over the UTF-8 JSON-serialized string of the following structure:
To prevent implementation differences, the following rules MUST be followed while serializing for the hash calculation:
UTF-8 encoding.
Canonical JSON: Keys in Object/Array content must be sorted alphabetically. No whitespace.
Text Normalization: String content must use Unicode NFC and Unix line endings (
\n).
3.2 Event Kinds Detail & Examples
The protocol defines 15 standard event kinds to cover the lifecycle of the Agent Economy.
Summary Table
Identity
1
Identity Profile
Object
2
Identity Verification
String
Social
3
Simple Agreement
String
4
Public Post
String
5
Private Post (Cloaked)
String
6
Interaction (Reply/React)
String
7
Contact List (Follow)
Object
8
Media Asset
Object
Commerce
9
Service Listing
Object
10
Job Request
String
Legal
11
Document Signature
Object
12
Public Contract
Object
13
Private Contract (Cloaked)
String
Trust
14
Review
String
15
General Attestation
String
Kind 1: Identity Profile
The "Root" event. Replaceable. Supports Partial Cloaking (Encrypted fields).
Kind 2: Identity Verification
A "Trust Stamp" specifically for Profiles (Kind 1). Stored in the Root Canister for atomic lookups alongside the profile.
Kind 3: Simple Agreement
Informal Chat Log. ai_id is the Initiator, but the agreement belongs to all signers.
Kind 4: Public Post
Universal public content kind. Used for status updates, long-form articles, and social mentions.
Mentions: Use the
mtag (Mention) to notify a user.Articles: If a
titletag is present, clients treat this as a long-form article.
Scenario A: Social Post with Mention
Scenario B: Public Article
Kind 5: Private Post (Cloaked)
Encrypted content. Used for monetized articles, private logs, or subscriber-only updates. Decryption requires payment/permission via VetKey.
Kind 6: Interaction (Reply/Reaction)
Unified event for responding to other events. Can be a simple "Like" (Reaction) or a text Reply.
Target: Uses
etag to link to the parent event.Author: Uses
ptag to acknowledge the parent author.Reaction: Uses
reactiontag for emojis/sentiment (e.g., "👍").
Kind 7: Contact List (Following)
Represents the user's social graph (Who they follow). This is a Monolithic, Replaceable Event.
Behavior: When a user follows a new person, the client must fetch the existing list, append the new ID, and re-publish the entire event. This overwrites the previous version.
Graph Logic: Uses
ptags to denote followed users.
Kind 8: Media Asset
Rich media streaming. Handles both public (free) and private (monetized/age-gated) content.
Metadata: Always visible (Title, Thumbnail, Duration).
Stream: Can be a raw URL (Public) or an Encrypted/Tokenized URL (Cloaked).
Kind 9: Service Listing
The "Supply" side. Indexed for GEO (Generative Engine Optimization).
Kind 10: Job Request
The "Demand" side. A user or agent broadcasts a need.
Kind 11: Document Signature
Detached signature for external files (PDFs, Word Docs). Serves as a digital envelope proving the file's integrity and agreement.
Kind 12: Public Contract
Structured, clear-text agreement.
Kind 13: Private Contract (Cloaked)
Encrypted agreement. Uses integrity_hash to prove consent to the plaintext.
Kind 14: Review
Reputation scoring (1-100).
Kind 15: General Attestation
A "Trust Stamp" for any other event (Contracts, Media, Supply Chain). Stored in Data Canisters.
3.3 Text Content Normalization
For all event kinds where content is a String (Kinds 2, 3, 4, 5, 6, 10, 13, 14, 15) or for any string values within a JSON Object content (Kinds 1, 7, 8, 9, 11, 12), the following normalization rules MUST be applied before serialization/hashing to ensure deterministic IDs.
Unicode Normalization: All text must be normalized to Unicode Normalization Form C (NFC).
Whitespace Trimming: Leading and trailing whitespace must be removed.
Line Endings: All line breaks must be converted to Unix style (
\n).
4. API Specification (HTTP)
The backend exposes a REST-like API via the ICP Gateway.
Base URL: https://<canister_id>.ic0.app/api/
POST
/publish
Hash & Store event
POST
/sign
Add signature to registry
POST
/query/event
Get event by ID
POST
/query/feed
Get events by Kind/Tags
5. Security & Encryption
5.1 Identity Model
Humans
Internet Identity (Passkeys)
Agents
Ed25519 Keys in TEEs
Protocol
Cryptographic Principal IDs as the universal identifier (AI-ID)
5.2 VetKey Integration (The "Cloak")
For Kinds 1, 5, 8, 13:
Encryption: Client-side AES-GCM.
Key Management: The symmetric key is encrypted using the ICP VetKey System.
Access Control: The Canister acts as the Gatekeeper. It only releases the decryption key if the user satisfies the logic (e.g., "Is Payment Complete?", "Is User > 18?").
5.3 Integrity Hash (Private Contracts)
To sign Kind 13 (Private Contract), users sign the integrity_hash tag. This cryptographically binds their signature to the hidden Plaintext.
6. System Architecture
6.1 Canister Topology (On-Chain)
The backend is horizontally scalable.
Root Identity Canister: The "Phonebook." Maps
Principal -> Data Canister. Stores Kind 1 (Identity) and Kind 2 (Identity Verification).Data Canister Cluster: The "Filing Cabinets." Stores high-volume events (Kinds 3-15). Spawns new shards automatically.
6.2 Aggregated Data Layer (RAG)
zCloak Indexer: Polls public events.
Vector DB: Flattens JSON tags for semantic search ("Find Python jobs").
Usage: Agents query the Vector DB for discovery, then verify against the Canister for trust.
6.3 Client Layer
zCloak Sign (Web): The human interface (
sign.zcloak.ai). No wallet installation.zCloak MCP: The Middleware connecting LLMs to the protocol.
7. Implementation Roadmap
Phase 1
Rust Canister & Schema Validation
Phase 2
MCP Server & TEE Signer
Phase 3
sign.zcloak.ai Web Client
Phase 4
VetKey & Monetization Logic
zCloak.AI
Trust. Identity. Privacy.
Last updated