Unclassified

L2 Twin Surface Contract

Status: Draft v1 — foundational ontology
Last updated: May 15, 2026
Owner: Nirmal
Referenced from: CONTINUOUS_KM_PLAN.md §10
Supersedes (partial): the "14 components" enumeration in docs/tech/SYSTEM_FLOW_DEFINITIVE.md §L2 and docs/design/FIGMA_DESIGN_CONTEXT.md §L2


0. Purpose

This document is the canonical ontology for everything the L2 Cognitive Layer exposes — to humans, to the Twin runtime, to automations, and to integrating systems. It replaces ad‑hoc lists ("the 14 components", "the drawer panels", "the cognitive surfaces") with a single hierarchical contract.

The L2 Cognitive Layer is the Cognitive Runtime Environment of IntegrateWise: a substrate that unifies organisational truth (Spine), conversational memory, human interaction surfaces, the Twin's execution primitives, and the automation fabric that fires it all. It is not a frontend feature set.


1. First Principle

Cognitive Surface ≠ UI Panel.

A cognitive surface is a semantic operational capability space. It may simultaneously expose:

  • UI (drawer panels, dashboards, modals)
  • API (HTTP, OpenAI-compatible)
  • MCP (tools, resources)
  • Automation (triggers, schedules, webhooks)
  • Workflow (executable graphs)
  • Background execution (cron, queues)
  • Reasoning substrate (prompts, skills, memory)

Reducing a surface to "a frontend component" loses the architecture. Every entry in this contract MUST be evaluated across all of those expression modes — even if a given mode is not yet implemented.


2. Topology

The contract is organised into four categories. They are layers of a single architecture, not a flat inventory.

L2 Cognitive Surface Contract
├── 1. Cognitive Domains          (semantic territories — what the system thinks about)
├── 2. Interaction Surfaces       (human-facing operational interfaces)
├── 3. Runtime Primitives         (Twin execution substrate — cognition mechanics)
└── 4. Automation / Workflow Fabric (the nervous system — triggers, graphs, schedulers)
CategoryNatureEvolution rateOwner concern
Cognitive DomainsSemanticSlow — these are the territories the system reasons overProduct + Doctrine
Interaction SurfacesUXMedium — UIs evolve with usage patternsDesign + Frontend
Runtime PrimitivesMechanicsSlow — substrate stability mattersTwin runtime engineering
Automation FabricPlumbingFast — new triggers/graphs added continuouslyWorkflow + Ops

Counts deliberately omitted. The number of entries per category will evolve. The topology, the categories, and the relationships are the architecture.

2.5 Workbench Boundary Binding

This contract governs the Twin Workbench only. It must not be read as the contract for the User Workbench or governance (embedded in Operational Workbench).

WorkbenchCanonical RuntimeOpen WebUI StatusBoundary Rule
User WorkbenchProjection-native customer/product shell in the IntegrateWise appNot Open WebUIThe customer-facing workbench lives in the product shell. Open WebUI may receive context handoff from it, but does not replace it.
Twin WorkbenchOpen WebUI primary Twin surfaceDirect mappingChat, folders, custom models, prompts, knowledge, tools/functions/MCP, automations, and memories map here.
GovernanceEmbedded at every layer — approval queue and HITL review inline in Operational WorkbenchGovernance-adjacentApproval panels appear inline, not in a separate shell.

Styling rule:

  • Twin / Open WebUI runtime surfaces must use the canonical Forest + Paper system language.
  • Midnight Executive is investor-deck language only and must not be treated as the runtime or product shell language.

3. Mapping Schema

Every surface in this contract is described with five attributes:

ColumnMeaning
SurfaceCanonical name used in code, docs, and UI
CategoryOne of: Cognitive Domain, Interaction Surface, Runtime Primitive, Automation Fabric
Open WebUI RoleHow it manifests in the Open WebUI shell (model / tool / function / panel / pipeline / prompt / workspace / RAG / native)
Runtime RoleWhat the Twin runtime does with it (reasoning, governance, retrieval, execution, gating, etc.)
Access PathConcrete entry point: HTTP route, MCP server, UI control, cron, webhook

4. Category 1 — Cognitive Domains

The semantic territories. Each is a space the system reasons about.

