You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
#145 — Ask Splitzy: personal spending chatbot (self-hosted LLM)
What to build
Multi-turn conversation support: the client sends a bounded window of recent turns with each request, the server trims and threads that history through both the router (so relative references like "and last month?" resolve correctly) and the synthesis step, without persisting any chat state server-side.
History trimming — In backend/splitzy-dotnet/Controllers/ChatController.cs, trim Messages to LlmSettings.MaxHistoryTurns (from Chat foundation: streaming balance intent + router skeleton #146's config) before passing to the orchestrator. No server-side persistence of any kind.
Router context — Update ChatOrchestrator.AskAsync (and IChatOrchestrator) signature to accept the trimmed history and pass it into the router prompt call, so the router can resolve relative time/category references ("and last month?") against the prior turn's resolved params rather than re-deriving them from scratch.
Synthesis context — Pass the trimmed history into ILlmClient.StreamAsync (already accepts IReadOnlyList<ChatTurn> per Chat foundation: streaming balance intent + router skeleton #146) so the final answer reads as a natural continuation of the conversation.
Tests — Extend backend/spllitzy-dotnet-tests/ChatControllerTests.cs: a two-turn scenario where turn 1 asks "how much did I spend on groceries this month" and turn 2 asks "and last month?", asserting the second response resolves to the correct prior month's Food category total.
New dependency additions allowed for this slice: no.
Architecture alignment
Server remains stateless for chat — no new tables, no session store. History lives only in the request payload, matching the resolved requirement that chat state is never persisted server-side.
create-git-issue provides routing hints only; it must not assign concrete agent/model names.
run-with-it remains the final runtime routing authority.
Integration touchpoints
Changes the POST /api/chat/stream request shape (adds Messages) — this is the contract both client slices (Angular web chat UI #149, Android/Expo chat screen #150) will build against, so it should land before UI work starts.
No schema/migration changes.
Acceptance criteria
A follow-up question referencing a prior turn ("and last month?") resolves against that turn's context and returns the correct figure.
History longer than MaxHistoryTurns is trimmed server-side before reaching the LLM.
No chat messages are persisted to the database at any point.
Parent
#145 — Ask Splitzy: personal spending chatbot (self-hosted LLM)
What to build
Multi-turn conversation support: the client sends a bounded window of recent turns with each request, the server trims and threads that history through both the router (so relative references like "and last month?" resolve correctly) and the synthesis step, without persisting any chat state server-side.
Implementation Steps
ChatRequestinbackend/splitzy-dotnet/DTO/ChatDTO.cs(from Chat foundation: streaming balance intent + router skeleton #146) to{ List<ChatTurn> Messages; string NewMessage }, reusing the existingChatTurn { Role, Content }shape.backend/splitzy-dotnet/Controllers/ChatController.cs, trimMessagestoLlmSettings.MaxHistoryTurns(from Chat foundation: streaming balance intent + router skeleton #146's config) before passing to the orchestrator. No server-side persistence of any kind.ChatOrchestrator.AskAsync(andIChatOrchestrator) signature to accept the trimmed history and pass it into the router prompt call, so the router can resolve relative time/category references ("and last month?") against the prior turn's resolved params rather than re-deriving them from scratch.ILlmClient.StreamAsync(already acceptsIReadOnlyList<ChatTurn>per Chat foundation: streaming balance intent + router skeleton #146) so the final answer reads as a natural continuation of the conversation.backend/spllitzy-dotnet-tests/ChatControllerTests.cs: a two-turn scenario where turn 1 asks "how much did I spend on groceries this month" and turn 2 asks "and last month?", asserting the second response resolves to the correct prior month'sFoodcategory total.Agent Routing
Technical Context Snapshot
Current stack in scope
ChatController,ChatOrchestrator, and the DTOs already created there.Dependencies in scope
Architecture alignment
create-git-issueprovides routing hints only; it must not assign concrete agent/model names.run-with-itremains the final runtime routing authority.Integration touchpoints
POST /api/chat/streamrequest shape (addsMessages) — this is the contract both client slices (Angular web chat UI #149, Android/Expo chat screen #150) will build against, so it should land before UI work starts.Acceptance criteria
MaxHistoryTurnsis trimmed server-side before reaching the LLM.Blocked by