How the per-session system prompt is delivered, redundantly, across six different channels.
The Computer Use Server delivers the same per-session system prompt through six channels. All six render from the same source (computer-use-server/system_prompt.py::render_system_prompt) with a shared 60-second in-process cache, so fan-out cost is one render per (chat_id, user_email) per minute.Redundancy is the point. A client might strip InitializeResult.instructions and never call resources/list — but it will always call tools/list, and the tool descriptions nudge the model toward /home/assistant/README.md inside the sandbox. That file is always present.Why not @mcp.prompt("system")? MCP prompts/* is user-controlled (slash-commands the user explicitly picks) and PromptMessage.role is restricted to {user, assistant} — naming a prompt "system" both clashes with the spec and duplicates InitializeResult.instructions, which is the canonical field.
If you’ve lost track of your environment (chat_id, file URLs, available skills), re-read /home/assistant/README.md.
Deliberately not “read this first” — Tiers 3/4 already identify the content as README.md, so if the client surfaced it, the model already has it. This line is a recovery hint, not a forcing function.
When docker_manager._create_container spins up a chat’s workspace, it calls render_system_prompt_sync(chat_id, user_email) and writes the result to /home/assistant/README.md via container.put_archive. Survives container removals because it lives in the chat’s persistent workspace volume.Does not enumerate uploaded files — that’s Tier 5 on every upload. README is static-per-container and changes only when user_email changes.
FastMCP constructor kwarg. A one-liner pointing at Tiers 2 and 5 so a client that only renders InitializeResult.instructions still learns where the per-session content lives.
Same instructions field, but per-request. Relies on:
streamable_http_manager._handle_stateless_request calls self.app.create_initialization_options() inside a per-request task (we run stateless_http=True).
lowlevel/server.py reads self.instructions at that moment.
session.py echoes into InitializeResult.instructions.
MCPContextMiddleware pre-renders the prompt and stores it in current_instructions: ContextVar[str]. _DynamicInstructionsServer subclasses mcp.server.lowlevel.Server with a @property returning the ContextVar. After FastMCP() constructs the lowlevel server, we swap the class on the instance — no reconstruction.
Stateful mode would break this (long-lived sessions cache init_options at construction). Do not flip stateless_http=False without re-reading the SDK source.
Private-API caveat.mcp._mcp_server and _resource_manager._resources are touched. Pin mcp narrowly in requirements.txt — a minor bump requires re-verifying attribute shapes.
resources/list returns a FunctionResource per file with URI file://uploads/{chat_id}/{encoded-rel-path}. resources/read fetches content — text for text/* and a short MIME allowlist, base64 blob otherwise.chat_id is in the URI because Agents SDK / Inspector don’t re-send X-Chat-Id on per-resource calls. URL-encoding: FastMCP’s ResourceTemplate.matches uses [^/]+ per template param — blocks nested paths. Flattening via urllib.parse.quote sidesteps it without forking the SDK.Dynamic registration: sync_chat_resources(chat_id) clears previous entries for that chat, re-adds from current filesystem state, under an asyncio.Lock. Called from container create + POST /api/uploads/{chat_id}/{filename}. Upload itself stays on HTTP — MCP has no upload primitive.
Response header X-Public-Base-URL is emitted so the filter’s outlet() can build browser-facing archive/preview URLs from the server-owned PUBLIC_BASE_URL.
render_system_prompt(chat_id, user_email) is cache-backed with a 60-second TTL (_RENDER_TTL_SECONDS). Matches skill_manager’s memory-cache TTL. Middleware renders on every MCP request to pre-fill the ContextVar for Tier 4, so the cache is load-bearing — without it, every tools/call would re-hit the skills provider. Second request for the same (chat_id, user_email) = dict lookup.Invalidation: invalidate_render_cache() — no arg clears all; chat_id arg clears that chat. Used in tests; callable when skills change upstream.
Filter inlet() fetches Tier 6, injects into body["messages"] → model sees it once.
Tier 4 InitializeResult.instructions is returned on initialize — LiteLLM is a tool-call proxy and does NOT forward instructions to the LLM. Tier 4 doesn’t reach the model here.
Tier 2 README sits in the container; model only reads it if it actively calls view.
The only real duplication source is the Tier 1 recovery-nudge: a model that follows it adds a second copy of ~3–5K tokens.
Total: up to 2 copies.
Agents SDK / MCP Inspector / Claude Desktop (MCP-native scenario)
No Open WebUI filter.
Integrator surfaces Tier 4 via server.server_initialize_result.instructions (Agents SDK) or Claude Desktop auto-applies it → model sees prompt once.
Tier 1 nudge: up to second copy if honored.
Total: up to 2 copies.
Why keep the nudge. Without it, a client that strips the system prompt leaves the model in a sandbox with zero context. The cost is paid only when the model needs it (context thins out, hint gets re-attended).
{"docsConfig":{"theme":"mint","$schema":"https://mintlify.com/docs.json","name":"Yambr","colors":{"primary":"#65A30D","light":"#A3E635","dark":"#3F6212"},"logo":{"light":"https://mintcdn.com/yambr/b_GH1xc1e1O0xxjD/logo/yambr.png?fit=max\u0026auto=format\u0026n=b_GH1xc1e1O0xxjD\u0026q=85\u0026s=86eaec0a14414049dfb9a1068cd73bcd","dark":"https://mintcdn.com/yambr/b_GH1xc1e1O0xxjD/logo/yambr.png?fit=max\u0026auto=format\u0026n=b_GH1xc1e1O0xxjD\u0026q=85\u0026s=86eaec0a14414049dfb9a1068cd73bcd"},"favicon":"https://mintcdn.com/yambr/b_GH1xc1e1O0xxjD/favicon.png?fit=max\u0026auto=format\u0026n=b_GH1xc1e1O0xxjD\u0026q=85\u0026s=8212a5dc1f6ddce62a776b01959c2a29","navbar":{"links":[{"href":"https://github.com/Yambr/open-computer-use","label":"GitHub"},{"href":"https://t.me/yambrcom","label":"Telegram"}],"primary":{"type":"button","label":"Dashboard","href":"https://app.yambr.com/"}},"footer":{"socials":{"github":"https://github.com/Yambr/open-computer-use","telegram":"https://t.me/yambrcom"}},"seo":{"metatags":{"og:image":"https://yambr.com/og-image.svg","og:site_name":"Yambr Docs","twitter:card":"summary_large_image","twitter:image":"https://yambr.com/og-image.svg"}},"styling":{"latex":true},"navigation":{"global":{"anchors":[{"anchor":"Try on chat.yambr.com","icon":"comments","href":"https://chat.yambr.com/"},{"anchor":"Get API key","icon":"key","href":"https://app.yambr.com/"},{"anchor":"GitHub","icon":"github","href":"https://github.com/Yambr/open-computer-use"},{"anchor":"Telegram","icon":"telegram","href":"https://t.me/yambrcom"}]},"pages":[]}},"deployment":{"deploymentMetadataValue":{"subdomain":"yambr","hasAudioNarration":false,"actualSubdomain":"yambr","customDomains":["docs.yambr.com"],"gitSource":{"type":"github","owner":"yambr","repo":"docs","deployBranch":"main","isPrivate":false,"contentDirectory":"","mountPath":"","label":""},"chroma":{"liveDeploymentHistoryId":"6a21dd7a29c7042dd5f5eeb7","collectionId":"fe7c0671-4c95-40b6-b349-8d4464c33b14","schemaVersion":"v2"},"feedback":{"thumbs":true,"edits":true,"issues":true},"entitlements":{"AI_CHAT":{"status":"DISABLED"}},"buildId":"6a21dd7a29c7042dd5f5eeb7:success","clientVersion":"0.0.3966","searchFilterCounts":[{"language":"default","tag":"Guides","count":47},{"language":"default","tag":"Demo course","count":10},{"language":"default","tag":"Yambr Platform","count":7},{"language":"default","tag":"API reference","count":6},{"language":"default","tag":"Integrations","count":6},{"language":"default","tag":"Features","count":5},{"language":"default","tag":"Self-hosting","count":5},{"language":"default","tag":"Reference","count":5},{"language":"default","tag":"Skills","count":5},{"language":"default","tag":"MCP methods","count":4}]},"assistantConfig":{"enableAskAiButton":false,"enableStarterQuestions":false,"enableContextualStarterQuestions":false,"enableAskAiSearchBar":true},"hasChatPermissions":false,"hasWebMcpPermissions":false,"toggles":[{"name":"kill-isr","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"agent-mintlify-slack","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"editor-v7-file-tree","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"agent-integrations-settings","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automations-pr-grouping","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"custom-prefix","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"analytics-v7","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"user-flows-analytics","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"no-publish-flow","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-onboarding","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"llms-txt-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"pause-universal-search-reconcile","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"snapshot-serving-live","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"stripTemperatureMiddleware","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"per-site-search-delta","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"support-platform-pylon-zendesk","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"snapshot-serving","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"instant-rollback","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"granular-notifications-server","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"granular-notifications","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"editor-private-page-search","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automations-fable","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"fixed-ai-action-pricing","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automation-resolve-merge-conflict","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"scoped-publishing","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"mintql","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"page-level-analytics","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"editor-version-history-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"editor-nav-generations","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"billing-page-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workspace-projects","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"assistant-v5","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"byok-sep-25","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"fork-pr-previews","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"revalidation-jwt","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"vite-origin","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"editor-agent-model-picker","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"billing-updated-9-15","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"hobby-abuse-scan","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"dashboard-inbox","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false}],"isAtlas":false,"googleFontsInlined":false},"customCss":[],"page":{"pagePath":"reference/system-prompt","slug":"/reference/system-prompt","pageMetadata":{"title":"System prompt — six MCP-native tiers","description":"How the per-session system prompt is delivered, redundantly, across six different channels.","href":"/reference/system-prompt"},"description":{"compiledSource":"\"use strict\";\nconst {jsx: _jsx} = arguments[0];\nconst {useMDXComponents: _provideComponents} = arguments[0];\nfunction _createMdxContent(props) {\n const _components = {\n p: \"p\",\n ..._provideComponents(),\n ...props.components\n };\n return _jsx(_components.p, {\n children: \"How the per-session system prompt is delivered, redundantly, across six different channels.\"\n });\n}\nfunction MDXContent(props = {}) {\n const {wrapper: MDXLayout} = {\n ..._provideComponents(),\n ...props.components\n };\n return MDXLayout ? _jsx(MDXLayout, {\n ...props,\n children: _jsx(_createMdxContent, {\n ...props\n })\n }) : _createMdxContent(props);\n}\nreturn {\n default: MDXContent\n};\n","frontmatter":{},"scope":{}},"pageType":"default","mdx":{"mdxSource":{"compiledSource":"\"use strict\";const{Fragment:_Fragment,jsx:_jsx,jsxs:_jsxs}=arguments[0];const{useMDXComponents:_provideComponents}=arguments[0];function _createMdxContent(props){const _components={a:`a`,blockquote:`blockquote`,code:`code`,li:`li`,ol:`ol`,p:`p`,pre:`pre`,span:`span`,strong:`strong`,tbody:`tbody`,td:`td`,th:`th`,thead:`thead`,tr:`tr`,ul:`ul`,..._provideComponents(),...props.components},{CodeBlock,Heading,Table,Warning}=_components;if(!CodeBlock)_missingMdxReference(`CodeBlock`,true);if(!Heading)_missingMdxReference(`Heading`,true);if(!Table)_missingMdxReference(`Table`,true);if(!Warning)_missingMdxReference(`Warning`,true);return _jsxs(_Fragment,{children:[_jsxs(_components.p,{children:[`The Computer Use Server delivers the same per-session system prompt through `,_jsx(_components.strong,{children:`six channels`}),`. All six render from the same source (`,_jsx(_components.code,{children:`computer-use-server/system_prompt.py::render_system_prompt`}),`) with a shared 60-second in-process cache, so fan-out cost is one render per `,_jsx(_components.code,{children:`(chat_id, user_email)`}),` per minute.`]}),`\n`,_jsxs(_components.p,{children:[_jsx(_components.strong,{children:`Redundancy is the point.`}),` A client might strip `,_jsx(_components.code,{children:`InitializeResult.instructions`}),` and never call `,_jsx(_components.code,{children:`resources/list`}),` — but it will always call `,_jsx(_components.code,{children:`tools/list`}),`, and the tool descriptions nudge the model toward `,_jsx(_components.code,{children:`/home/assistant/README.md`}),` inside the sandbox. That file is always present.`]}),`\n`,_jsxs(_components.p,{children:[_jsxs(_components.strong,{children:[`Why not `,_jsx(_components.code,{children:`@mcp.prompt(\"system\")`}),`?`]}),` MCP `,_jsx(_components.code,{children:`prompts/*`}),` is user-controlled (slash-commands the user explicitly picks) and `,_jsx(_components.code,{children:`PromptMessage.role`}),` is restricted to `,_jsx(_components.code,{children:`{user, assistant}`}),` — naming a prompt `,_jsx(_components.code,{children:`\"system\"`}),` both clashes with the spec and duplicates `,_jsx(_components.code,{children:`InitializeResult.instructions`}),`, which is the canonical field.`]}),`\n`,_jsx(Heading,{level:`2`,id:`the-tiers`,children:`The tiers`}),`\n`,_jsxs(Table,{children:[_jsx(_components.thead,{children:_jsxs(_components.tr,{children:[_jsx(_components.th,{children:`#`}),_jsx(_components.th,{children:`Surface`}),_jsx(_components.th,{children:`Where it lives`}),_jsx(_components.th,{children:`Who uses it`})]})}),_jsxs(_components.tbody,{children:[_jsxs(_components.tr,{children:[_jsx(_components.td,{\"data-numeric\":`true`,children:`1`}),_jsx(_components.td,{children:`Tool descriptions`}),_jsxs(_components.td,{children:[_jsx(_components.code,{children:`tools/list`}),` — `,_jsx(_components.code,{children:`bash_tool`}),` + `,_jsx(_components.code,{children:`view`}),` docstrings mention `,_jsx(_components.code,{children:`README.md`})]}),_jsx(_components.td,{children:`Every MCP client`})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{\"data-numeric\":`true`,children:`2`}),_jsx(_components.td,{children:_jsx(_components.code,{children:`/home/assistant/README.md`})}),_jsxs(_components.td,{children:[`Rendered into the sandbox on container create via `,_jsx(_components.code,{children:`put_archive`})]}),_jsxs(_components.td,{children:[`Any model that runs `,_jsx(_components.code,{children:`view`})]})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{\"data-numeric\":`true`,children:`3`}),_jsxs(_components.td,{children:[`Static `,_jsx(_components.code,{children:`instructions=`})]}),_jsxs(_components.td,{children:[`FastMCP constructor — one-line pointer to `,_jsx(_components.code,{children:`README`}),` + `,_jsx(_components.code,{children:`resources/list`})]}),_jsxs(_components.td,{children:[`Claude Desktop, MCP Inspector; Agents SDK via `,_jsx(_components.code,{children:`server.server_initialize_result`})]})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{\"data-numeric\":`true`,children:`4`}),_jsxs(_components.td,{children:[`Dynamic `,_jsx(_components.code,{children:`InitializeResult.instructions`})]}),_jsxs(_components.td,{children:[`Per-request ContextVar swapped onto `,_jsx(_components.code,{children:`mcp._mcp_server`}),` as a `,_jsx(_components.code,{children:`@property`})]}),_jsx(_components.td,{children:`Same clients as #3, with chat-specific content`})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{\"data-numeric\":`true`,children:`5`}),_jsxs(_components.td,{children:[_jsx(_components.code,{children:`resources/list`}),` + `,_jsx(_components.code,{children:`resources/read`})]}),_jsxs(_components.td,{children:[`Uploaded files as `,_jsx(_components.code,{children:`FunctionResource`}),` per chat, URI `,_jsx(_components.code,{children:`file://uploads/{chat_id}/{encoded-rel-path}`})]}),_jsx(_components.td,{children:`Agents SDK, Inspector, Claude Desktop`})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{\"data-numeric\":`true`,children:`6`}),_jsxs(_components.td,{children:[_jsx(_components.code,{children:`GET /system-prompt`}),` HTTP`]}),_jsx(_components.td,{children:`Backward-compat endpoint with header > query priority`}),_jsx(_components.td,{children:`Open WebUI filter; external integrations (n8n)`})]})]})]}),`\n`,_jsx(Heading,{level:`2`,id:`tier-1-—-tool-description-nudges`,children:`Tier 1 — tool description nudges`}),`\n`,_jsxs(_components.p,{children:[`Docstrings of `,_jsx(_components.code,{children:`bash_tool`}),` and `,_jsx(_components.code,{children:`view`}),` end with:`]}),`\n`,_jsxs(_components.blockquote,{children:[`\n`,_jsxs(_components.p,{children:[`If you’ve lost track of your environment (chat_id, file URLs, available skills), re-read `,_jsx(_components.code,{children:`/home/assistant/README.md`}),`.`]}),`\n`]}),`\n`,_jsxs(_components.p,{children:[`Deliberately `,_jsx(_components.strong,{children:`not`}),` “read this first” — Tiers 3/4 already identify the content as `,_jsx(_components.code,{children:`README.md`}),`, so if the client surfaced it, the model already has it. This line is a `,_jsx(_components.strong,{children:`recovery hint`}),`, not a forcing function.`]}),`\n`,_jsx(Heading,{level:`2`,id:`tier-2-—-readme-md-in-the-sandbox`,children:`Tier 2 — README.md in the sandbox`}),`\n`,_jsxs(_components.p,{children:[`When `,_jsx(_components.code,{children:`docker_manager._create_container`}),` spins up a chat’s workspace, it calls `,_jsx(_components.code,{children:`render_system_prompt_sync(chat_id, user_email)`}),` and writes the result to `,_jsx(_components.code,{children:`/home/assistant/README.md`}),` via `,_jsx(_components.code,{children:`container.put_archive`}),`. Survives container removals because it lives in the chat’s persistent workspace volume.`]}),`\n`,_jsxs(_components.p,{children:[`Does `,_jsx(_components.strong,{children:`not`}),` enumerate uploaded files — that’s Tier 5 on every upload. README is static-per-container and changes only when `,_jsx(_components.code,{children:`user_email`}),` changes.`]}),`\n`,_jsxs(Heading,{level:`2`,id:`tier-3-—-static-instructions=`,children:[`Tier 3 — static `,_jsx(_components.code,{children:`instructions=`})]}),`\n`,_jsxs(_components.p,{children:[`FastMCP constructor kwarg. A one-liner pointing at Tiers 2 and 5 so a client that only renders `,_jsx(_components.code,{children:`InitializeResult.instructions`}),` still learns where the per-session content lives.`]}),`\n`,_jsxs(Heading,{level:`2`,id:`tier-4-—-dynamic-initializeresult-instructions`,children:[`Tier 4 — dynamic `,_jsx(_components.code,{children:`InitializeResult.instructions`})]}),`\n`,_jsxs(_components.p,{children:[`Same `,_jsx(_components.code,{children:`instructions`}),` field, but `,_jsx(_components.strong,{children:`per-request`}),`. Relies on:`]}),`\n`,_jsxs(_components.ol,{children:[`\n`,_jsxs(_components.li,{children:[_jsx(_components.code,{children:`streamable_http_manager._handle_stateless_request`}),` calls `,_jsx(_components.code,{children:`self.app.create_initialization_options()`}),` inside a per-request task (we run `,_jsx(_components.code,{children:`stateless_http=True`}),`).`]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.code,{children:`lowlevel/server.py`}),` reads `,_jsx(_components.code,{children:`self.instructions`}),` at that moment.`]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.code,{children:`session.py`}),` echoes into `,_jsx(_components.code,{children:`InitializeResult.instructions`}),`.`]}),`\n`]}),`\n`,_jsxs(_components.p,{children:[_jsx(_components.code,{children:`MCPContextMiddleware`}),` pre-renders the prompt and stores it in `,_jsx(_components.code,{children:`current_instructions: ContextVar[str]`}),`. `,_jsx(_components.code,{children:`_DynamicInstructionsServer`}),` subclasses `,_jsx(_components.code,{children:`mcp.server.lowlevel.Server`}),` with a `,_jsx(_components.code,{children:`@property`}),` returning the ContextVar. After `,_jsx(_components.code,{children:`FastMCP()`}),` constructs the lowlevel server, we swap the class on the instance — no reconstruction.`]}),`\n`,_jsx(Warning,{children:_jsxs(_components.p,{children:[`Stateful mode would break this (long-lived sessions cache `,_jsx(_components.code,{children:`init_options`}),` at construction). Do `,_jsx(_components.strong,{children:`not`}),` flip `,_jsx(_components.code,{children:`stateless_http=False`}),` without re-reading the SDK source.`]})}),`\n`,_jsxs(_components.p,{children:[_jsx(_components.strong,{children:`Private-API caveat.`}),` `,_jsx(_components.code,{children:`mcp._mcp_server`}),` and `,_jsx(_components.code,{children:`_resource_manager._resources`}),` are touched. Pin `,_jsx(_components.code,{children:`mcp`}),` narrowly in `,_jsx(_components.code,{children:`requirements.txt`}),` — a minor bump requires re-verifying attribute shapes.`]}),`\n`,_jsx(Heading,{level:`2`,id:`tier-5-—-uploaded-files-as-mcp-resources`,children:`Tier 5 — uploaded files as MCP resources`}),`\n`,_jsxs(_components.p,{children:[_jsx(_components.code,{children:`resources/list`}),` returns a `,_jsx(_components.code,{children:`FunctionResource`}),` per file with URI `,_jsx(_components.code,{children:`file://uploads/{chat_id}/{encoded-rel-path}`}),`. `,_jsx(_components.code,{children:`resources/read`}),` fetches content — text for `,_jsx(_components.code,{children:`text/*`}),` and a short MIME allowlist, base64 blob otherwise.`]}),`\n`,_jsxs(_components.p,{children:[_jsx(_components.code,{children:`chat_id`}),` is in the URI because Agents SDK / Inspector don’t re-send `,_jsx(_components.code,{children:`X-Chat-Id`}),` on per-resource calls. URL-encoding: FastMCP’s `,_jsx(_components.code,{children:`ResourceTemplate.matches`}),` uses `,_jsx(_components.code,{children:`[^/]+`}),` per template param — blocks nested paths. Flattening via `,_jsx(_components.code,{children:`urllib.parse.quote`}),` sidesteps it without forking the SDK.`]}),`\n`,_jsxs(_components.p,{children:[`Dynamic registration: `,_jsx(_components.code,{children:`sync_chat_resources(chat_id)`}),` clears previous entries for that chat, re-adds from current filesystem state, under an `,_jsx(_components.code,{children:`asyncio.Lock`}),`. Called from container create + `,_jsx(_components.code,{children:`POST /api/uploads/{chat_id}/{filename}`}),`. Upload itself stays on HTTP — MCP has no upload primitive.`]}),`\n`,_jsxs(Heading,{level:`2`,id:`tier-6-—-http-/system-prompt`,children:[`Tier 6 — HTTP `,_jsx(_components.code,{children:`/system-prompt`})]}),`\n`,_jsx(_components.p,{children:`Kept for the Open WebUI filter which fetches the prompt server-side and injects it into the LLM’s system message. Priority:`}),`\n`,_jsx(CodeBlock,{numberOfLines:`3`,language:`text`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`text`,children:_jsxs(_components.code,{language:`text`,numberOfLines:`3`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`X-Chat-Id | X-OpenWebUI-Chat-Id > ?chat_id= > \"default\"`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`X-User-Email | X-OpenWebUI-User-Email > ?user_email= > None`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{})})]})})}),`\n`,_jsxs(_components.p,{children:[`Response header `,_jsx(_components.code,{children:`X-Public-Base-URL`}),` is emitted so the filter’s `,_jsx(_components.code,{children:`outlet()`}),` can build browser-facing archive/preview URLs from the server-owned `,_jsx(_components.code,{children:`PUBLIC_BASE_URL`}),`.`]}),`\n`,_jsx(Heading,{level:`2`,id:`render-cache`,children:`Render cache`}),`\n`,_jsxs(_components.p,{children:[_jsx(_components.code,{children:`render_system_prompt(chat_id, user_email)`}),` is cache-backed with a 60-second TTL (`,_jsx(_components.code,{children:`_RENDER_TTL_SECONDS`}),`). Matches `,_jsx(_components.code,{children:`skill_manager`}),`’s memory-cache TTL. Middleware renders on `,_jsx(_components.strong,{children:`every`}),` MCP request to pre-fill the ContextVar for Tier 4, so the cache is load-bearing — without it, every `,_jsx(_components.code,{children:`tools/call`}),` would re-hit the skills provider. Second request for the same `,_jsx(_components.code,{children:`(chat_id, user_email)`}),` = dict lookup.`]}),`\n`,_jsxs(_components.p,{children:[`Invalidation: `,_jsx(_components.code,{children:`invalidate_render_cache()`}),` — no arg clears all; `,_jsx(_components.code,{children:`chat_id`}),` arg clears that chat. Used in tests; callable when skills change upstream.`]}),`\n`,_jsx(Heading,{level:`2`,id:`duplication-analysis`,children:`Duplication analysis`}),`\n`,_jsx(_components.p,{children:_jsx(_components.strong,{children:`Open WebUI via LiteLLM (main scenario)`})}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsxs(_components.li,{children:[`Filter `,_jsx(_components.code,{children:`inlet()`}),` fetches Tier 6, injects into `,_jsx(_components.code,{children:`body[\"messages\"]`}),` → model sees it `,_jsx(_components.strong,{children:`once`}),`.`]}),`\n`,_jsxs(_components.li,{children:[`Tier 4 `,_jsx(_components.code,{children:`InitializeResult.instructions`}),` is returned on `,_jsx(_components.code,{children:`initialize`}),` — LiteLLM is a tool-call proxy and does NOT forward `,_jsx(_components.code,{children:`instructions`}),` to the LLM. Tier 4 doesn’t reach the model here.`]}),`\n`,_jsxs(_components.li,{children:[`Tier 2 README sits in the container; model only reads it if it actively calls `,_jsx(_components.code,{children:`view`}),`.`]}),`\n`,_jsxs(_components.li,{children:[`The only real duplication source is the Tier 1 recovery-nudge: a model that follows it adds a `,_jsx(_components.strong,{children:`second copy`}),` of ~3–5K tokens.`]}),`\n`,_jsx(_components.li,{children:_jsx(_components.strong,{children:`Total: up to 2 copies.`})}),`\n`]}),`\n`,_jsx(_components.p,{children:_jsx(_components.strong,{children:`Agents SDK / MCP Inspector / Claude Desktop (MCP-native scenario)`})}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsx(_components.li,{children:`No Open WebUI filter.`}),`\n`,_jsxs(_components.li,{children:[`Integrator surfaces Tier 4 via `,_jsx(_components.code,{children:`server.server_initialize_result.instructions`}),` (Agents SDK) or Claude Desktop auto-applies it → model sees prompt `,_jsx(_components.strong,{children:`once`}),`.`]}),`\n`,_jsxs(_components.li,{children:[`Tier 1 nudge: up to `,_jsx(_components.strong,{children:`second copy`}),` if honored.`]}),`\n`,_jsx(_components.li,{children:_jsx(_components.strong,{children:`Total: up to 2 copies.`})}),`\n`]}),`\n`,_jsxs(_components.p,{children:[_jsx(_components.strong,{children:`Why keep the nudge.`}),` Without it, a client that strips the system prompt leaves the model in a sandbox with zero context. The cost is paid only when the model needs it (context thins out, hint gets re-attended).`]}),`\n`,_jsx(Heading,{level:`2`,id:`see-also`,children:`See also`}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsx(_components.li,{children:_jsx(_components.a,{href:`/api-reference/introduction`,children:`MCP API reference`})}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.a,{href:`/integrations/open-webui-filter`,children:`Open WebUI filter`}),` — how Tier 6 is consumed`]}),`\n`]})]})}function MDXContent(props={}){const{wrapper:MDXLayout}={..._provideComponents(),...props.components};return MDXLayout?_jsx(MDXLayout,{...props,children:_jsx(_createMdxContent,{...props})}):_createMdxContent(props)}return{default:MDXContent};function _missingMdxReference(id,component){throw new Error(`Expected `+(component?`component`:`object`)+\" `\"+id+\"` to be defined: you likely forgot to import, pass, or provide it.\")}","frontmatter":{},"scope":{"config":{},"pageMetadata":{"title":"System prompt — six MCP-native tiers","description":"How the per-session system prompt is delivered, redundantly, across six different channels.","href":"/reference/system-prompt"}}},"mdxSourceWithNoJs":null},"mdxExtracts":{"tableOfContents":[{"title":"The tiers","slug":"the-tiers","depth":2,"children":[]},{"title":"Tier 1 — tool description nudges","slug":"tier-1-—-tool-description-nudges","depth":2,"children":[]},{"title":"Tier 2 — README.md in the sandbox","slug":"tier-2-—-readme-md-in-the-sandbox","depth":2,"children":[]},{"title":"Tier 3 — static instructions=","slug":"tier-3-—-static-instructions=","depth":2,"children":[]},{"title":"Tier 4 — dynamic InitializeResult.instructions","slug":"tier-4-—-dynamic-initializeresult-instructions","depth":2,"children":[]},{"title":"Tier 5 — uploaded files as MCP resources","slug":"tier-5-—-uploaded-files-as-mcp-resources","depth":2,"children":[]},{"title":"Tier 6 — HTTP /system-prompt","slug":"tier-6-—-http-/system-prompt","depth":2,"children":[]},{"title":"Render cache","slug":"render-cache","depth":2,"children":[]},{"title":"Duplication analysis","slug":"duplication-analysis","depth":2,"children":[]},{"title":"See also","slug":"see-also","depth":2,"children":[]}],"codeExamples":{}},"jsLinks":[],"subdomain":"yambr","siteName":"Yambr","title":"System prompt — six MCP-native tiers - Yambr","navMaps":{"firstHrefInVersion":{},"firstHrefInLanguage":{}},"lastModified":"2026-04-19T15:59:30.863Z","originalFileLocation":"reference/system-prompt.mdx"},"headHtml":"\u003cscript data-mint-head>(function(){var d=document.documentElement,p=null;if(!p){try{p=localStorage.getItem(\"isDarkMode\")}catch(e){}if(p==='true')p='dark';else if(p==='false')p='light';if(p!=='light'\u0026\u0026p!=='dark'\u0026\u0026p!=='system')p=\"system\"}var r=p==='system'?(matchMedia(\"(prefers-color-scheme: dark)\").matches?'dark':'light'):p;d.classList.remove(r==='dark'?'light':'dark');d.classList.add(r);d.setAttribute(\"data-theme-preference\",p)})();\u003c/script>\u003cmeta data-mint-head name=\"description\" content=\"How the per-session system prompt is delivered, redundantly, across six different channels.\">\u003cmeta data-mint-head name=\"application-name\" content=\"Yambr\">\u003cmeta data-mint-head name=\"generator\" content=\"Mintlify\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"192x192\" href=\"/mintlify-assets/_mintlify/favicons/yambr/c0eEsQsYs_9x07u-/_generated/favicon/android-chrome-192x192.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"apple-touch-icon\" type=\"image/png\" sizes=\"180x180\" href=\"/mintlify-assets/_mintlify/favicons/yambr/c0eEsQsYs_9x07u-/_generated/favicon/apple-touch-icon.png\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"16x16\" href=\"/mintlify-assets/_mintlify/favicons/yambr/c0eEsQsYs_9x07u-/_generated/favicon/favicon-16x16.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"32x32\" href=\"/mintlify-assets/_mintlify/favicons/yambr/c0eEsQsYs_9x07u-/_generated/favicon/favicon-32x32.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"shortcut icon\" type=\"image/x-icon\" href=\"/mintlify-assets/_mintlify/favicons/yambr/c0eEsQsYs_9x07u-/_generated/favicon/favicon.ico\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"192x192\" href=\"/mintlify-assets/_mintlify/favicons/yambr/c0eEsQsYs_9x07u-/_generated/favicon-dark/android-chrome-192x192.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"16x16\" href=\"/mintlify-assets/_mintlify/favicons/yambr/c0eEsQsYs_9x07u-/_generated/favicon-dark/favicon-16x16.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"32x32\" href=\"/mintlify-assets/_mintlify/favicons/yambr/c0eEsQsYs_9x07u-/_generated/favicon-dark/favicon-32x32.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"shortcut icon\" type=\"image/x-icon\" href=\"/mintlify-assets/_mintlify/favicons/yambr/c0eEsQsYs_9x07u-/_generated/favicon-dark/favicon.ico\" media=\"(prefers-color-scheme: dark)\">\u003cmeta data-mint-head property=\"og:title\" content=\"System prompt — six MCP-native tiers - Yambr\">\u003cmeta data-mint-head property=\"og:description\" content=\"How the per-session system prompt is delivered, redundantly, across six different channels.\">\u003cmeta data-mint-head property=\"og:site_name\" content=\"Yambr Docs\">\u003cmeta data-mint-head property=\"og:url\" content=\"https://docs.yambr.com/reference/system-prompt\">\u003cmeta data-mint-head property=\"og:type\" content=\"website\">\u003cmeta data-mint-head property=\"og:image\" content=\"https://yambr.com/og-image.svg\">\u003cmeta data-mint-head property=\"og:image:width\" content=\"1200\">\u003cmeta data-mint-head property=\"og:image:height\" content=\"630\">\u003cmeta data-mint-head name=\"twitter:card\" content=\"summary_large_image\">\u003cmeta data-mint-head name=\"twitter:title\" content=\"System prompt — six MCP-native tiers - Yambr\">\u003cmeta data-mint-head name=\"twitter:description\" content=\"How the per-session system prompt is delivered, redundantly, across six different channels.\">\u003cmeta data-mint-head name=\"twitter:image\" content=\"https://yambr.com/og-image.svg\">\u003cmeta data-mint-head name=\"twitter:image:width\" content=\"1200\">\u003cmeta data-mint-head name=\"twitter:image:height\" content=\"630\">\u003cmeta data-mint-head name=\"msapplication-config\" content=\"/mintlify-assets/_mintlify/favicons/yambr/c0eEsQsYs_9x07u-/_generated/favicon/browserconfig.xml\">\u003cmeta data-mint-head name=\"apple-mobile-web-app-title\" content=\"Yambr\">\u003cmeta data-mint-head name=\"msapplication-TileColor\" content=\"#65A30D\">\u003clink data-mint-head rel=\"canonical\" href=\"https://docs.yambr.com/reference/system-prompt\">\u003clink data-mint-head rel=\"alternate\" type=\"application/xml\" href=\"/sitemap.xml\">\u003clink data-mint-head rel=\"alternate\" type=\"text/markdown\" href=\"/reference/system-prompt.md\">\u003cscript data-mint-head type=\"application/ld+json\">{\"@context\":\"https://schema.org\",\"@graph\":[{\"@type\":\"Organization\",\"@id\":\"https://docs.yambr.com/#organization\",\"name\":\"Yambr\",\"url\":\"https://docs.yambr.com\",\"logo\":{\"@type\":\"ImageObject\",\"url\":\"https://mintcdn.com/yambr/b_GH1xc1e1O0xxjD/logo/yambr.png?fit=max\u0026auto=format\u0026n=b_GH1xc1e1O0xxjD\u0026q=85\u0026s=86eaec0a14414049dfb9a1068cd73bcd\"}},{\"@type\":\"WebSite\",\"@id\":\"https://docs.yambr.com#website\",\"name\":\"Yambr\",\"url\":\"https://docs.yambr.com\",\"publisher\":{\"@id\":\"https://docs.yambr.com/#organization\"}},{\"@type\":\"WebPage\",\"@id\":\"https://docs.yambr.com/reference/system-prompt#webpage\",\"url\":\"https://docs.yambr.com/reference/system-prompt\",\"name\":\"System prompt — six MCP-native tiers\",\"description\":\"How the per-session system prompt is delivered, redundantly, across six different channels.\",\"dateModified\":\"2026-04-19T15:59:30.863Z\",\"isPartOf\":{\"@id\":\"https://docs.yambr.com#website\"},\"breadcrumb\":{\"@id\":\"https://docs.yambr.com/reference/system-prompt#breadcrumb\"}},{\"@type\":\"BreadcrumbList\",\"@id\":\"https://docs.yambr.com/reference/system-prompt#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Reference\",\"item\":\"https://docs.yambr.com/reference/comparison\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"System prompt — six MCP-native tiers\",\"item\":\"https://docs.yambr.com/reference/system-prompt\"}]},{\"@type\":[\"Article\",\"TechArticle\"],\"@id\":\"https://docs.yambr.com/reference/system-prompt#article\",\"headline\":\"System prompt — six MCP-native tiers\",\"name\":\"System prompt — six MCP-native tiers\",\"description\":\"How the per-session system prompt is delivered, redundantly, across six different channels.\",\"url\":\"https://docs.yambr.com/reference/system-prompt\",\"mainEntityOfPage\":{\"@id\":\"https://docs.yambr.com/reference/system-prompt#webpage\"},\"image\":\"https://yambr.com/og-image.svg\",\"dateModified\":\"2026-04-19T15:59:30.863Z\",\"publisher\":{\"@id\":\"https://docs.yambr.com/#organization\"},\"isPartOf\":{\"@id\":\"https://docs.yambr.com#website\"}}]}\u003c/script>\u003cscript data-mint-head type=\"application/ld+json\">{\"@context\":\"https://schema.org\",\"@type\":\"WebSite\",\"name\":\"Yambr\",\"creator\":{\"@type\":\"Organization\",\"name\":\"Mintlify\",\"url\":\"https://mintlify.com\"}}\u003c/script>","siteName":"Yambr","nav":{"global":{"anchors":[{"anchor":"Try on chat.yambr.com","icon":"comments","href":"https://chat.yambr.com/"},{"anchor":"Get API key","icon":"key","href":"https://app.yambr.com/"},{"anchor":"GitHub","icon":"github","href":"https://github.com/Yambr/open-computer-use"},{"anchor":"Telegram","icon":"telegram","href":"https://t.me/yambrcom"}]},"tabs":[{"tab":"Guides","groups":[{"group":"Getting started","pages":[{"title":"Yambr Open Computer Use","href":""},{"title":"Quickstart","href":"/quickstart"},{"title":"Introduction","href":"/introduction"},{"title":"Architecture","href":"/architecture"}]},{"group":"Demo course","pages":[{"title":"Demo course","href":"/demo-course/overview"},{"title":"1. Investor pitch deck","href":"/demo-course/01-presentation"},{"title":"2. Project proposal (Word)","href":"/demo-course/02-document"},{"title":"3. Marketing budget tracker (Excel)","href":"/demo-course/03-spreadsheet"},{"title":"4. Freelance invoice (PDF)","href":"/demo-course/04-pdf"},{"title":"5. Data → chart","href":"/demo-course/05-data-chart"},{"title":"6. Roasthaus landing page","href":"/demo-course/06-frontend"},{"title":"7. Hacker News AI digest","href":"/demo-course/07-browser"},{"title":"8. Building the invoice-builder skill","href":"/demo-course/08-skill-creator"},{"title":"9. What's next","href":"/demo-course/09-whats-next"}]},{"group":"Yambr Platform","pages":[{"title":"Yambr Platform","href":"/platform/overview"},{"title":"Access model — MCP only","href":"/platform/access-model"},{"title":"Dashboard tour","href":"/platform/dashboard"},{"title":"API keys","href":"/platform/api-keys"},{"title":"LiteLLM gateway","href":"/platform/litellm"},{"title":"chat.yambr.com","href":"/platform/hosted-chat"},{"title":"cu.yambr.com","href":"/platform/cu-endpoint"}]},{"group":"Self-hosting","pages":[{"title":"Requirements","href":"/install/requirements"},{"title":"Self-host quickstart","href":"/install/quickstart"},{"title":"Configuration","href":"/install/configuration"},{"title":"Docker details","href":"/install/docker"},{"title":"Model settings","href":"/install/model-settings"}]},{"group":"Features","pages":[{"title":"Live browser","href":"/features/browser"},{"title":"Terminal tab","href":"/features/terminal"},{"title":"Code execution","href":"/features/code-execution"},{"title":"Sub-agents (Claude Code)","href":"/features/sub-agents"},{"title":"File preview","href":"/features/file-preview"}]},{"group":"Skills","pages":[{"title":"Skills overview","href":"/skills/overview"},{"title":"Skills user guide","href":"/skills/user-guide"},{"title":"Skills reference","href":"/skills/reference"},{"title":"Dynamic skills","href":"/skills/dynamic"},{"title":"Creating skills","href":"/skills/creating"}]},{"group":"Integrations","pages":[{"title":"Open WebUI","href":"/integrations/open-webui"},{"title":"Open WebUI filter","href":"/integrations/open-webui-filter"},{"title":"Claude Desktop","href":"/integrations/claude-desktop"},{"title":"LiteLLM","href":"/integrations/litellm"},{"title":"n8n","href":"/integrations/n8n"},{"title":"Custom MCP clients","href":"/integrations/custom"}]},{"group":"Reference","pages":[{"title":"Comparison","description":"Open Computer Use vs open-terminal vs Claude.ai vs OpenAI Operator. A trade-off map, not a ranking.","href":"/reference/comparison"},{"title":"System prompt — six MCP-native tiers","href":"/reference/system-prompt"},{"title":"Known bugs","description":"Caveats that will bite you. Upstream fixes in progress — track them on GitHub.","href":"/reference/known-bugs"},{"title":"Changelog","href":"/reference/changelog"},{"title":"Contributing","href":"/reference/contributing"}]}]},{"tab":"API reference","pages":[{"title":"API reference","href":"/api-reference/introduction"}]}]},"title":"System prompt — six MCP-native tiers - Yambr","buildId":"dpl_cadrRc5H9XQiJQbDFN5mcYRs2PAj","deploymentId":"dpl_cadrRc5H9XQiJQbDFN5mcYRs2PAj","dynamics":[],"chunks":[]}