The official TypeScript SDK for VerifiedState — verified memory infrastructure for AI agents.
npm install @verifiedstate/sdkimport{VerifiedStateClient}from'@verifiedstate/sdk';constclient=newVerifiedStateClient({apiKey: 'vs_live_...',baseUrl: 'https://api.verifiedstate.ai',// optional, this is the default});// Store contentconstartifact=awaitclient.ingest({namespace_id: 'your-namespace-uuid',content: 'The user prefers dark mode and uses PostgreSQL.',source_type: 'user_input',});// Extract assertionsconstextracted=awaitclient.extract({namespace_id: 'your-namespace-uuid',artifact_id: artifact.artifact_id,});// Verify an assertionconstreceipt=awaitclient.verify({assertion_id: extracted.assertion_ids[0],namespace_id: 'your-namespace-uuid',});// Query memoryconstresults=awaitclient.query({namespace_id: 'your-namespace-uuid',query_text: 'What database does the user prefer?',});Store raw content and create an artifact with spans.
constresult=awaitclient.ingest({namespace_id: 'uuid',content: 'Raw text content to store',source_type: 'user_input',// or 'document', 'api', etc.source_id: 'optional-external-id',});// => { artifact_id, span_count, r2_stored }Extract structured assertions from an artifact using LLM.
constresult=awaitclient.extract({namespace_id: 'uuid',artifact_id: 'artifact-uuid',});// => { assertions_created, assertion_ids }Run the verification ladder and produce a signed receipt.
constresult=awaitclient.verify({assertion_id: 'assertion-uuid',namespace_id: 'uuid',});// => { receipt_id, status, final_confidence, conflicts_found }Multi-channel retrieval with intent-aware routing.
constresult=awaitclient.query({namespace_id: 'uuid',query_text: 'What is the user'spreferredlanguage?',
mode: 'current',// 'current' | 'point_in_time' | 'trusted'limit: 10,filters: {valid_only: true},});// => { assertions, receipts, total, answerable, channels_used }Structured queries:
constresult=awaitclient.query({namespace_id: 'uuid',query: {subject: 'user:42',predicate: 'prefers'},});Retrieve a verification receipt by ID.
constdetail=awaitclient.receipt('receipt-uuid');// => { receipt, assertion, evidence_spans }Get the Merkle chain for a writer.
constchain=awaitclient.chain('agent:billing');// => { writer_principal, current_hash, assertion_count, recent_assertions }Compress an artifact to IR1 format.
constresult=awaitclient.compress({namespace_id: 'uuid',artifact_id: 'artifact-uuid',});// => { encoded_artifact_id, compression_ratio }Decompress an encoded artifact.
constresult=awaitclient.decompress({namespace_id: 'uuid',encoded_artifact_id: 'encoded-uuid',});// => { content, verified }Challenge an assertion with counter-evidence.
constresult=awaitclient.challenge({assertion_id: 'assertion-uuid',namespace_id: 'uuid',reason: 'Contradicted by updated policy',counter_evidence: 'Policy v2 states...',});// => { challenge_id, status }Retract an assertion.
constresult=awaitclient.retract({assertion_id: 'assertion-uuid',namespace_id: 'uuid',reason: 'Information no longer valid',});// => { retraction_id, status }Get memory health metrics.
consthealth=awaitclient.health('namespace-uuid');// => { namespace_id, total_assertions, verified_count, disputed_count, coverage_score }Billing attestation for AI agents. Every transaction signed, chained, and independently verifiable.
// Create a spend authorizationconstcap=awaitclient.meter.authorize({namespace_id: 'your-namespace-uuid',authorizedAgentId: 'agent-alpha',maxBudgetCents: 1000,scope: {allowedProviders: ['openai','anthropic']},});// Submit a spend receiptconstreceipt=awaitclient.meter.spend({namespace_id: 'your-namespace-uuid',capabilityId: cap.capability_id,actorId: 'agent-alpha',providerId: 'openai',usageUnit: 'tokens',usageQuantity: 1500,costCents: 45,occurredAt: newDate().toISOString(),});// => { receipt_id, receipt_hash, signature, status: 'verified' }// Check remaining budgetconstbudget=awaitclient.meter.budget(cap.capability_id);// => { spent_cents, remaining_cents, receipt_count, children }// Verify a receipt (cryptographic integrity check)constcheck=awaitclient.meter.verify(receipt.receipt_id);// => { verified: true, checks: { hash_integrity, signature_valid, chain_continuity, merkle_inclusion }}// Settle receipts into a Merkle rootconstsettlement=awaitclient.meter.settle({namespace_id: 'your-namespace-uuid',capabilityId: cap.capability_id,});// => { settlement_id, merkle_root, total_cost_cents, receipt_count }Subscribe once. Get instant answers.
// Subscribe to your namespaceawaitclient.subscribe(namespaceId);// Four-tier retrieval — automatically takes the fastest pathconstfact=awaitclient.quickQuery(namespaceId,'user|prefers.drink|morning');Retrieval speed:
- Existence check: 0.01ms (local filter, no network)
- Cached facts: <1ms (live in memory via real-time stream)
- Direct queries: <5ms (pre-computed state)
- Complex queries: <100ms (full retrieval)
Before VerifiedState: 80ms per query, every time. After VerifiedState: 0.01ms to know if a fact exists, <1ms to retrieve it.
subscribe(namespaceId)— load filter + cache + start receiving stateunsubscribe()— clean up subscription and clear cacherefreshFilter(namespaceId)— refresh existence filter (call every ~5 min for long-running agents)quickQuery(namespaceId, slotKey)— four-tier retrieval with automatic fastest pathresync(namespaceId)— catch up on missed deltas
VerifiedState works across every MCP-compatible coding tool.
Define something in Claude Code — it's instantly available in Cursor, Windsurf, and every other session connected to the same namespace.
Compatible tools:
- Claude Code
- Cursor
- Windsurf
- VS Code + Continue
- Gemini CLI
- GitHub Copilot
- Any MCP client
One config, all tools:
Add https://mcp.verifiedstate.ai/mcp as an MCP server in your tool of choice.
import{VerifiedStateError}from'@verifiedstate/sdk';try{awaitclient.query({namespace_id: 'uuid',query_text: '...'});}catch(err){if(errinstanceofVerifiedStateError){console.error(err.status,err.message,err.body);}}MIT