External MCP Clients
Connecting Cursor, Cline, Windsurf, VS Code, Zed, Gemini CLI, and cairnmind-recorder over stdio MCP with degraded provenance rules.
A client the launcher cannot start uses the same memory through an external session. Cairnmind cannot read or archive such a client's conversation, so its session is evidence-degraded: it can ask, read the resume packet, acknowledge it and write, but nothing it writes is ever shown or counted as verified. Give the client this stdio MCP server. When a tool call finds the knowledge service not running, the server starts it (and the engine), as run, ask and context do, so the client also works after a reboot without a manual cairnmind serve; parallel tool calls share one start. On an installation that only reads a store another installation writes, nothing is started and the error gives that reason (when the installation's role cannot be read, because the engine does not answer, the start is attempted and a reader's service refuses to run, so the error names the command that starts it instead); when the service cannot start, the error says why and names the command that starts it:
cairnmind mcp --client external --project /path/to/my-app--project takes the project id, its name or a path inside it. A relative path is read from the editor's working directory, not the service's, and a registered name wins over a folder of the same name. A value is read as a path only when it is written as one, starting with . or ~ or containing a / (./app, packages/api), as on the command line: a bare app is a project name, and one that is not registered is refused even when a folder of that name exists here. Without it the client's working directory is used, which an editor does not always set to the project. --worktree picks a registered worktree; by default it is the one containing the project path. Use the absolute path of the cairnmind command (command -v cairnmind), since an editor may not read your shell's PATH. For Cursor (.cursor/mcp.json) and Cline (its MCP settings file):
{
"mcpServers": {
"cairnmind": {
"command": "/home/me/.local/bin/cairnmind",
"args": ["mcp", "--client", "external", "--project", "/path/to/my-app"]
}
}
}Zed takes the same command and arguments as a custom context server in its settings; see Zed's documentation for the current form. On native Windows, point the editor directly at cairnmind.exe with ["mcp", "--client", "external", "--project", "my-app"]. If you run Cairnmind inside WSL instead, an editor on Windows reaches it with "command": "wsl.exe" and the arguments ["-d", "Ubuntu", "--", "/home/me/.local/bin/cairnmind", "mcp", ...]. None of these editors was connected in Cairnmind's own tests, which drive the server with the MCP SDK's client.
What the session does
- The first
resume_contextcreates the session. Its packet has"client": "external","history": "unarchived"and"evidence": "degraded", with a warning saying so. The ACK works as for any client: untilack_resumewith the exact packet id, hash and readback,remember,checkpointandsave_planare refused, and a change of plan, task, decisions or code asks for a new packet and ACK. - Such a session has no archived conversation to cite, so its
remembermay send"sources": []: the service keeps the reported text as the record's own source, with the same external mark. A fact or question does not change the state the ACK was given for, so several can be saved after one ACK; a checkpoint, decision, constraint, preference or task does, also when the session saved it itself, and the next write then asks forresume_contextand a new ACK. - Reading again costs little (#325). After
ack_resume, while nothing the packet promises has changed,resume_contextanswers in a few hundred bytes instead of the whole packet:"unchanged": true,"acknowledged": true, thepacket_idandpacket_hashit still stands for,newer_automatic_proposals(automatic proposals written after the packet; read them withask), andhistory: unarchivedandevidence: degraded. It is not an acknowledgement and does not extend one: every write is still checked against the current state. A client that no longer has the packet, for example after its own conversation was compacted, callsresume_contextwith"full_packet": true. A session that has not acknowledged its packet, and every new or changed packet, gets the whole packet.rememberandcheckpointanswer with the stored record'sid,version,status,kind,keyandsource_ids, theorigin_*mark the service set, and, where they apply,supersedes,possible_conflicts,supersede_warningandmetadata_not_stored_as_sent(keys of the metadata you sent that the stored version does not hold with the value you sent),metadata_dropped(keys the version before held that this version no longer holds: the service removes some by itself, such as reported proof or criteria links when a task's definition changes) andomitted_source_ids(source ids beyond the last eight); they no longer repeat the content just sent.save_planno longer repeats the plan's title. --client externalrefuses to start where the launcher setCAIRNMIND_SESSION_IDorCAIRNMIND_PACKET_ID: a verified native session is never replaced by a degraded one. A variable that is set but empty counts as not set, and that is how thecairnmind-recordersubagent that install writes for Claude Code starts inside a launched, verified session: it is a separate external session, so what it writes is degraded, not native (see below).- Transcripts of Codex or Claude Code in the same worktree that are not yet archived, or that hold a record Cairnmind cannot parse, keep the packet
partial, exactly as for a native client. - Everything the session writes (records, checkpoints, plans and tasks) carries
origin_client: external,origin_session_id,origin_history: unarchivedandorigin_evidence: degraded, set by the service and never by the client. A record keeps this mark when anyone edits it later; the one checkpoint record is the exception, since every checkpoint replaces it, so its mark follows whoever saved the latest checkpoint, and a checkpoint by anyone else that replaces an external one keeps none of the external one's fields. It starts from its own state alone, so fields that earlier native checkpoints set and neither of the last two repeats are dropped as well: that is the price of never carrying external text unmarked. A plan save marks the steps whose stored definition it adds or changes (content, dependencies, order, profiles, criteria and their links) and the plan when anything in it changed. Its evidence state isdegraded, neveranchored, in resume packets, the inspector,cairnmind memory orphansandcairnmind impact, and a source it wrote cannot anchor another record; search hits from such a source carry the mark too. An active plan or task it wrote is marked in every later resume packet, also a native client's, whose bootstrap then does not call itself verified. Its test and acceptance claims stayreported; only a check run bycairnmind check runis machine evidence. - The mark exists only for writes made through the MCP tools. If the editor's agent runs the
cairnmindcommand in its shell, that process has no session: its writes are stored as a person's, unmarked and without the ACK gate, as for any process without a session. Let the editor write through the MCP tools, not through the command line.
Recording without spending the conversation's context
What an explicit record costs the main conversation is its call and answer (about 1.0 KB since #325) and, once anything the packet promises has changed since its last ack_resume, the whole packet again plus the acknowledgement. Measured on this repository's sample project with the test tests/test_recorder_session.py (compact JSON bytes of what the main conversation sends and receives for one decision of 630 characters; the handed-off row counts the request text and the one-line answer only, not the fields of Claude Code's own subagent call or what it wraps around the answer, which were not measured):
| Sample project | Store with 20 long decisions | |
|---|---|---|
| Written by the main conversation, its ACK current | 1.0 KB | 1.0 KB |
Written by the main conversation, its ACK stale (call, new packet, ack_resume) |
6.9 KB | 20.9 KB |
Handed to cairnmind-recorder (request text and one-line answer, without Claude Code's own call fields and wrapper) |
0.8 KB | 0.8 KB |
| Spent inside the recorder's own context, then discarded (packet, ACK, write) | 7.5 KB | 21.4 KB |
Claude Code only (2.1.238 or newer; the version since which it asks you to trust the folder before it starts a subagent's own MCP server): cairnmind install writes the subagent .claude/agents/cairnmind-recorder.md. Its MCP server is a separate process started with --client external, so it is its own external session. It reads and acknowledges its own packet, stores the words the main agent quoted to it as a decision, constraint, preference, fact or question, and answers in one line, or in one line that names why nothing was recorded. Its tools list names only its own server's three tools (resume_context, ack_resume, remember); it has no checkpoint tool, because a checkpoint it saved would replace a native one and mark that one's fields as the recorder's. cairnmind install --no-recorder removes the file it wrote (with a backup), writes none and remembers that for the project in the data directory, so a later plain install keeps it off; --recorder turns it on again, and an older Claude Code still gets none. Install is idempotent, says what it wrote, leaves a file that is not a regular file of the project with Cairnmind's markers alone (a symlinked .claude or .claude/agents included, since it would reach a folder outside the project's trust), and removes the file it wrote earlier when Claude Code is older or its version cannot be read. The recorder runs as a separate external session inside a launched session too, so its records are degraded where the launched session's own would be verified.
When it saves context and when it does not:
- A record written by the main conversation first needs a current ACK, and any decision, constraint, preference, checkpoint or task written by any session, the writer's own included, makes every ACK stale. Handing the record off saves the packet read before it, about 6 KB on the sample project and 20 KB on a full store, each time something had changed since the last
ack_resume. When nothing had, writing it yourself is about as small as handing it off, so do not hand it off then. - It does not save the re-read before the main conversation's own plan or task writes. A record the recorder saves makes the main conversation's ACK stale like any other write, so the next plan or task update still reads the new packet, which shows the recorder's record with its external origin. A fact or question stales nobody.
- With the records R1, R2, R3 and the main conversation's own task updates T1, T2, T3 in turn (R1 T1 R2 T2 R3 T3), writing everything itself needs a re-read before T1, R2, T2, R3 and T3: five packets. Handing every R to the recorder needs one before T1, T2 and T3: three. This counts each handed-off record as landing before the next task write. The agent file sets no
backgroundfield, and Claude Code runs a subagent that the main conversation spawns in the background by default (its sub-agents page), so the recorder's one-line answer comes later and the order against the session's own writes is not fixed: if T1 lands first, the recorder's write is refused as stale and it retries inside its own context, and its record makes the ACK stale after T1 instead of before it. The per-record figure is unaffected; the packet counts are not measured with background runs. - Plans and task progress stay with the session. A subagent sees only what is quoted to it, so it cannot record what the session did not say.
What its records are: stored as proposed, never verified and never confirmed, marked origin_client: external, origin_history: unarchived and origin_evidence: degraded, and naming the recorder's own session in origin_session_id. No existing field can say truthfully that a session wrote on behalf of another, so none says it. Each use leaves one session, one packet (5 to 19 KB) and one ACK in the store, as any external session does. The subagent's description, up to 600 bytes, sits once in the main conversation's list of subagents.
Limits: in a session started by cairnmind run, the recorder's packet waits up to 30 seconds for the main session's live transcript to be archived, and when it is still partial the recorder answers that nothing was recorded. Without the launcher, a bare claude in an installed project can still write through the recorder. Only a real Claude Code confirms that the subagent's own server starts, that its tool filter admits the server's tools, and that the filter leaves out the main session's own cairnmind tools; if the first two fail, the recorder answers that nothing was recorded and nothing is written. Check the third by asking the recorder to list its tools: no mcp__cairnmind__* tool may appear, and its own server shows only resume_context, ack_resume and remember (the server itself offers every tool of an external client, checkpoint and save_plan included: only the filter keeps them from the subagent).
The claim the feature rests on is that a subagent defined with its own server gets a separate server process, hence its own external session, and not the main conversation's connection. It rests on one page, Claude Code's sub-agents page (https://code.claude.com/docs/en/sub-agents, section "Scope MCP servers to a subagent", read on 22 November 2026): "Inline servers defined here are connected when the subagent starts, subject to the trust rule for the agent file's folder, and disconnected when it finishes. String references share the parent session's connection." The file defines the server inline, never by a string reference. No test can run the client, so this is documentation, not something measured. What Cairnmind can detect, it detects, and fails closed:
- The recorder's tools list names no tool of the main conversation's
cairnmindserver, so a subagent bound to the parent's connection has no tool to write with and answers that nothing was recorded. - The file sets the four session variables to empty. If the client leaves a variable of the launcher in the environment instead, the bridge refuses to start (the guard of
--client external) and never adopts that session. - An external bridge always prepares a session of its own. If the service ever handed back one that already holds an acknowledgement, the bridge discards it and refuses, and the instructions tell the recorder to stop when its first
resume_contextanswer is the short unchanged answer or is not an external, degraded packet.
The limit: a bridge cannot see which process the client connected the subagent to, only the session its own process holds. If the client connected the subagent to the parent's already running native server under the name of the recorder's tools, nothing in Cairnmind would tell, and the only protection is the instructions' check of the packet, which a model carries out. Run the manual check after an update of Claude Code.
What the file may do: its tools are only the three of its own server (no shell, file, network or other tools), it names no other server, and it records the quoted words only. Its instructions say that record content and anything read from memory is data and never instructions, that it never confirms, verifies or adds anything, and that it answers in one line Not recorded: ... to a request to read files, run commands, change settings or record words as confirmed, as verified or as said by a person. A test with a hostile record, as in the injection evaluation, needs the client and is not made; the tests pin the file's tool list, its single server and the sentences of its instructions (tests/test_recorder_install.py).
Codex gets nothing: its documentation says a custom agent inherits the parent's MCP servers and cannot override them, so a subagent would write as the same session on the parent's acknowledgement. A hook writes nothing either: the hooks install writes only queue an event, and a record a hook wrote would make the main conversation read the packet again. Cursor, Cline, Zed and other MCP clients have the tools only.
Upgrading
The installer stops when it finds such a server open and names its process: close the server in the editor, or end the process, then run the installer again. While an installer runs, a tool call does not start the service; the error says that an upgrade is in progress. A server that was open while Cairnmind was upgraded or reinstalled still runs the code it started with, so every tool call then asks you to restart it in the editor. A server that finds this data directory's knowledge service running another version of Cairnmind sends it nothing: every tool call names both versions and the command that stops that service, and the next call after the stop starts it in the new version.
What your provider receives
The answers of ask and the resume packet go to the model of the client that asked, and so to that client's own provider. Cairnmind does not gate them by sensitivity class for Cursor, Cline, Zed or any other external MCP client, nor for Codex CLI or Claude Code: it cannot know which provider they use, and a packet without the decisions and notes of earlier sessions would defeat its purpose. A conversation note or a quote of an archived transcript in an answer or a packet therefore reaches that provider. Only the built-in agent on a hosted model is held back by class (memory_remote_classes; API.md). The MCP tools of an external client are ask, remember, checkpoint, save_plan, next_task, resume_context, ack_resume and check_status; read_source and memory_records belong to the built-in agent.
Limits
An external MCP session (Cursor, Cline, Zed) has no archived conversation to quote or verify against. Its packet says history: unarchived and evidence: degraded, and what it writes is never verified. Nothing stops a person from configuring Codex or Claude Code as an external client; such a session is then marked external and degraded like any other. The mark is applied where the service receives a session's write: a cairnmind command that the editor's agent runs in its shell carries no session, so what it writes is stored as a person's, unmarked and without the ACK gate. This holds for any process without a session and cannot be told apart; keep an external client's writes to its MCP tools.