![]() |
What an agent may not do, and why | ![]() |
A TeXmacs document is active: it holds macros that run programs, links which run scripts, files which are included when the document is typeset, and strings which are written as they are into the LaTeX or the HTML which you export. If an agent could write anything, a few words planted in a text which it has read (a web page, a paper, an e-mail) could turn into an action in your TeXmacs or in a file that you send to a coauthor. The server therefore checks what the agent writes, and refuses the edit entirely, changing nothing, when it breaks a rule. The answer says the rule.
The agent cannot write inside an assignment, a macro, a style or package declaration of the document, nor define anything new. It can insert text next to them.
It cannot call a macro of the document or of the style which would send its text to a link, a file, a program or the name of another macro. The macros are analysed, not just listed by name.
A link goes to a relative address, an anchor, http, https or mailto; a link to an absolute path or with .. is accepted too, because a link only acts when you click it. A file (an image, an inclusion) is a relative name inside the folder of the document or the folders allowed. Labels, keys and values which end up in an export have no backslashes, braces, quotes or angle brackets.
No scripts, no extern, no actions, no LaTeX or other raw text for other programs. LaTeX given by the agent is scanned for the commands which read files or run programs.
No loops, and bounds on the numbers which multiply the work of the typesetter (columns, sizes, resolution).
Only TeXmacs writes the markup of proposals.
What you already have in your document, links, scripts or raw LaTeX, stays, and does not prevent the agent from editing around it; but a change of it counts as new content.
This is a filter on what the agent writes into your documents. It is not a sandbox. The server opens any file which you can read, as TeXmacs would (limit this with TEXMACS_MCP_ROOTS), and the program of the agent can still do everything which you can do with the other tools which you gave it: a shell, other servers, the network. The local link between your TeXmacs and a program of the same user is not protected against a hostile program of that user either. Decide what the agent may do with the permissions of the agent itself, and read the proposals before you accept them.
The rules, the reasons for each, what was tried before and what is still open are on the page MCP-security of the wiki of the repository.