Skip to content

ContextCore

ContextCore is the kernel of the ContextUnity ecosystem. It contains zero business logic — only shared types, protocols, and infrastructure used by every other service.

ContextUnit SDK

Atomic data exchange format with provenance tracking, Pydantic validation, and gRPC serialization.

ContextToken

Capability-based authorization tokens with Ed25519 signing, tenant isolation, and permission scoping.

gRPC Contracts

Protocol Buffer definitions for Brain, Router, Worker, Commerce, Shield, and View services.

SharedConfig

Pydantic-based configuration with .env support ensuring consistency across all services.

Architecture

contextunity/core/
├── sdk/ # ContextUnit, BrainClient, WorkerClient
│ ├── bootstrap/ # Project bootstrap (standalone, Django)
│ ├── clients/ # BrainClient, RouterClient, WorkerClient
│ ├── streaming/ # BiDi streaming (bidi, heartbeat)
│ ├── contextunit.py # ContextUnit model and serialization
│ ├── identity.py # get_project_id(), get_tenant_id()
│ └── tools.py # @federated_tool decorator
├── authz/ # Unified authorization engine
├── security/ # Token signing backends, interceptors
├── permissions/ # Permission definitions, inheritance, validation
├── token_utils/ # Token serialization, gRPC/HTTP extraction
├── manifest/ # Project manifest models and generators
├── tokens.py # ContextToken, TokenBuilder
├── signing.py # SigningBackend, HmacBackend, SessionTokenBackend
├── ed25519.py # Ed25519Backend
├── config.py # SharedConfig, SharedSecurityConfig
├── logging.py # Structured logging with secret redaction
├── interfaces.py # IRead, IWrite abstract interfaces
├── discovery.py # Redis-based service registration
├── grpc_utils.py # gRPC channel helpers
├── exceptions.py # ContextUnityError hierarchy, ErrorRegistry
├── *_pb2.py # Generated gRPC stubs (DO NOT EDIT)
└── *_pb2_grpc.py # Generated gRPC stubs (DO NOT EDIT)

Installation

Terminal window
pip install contextunity-core

Dependencies (kept intentionally minimal):

  • grpcio — gRPC runtime
  • protobuf — Protocol Buffer serialization
  • pydantic — validation and settings

Key Principle

Zero business logic. ContextCore provides only infrastructure: types, protocols, contracts, configuration, and logging.