Skip to content

docs: add "Manage the system prompt as code" recipe under ai-coder/agents/platform-controls/ #28090

Open

Description

@blinkagent

Summary

Add a new docs page under docs/ai-coder/agents/platform-controls/ that documents the pattern of managing the Coder Agents deployment-wide system prompt (and, more broadly, AI providers/models) as code — with PR review, CI-driven deploys, and drift detection — instead of clicking it into the dashboard.

We already run this pattern in production on cdrstable.dev via coder/dogfood, but it's currently only discoverable if you happen to know to look in that repo. Prospects and customers asking "how do we govern the system prompt at enterprise scale?" have no docs page to land on.

Why

The existing docs cover the what well:

…but none of them show the how for a team that wants to manage the prompt like any other production config. Enterprise prospects consistently ask for this — it's the natural first-step answer to "how do we bring institutional knowledge into agents and govern it?"

Reference implementation (already in production)

We should link to and summarize the dogfood pattern:

Key elements of the pattern worth documenting:

  • system-prompt.md lives in a git repo, deployed byte-for-byte via PUT /api/experimental/chats/config/system-prompt from CI (listed in .prettierignore so formatters don't rewrite it).
  • include_default_system_prompt: true keeps Coder's built-in prompt and appends the custom text.
  • Providers and models are managed via the coder/coderd Terraform provider with S3 remote state.
  • GitHub Actions: terraform plan on PRs (with a diff of the live system prompt for drift detection), terraform apply + prompt PUT on merge to main.
  • OIDC-authed CI roles scoped to state read (plan) vs. state write (apply).
  • Write-only API keys (api_key_wo + api_key_wo_version) so live secret values are preserved across applies.
  • Drift caught in PR review: changes made in the dashboard show up in the next plan and get reverted on apply unless promoted into the config.

Proposed page

  • Path: docs/ai-coder/agents/platform-controls/system-prompt-as-code.md (open to a better name — e.g. manage-system-prompt-as-code.md)
  • Suggested sections:
    1. Why manage the system prompt as code (audit, review, rollback, drift detection)
    2. Repo layout (a system-prompt.md + a thin Terraform module for providers/models)
    3. Deploying the system prompt via API PUT from CI (with a minimal working example)
    4. Managing providers and models with the coder/coderd Terraform provider
    5. CI recipe: plan on PR, apply on merge, drift detection
    6. Secret handling (api_key_wo / api_key_wo_version)
    7. Known limitations and follow-ups (no native coderd resource for the system prompt yet — track when it lands and fold the file into the Terraform module)
    8. Link out to the live dogfood implementation as a reference
  • Cross-links to add:

Follow-up

When the coderd Terraform provider adds a native resource for the chat system prompt, update this recipe to use the resource and drop the workflow-driven API PUT (as already noted in the dogfood README).


Created on behalf of @mdanter

Activity

  1. linear-code commented on Aug 12, 2026

    @linear-code
  2. bpmct commented on Aug 18, 2026

    @bpmct
    Member

    Opened coder/terraform-provider-coderd#411 for the native resource mentioned in the Follow-up section — the system prompt is one of the most frequently-changing pieces of agents config, so it should be codified rather than PUT from CI. Once that ships, the recipe here can use coderd_chat_system_prompt directly and drop the workflow PUT + drift steps.

    Generated by Coder Agents on behalf of @bpmct

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions