Triage System — Execution Flow
Two-Path Mapping
Triage spans the User Path (human experience) and System Path (operational pipeline). The diagram below shows which steps belong to which path.
Neither path can bypass the other. The System Path never writes canonical memory. The User Path never classifies.
End-to-End Data Flow
Step-by-Step Walkthrough
Step 1: Intake
An event arrives from one of:- MCP Connector — saves session memory after a tool call
- Conversation Archive — triggers extraction when a conversation is archived
- Session Triage —
/v1/triage/sessionendpoint receives session summary - Manual Trigger — admin triggers triage via API
iw-agent-runtime TriageAgent (Durable Object) receives the event, classifies it by simple pattern matching, and stores it as a triage_item in operational state.
Step 2: Continuity Emission
The TriageAgent callsemitTriageInput() which posts to the Continuity service at http://internal/v1/continuity/events. This creates a cognition/system event in the continuity stream.
Step 3: Cognitive Evaluation
If the event qualifies for cognitive triage (higher-stakes content), theintelligence service’s TriageAgent performs a deep evaluation:
- Intelligent Categorization — What is the true intent? (Lead, Document, Operational Request)
- Contextual Linking — How does this relate to canonical memory? Which entities does it touch?
- Canonical Review — Is it stale? Duplicate? Conflicts with established truths?
- Guardrails & Governance — Based on sensitivity, should it be staged for review or rejected?
"STAGE_FOR_REVIEW" or "REJECT". No AUTO_APPROVE.
Step 4: Workflow Routing
TheTriageWorkflow durable workflow routes the result:
pending_approval→ sent to HITL DLQ (Human-In-The-Loop Dead Letter Queue)rejected→ terminal state, no memory publishedapproved(legacy — should not occur after patching) → treated as staging_for_review
Step 5: Knowledge Extraction
Theknowledge service’s triage-bot.ts extracts structured knowledge using Workers AI:
- Memory types: insight, preference, fact, decision, action_item, relationship
- All extractions written to
triage_resultswithapproval_status = 'pending' - Slack notification sent for review (channel, not authority bypass)
Step 6: Human Review
A human reviews the triage item via:- Workspace Triage Inbox —
GET /v1/knowledge/inboxshows pending/deferred items - Slack Reactions — ✅ Approve, ❌ Discard, ⏰ Defer (must be verified as approval event)
- API —
PATCH /v1/knowledge/triage/:idwith action: approve/discard/defer
- Authenticated principal
- Tenant authority
- Optimistic/version check
- Approver identity and timestamp
- Immutable decision audit
Step 7: Consolidation
The Memory Consolidator runs on schedule:
It reads only approved triage items and generates consolidated memories.
Step 8: Canonical Promotion
The Pipeline’smemory-promoter.ts is the sole canonical writer:
- Scores the Spine write against 7 Promotion Signals
- Determines governance state (staging vs approved)
- Writes to
org_memory(D1) - Deduplicates by lineage_ref
- Creates audit trail in
memory_promotion_audit - Indexes approved memory into AI Search