Repository navigation
feat(mcp): a message a connected app writes carries a mark, for the person and for the assistant - #385
Merged
Conversation
…erson and for the assistant Every message a connected app writes into a conversation (assistant, matter or table-review thread; new or existing) is stored with a mark of its own. The person sees one line of plain text under it; the assistant reads it after one fixed line and inside a fence of its own, as the person's request sent through an app, subject to system rules. Which history messages carry the mark is decided by the stored text. One migration that adds nullable columns to the two message tables.
Both migrations of 2026-11-28 are listed in the schema ledger, in filename order.
…written messages with a list The three route suites answered every read with one object. The read of the messages a connected app wrote expects rows, as the database returns, and a turn fails when it cannot be read.
…ext colour The same grey as the other secondary text, so it reads on a light background.
…rk of an app-written message The curator's transcript says when a person's message was sent through a connected app; nothing else in it changes. The account, conversations and table-review downloads keep a message's origin and the app's name and do not carry the connection's id. One test pins that a table-review turn hands the mark down to the stored message.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
A message a connected app writes into a conversation now carries a mark of its own. The person sees it where the message is drawn, and the assistant is told, on that message only, that it was sent through an app the person connected. Main conversations, matter conversations and the threads of a table review work the same way, for a new conversation and for an existing one.
What changed
20261128_02_litt_message_origin.sql:origin('mcp' only),origin_grant_id(FK tomcp_grants,on delete set null) andorigin_label(<= 120) onchat_messagesandtabular_review_chat_messages. Re-runnable, no backfill, no policy or grant change.schema.sqlcarries the same block and ledger line.start_chat,send_chat_message, the matter and workflow tools,send_tabular_chat_message); the three insert points write it throughchatOriginColumns. Nothing in a request body can set it.[Sent through an app the person connected to LiTT, on their behalf; not typed by them in LiTT.], never the app's name) and the text inside an<app-message nonce>fence, built like the workflow fence (same nonce, same neutralization, which now also coversapp-message). One policy paragraph in the system prompt says to treat it as the person's request, subject to system rules. The review thread's prompt gets the paragraph when a marked message is present.GET /chat/:idno longer returnsorigin_grant_id; the review thread read returnsoriginandorigin_labelonly.User (sent through a connected app): …); a transcript without such messages is unchanged, and what is eligible for memory is unchanged.originandorigin_labeland no longer carry the connection's id (conversations and messages).docs/mcp-server.mddescribes the rule.Why
A person who continues, on the web, a conversation an app wrote into should be able to see which messages came from the app, and the assistant should be told too. The mark is information: it changes no permission and asks for no confirmation, and a person asking through their own app is not told "data only".
Testing
Backend: new tests for the fence and its neutralization, the exact model input (including text that holds the line and fence tags), the unchanged input of an ordinary conversation, storing the mark for new and existing conversations in chat, matter chat and review threads, web requests unable to set it, the failing read, histories that differ from the stored rows, and the reads that serve clients. Frontend: component, mapper and review-thread tests; coverage gate at 100 % lines, functions and statements. Typechecks (backend, tests, contracts, frontend, word-add-in) and the source-reading tests pass. The whole backend suite and the migration on a database run in CI.
Also: the curator transcript with and without app-written messages and the select per table; the three downloads without the connection's id; the table-review turn handing the mark to the stored row. Each new assertion was checked against a change that breaks it.
Deploy notes
One migration that adds nullable columns, check constraints and a foreign key to two small tables (brief lock, one scan to validate). The previous backend keeps working on the migrated database. Messages written before the migration are not marked. The system prompt of every conversation gains one paragraph (how to read a message sent through an app), so each conversation's cached prompt is rebuilt once after the deploy. Going back to the previous backend after apps have written messages is not advised: its conversation read returns whole rows, the connection's id included.