Triage Agents
The triage system uses three distinct agents, each with a specific role.Agent Registry
1. Runtime TriageAgent (iw-agent-runtime)
File:services/iw-agent-runtime/src/agents/triage-agent.ts
Type: Durable Object Agent (extends Agent<Env, TriageState>)
Role: First-line intake classifier. Receives raw events and routes them by simple pattern matching.
State Model
Classification Rules
Default rules (configurable viaaddRule()):
Execution Flow
triage()receives input (kind, content, source, metadata)classify(content)matches against rules → determines route- Writes
triage_itemto SQLite (operational state) - If route is
memoryorsignal, callsemitTriageInput()to Continuity service - Returns
{ itemId, route, status: "open" }
What It Writes
triage_itemstable (Durable Object SQLite) — operational state only- Continuity event via
emitTriageInput()— evidence emission
What It Never Writes
- Canonical organizational memory
- Approved knowledge
- Entity state
2. Cognitive TriageAgent (intelligence)
File:services/intelligence/src/agents/specialized/triage.ts
Type: Workflow agent (extends BaseAgent)
Role: Deep cognitive evaluation of high-stakes content. Uses LLM reasoning across 4 dimensions.
Cognitive Dimensions
- Intelligent Categorization — What is the true intent?
- Contextual Linking — How does this relate to canonical memory?
- Canonical Review — Stale? Duplicate? Conflicts?
- Guardrails & Governance — Sensitivity → stage or reject?
Output Schema
STAGE_FOR_REVIEW and REJECT. AUTO_APPROVE is deprecated and prohibited for organizational memory.
Final Status Mapping
3. Triage Bot (knowledge)
File:services/knowledge/src/triage-bot.ts
Type: Function module (not an agent class)
Role: AI-powered knowledge extraction from conversations. Uses Workers AI for extraction, Slack for review notification.
Extraction Categories
AI Provider Priority
- Cloudflare Workers AI (
env.AI) — edge-native, zero external calls - OpenRouter (
env.OPENROUTER_API_KEY) — fallback for larger models
What It Writes
triage_resultstable (Neon/D1) withapproval_status = 'pending'- Slack notification (review channel only, not authority bypass)
What It Never Writes
- Approved organizational memory
- Canonical entity state
- Direct promotions
Slack Integration
Slack is a review channel, not an authority bypass. A Slack reaction must become a verified approval event bound to the triage item, tenant, principal, and candidate version before promotion. Reaction mapping:- ✅ → Approve
- ❌ → Discard
- ⏰ → Defer