[claude] Context injection — pass conversation history to work model (#39) #78
Reference in New Issue
Block a user
Delete Branch "claude/issue-39"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Fixes #39
Summary
session_messagestable + migration (0008_session_messages.sql) — storesrole,content,token_countper turn, indexed bysession_idgetSessionHistory()helper inlib/db/src/index.ts— loads the most recent messages capped by turn count (default 8) and approximate token budget (default 4000)executeWork()andexecuteWorkStreaming()now accept an optionalconversationHistoryparameter that gets prepended to the messages array sent to the Anthropic APIPOST /sessions/:id/requestloads history before the work call and persists user+assistant messages inside the DB transaction — only onfinalState === "complete"so rejected/failed requests don't pollute historyTest plan
pnpm run typecheck) ✅pnpm run lint) ✅