Skip to content

Enforced system prompt

Last updated: 2026-11-13T07:33:34-03:00 (UTC-3)

Attach a reviewed prompt registry publication to a Chat alias with models[].system_prompt. The gateway applies it even when the client does not request a template. The default replace mode removes client system and developer messages, then inserts the published system messages before the rest of the conversation. This controls the request sent to a provider; it does not guarantee model obedience or keep instructions secret from a model’s output.

Enable features.system_prompt (default false) and features.prompt_registry. The registry already requires the console and PostgreSQL. Use the registry to create and publish a static, system-only flat_strings_v1 prompt, owned by an existing active team. No variables or typed input schema are accepted in this policy profile.

features:
ui: true
prompt_registry: true
prompt_management: true
system_prompt: true
prompts:
- id: support-policy
team: team_platform # replace with your existing team's ID
name: Support policy
schema_profile: flat_strings_v1
messages:
- role: system
content: Answer clearly and identify uncertainty.
variables: {}
models:
- id: support-chat
capabilities: [chat]
system_prompt:
prompt_id: support-policy
owner_team: team_platform
revision: 1 # the actual current published revision
position: replace
targets:
- provider: openai # an existing configured connection
model: gpt-4o-mini

YAML stages the reference, but does not publish a draft automatically. Publish in Prompt registry, confirm its revision, then use that exact revision in the alias. A new publication requires updating the reference; the gateway refuses a stale reference instead of silently using different instructions. A YAML base change likewise requires the registry’s normal publication/review flow.

The authenticated key must belong to owner_team, and that team must own the prompt. A supplied team name, metadata field or header cannot change this ownership. The policy does not grant model access or a prompt-content read scope. Existing authorization, plans, guardrails and quota ceilings still apply.

Parameter Default Accepted value
features.system_prompt false Operator feature switch; requires prompt_registry
models[].system_prompt Absent Optional reference; explicit null is invalid
prompt_id Required Existing registry ID, 1–64 ASCII characters, starting with a letter or digit; remaining characters may include ., _, -
owner_team Required Exact nonempty registry team ID, up to128UTF-8bytes
revision Required Integer1–100 asserting the current published revision
position replace replace or prepend

Unknown, duplicate, case-aliased or incorrectly typed fields are rejected. The reference contains no prompt text or variable values. Existing registry bounds govern static text, messages and rendering. Existing model-write/request size limits continue to apply.

prepend retains client system/developer messages after the published system messages. Choose it only when keeping those instructions is intentional; conflicting messages remain possible. Neither mode changes user, assistant, tool or multimodal message members. Malformed or ambiguous messages are refused rather than inspected one way and forwarded another.

This profile requires an alias with only the chat capability. It supports streaming and non-streaming Chat, including the existing Chat encoders for Anthropic and Gemini. Native Messages, Responses, GenerateContent, realtime, media and resource routes do not acquire this policy implicitly; incompatible alias declarations are rejected.

An alias with auto_route cannot also declare this policy. A concrete destination chosen by an auto-router may declare it; it is applied after destination selection, before its guardrails, token/cost reservation and provider call. Earlier helper/classifier calls use their own configured aliases and policies. They do not inherit a parent’s private prompt or an applied marker.

An enforced alias’s semantic fallback destinations must carry the same normalized reference, including revision, owner and position. This prevents a context-window or content-policy fallback from escaping mandatory instructions. Fallback starts from the original client messages and applies the destination policy once. An unbound source may fall back into an enforced destination, subject to its ownership and access checks. For a sequential API revision change across a fallback pair, temporarily remove the fallback edge, update both references, then restore the edge once they match. The individual protected aliases remain enforced throughout; exact current-publication assertions can refuse traffic while the new publication/reference is being coordinated. No zero-downtime publication switch is promised.

alias_of inherits the canonical alias’s policy; it cannot override it. Conditions, rate limits, provider selection and existing financial proof still apply independently.

The gateway checks the current publication and active owner in PostgreSQL before serving the protected request, including before any cache answer. Deleted, disabled, unpublished, changed-base, invalid-shape and stale-revision prompts never fall back to an older draft or cached copy. Foreign or missing caller teams are denied without exposing private prompt content. A disabled policy/registry prerequisite or unavailable storage refuses the request before the provider.

Injected messages are included in guardrail input and token/cost reservation. The original raw request fast path is invalidated so the provider receives the same effective messages that those controls evaluated. Semantic answer caching is bypassed for an enforced answer alias. Existing exact-cache profiles remain embeddings/moderations only and cannot declare this Chat policy.

References are visible only in private global model administration. Team/public model inventories and the public hub exclude them. Request/trace IDs correlate normal logs and usage; telemetry does not record prompt text or raw policy values. Optional captured-content behavior retains its separate explicit consent and access controls.

Use Model catalog → Edit routing → System prompt. A global administrator can select an active published registry entry and review its owner/revision and mode. The picker reads inventory metadata, not template text. Publication alone does not certify a static system-only template. Saving validates the reference and model compatibility. Publication, active ownership and static content are checked on every inference; a successful Save does not certify readiness.

Adding, changing, removing or restoring a different binding requires a global administrator. An operator may preserve an identical normalized binding while making an otherwise authorized model edit; applicable license checks still apply. Omitting position is equivalent to replace for that comparison. The fixed publication-only unpublish operation preserves the binding and its existing recovery behavior.

The existing model API accepts the same reference inside the complete model object in PUT /api/v1/admin/models/{id}. Fetch the current global configuration version first. PUT is a full replacement: omitting system_prompt removes it, and therefore requires binding-change authority. DELETE restores the YAML model and its reviewed binding. Version conflicts return409; reload and review instead of overwriting another change. No new endpoint is needed.

V20 introduced this finite profile with108definitions; the current console uses V21 with109definitions, preserving the same prompt contract. Older selectors and defaultV1 stay unchanged. system_prompt_access.write describes binding-write authority independently of whether the operational flag is enabled. Missing metadata/capability never enables an editor by guesswork.

No new database schema is needed. Replace or quiesce all older replicas and model writers before storing a binding. Older binaries can ignore a new JSON field or serve an older snapshot; a mixed-version pool cannot enforce mandatory instructions reliably.

Back up the existing configuration/database and use the current binary for recovery. To restore service after publication changes, publish/review the intended static revision and update the alias reference with a current version. Do not work around an invalid policy by sending traffic through an older gateway.

m7gtwcontact@m7gtw.com