An anchored conversation now has a mode. 'about' is the existing behaviour (a persona talks with the user about the thread). 'as_contact' has the model play the contact so the user can rehearse the conversation: its own prompt (stay in the contact's voice, don't invent facts, coach on 'out of character'), no persona prompt, and only the thread tools — no memory, library, calendar or other-thread access, and no knowledge writes. The shared persona/file-chat loop now refuses tool calls that weren't in the turn's catalog, so the gates hold even when a model names a tool it wasn't offered. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
29 lines
1.6 KiB
SQL
29 lines
1.6 KiB
SQL
-- Anchor a persona conversation on a point in an SMS thread.
|
|
--
|
|
-- "Continue with persona" starts a persona chat from a long-pressed message
|
|
-- in the Messages screen. The conversation remembers which thread and which
|
|
-- message it grew out of, so the SMS screen can list the persona chats that
|
|
-- belong to a thread and the chat screen can show where it picked up.
|
|
--
|
|
-- `anchor_context` is a snapshot of the thread leading up to the anchor,
|
|
-- rendered once at creation and spliced into the system prompt on every
|
|
-- turn. Snapshotting (rather than refetching per turn) keeps the prompt
|
|
-- prefix byte-stable for KV-cache reuse and keeps the persona's view of the
|
|
-- thread fixed even if SMS-API is re-imported underneath it.
|
|
--
|
|
-- `anchor_mode` is how the chat relates to the thread: 'about' (a persona
|
|
-- talks with the user about it) or 'as_contact' (the model plays the
|
|
-- contact so the user can practise the conversation). NULL reads as 'about'.
|
|
--
|
|
-- All nullable: an unanchored (open) persona chat leaves them NULL.
|
|
|
|
ALTER TABLE persona_chat_conversations ADD COLUMN anchor_contact_id BIGINT;
|
|
ALTER TABLE persona_chat_conversations ADD COLUMN anchor_contact_name TEXT;
|
|
ALTER TABLE persona_chat_conversations ADD COLUMN anchor_message_id BIGINT;
|
|
ALTER TABLE persona_chat_conversations ADD COLUMN anchor_ts BIGINT;
|
|
ALTER TABLE persona_chat_conversations ADD COLUMN anchor_context TEXT;
|
|
ALTER TABLE persona_chat_conversations ADD COLUMN anchor_mode TEXT;
|
|
|
|
CREATE INDEX idx_persona_chat_anchor_contact
|
|
ON persona_chat_conversations (user_id, anchor_contact_id, updated_at DESC);
|