> ## Documentation Index
> Fetch the complete documentation index at: https://docs.spineworkspace.com/llms.txt
> Use this file to discover all available pages before exploring further.

# 11 — Code Map

> Map of triage source files, services, and entry points in the repository.

# Code Map

Where each triage responsibility lives in the codebase.

## Responsibility → File Mapping

| Responsibility | Service | File | Status |
| - | - | - | - |
| **Runtime intake classifier** | iw-agent-runtime | `src/agents/triage-agent.ts` | VERIFIED |
| **Continuity emission** | iw-agent-runtime | `src/ecosystem/memory-pipeline.ts` | VERIFIED |
| **Service bindings** | iw-agent-runtime | `src/ecosystem/bindings.ts` | VERIFIED |
| **Cognitive triage** | intelligence | `src/agents/specialized/triage.ts` | VERIFIED — patched |
| **Durable triage workflow** | intelligence | `src/workflows/triage-workflow.ts` | VERIFIED — patched |
| **AI extraction (triage-bot)** | knowledge | `src/triage-bot.ts` | VERIFIED |
| **Human decision endpoint** | knowledge | `src/index.ts` PATCH `/v1/knowledge/triage/:id` | VERIFIED |
| **Session triage endpoint** | knowledge | `src/index.ts` POST `/v1/triage/session` | VERIFIED — patched |
| **Inbox endpoint** | knowledge | `src/index.ts` GET `/v1/knowledge/inbox` | VERIFIED |
| **Approved items endpoint** | knowledge | `src/index.ts` GET `/v1/triage/approved` | VERIFIED |
| **Manual trigger** | knowledge | `src/index.ts` POST `/v1/triage/run` | VERIFIED |
| **IQ Hub sessions** | knowledge | `src/iq-hub.ts` GET `/sessions` | VERIFIED |
| **Conversation archive** | knowledge | `src/iq-hub.ts` POST `/conversations/:id/archive` | VERIFIED |
| **Memory consolidator** | knowledge | `src/memory-consolidator.ts` | VERIFIED |
| **Domain governance config** | knowledge | `src/synthesis/knowledge-model.ts` | VERIFIED — patched |
| **Deprecated promotion gate** | knowledge | `src/synthesis/promotion-gate.ts` | DEPRECATED — points to pipeline |
| **Deprecated triage types** | knowledge | `src/synthesis/triage-bot.ts` | DEPRECATED — types only |
| **Canonical promotion engine** | pipeline | `src/memory-promoter.ts` | VERIFIED — sole writer |
| **Memory indexer** | pipeline | `src/memory-indexer.ts` | VERIFIED |
| **SQL approval state** | sql-migrations | `058_triage_approval_status.sql` | VERIFIED |
| **Flow C doctrine** | apps/web | `public/docs/ip/tech/FLOW_C_AI_MEMORY_AND_TRIAGE.md` | UPDATED |

## Service Dependencies

```
iw-agent-runtime
    └── CONTINUITY (service binding) → Continuity service
    └── PIPELINE (service binding) → Pipeline service

intelligence
    └── OPS_DLQ_QUEUE (queue) → HITL approval queue
    └── PIPELINE_QUEUE (queue) → Spine write queue (DISABLED for triage)

knowledge
    └── DB (D1) → Triage results, consolidated memories
    └── DATABASE_URL (Neon) → Triage results (primary)
    └── AI (Workers AI) → Extraction, classification
    └── TASKS_QUEUE (queue) → Consolidation triggers
    └── IQ_HUB (service binding) → Session data
    └── THINK (service binding) → Summarization
    └── KNOWLEDGE (service binding) → Knowledge base updates

pipeline
    └── CACHE_DB (D1) → org_memory, memory_promotion_audit
    └── AI_SEARCH (Vectorize) → Memory indexing
```

## Key Entry Points

| Entry Point | URL/Binding | Handler |
| - | - | - |
| Session triage | `POST /v1/triage/session` | `knowledge/src/index.ts` |
| Triage inbox | `GET /v1/knowledge/inbox` | `knowledge/src/index.ts` |
| Human decision | `PATCH /v1/knowledge/triage/:id` | `knowledge/src/index.ts` |
| Manual trigger | `POST /v1/triage/run` | `knowledge/src/index.ts` |
| Triage status | `GET /v1/triage/status` | `knowledge/src/index.ts` |
| Approved items | `GET /v1/triage/approved` | `knowledge/src/index.ts` |
| Conversation archive | `POST /conversations/:id/archive` | `knowledge/src/iq-hub.ts` |
| Memory consolidate | Cron / `POST /trigger/:type` | `knowledge/src/memory-consolidator.ts` |
| Memory promote | `memory-promote` queue | `pipeline/src/memory-promoter.ts` |


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.