# Context Systems for the AI-Native Era

> Build context-aware applications with semantic types, intelligent AI agent orchestration, and global edge deployment. Systems that understand intent, maintain state across interactions, and adapt autonomously to changing business conditions with <50ms response times.

Canonical: https://ctx.do/

## In code

```ts
import { Ctx } from 'ctx.do'

// Context-aware business logic with semantic types
const orderCtx = Ctx({
  $type: 'OrderContext',
  customer: $.Customer,
  cart: $.ShoppingCart,
  payment: $.PaymentMethod
})

// Context flows through all operations
on.Order.created($ => {
  if ($.Ctx.customer.loyaltyTier === 'premium') {
    $.Order.apply.Discount({ rate: 0.15 })
    $.Shipping.expedite({ orderId: $.id })
  }
})
```

## Frequently asked questions

### What makes ctx.do different from traditional state management?

Ctx.do is built for the AI-native era with semantic types that AI agents can understand and reason about natively. Unlike Redux, MobX, or Zustand which store opaque state blobs, ctx.do creates a queryable knowledge graph where every piece of context has semantic meaning. Agents can traverse relationships, infer intent, and modify behavior autonomously. Context flows automatically through distributed systems, maintains consistency across edge locations, and scales to millions of concurrent contexts without performance degradation. Built-in time-travel debugging, automatic persistence, and cross-session context continuity.

### How does Business-as-Code work with context?

Express business logic as semantic patterns using $.Subject.predicate.Object syntax where context is a first-class citizen. AI agents understand intent, not just syntax—they reason about why code exists, what business goals it serves, and how to modify it safely. Your codebase becomes a living knowledge graph that agents can query ("find all order processing logic"), analyze ("what happens when a premium customer cancels?"), and modify autonomously ("add gift wrapping for orders over $100"). Context links code to business outcomes, enabling agents to optimize for revenue, conversion, retention, and other KPIs automatically.

### Can I migrate existing projects to ctx.do?

Yes. Import codebases (JavaScript, TypeScript, Python, Go, etc.), databases (PostgreSQL, MongoDB, MySQL, etc.), and configurations (JSON, YAML, TOML) automatically. The platform analyzes your architecture, infers semantic types from code patterns, generates TypeScript definitions, and creates migration plans with zero-downtime cutover strategies. Most projects migrate in hours, not weeks. Gradual migration supported—run legacy and ctx.do code side-by-side, incrementally adopt semantic patterns, and validate behavior matches before full cutover. Automatic regression testing ensures nothing breaks during migration.

### What are the platform limits and scaling characteristics?

Unlimited projects, team members, contexts, and deployments on all plans. Context storage scales automatically from KBs to TBs with no configuration. Handle 100K+ context reads/writes per second with <50ms global latency. Compute and storage use usage-based pricing—pay only for active contexts and operations, not idle capacity. Enterprise plans remove all limits with dedicated capacity (guaranteed IOPS, reserved memory, priority scheduling), custom SLAs (99.99% uptime, <10ms p99 latency, dedicated support), private deployments (VPC, on-premise, hybrid cloud), and compliance certifications (SOC 2, ISO 27001, HIPAA, GDPR).

### Is the platform itself open source?

The SDK, CLI, and core runtime tools are fully open source on GitHub under MIT license. Fork, modify, and contribute back to the community. The managed platform provides optimized hosting with Cloudflare's global edge network, AI capabilities (GPT-4, Claude, Gemini integration), advanced monitoring and analytics, automatic scaling and failover, and enterprise features. You can self-host everything using the open source stack (run on AWS, GCP, Azure, or bare metal) or use our managed service for zero-ops deployment. Hybrid deployments supported—sensitive data stays in your infrastructure while leveraging managed edge for public APIs.

## Part of Platform.do

ctx.do is one of the primitives of Platform.do. Every .do shares one grammar, Business-as-Code, and one SDK.

- What is Business-as-Code? https://platform.do/business-as-code
- Platform.do: https://platform.do/
- Docs: https://docs.platform.do
