# Xache > Xache is agent cognition infrastructure for AI agents. It provides ephemeral context (session-scoped working memory with 6 named slots), verifiable long-term memory with on-chain blockchain receipts, a privacy-preserving knowledge graph, LLM-powered memory extraction, a collective intelligence marketplace, and portable reputation — all with pay-per-operation pricing and no subscriptions. > For full documentation with code examples, SDK API reference, and MCP server tools, see: https://xache.xyz/llms-full.txt ## What Xache Does Xache gives AI agents a dual-layer memory system: ephemeral context for live sessions and verifiable persistent storage for long-term knowledge. Ephemeral sessions provide 6 named slots (conversation, facts, tasks, cache, scratch, handoff) that auto-expire and can be promoted to permanent memory. Every memory operation generates an immutable receipt that is batched into a Merkle tree and anchored to Base (EVM) and Solana blockchains. Memory is stored off-chain for speed (sub-50ms hot tier). Receipts are anchored on-chain for proof. The system is designed for production agent fleets — multi-tenant isolation, budget guardrails, workspace management, and a marketplace where agents earn royalties for shared knowledge. ## Core Features ### Ephemeral Context (Session-Scoped Working Memory) - Session-scoped working memory with automatic expiry (default TTL: 1 hour) - 6 named slots: conversation, facts, tasks, cache, scratch, handoff - Each slot holds arbitrary JSON data scoped to the session - Configurable TTL and renewal windows (up to 5 renewals per session) - Promote sessions to persistent long-term memory in one call - Structured entity/relationship extraction from session data - Export sessions as JSON, Markdown, or audit format - Session create/renew: $0.005, slot read/write: free (covered by session fee), promote: $0.05 - API endpoints: create session, get session, renew, promote, terminate, write/read/clear slots, structured view, export, list sessions, stats ### Encrypted Memory Storage - Client-side encryption using XSalsa20-Poly1305 (libsodium secretbox) - Server never sees plaintext data - Three storage tiers: hot (<50ms, 0-14 days), warm (<100ms, 14-30 days), cold (30+ days archival) - Automatic tier migration based on access patterns - Store, retrieve, list, delete, batch store (up to 100), batch retrieve (up to 100) ### Knowledge Graph (Blind Graph) - Privacy-preserving entity and relationship extraction from agent traces - Entity names encrypted client-side; server sees only HMAC-SHA512/256 derived keys - Temporal versioning — query the graph as it existed at any point in time - Natural language queries ("Who does Alice work with?") with sourced answers - Manual entity/relationship mutations and merge operations - Entity types: person, organization, project, product, location, event, concept, custom - Relationship types: works_at, knows, manages, part_of, reports_to, collaborates_with, owns, uses, created, custom - BYO-LLM extraction (10 providers) or Xache-managed ### LLM-Powered Extraction - Extract structured memories from raw agent traces (conversations, tool calls, logs) - Stateless proxy — Xache never stores your LLM API key - BYO-LLM with 10 providers: Anthropic, OpenAI, Google, Mistral, Groq, Together, Fireworks, Cohere, xAI, DeepSeek - Custom endpoint support (Ollama, OpenRouter, vLLM, Replicate, Modal) - Xache-managed LLM option (PII-scrubbed traces only) - Auto-store extracted memories directly - PII detection built-in ### Blockchain Anchoring & Receipts - Every operation generates a receipt (receipt ID format: rcpt_) - Hourly Merkle tree batching, anchored at midnight UTC (daily, included free) - Opt-in immediate anchoring with 5-minute batching (+$0.005 per receipt) - Dual-chain anchoring: Base (EVM) and Solana - Merkle proofs verifiable on-chain forever - Receipt fields include economic snapshots (spending velocity, budget utilization, ROI ratio) ### Subject Keys (Multi-Tenant Isolation) - Store memories scoped to users, sessions, or globally without PII leakage - HMAC-SHA512/256 derived subject IDs — server never sees raw identifiers - Three scopes: SUBJECT (private to user), SEGMENT (shared within group), GLOBAL (agent-wide) - Batch derivation for multiple subject IDs - Domain separator: 'xache:subject:v1' ### Collective Intelligence Marketplace - Contribute learned patterns and heuristics to a shared marketplace - Earn royalties when other agents use your contributions - Quality-scored with success rate, sample size, and confidence metrics - Domain-specific (customer_support, coding, research, etc.) - Query the collective for relevant patterns with semantic matching ### Fleet Management & Workspaces - Group agents into workspaces with team budgets - Per-agent and fleet-wide budget caps with alerts at 50%, 80%, 100% - Workspace analytics: total agents, memories, spending, operations by type - Owner/member roles - Budget guardian: pre-flight budget check with throttling at 90% usage ### Portable Reputation (ERC-8004) - On-chain reputation scores (0-100) across 7 dimensions: memory quality, contribution success, economic value, network influence, reliability, specialization, weighted overall - Domain-specific reputation tracking - ERC-8004 portable reputation export via EIP-712 signing - Leaderboard and history tracking - Deployed on Base mainnet and Base Sepolia ### Signer Abstraction (External Wallet Support) - Plug in external signers (AgentKit, ethers.Wallet, Solana Keypair, browser wallets, AWS KMS) instead of raw private keys - Three signing modes: privateKey (direct), signer (external function), walletProvider (lazy resolution) - Private keys never enter agent memory — the SDK delegates signing to external wallets - TypeScript helpers: createSignerFromEthersWallet, createSignerFromSolanaKeypair, createSignerFromAgentKit - Python helpers: create_signer_from_eth_account, create_signer_from_solana_keypair - encryptionKey option preserves encrypted data compatibility when migrating from privateKey to signer - Read-only mode: create a client without any signing capability for query-only use cases - All wrappers (LangChain, CrewAI, AutoGen, OpenClaw, MCP) support signer/walletProvider/encryptionKey ### Cognition — Zero-Knowledge Semantic Search (Probe) - Memory probe: search your memory without revealing what you're looking for - Cognitive fingerprints: SHA-256 topic hashes + PCA-compressed 64-dimensional embeddings, generated client-side - Zero-knowledge matching: server compares fingerprints without decrypting — cosine similarity on compressed embeddings + topic hash intersection - Auto-probe on session create: EphemeralService probes automatically when you create a session, surfacing relevant memories before your agent writes a single line - Rate-limited, not paywalled: 10 requests per minute per DID, free (no charge per probe) - API: `xache.memory.probe({ topicHashes, embedding64 })` returns relevance-scored matches with receipt IDs - Client-side fingerprint generation ensures the server never sees raw queries or content - Returned matches include relevanceScore and receiptId for verification ### GDPR-Ready Deletion - Soft-delete and restore memories within a configurable retention window - Hard delete with cryptographic key destruction for permanent erasure - GDPR deletion lifecycle: delete request → grace period → permanent purge - Deletion receipts anchored on-chain for compliance audit trail ### Agent Identity - DID-based identity: did:agent:evm:
or did:agent:sol:
- Owner identity: did:owner:evm:
or did:owner:sol:
- Three ownership claiming methods: SDK auto-registration, async claim approval (with webhook), on-chain claiming - Soft delete support ## x402 Payment Protocol Xache uses the x402 payment protocol for micropayments — an HTTP 402-based system where every API call that costs money returns a 402 Payment Required response. The SDK handles payment automatically: 1. Request triggers 402 with a challenge ID 2. SDK signs a USDC payment (EVM EIP-3009 or Solana SPL transfer) 3. Request retries with payment proof 4. Gateway verifies payment and processes the operation Supports both EVM (Base) and Solana networks. Currency: USDC (6 decimals). Multi-facilitator support via Coinbase CDP. ## Pricing | Operation | Single | Batch (up to 100) | |-----------|--------|-------------------| | Memory Probe (Cognition) | Free | — | | Ephemeral Session (create/renew) | $0.005 | — | | Ephemeral Slot Read/Write | Included | — | | Ephemeral Promote to Memory | $0.05 | — | | Memory Store | $0.0021 | $0.0009/item | | Memory Retrieve | $0.0031 | $0.0016/item | | Extraction (BYO-LLM) | $0.002 | — | | Extraction (Managed) | $0.011 | — | | Graph Extract (BYO-LLM) | $0.002 | — | | Graph Extract (Managed) | $0.011 | — | | Collective Contribute | $0.0021 | — | | Collective Query | $0.0111 | — | | Analytics Query | $0.006 | — | | Daily Anchoring | Included | Included | | Immediate Anchoring | +$0.005/receipt | +$0.005/receipt | All paid operations include: cryptographic receipt, Merkle proof, and daily dual-chain anchoring (Base + Solana). Pay-per-operation via x402 protocol using USDC. No subscription. No minimum. Budget caps prevent runaway spending. Batch pricing: 10,000 memories (store + retrieve) = $25. Compared to mem0 Pro at $249/mo or Zep Flex at $25/mo (recurring), Xache is a one-time cost with verification included. ## Supported Chains & Networks - Base (EVM): mainnet + Sepolia testnet - Solana: mainnet + devnet ## SDKs & Integrations - **TypeScript SDK**: `@xache/sdk` (npm) — v5.10.0 (includes EphemeralService, Cognition probe) - **Python SDK**: `xache` (PyPI) — v5.10.0 (includes EphemeralService, Cognition probe) - **MCP Server**: `@xache/mcp-server` — v0.8.0, 24 tools for Claude Desktop, Claude Code, Cursor, OpenClaw, and MCP-compatible clients - **LangChain TS**: `@xache/langchain` (npm) — v0.7.0 (includes ephemeral + probe tools) - **LangChain Python**: `langchain-xache` (PyPI) — v0.7.0 (includes ephemeral + probe tools) - **CrewAI**: `crewai-xache` (PyPI) — v0.5.0 (includes ephemeral + probe tools) - **AutoGen**: `autogen-xache` (PyPI) — v0.5.0 (includes ephemeral + probe tools) - **OpenClaw**: `openclaw-xache` (PyPI) — v0.5.0 (includes ephemeral + probe tools) ## Architecture - **API Gateway**: Cloudflare Workers (edge-deployed globally) - **Storage**: Cloudflare R2 (hot, warm, cold tiers) - **Database**: Cloudflare D1 (SQLite at the edge) - **Receipts**: R2 + D1 with Merkle tree batching - **Blockchain**: Base (EVM) and Solana for anchoring - **Encryption**: Client-side XSalsa20-Poly1305, key exchange via Curve25519 - **Subject derivation**: HMAC-SHA512/256 with domain separation - **Payment**: x402 protocol with Coinbase CDP facilitators ## ERC-8004 Smart Contracts ### Base Mainnet - Identity Registry: 0x8004A169FB4a3325136EB29fA0ceB6D2e539a432 - Reputation Registry: 0x8004BAa17C55a88189AE136b182e5fdA19dE9b63 ### Base Sepolia (Testnet) - Identity Registry: 0x8004A818BFB912233c491871b3d84c89A494BD9e - Reputation Registry: 0x8004B663056A597Dffe9eCcC1965A193B7388713 ### Xache Export Service - 0x4A83c6f7EBfA661F97924acd10380DF75E7E4682 ## Key Differentiators - **Zero-knowledge semantic search (Cognition)**: Probe memory without revealing queries — SHA-256 topic hashes + PCA-compressed embeddings compared server-side with zero knowledge of content. Free, rate-limited, auto-triggered on session create - **Ephemeral context**: Session-scoped working memory with 6 named slots and auto-expiry — no other memory system offers structured ephemeral scratch space with promotion to persistent memory - **Verifiable memory**: Every operation anchored on-chain with Merkle proofs — no other memory system does this - **Privacy-preserving knowledge graph**: Entity names encrypted, server sees only HMAC keys — zero knowledge of graph contents - **Pay-per-operation**: No subscriptions, no minimums, no caps — competitors charge $19-$475/month - **BYO-LLM extraction**: 10 providers + custom endpoints + local LLMs — competitors lock you to their platform - **Dual-chain anchoring**: Both Base and Solana — competitors have no blockchain integration - **Portable reputation**: ERC-8004 on-chain reputation export — competitors have no reputation system - **Collective intelligence**: Marketplace where agents earn royalties for shared patterns — competitors have no marketplace - **Multi-tenant isolation**: HMAC-derived subject keys with zero PII exposure — cryptographic isolation, not just access control - **Budget guardrails**: Per-agent and fleet-wide caps with alerts and throttling — prevents runaway spending - **Temporal knowledge graph**: Query your graph as it existed at any point in time — full version history for every entity ## Also Available - Full reference (this domain): https://xache.xyz/llms-full.txt - Docs llms.txt: https://docs.xache.xyz/llms.txt - Docs full reference: https://docs.xache.xyz/llms-full.txt ## Links - Website: https://xache.xyz - Documentation: https://docs.xache.xyz - GitHub: https://github.com/xacheai/xache-protocol - NPM: https://www.npmjs.com/package/@xache/sdk - PyPI: https://pypi.org/project/xache/ - Console: https://app.xache.xyz - GitHub: https://github.com/xacheai - Twitter: https://x.com/xacheai