AI System
Pipeline Overview
A chat turn in ClayDiary is a fixed decision tree, not a free-form agent loop. Each step is one narrow component with a defined input and output, and the orchestrator decides which step runs next.
Steps
| Step | What it does | Documented in |
|---|---|---|
| Classifier | Decides whether the question is about pottery; if not, the turn ends with a refusal | Classification Gate |
| Router | Decides whether the question is structured (counts, filters) or descriptive | Question Routing |
| SQL agent | Answers structured questions by querying the database | Text-to-SQL |
| Retrieval | Finds the most relevant events with hybrid search and reranking, then groups them by piece | RAG Architecture |
| Generator | Writes the answer from the SQL result or the retrieved context and names the pieces it used | Answer Generation |
Across the steps
Three outcomes. A turn ends in an answer, a refusal, or an error. Unexpected failures are handled in one place, and the frontend learns which path the turn took from the end of the streamed response.
One conversation history. Every step that calls a model sees the same clean conversation history.
One trace. The whole turn is recorded as a single trace, so each step and the prompt version it ran can be inspected together. See Monitoring.