ctx
Deploy context-aware systems with semantic types and AI agent orchestration. Build autonomous business logic that adapts in real-time with 95% less code. Full TypeScript support at the edge.
ctx
CTX.do
Overview
The ctx primitive is part of the .do platform's semantic API system. It follows the $.Subject.verb.Object pattern for consistent, intuitive interactions across SDK, CLI, API, and MCP interfaces.
Semantic Pattern
All ctx operations follow the semantic $.Ctx.verb.Object pattern:
import { $, ctx } from 'sdk.do'
// Create resources
await $.Ctx.create.Resource({ /* config */ })
// Query data
await $.Ctx.get.Data({ /* params */ })
// Update state
await $.Ctx.update.Status({ /* changes */ })Quick Start
import { ctx } from 'sdk.do'
// Initialize and use the primitive
const result = await ctx.operation({
// configuration parameters
})Access Methods
The ctx primitive is accessible through multiple interfaces:
SDK
TypeScript/JavaScript library for programmatic access:
import { ctx } from 'sdk.do'
await ctx.method({ /* ... */ })CLI
Command-line interface for terminal operations:
do ctx <command> [options]API
REST/RPC endpoints for HTTP integration:
curl -X POST https://api.do/v1/ctx \
-H "Content-Type: application/json" \
-d '{"key":"value"}'MCP
Model Context Protocol for AI assistant integration:
Use ctx primitives with AI assistants via MCPRelated Primitives
See other primitives in the core-concepts category.