ContextUnity Manifestoπ
An open R&D and application platform for building sovereign, zero-trust AI systems β free from cloud provider dependencies and vendor lock-in.
Prefaceπ
ContextUnity is an R&D and production platform engineered for teams building real AI applications that they fully own and control. Rather than another thin wrapper around hosted LLM APIs, it provides a modular AI service mesh where agents plan, execute, verify, document, and learn under fail-closed security boundaries.
Managed black-box agent platforms lock teams into single cloud vendors, burn tokens on every loop, and strip away data and infrastructure ownership. ContextUnity is built so you can run your own applications on local hardware, private servers, or any cloud of your choice β with zero cloud provider lock-in and zero vendor lock-in. Several domain products are already in active development on top of ContextUnity.
This document separates what is on the planned iterative engineering track (0.6 β 0.14) from the long-term evolutionary horizon (0.15+).
1. Fundamental Principlesπ
- Universal Protocol: All service-to-service communication flows over gRPC using a single typed
ContextUnitenvelope (ADR-0001). - Zero-Trust Security: No agent holds ambient privileges.
ContextTokencredentials undergo dynamic Capability Stripping (Attenuation) before every node execution (ADR-0017); a child token can never widen its parent's permissions. - Inversion of Control (Federated Execution): The platform never steals application database credentials. Agents emit typed intents while consumer projects execute
@federated_toolhandlers inside their own perimeters over bidirectional gRPC streams. - Pass-by-Reference: Rather than shuffling megabytes of raw prompts between services,
ContextUnitcarries lightweight UUID pointers to canonical records (ADR-0004). - Manifest-First Architecture: Projects integrate via a single declarative
contextunity.project.yamlwithout boilerplate orchestration glue (ADR-0002).
Part I β Planned Iterative Track (0.6 β 0.14)π
Everything in Part I maps directly to the Platform Roadmap (0.6 β 0.14).
2. Flat Hybrid Memory (ContextBrain)π
ContextBrain unifies transport pointers, working memory, and long-term experience into a graph-first, vector-fallback store (ADR-0011, ADR-0018):
- Blackboard: Run-scoped coordination scratchpad for active plans, handoffs, and receipts.
- BrainCell: Atomic, versioned knowledge units with provenance, tenant isolation, and decay policies.
- CellEdges: Explicit relational, causal, and dependency edges traversed first for exact multi-hop recall.
- BrainSynapse (Q-Learning): Outcome observations from
FinalVerdictadjust edge weights over time so proven paths rise and noisy ones prune. - BrainEngram (Vector Fallback):
pgvectorsemantic index activated when graph traversal falls below coverage threshold, paired with background consolidation.
Multi-tenancy is enforced at the database kernel via PostgreSQL Row-Level Security (RLS) on tenant_id.
3. Stateless Orchestration (ContextRouter) & Durable Execution (ContextWorker)π
- Stateless LangGraph 1.2 DAGs:
ContextRoutercompilescontextunity.project.yamlinto runnable graphs with per-node model policies, automatic fallback chains, and tool contracts. - Unified
PATH L/PATH T(ADR-0016):ContextWorkerruns identical workflow definitions on local async runners (PATH L) for laptop/CI speed and on Temporal Server (PATH T) for durable timers, heartbeats, and crash recovery. - Contract-Enforced Safety: Destructive actions require explicit upstream proof pointers (e.g., a Shield clearance ID or encrypted offload pointer per ADR-0015) in their Pydantic tool schema so an LLM cannot bypass verification steps.
4. Defense-in-Depth (ContextShield) & Privacyπ
- Token Attenuation:
TokenBuilderstrips scopes per LangGraph node before execution. - gRPC Permission Interceptors: Fail-closed scope enforcement on every RPC boundary.
- AI Firewall & Prompt Vault: Canonical prompts and secrets remain in Shield; Router performs controlled pre-LLM PII masking.
- PostgreSQL RLS: Kernel-level tenant isolation even if upstream layers fail.
- Ephemeral Sandboxes: Generated or untrusted code runs in isolated sandboxes with restricted network and filesystem access.
5. Read-Only Observability (ContextForge)π
ContextForge unifies operational visibility into a single read-only Django + HTMX console:
- Trace & Graph Journey: Inspect
ContextUnitexecution, pointer dereferencing, and memory recall paths without mutating production control planes. - Human-in-the-Loop (HITL) Review Queues: High-risk actions pause for explicit operator approval and emit
ReportOutcomeObservationback toContextBrain. - ForgeLibrarian & Lab Mode: Continuous architecture diagnostics and side-by-side workflow replay.
6. Graceful Degradation: Laptop to Clusterπ
| Component | Production Cluster | Local Loopback |
|---|---|---|
| ContextBrain | PostgreSQL + pgvector | SQLite |
| Service Registry | Redis | In-Memory |
| ContextWorker | Temporal (PATH T) | Async Runner (PATH L) |
| Transport | gRPC + mTLS | Local loopback / in-process |
Part II β Evolutionary Horizon (0.15+)π
The capabilities below represent long-term research and decentralized ecosystem evolution beyond the 0.6 β 0.14 foundation.
7. TeacherβStudent Loops & LoRA Hot-Swappingπ
- Golden Trajectory Distillation:
ContextWorkerscans high-Q-value trajectories to curate compact tool-calling datasets. - Unsloth + Local Fine-Tuning: Lightweight LoRA adapters train inside ephemeral sandboxes and register in
ContextBrain. - Dynamic Hot-Swapping & Auto-Fallback: Router routes routine tasks to specialized local adapters and falls back to frontier models on uncertainty, feeding new successes back into the training loop.
8. Deep Archive & CRDT Synchronizationπ
- Cold Storage: Continuous WAL archiving (Point-in-Time Recovery) and client-side encrypted backups to S3/R2.
- Differential Sync & CRDTs: Conflict-free state replication across edge nodes with offline Worker buffers.
9. Federated P2P Mesh & ContextSeedπ
- Signed
ContextSeedPackages: VerifiedBrainCells, procedures, and capabilities packaged into cryptographically signed, portable seeds without leaking raw tenant conversations. - Edge Federation & Zero-DNS Gossip: WireGuard-backed peer nodes sharing verified knowledge under local Shield policy validation.
- Immune Node Isolation: Instant Ed25519 certificate revocation across the mesh when anomalies are detected.
10. M2M Economy & Autonomous Geo-Deploymentπ
- Shield-Governed Wallets & Temporal Escrow: Agents hire external specialist agents via escrow workflows (
HireExternalAgentWorkflow), releasing funds only after automated verdict validation. - Experience Tokenization: High-Q-value strategies and adapters packaged as reusable ecosystem artifacts.
11. Vision: Sovereign Foundation for AI Applicationsπ
ContextUnity is an open R&D and application core (Core, Router, Brain, Worker, Shield, Forge, CLI, Django) around which teams and the community build domain extensions, manifests, and products β with several real-world products already in active development on top of the platform:
- For a solo developer: Install
contextunity-cli, write a YAML manifest, and run locally on your own hardware with zero cloud dependencies. - For a product team: Switch configuration to your own PostgreSQL, Redis, Temporal, and Shield enforcement β no vendor lock-in, full sovereignty over data and models.
- For the open ecosystem: Sovereign installations that retain 100% data ownership while selectively exchanging verified engineering memory.