Files
timmy-tower/lib/db/migrations/0008_session_messages.sql
Alexander Whitestone 43c948552a
Some checks failed
CI / Typecheck & Lint (pull_request) Failing after 0s
feat: inject conversation history into session work model
- Add session_messages table and migration for storing conversation turns
- Add getSessionHistory() helper to load recent history with token budget
- Pass conversation history to executeWork() and executeWorkStreaming()
- Persist user/assistant exchanges after completed requests
- Rejected/failed requests do not pollute history

Fixes #39

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-22 21:50:55 -04:00

14 lines
481 B
SQL

-- Migration: Session conversation history (#38/#39)
-- Stores user/assistant message pairs for context injection into the work model.
CREATE TABLE IF NOT EXISTS session_messages (
id SERIAL PRIMARY KEY,
session_id TEXT NOT NULL REFERENCES sessions(id),
role TEXT NOT NULL,
content TEXT NOT NULL,
token_count INTEGER,
created_at TIMESTAMPTZ NOT NULL DEFAULT NOW()
);
CREATE INDEX idx_session_messages_session_id ON session_messages(session_id);