{"slug":"business/FLOW_C_AI_MEMORY_AND_TRIAGE","title":"Current Surface-Binding Doctrine","section":"business","sectionLabel":"Business","status":"unclassified","type":"document","path":"business/FLOW_C_AI_MEMORY_AND_TRIAGE.mdx","bytes":2933,"description":null,"updated":null,"source":"integratewise/Integratewise-docs-wiki","content":"## Current Surface-Binding Doctrine\n\n- Operational Workbench = the primary work surface; left sidebar nav; Twin sidebar pops out when needed.\n- Twin Workbench = full AI ecosystem surface (skills, knowledge, agents, prompts, conversational library).\n- Governance is embedded at every layer — not a separate workbench.\n- OpenWebUI is not the customer-facing product shell.\n- Twin / OpenWebUI runtime surfaces use the canonical Forest + Paper system language.\n- Midnight Executive is investor-deck / fundraising language only.\n\nUse older L1/L2 / workspace / knowledge-UI language in this file through that boundary if any historical phrasing remains.\n\n---\n\n# Flow C: AI Memory & Triage\n\n## Principle\n\nFlow C (AI reasoning) NEVER writes directly to Spine. All AI-generated content goes through triage → governance review → approved knowledge. Only approved content feeds Entity 360.\n\n## Architecture\n\n```\nAI Source (MCP, OpenAI, Claude, Moonshot)\n    ↓\nD1 Buffer (flow_c_config rules)\n    ↓\nTriage Bot (Workers AI extraction)\n    ↓\n  ┌─────────────┐\n  │ Auto-approve │ ← High confidence + trusted source\n  │ HITL Review  │ ← Low confidence or new source\n  │ Reject       │ ← Below threshold\n  └─────────────┘\n    ↓\nTriage Bot review → approved knowledge\n    ↓\nEntity 360 Memory Layer → Twin Triggers\n```\n\n## Flow C Config\n\nEach tenant has a `flow_c_config` in D1:\n\n```typescript\ninterface FlowCConfig {\n  auto_approve_sources: string[]; // e.g. [\"claude\", \"system\"]\n  min_confidence: number; // 0-1, default 1.0 (all to HITL)\n  max_auto_approve_per_day: number; // rate limit\n  require_entity_link: boolean; // must link to entity\n  notifications: {\n    slack_webhook_url?: string;\n    notify_on_auto_approve: boolean;\n    notify_on_triage: boolean;\n  };\n}\n```\n\n## Triage Bot\n\nLocated in `services/knowledge/src/triage-bot.ts`:\n\n1. Receives content from D1 buffer\n2. Uses Workers AI (Llama 3.1 8B) for extraction\n3. Extracts: entities mentioned, sentiment, key facts, action items\n4. Scores confidence based on extraction quality\n5. Routes based on flow_c_config rules\n\n## Memory Consolidation\n\nThe Knowledge service consolidates memories via Durable Object (`MemoryConsolidator`):\n\n1. Sessions accumulate in D1\n2. Consolidator runs periodically (or on-demand via `/v1/triage/run`)\n3. Extracts patterns across sessions\n4. Creates `consolidated_memories` records\n5. Types: decision, preference, insight, action, rule, fact\n\n## Entity 360 Integration\n\nEntity 360 Memory layer fetches from:\n\n- `GET /v1/memories?entity_id=X` on Knowledge service\n- Falls back to Spine DB `ai_memories` table\n- Twin trigger `memory_conflict` detects low-confidence decisions\n\n## Twin Memory Triggers\n\n- **memory_conflict**: 2+ low-confidence decisions → \"Review memories\"\n- **context_gap**: High-value account with 0 context items → \"Connect integrations\"\n"}