1. The Architectural Premise
In typical LLM wrappers and contemporary autonomous agent platforms, the language model functions simultaneously as reasoning engine, storage gateway, session coordinator, and tool dispatcher. If the model hallucinates or succumbs to prompt injection, the entire security boundary collapses.
TELHAR separates these responsibilities into distinct architectural planes with orthogonal lifecycles and strict contract boundaries. Cognition proposes plans; Policy dictates legality; the Effect Gate enforces execution; and Evidence records immutable proof.
2. The Five Planes in Detail
Memory Plane — Mnḗmē (ai/mneme)
Mnḗmē is not a generic vector database. It is a governed memory plane maintaining persistent personal context across surfaces. It supports temporal decay, semantic indexing via pgvector and Qdrant, KMS-backed Data Encryption Keys (DEK), and Row-Level Security (RLS) isolation.
Cognitive Plane — Praxis & ARK (Agent Runtime Kernel)
The cognitive plane handles natural language interpretation, task decomposition, context assembly, and plan generation. It operates under the Agent Runtime Kernel (ARK), a finite state machine whose termination and non-livelock invariants have been formally model-checked in TLA+ (TLC 1.8.0, 149 distinct states).
Policy Plane — Foedus (security/foedus)
The sole Policy Decision Point (PDP) of the architecture. Written in TypeScript and Open Policy Agent (Rego), Foedus evaluates explicit tenant covenants. Any access or action not explicitly permitted is rejected by default (fail-closed).
Evidence & Assurance Plane — Explorator & Refuto
Replaces blind trust with empirical proof. Explorator discovers external intelligence through fail-closed network egress guards and verifiable source provenance. Refuto provides the independent assurance harness that ensures agents never judge their own work.
Experience Plane — Experience Platform (platform/experience)
A single decision core projecting onto multiple perceptual modalities: Web (Next 15), Desktop (Tauri 2), Mobile (React Native), and Terminal (Rust TUI). A modality is treated as an adapter, not a reimplementation of business logic.
3. The Singular Effect Gate (Gateway Chokepoint)
All side-effects on the outside world — file writes, API calls, process spawning, shell execution, or remote communications — must flow through the **Effect Gate** in `core/gateway`. The gate enforces 7 sequential controls:
- Authentication & Identity: Cryptographic verification of the calling principal token (RS256).
- Tenant Isolation: Validation of workspace boundary and tenant tenancy keys.
- Rate & Budget Limiting: Fail-closed token/cost ceilings. Overrun stops execution immediately.
- Policy PDP Evaluation: Synchronous Foedus OPA check. Non-ALLOW responses terminate the call.
- Approval Plan Binding: Verification of single-use hash (
approvedSetHash) tied to the user turn. - Capability Token Attenuation: Verification that the capability was derived in kernel without escalation.
- Idempotency Validation: Checking deduplication caches to prevent duplicate external side-effects.
4. Ecosystem Topology: Multi-Plane Responsibility Matrix
6 Planes · 15 Bounded Contexts · Zero DriftThe TELHAR ecosystem rejects the superficial illusion of a monolithic AI pipeline. Across the active GitLab estate and live runtime clusters, every component executes within an airtight bounded context governed by single-ownership contracts, strictly enforced negative boundaries (what a component is forbidden from doing), and deterministic fail-stop invariants:
Sans-I/O pure PBFT state machine (Replica::step) with $3f+1$ replicas and Ed25519 quorum certificates (⌊(n+f)/2⌋+1). Formal TLA+ specification in formal/PbftCore.tla.
Custody of cryptographic anchoring, Merkle inclusion proofs, and immutable evidence ledgers (telhar:v1:evidence-event).
Durable DAG execution engine with distributed sagas, OTEL step traces, and cryptographic fencing tokens (telhar:v1:durable-job).
Frontier Fabric Router running natively on mk02 (:3200). Evaluates dynamic model scoring, latency budgets, and fallback matrices. Mints and signs telhar:v1:execution-plan (ExecutionPlanV1).
via-providers permanently archived).
Canonical prompt & cognitive formulae store over JSON-Schema (telhar:v1:prompt). Immutable monotonic versions with SHA-256 contentHash and URN resolution (urn:telhar:prompt:*).
scope='platform' (tenants cannot overwrite safety floor); zero direct LLM egress.
Autonomous agent orchestration runtime (:3001). Manages conversational turn-loops, intent decomposition, and tool execution state transitions.
Sole holder of external LLM credentials, provider SDKs, token meters, and circuit breakers (ART-10). Consumes telhar:v1:model-invocation-request from Gateway and emits authenticated telhar:v1:outcome (OutcomeReportV1).
provider_sdk_sites_outside_executor: 0. No other service in the estate is permitted to hold provider keys or call upstream AI vendors.
Asynchronous media, document (docx/xlsx/pptx/pdf), and vectorial chart generation service (:3020). Backed by Fastify, BullMQ, Redis, and Temporal. Implements RFC 7240 (202 Accepted + jobId, SSE streaming at /cancel). Watermarking via C2PA Content Credentials and SynthID hooks.
generate_media); forbidden from direct provider bypass.
Continuous memory substrate (:3130) fusing hybrid vector retrieval with BM25, KMS-backed envelope encryption (DEK/KEK), temporal contradiction detection, and tenant-isolated Row-Level Security (telhar:v1:memory-envelope).
Protected open-source web intelligence gatherer (:3120). Hardened with fail-closed SSRF filters tested against 133,000 IP ranges (RFC 1918, CGNAT, link-local, loopback). Emits verified telhar:v1:evidence-event.
Central Policy Decision Point (PDP, :3110) backed by Open Policy Agent (:3111). Evaluates deterministic OPA/Rego covenants (telhar:v1:policy-decision).
Rust Axum PEP (:3010). Enforces Effect Gate, validates SSO bearer once, and mints derive-once envelopes (telhar:v1:gateway-identity-envelope).
Rust FSM safety kernel checked in TLA+ (149 states, 0 deadlocks). Imposes typed untrusted taint analysis on model outputs (telhar:v1:governed-tool-call).
Cryptographic identity authority (:3100). Implements OIDC 2.1 / PKCE, RFC 8693 token exchange, and RS256 JWKS rotation (telhar:v1:access-token-claims).
Perceptual physics & optical materials engine translating abstract computational states into closed-form physical magnitudes (Fresnel/Schlick, Blinn-Phong, Beer-Lambert, dual-term directional shadows, and APCA-W3 contrast).
Human sovereign interaction surfaces: high-performance Rust TUI and multidevice Web. Enforces irrevocable cancellation authority (/v1/agent-runs/:runId/cancelar) over in-flight autonomous agent runs.
Perceptual Physics Boundary & Material Interface (ai/aesthesis)
10 Rust Engine Crates
In TELHAR, the interface is not a layer of decorative CSS. ai/aesthesis sits as an explicit architectural boundary between internal cognitive execution and human sensory perception, translating computational states into closed-form physical magnitudes:
Surfaces are governed by closed-form Fresnel reflectance (R(θ)), Blinn-Phong specular lobes (s = 2/α² - 2), and Beer-Lambert extinction (T = exp(-σ·d)).
Orthogonal separation of dense contact occlusion (r_c ∈ [2,6]px) from soft ambient penumbras (r_p ∈ [16,48]px) unified by light vector θ = 118°.
Strict exclusion of mid-luminance collision (L ∈ [0.44, 0.60]), guaranteeing |Lc| ≥ 60 body text contrast and CVD discrimination (ΔE ≥ 15.0).
5. Agent Run Cancellation: Invariant of Human Authority
In TELHAR, human agency is an operational invariant, not an aspiration. When a person requests cancellation of an autonomous agent turn:
- Authority: Only the sovereign person may initiate cancellation via authenticated HTTP (
/v1/agent-runs/:runId/cancelar). - Zero Model Authority: The AI model has zero capacity to decide, delay, or prevent its own cancellation.
- Deterministic Propagation:
AgentRunServicemarkscancelRequestedAtidempotently and routes the order through the bridge gateway directly totelhar-cli(serve.rs). - Execution Fence: Any action currently in-flight finishes its bounded step, but no subsequent acts are dispatched. The run seals in immutable
CANCELLEDstate.
6. Contract Authority & Canonical Schemas
TELHAR rejects implicit contracts and ad-hoc JSON payloads. The system is governed by 29 formal JSON Schemas located in contracts/schemas, versioned under strict SemVer and serialized deterministically per RFC-8785 (Canonical JSON).
7. Target Topology & Governance Enforcement
The 5–10 year target architecture (Document 11) is driven by radical consolidation: collapse to the real. The architecture enforces a single enforcement point without bypass ingress paths:
Identity & Token Invariants
Single IdP (core/sso), RS256/JWKS exclusively, zero HMAC/HS256 side-doors. Service-to-service communication relies on mTLS or signed service tokens.
Tenancy & Row-Level Security
Tenancy is not enforced by fragile manual WHERE clauses. Postgres Row-Level Security (RLS) acts as a cryptographic backstop under every query in Mnḗmē.