SurfaceCategoryOpen WebUI RoleRuntime RoleAccess Path
spineCognitive DomainMCP tool + side panelSource-of-truth read (via Entity 360)MCP spine.read
contextCognitive DomainMCP toolEntity 360 context assemblyMCP context.assemble
knowledgeCognitive DomainRAG collection + MCPConversational + consolidated memory retrievalMCP kb.search, kb.write
evidenceCognitive DomainInline panel (function)Provenance tracing for any claimMCP evidence.trace
signalsCognitive DomainNotification badge + pipelineReal-time sensing across connected toolsSSE stream + MCP signals.query
thinkCognitive DomainCustom model iw-twin-thinkReasoning orchestration/v1/chat/completions
actCognitive DomainApproval modal (function)Governed action executionMCP act.execute (requires approval token)
governCognitive DomainPolicy panelPolicy check + audit emissionMCP govern.check, govern.audit
adjustCognitive DomainCorrect/redo functionDecision correction loop (ADJUST in Sense/Think/Act)MCP adjust.correct
auditCognitive DomainWorkspace tabCross-layer integrity monitoringMCP audit.query
agentCognitive DomainCustom model iw-twin-proactive (background)Proactive reasoning without promptCron → Pipeline → model
twinCognitive DomainTrust score badge (function)Twin identity + trust surfaceMCP twin.trust, twin.identity
chatCognitive DomainNative Open WebUI chatMulti-turn conversational interfaceOWUI native
searchCognitive DomainMCP + workspaceTriage + knowledge searchMCP triage.search, kb.search
bridgeCognitive DomainWorkspace dashboardSense / Think / Act unified mission controlOWUI workspace
goal-frameworkCognitive DomainSide panel + MCPGoal/outcome tracing for every insightMCP goals.read, goals.write

5. Category 2 — Interaction Surfaces

Human-facing operational interfaces. These can evolve independently of the cognitive domains they expose.

SurfaceCategoryOpen WebUI RoleRuntime RoleAccess Path
ai-chatInteraction SurfaceNative Open WebUI chatConversational entry into the TwinOWUI native
workflow-builderInteraction SurfacePipeline editor (design mode)Design of executable workflows (not execution)OWUI Pipelines UI
document-storageInteraction SurfaceRAG document collectionDocument ingest + retrievalOWUI RAG + S3/R2
approvalsInteraction SurfaceApproval modal + queueHuman-in-the-loop gate UIOWUI function + Workers HITL DO
trust-panelsInteraction SurfaceTrust score panelsConfidence + provenance displayOWUI function
triage-inboxInteraction SurfaceWorkspace tabMemory triage queueOWUI workspace + MCP triage.list
dashboardsInteraction SurfaceOWUI workspace dashboardsCross-domain situational viewOWUI workspace
stackeditInteraction SurfaceExternal (browser)Markdown editor on GitHub-backed canonStackEdit ↔ GitHub round-trip
owui-workspacesInteraction SurfaceWorkspace registryPer-domain workspace (sales, success, ops, etc.)OWUI workspaces

6. Category 3 — Runtime Primitives

The Twin's execution substrate. Architecturally the most critical category — these are not UI concepts, they are the cognition mechanics.

SurfaceCategoryOpen WebUI RoleRuntime RoleAccess Path
skillsRuntime PrimitiveTool registryCapability execution unitOWUI Tools + MCP
promptsRuntime PrimitivePrompt library (versioned)Instruction substrate per domainOWUI Prompts + Twin runtime
tool-callsRuntime PrimitiveOpenAI function callingTool invocation protocol/v1/chat/completions (functions)
mcpRuntime PrimitiveMCP client configTool/resource exchange protocolOWUI MCP client → N Twin MCP servers
context-windowRuntime Primitive(transparent)Token budget + E360 packingTwin runtime internal
memoryRuntime Primitive(transparent)Conversational memory storeSpine DB memory.conversational_memory
working-memoryRuntime Primitive(transparent)Short-term scratchpad per sessionTwin runtime in-process
model-routingRuntime PrimitiveCustom model entryProvider/model selection (OpenRouter upstream)OWUI model registry → Twin → OpenRouter
streamingRuntime PrimitiveSSE on chatToken-stream deliverySSE on /v1/chat/completions
evalsRuntime PrimitiveThumbs/score functionEval logging + quality signalOWUI function → Twin eval log
approvals-tokenRuntime Primitive(transparent)HITL gate token issued by Govern, consumed by ActWorkers HITL DO

7. Category 4 — Automation / Workflow Fabric

The nervous system. Triggers, graphs, schedulers, background execution. Distinct from cognition itself.

