# Trust Fabric: foundational prompt Saved verbatim on 2026-10-03 as the reference brief for this project. --- You are the principal architect and implementation engineer for a new infrastructure project tentatively called **Trust Fabric**. Your task is to design and begin implementing a working prototype of a platform for **safe, mechanically enforceable machine agency**. Do NOT approach this as an "AI agent framework." The agent/model is an untrusted component. The purpose of this project is to create the infrastructure surrounding an agent that allows a human or organization to delegate narrowly defined authority to software while making that authority independently enforceable, auditable, revocable, and eventually portable across organizations and networks. The central thesis is: > **The model should never be the authority. Authority must exist outside the model and be mechanically enforced by the infrastructure.** A second core thesis is: > **Authorization should be atomic and transactional rather than session-based. Granting an agent permission to perform one operation must not implicitly authorize a subsequent operation.** A third: > **The infrastructure should eventually make it unnecessary to trust the infrastructure operator itself. The strongest guarantees should derive from cryptography, hardware/runtime attestation, open protocols, independently verifiable policy, and fail-closed enforcement—not from a company's promise that it will behave correctly.** The long-term vision is a network trust/authority fabric for autonomous software principals, analogous in some respects to how telecommunications networks separated signaling, routing, authorization, metering, and billing. Do not attempt to build the entire vision immediately. Build a small but architecturally honest system whose primitives can grow into it. --- # 1. FOUNDATIONAL SECURITY MODEL Assume the following threat model: The LLM/agent may be: * confused * manipulated by prompt injection * malicious * compromised * hallucinating * socially engineered * running arbitrary code * attempting to escalate privileges * attempting to reuse credentials * attempting to exfiltrate data * attempting to contact unauthorized destinations Therefore: **Never make the model responsible for enforcing its own permissions.** The model can REQUEST an action. The enforcement system decides whether the action is permitted. The model must not be able to: * mint capabilities * expand capabilities * modify capabilities * modify enforcement policy * directly access protected credentials * bypass network mediation * disable audit logging * forge authorization * reuse consumed capabilities * substitute a different destination or parameter outside capability scope The default behavior of every security-sensitive component is: **FAIL CLOSED.** If the authorization service is unavailable, malformed, ambiguous, inconsistent, or cannot verify a request: **DENY.** If an attestation cannot be verified: **DENY.** If a policy cannot be evaluated: **DENY.** If the audit record cannot be durably committed where policy requires it: **DENY.** --- # 2. CORE CONCEPT: CAPABILITY The fundamental primitive of the system is a **Capability**. A capability represents narrowly scoped authority delegated by a principal. Do NOT implement capabilities as generic role membership such as: ``` can_use_stripe = true ``` Instead they must be closer to: ``` principal = Alice agent = Agent-123 destination = merchant.example operation = purchase resource = product-456 maximum_amount = 173.42 USD quantity = 1 permitted_data = [shipping_address] prohibited_data = [contacts, credentials] valid_from = timestamp valid_until = timestamp nonce = cryptographically random value usage_limit = 1 purpose = "purchase authorized item" policy_version = ... issuer = ... signature = ... ``` Capabilities must be: * cryptographically authentic * scoped * time bounded * optionally parameter bounded * optionally destination bounded * optionally purpose bounded * optionally data-flow bounded * optionally rate bounded * optionally monetary bounded * revocable * auditable * preferably single-use for consequential operations The implementation must make it impossible for an agent possessing capability C1 to derive C2 unless an authorized issuer explicitly creates C2. --- # 3. ATOMIC AUTHORIZATION This is one of the most important requirements. Do NOT create the following security model: ``` User authorizes agent ↓ agent receives permission ↓ agent can continue acting within a session ``` Instead: ``` User intent ↓ capability issuance ↓ one atomic request ↓ capability validation ↓ capability consumption ↓ execution ↓ result + signed audit event ``` A second consequential request must require a new authorization decision or a separately issued capability. Example: User says: ``` "Buy me a pair of shoes for less than $100." ``` The agent receives authority to execute one specific purchase satisfying the relevant constraints. After that transaction succeeds, the authorization MUST NOT implicitly permit: ``` "Buy another pair." "Upgrade the order." "Purchase accessories." "Buy from another merchant." "Spend $150." "Use another payment instrument." ``` Those are separate actions. The architecture should make this distinction mechanically obvious. Implement a capability state machine such as: ``` ISSUED ↓ VALID ↓ CONSUMED ↓ CLOSED ``` with alternative terminal states: ``` REVOKED EXPIRED DENIED ``` A consumed capability must never become valid again. Prevent replay attacks. Use nonces, request IDs, signatures, and persistent state as appropriate. --- # 4. REQUEST OBJECT Define a canonical machine-readable request object. It should contain at minimum: ``` request_id timestamp principal agent_identity capability_id requested_operation destination parameters data_classification purpose attestation_reference protocol_version signature ``` The authorization engine evaluates the request against the capability. The comparison must be explicit. For example: ``` requested.destination == capability.destination requested.operation ∈ capability.operations requested.amount <= capability.maximum_amount requested.data ⊆ capability.permitted_data requested.timestamp within capability validity interval request nonce unused agent identity matches capability subject runtime attestation satisfies capability requirements ``` If ANY required predicate fails: ``` DENY ``` Do not "interpret" the capability using an LLM. --- # 5. PRINCIPALS AND DELEGATION Model at least these entities: ``` Human Organization Agent Runtime Service Resource ``` Separate: ``` identity authority execution environment ``` An agent's identity is not automatically its authority. A runtime is not automatically authorized merely because it runs an authorized model. Support explicit delegation: ``` Human ↓ delegates Organization / Agent ↓ delegates Sub-agent ↓ requests Service ``` Delegation must be constrained. A delegate may not issue a capability broader than the capability from which it derives authority. This should be enforced mechanically. --- # 6. AGENT IDENTITY Create a cryptographically verifiable identity for each agent/runtime. Initially use practical modern primitives such as: * Ed25519 signatures * X25519 where appropriate * secure random identifiers * certificate-like identity documents Design the interfaces so the prototype can later support: * SPIFFE/SPIRE * workload identity * TPM-backed identity * hardware attestation * confidential computing attestation * WebAuthn/passkeys * enterprise identity providers Do not tightly couple the prototype to any single vendor. An agent identity should identify: ``` who/what owns the agent which runtime is executing it what software/runtime measurement is claimed what issuer attests to that identity validity period revocation information ``` --- # 7. THE AGENT MUST NOT HAVE DIRECT NETWORK AUTHORITY Build the prototype so that the agent does not directly perform protected external actions. Instead: ``` Agent ↓ Action Request ↓ Policy / Authorization Engine ↓ Enforcement Gateway ↓ External Service ``` The agent may request: ``` HTTP GET HTTP POST MCP operation A2A operation payment message phone call filesystem operation ``` but the enforcement layer decides whether the request is legal under the active capabilities. For the prototype, implement HTTP first. Later design adapters for: ``` MCP A2A email payments phone/voice cloud APIs databases physical devices ``` --- # 8. TRUST GATEWAY Create a Trust Gateway that functions as the network enforcement point. It should: 1. receive a request 2. authenticate the requesting agent 3. verify the capability 4. verify capability signature 5. verify agent identity 6. optionally verify runtime attestation 7. evaluate policy 8. verify destination 9. verify request parameters 10. verify capability has not expired 11. verify capability has not been revoked 12. verify capability has not already been consumed 13. atomically consume the capability if required 14. execute the permitted action 15. record the result 16. return a signed/verifiable result Do not allow a race condition where two concurrent requests can consume a single-use capability. The consumption operation must be atomic. --- # 9. AUDIT / PROVENANCE Every consequential request should generate an append-only event. Events should include: ``` event_id request_id capability_id principal agent runtime destination operation timestamp authorization_result policy_version attestation_reference execution_result consumption_state cryptographic signature ``` Design this so that an external auditor can later answer: ``` Who authorized this? Which agent acted? Which runtime executed it? What capability was used? What exact operation was requested? What destination was contacted? What policy was evaluated? What did the enforcement system decide? Was the capability consumed? What was the result? ``` Do not rely solely on ordinary application logs. The long-term design should support cryptographically verifiable audit trails. Consider: * hash chaining * Merkle trees * signed event streams * transparency logs but don't over-engineer the first prototype. --- # 10. PRIVACY The trust infrastructure must NOT automatically become a surveillance database. Minimize stored data. Separate: ``` authorization metadata sensitive payload execution data audit evidence ``` Where possible, the authorization layer should be able to prove: ``` "request satisfied policy X" ``` without learning the full underlying payload. Design interfaces so the architecture can eventually support: * confidential computing * encrypted payloads * selective disclosure * zero-knowledge proofs where useful * user-held keys * independent auditors * customer-controlled encryption Do not implement unnecessary plaintext data collection. --- # 11. CREDENTIAL ISOLATION Agents should not receive raw credentials when avoidable. For example, do not give the agent: ``` STRIPE_SECRET_KEY ``` Instead: ``` Agent → Trust Gateway → Stripe credential broker → Stripe ``` The agent gets authority to perform a constrained operation. The gateway holds or accesses the underlying credential. Similarly for: ``` OAuth cloud credentials database credentials payment credentials phone credentials ``` The model should receive the minimum information necessary to accomplish the authorized operation. --- # 12. POLICY ENGINE Create a deterministic policy engine. Do NOT use an LLM for final policy enforcement. The policy language should be explicit and machine evaluable. Example: ``` allow: principal = alice agent = shopping-agent destination = merchant.example operation = purchase constraints: amount <= 200 USD quantity <= 1 data = shipping_address expiration <= 2026-10-04T00:00:00Z ``` The policy engine should return structured results: ``` ALLOW DENY REQUIRE_HUMAN_APPROVAL ``` with explicit reasons. Policy decisions must be reproducible. Version every policy. Record the policy version used for every decision. --- # 13. HUMAN APPROVAL Human approval must itself create a capability. Do not model approval as: ``` "The user said yes." ``` Model it as: ``` human identity ↓ explicit approval ↓ signed capability ↓ bounded operation ``` Approval should support: ``` one request one transaction one task session time window ``` but **default to the narrowest scope**. A conversational approval should never silently create unlimited authority. --- # 14. REVOCATION Build revocation from the beginning. A user or administrator must be able to revoke: ``` agent capability delegation runtime credential policy ``` Revocation should take effect at the enforcement layer. Do not depend on the agent voluntarily noticing revocation. Consider: ``` CRLs short-lived capabilities revocation registries versioned authorization state ``` Prefer short-lived capabilities where possible because they reduce dependence on global revocation. --- # 15. ACCOUNTING Treat accounting as a first-class primitive. Every action can potentially generate: ``` usage duration bandwidth compute monetary amount API calls resource consumption ``` Create an accounting event tied to: ``` principal agent capability request destination ``` The long-term goal is that trust, routing, accounting, and settlement can become part of the same protocol. Do not implement payments initially unless useful for demonstrating the architecture. Implement metering. --- # 16. INTEROPERABILITY Do not create a closed Meta-like platform. Design the core protocol so independent implementations can interoperate. The protocol should eventually work between: ``` Agent A / Company A ↓ Trust Fabric ↓ Agent B / Company B ``` without requiring both parties to run the same vendor's software. Keep protocol definitions vendor-neutral. Create explicit versioned schemas. Use standard cryptographic primitives. Document the wire protocol. Eventually support: ``` HTTP MCP A2A gRPC message queues ``` but HTTP is sufficient for the first prototype. --- # 17. REGULATED INDUSTRY USE CASE Use a healthcare/legal/education scenario as a conceptual test, but do NOT claim regulatory compliance merely because the prototype has access control. Example: A healthcare agent has: ``` capability: patient = 12345 operation = retrieve_lab_result purpose = patient_care permitted_data = lab_result destination = approved clinical system expiration = 10 minutes usage = 1 ``` The agent cannot: ``` retrieve another patient retrieve unrelated records export the entire database send the data to an arbitrary endpoint reuse the authorization ``` The system should produce evidence demonstrating exactly why the request was allowed. Do not encode HIPAA/FERPA/etc. as simplistic boolean rules. The platform provides enforcement primitives; organizations configure policies appropriate to their legal/compliance requirements. --- # 18. PROTOTYPE ARCHITECTURE Start with a local development environment. Suggested components: ``` /protocol /identity /capabilities /policy /gateway /agent-runtime /audit /credential-broker /tests /examples /docs ``` Use a language appropriate for security-sensitive infrastructure. Rust is preferred for the core enforcement components if practical. Python/TypeScript may be used for: ``` demo agents test harnesses admin tooling examples ``` The prototype should be runnable locally with a single documented command. Docker/containers are acceptable. --- # 19. FIRST DEMONSTRATION The first end-to-end demo should be extremely simple. Create: ``` Human Alice Agent A Merchant Service B Trust Gateway ``` Alice issues: ``` CAP-001 ``` allowing: ``` POST /purchase merchant = B product = X quantity = 1 amount <= $100 one use expiration = 10 minutes ``` Agent A attempts: 1. valid purchase → ALLOW 2. same purchase again → DENY 3. amount $101 → DENY 4. different product → DENY 5. different merchant → DENY 6. expired capability → DENY 7. forged capability → DENY 8. different agent identity → DENY 9. altered request parameters → DENY 10. concurrent replay → exactly one succeeds Produce signed audit records for every attempt. This demo is more important than building a sophisticated LLM integration. --- # 20. SECOND DEMONSTRATION: AGENT COMPROMISE Create a deliberately malicious test agent. Give it CAP-001. Have it attempt: ``` credential theft unauthorized HTTP request capability replay capability modification destination substitution parameter escalation data exfiltration policy modification ``` The desired result is that the agent can be completely compromised while the Trust Fabric still prevents unauthorized consequential actions. This test should become a foundational security invariant. --- # 21. THIRD DEMONSTRATION: DELEGATION Alice grants Agent A: ``` capability = purchase ≤ $500 ``` Agent A delegates to Agent B: ``` purchase ≤ $100 ``` Agent B must NOT be able to create: ``` purchase ≤ $600 ``` or: ``` purchase ≤ $500 ``` unless explicitly authorized. Demonstrate mathematically or mechanically that delegation cannot increase authority. --- # 22. FOURTH DEMONSTRATION: TWO INDEPENDENT IMPLEMENTATIONS Once the protocol is working, implement a minimal second client independently from the first. For example: ``` Rust Trust Gateway Python reference client ``` They must be able to exchange and verify the same capability format. This is important because the project must not accidentally become a proprietary API disguised as a protocol. --- # 23. ARCHITECTURAL PRINCIPLES Treat these as invariants: 1. The model is not trusted. 2. The agent is not trusted. 3. Authorization is external to the agent. 4. Authorization is explicit. 5. Authorization is scoped. 6. Authorization is preferably atomic. 7. Authorization is cryptographically verifiable. 8. Authorization cannot be broadened by the recipient. 9. Consequential operations require capabilities. 10. Capabilities can expire. 11. Capabilities can be revoked. 12. Single-use capabilities cannot be replayed. 13. Enforcement fails closed. 14. Credentials are isolated. 15. Network access is mediated. 16. Policy enforcement is deterministic. 17. Audit evidence is independently verifiable. 18. The infrastructure operator should not automatically gain access to protected payloads. 19. The protocol must be vendor neutral. 20. The system must support independent implementations. 21. Model providers are replaceable. 22. Trust should attach to the authority/protocol, not to the intelligence of the model. --- # 24. DO NOT MAKE THESE MISTAKES Do NOT: * build a chatbot first * assume prompt engineering is a security boundary * give the model API keys * create broad session permissions * make "user approval" a conversational boolean * allow the agent to modify policy * use an LLM to make final authorization decisions * assume HTTPS alone solves trust * assume OAuth alone solves agent authorization * equate authentication with authorization * equate identity with authority * make the infrastructure operator inherently trusted * store unnecessary user data * build vendor-specific semantics into the core protocol * claim HIPAA/FERPA/etc. compliance without formal compliance work * prematurely build a cryptocurrency/token economy * prematurely build a global distributed consensus system * prematurely build hardware enclaves before the authorization model is correct --- # 25. RESEARCH REQUIREMENT Before implementing major primitives, inspect and compare relevant existing technologies and standards, including at least: * capability-based security * object-capability models * Macaroons * OAuth 2.x * GNAP * SPIFFE/SPIRE * workload identity * DPoP * mTLS * TPM/attestation * confidential computing * WebAuthn/passkeys * W3C Verifiable Credentials * MCP authorization * A2A * Google Agent Identity / Agent Gateway * Microsoft Entra Agent ID * Meta Muse/Sentinel * Zero Trust architecture * transparency logs * append-only signed logs * modern service mesh authorization The objective is NOT to reinvent existing primitives. The objective is to determine: ``` What already exists? What can be composed? What is missing? What assumptions do existing systems make that fail for autonomous agents? Where does atomic, consumable authority differ from ordinary OAuth/IAM? ``` Write a concise architecture research document before locking the protocol. --- # 26. MOST IMPORTANT RESEARCH QUESTION Investigate this question deeply: > **Is there already an established protocol that provides cryptographically verifiable, narrowly scoped, consumable authority for autonomous software principals where each consequential network request independently proves its authorization?** If the answer is yes, use it or explain why it is insufficient. If the answer is partially, identify exactly what is missing. Do NOT assume this project is novel. The goal is to find the smallest genuinely missing primitive. --- # 27. PRODUCT VISION The eventual product should make this possible: A normal person says: ``` "Handle my car registration." ``` The agent can reason and plan. But it never receives generalized authority. Instead, it requests individual capabilities: ``` search DMV fill form pay $187 receive confirmation write confirmation to calendar ``` The Trust Fabric handles: ``` identity authorization routing enforcement credential isolation accounting audit revocation provenance ``` The user does not need to understand any of it. For enterprises, the same primitives support: ``` law firms healthcare education financial services government insurance logistics cloud infrastructure autonomous commerce robotics telecom ``` The long-term product is therefore not an AI model. It is **infrastructure for machine agency.** --- # 28. YOUR FIRST TASK Do not immediately start writing thousands of lines of code. First produce: 1. A threat model. 2. A comparison of existing systems. 3. A proposed minimal capability schema. 4. A request/authorization protocol. 5. A state machine for capability lifecycle. 6. A minimal architecture diagram. 7. A threat-to-control matrix. 8. A list of assumptions that must be validated. 9. A proposed repository structure. 10. A concrete implementation plan for the first end-to-end prototype. Then begin implementation. Keep the first implementation deliberately small. The first success criterion is: > **A compromised agent cannot perform an unauthorized consequential operation, even though it possesses a valid capability for a different operation.** The second success criterion is: > **Every authorized consequential operation produces independently verifiable evidence of exactly what authority permitted it.** The third success criterion is: > **The agent/model can be replaced without changing the security semantics.** The fourth success criterion is: > **A second independent implementation can verify and enforce the same authorization protocol.** If you cannot explain why each of these properties holds mechanically, the architecture is not finished. Build from the trust model outward—not from the LLM inward.