SurfaceCategoryOpen WebUI RoleRuntime RoleAccess Path
workflowsAutomation FabricPipeline runtimeExecution of cognition graphs (DAGs)OWUI Pipelines runtime + MCP workflow.run
automationsAutomation Fabric(background)Triggering mechanisms (rule-driven)Workers cron + event handlers
triggersAutomation Fabric(background)Event sources (signal, webhook, schedule, manual)Workers Queues + signal-engine
pipelinesAutomation FabricOWUI PipelinesComposable filters/actions on chat trafficOWUI Pipelines
schedulersAutomation Fabric(background)Cron + interval-based dispatchWorkers cron triggers
event-routingAutomation Fabric(background)Pub/sub between servicesWorkers Queues + Durable Objects
background-executionAutomation Fabric(background)Long-running jobs outside chat turnWorkers + queue consumers

8. Critical Distinctions to Preserve

These distinctions are load-bearing. Do not collapse them in future refactors.

DistinctionWhy it matters
workflow-builder (Interaction) vs workflows (Automation)Design surface vs runtime execution. Different evolution rates, different owners.
workflows vs automations vs triggersGraph definition vs rule that fires it vs event that activates the rule. Three distinct layers.
skills vs tool-callsCapability unit (durable) vs invocation protocol (per-turn).
prompts vs acceleratorsVersioned instruction substrate vs UX-shipped templates. (accelerators may collapse into prompts in v2; for now treat as alias.)
memory (Runtime Primitive) vs knowledge (Cognitive Domain)Substrate that stores vs domain that reasons over what is stored.
chat (Cognitive Domain) vs ai-chat (Interaction Surface)The conversational territory vs the UI surface that exposes it.
User Workbench vs Twin WorkbenchProjection-native customer/product shell vs Open WebUI primary cognitive surface. Context may pass between them, but they must never collapse into one shell.
Twin Workbench vs GovernanceTwin reasons and surfaces proposals; Governance owns approval, policy, and controlled mutation. Governance is embedded — not a separate shell.
agent vs twinBackground proactive reasoner vs trust/identity surface of the unified Twin.

9. What This Contract Replaces

SourceStatus
docs/tech/SYSTEM_FLOW_DEFINITIVE.md §L2 (claims "14 components", lists 9)Update to point to this doc
docs/design/FIGMA_DESIGN_CONTEXT.md §L2 Cognitive Overlay (lists 6 panels)Update to point to this doc; FIGMA list is a subset of Interaction Surfaces
apps/web/src/components/l2/cognitive/cognitive-panel-provider.tsx CognitiveSurface enumCode-side enumeration of drawer-rendered Cognitive Domains; expand or rename only via this contract
apps/web/src/components/l2/* directory layoutFolder structure should converge to mirror Categories 1+2 over time

This contract governs the Twin surface only. It does not define the Operational Workbench shell. Governance is embedded at every layer, not a separate surface.


10. Open Questions

  1. Does accelerators stay as its own entry, or fold into prompts?
  2. Does bridge (Sense/Think/Act mission control) live as a Cognitive Domain or graduate to a top-level meta-surface that orchestrates the other three?
  3. Should audit split into audit (read) and governance-audit-log (write-only sink)?
  4. background-execution vs schedulers — keep both or merge?
  5. Naming: confirm "Cognitive Runtime Environment" as the umbrella phrase. Alternatives: "Cognitive Layer", "Cognitive Intelligence Overlay" (both already approved canon).

11. Architectural Convergence Note

This contract is the place where IntegrateWise stops being describable as "an AI assistant" or "an agent system" or "a knowledge management tool", and becomes accurately describable as:

Persistent Cognitive Runtime
    + Federated Memory
    + Governed Organisational Truth
    + Human Cognitive Surfaces
    + Automation Fabric
    + Runtime Execution Primitives

The 14-surface enumeration in earlier docs was an early, incomplete glimpse of this topology. This contract makes the topology explicit so future work plugs into it deliberately rather than rediscovering it ad hoc.


12. Maintenance Rules

  • Adding a surface: must declare Category and fill all 5 mapping columns. PR must reference an existing Cognitive Domain it serves (or justify a new domain).
  • Removing a surface: requires migration note + update to dependent Interaction Surfaces and Runtime Primitives.
  • Renaming: update the CognitiveSurface enum, the apps/web/src/components/l2/* directory, and this contract atomically.
  • Counts are not part of the contract. Do not write "the N cognitive domains" or "the N runtime primitives" in product or marketing copy. Refer to categories.