Skip to content

feat: playbooks for the agent - #3188

Draft
mxkaske wants to merge 9 commits into
mainfrom
feat/playbooks
Draft

mxkaske wants to merge 9 commits into
mainfrom
feat/playbooks

Conversation

@mxkaske

@mxkaske mxkaske commented Nov 26, 2026 •

Copy link
Copy Markdown
Member

Summary

One markdown playbook per workspace and type: "this is how we run stuff". People write them under Agents > Playbooks; the agent reads them when asked and before it drafts public text. Nothing is enforced.

Type Holds
incident_response severities, roles, steps, cadence, escalation
status_page tone, what to say and never say, public names
maintenance_windows what a window means, when to schedule, notice period
postmortem sections and what goes in each
packages/db/src/schema/playbooks/   # table, types, {{name}} variable helpers
packages/services/src/playbook/     # savePlaybook, clearPlaybook, listPlaybooks, getPlaybook
packages/services/src/agent-tools/
├── playbook.ts                     # list_playbooks, get_playbook, update_playbook
└── playbook-hint.ts                # one sentence on the tools that write public text
packages/api/src/router/playbook.ts # tRPC: list, get, save, clear
apps/dashboard/.../agents/playbooks # list + editor with Properties and Variables

How a playbook reaches the agent:

Slack / dashboard chat
  loadPlaybookSection(ctx)           # prompt names the filled types, no content
  get_playbook({ type })             # content with variables filled in
MCP
  server instructions + tool descriptions point at list_playbooks / get_playbook
generatePostmortemDraft
  postmortem playbook filled  -> its structure replaces the default sections
  empty                       -> prompt identical to before

Writes:

dashboard   save / clear (delete from the row menu, with confirm)
agent       update_playbook (creates or replaces, approval card) ; no delete tool
variables   {{name}} in the text, values in playbook.variables (flat JSON map)
            saved on blur per value ; unset ones stay as {{name}} for the agent

Empty slots change nothing: no prompt section, default postmortem prompt.

Also in here: PropertyInput shows a tooltip with the full value when it is clipped, and QuickActions computes its visible items once.

Evidence

  • Before: no playbook table, tools or tab.
    After: pnpm verify green. Suites on an isolated libSQL:
packages/services   148 files, 1941 tests passed
apps/dashboard       50 files,  459 tests passed
packages/api         42 files,  518 tests passed
  • Postmortem prompt: postmortem-draft.test.ts asserts the system prompt equals the previous one without a playbook, and carries the playbook's sections plus the unchanged rules with one.
  • Variables round trip: packages/api/src/router/playbook.test.ts saves a value, changes only the value, reads it back.

Not shown or not done:

  • apps/server suite: green earlier on this branch; the last three full runs failed 4 to 7 tests, a different set each time, in slack/handler.test.ts and monitor/heartbeat RPC tests. Each file passes alone. The machine was under heavy load; needs one clean CI run.
  • pnpm eval:mcp: not run. Two cases added; select.declare_incident may now pick list_playbooks first.
  • Real model check: no run against Slack, dashboard chat or MCP yet, so how often the agent reads before drafting is unmeasured.
  • Screenshots: taken locally, not attached.

Merge Danger

Door: two-way

Two additive migrations (0099 creates playbook, 0100 adds variables). No existing table or column changes.

Blast Radius: agent

Ten write tools gain one sentence in their description, and both agent prompts gain a line listing the playbook tools, for every workspace. With a filled slot the prompt also gains a short section. Tool selection can shift: a model may call list_playbooks before drafting. update_playbook lets the agent rewrite the rules it follows, behind the same approval card as other writes.

View guided diff

One markdown playbook per workspace and type (incident response, status page, maintenance windows, postmortem), edited under Agents > Playbooks with default templates and {{name}} variables.

The agent reads them through list_playbooks / get_playbook on Slack, dashboard chat and MCP, and writes them through update_playbook with approval. The postmortem generator uses the postmortem playbook for its structure when one exists.
@vercel

vercel Bot commented Nov 26, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
openstatus-dashboard Ready Ready Preview Nov 27, 2026 8:26am UTC
openstatus-status-page Ready Ready Preview Nov 27, 2026 8:26am UTC
openstatus-web Ready Ready Preview Nov 27, 2026 8:26am UTC

Request Review

ListPlaybooks, GetPlaybook, UpdatePlaybook (creates or replaces) and DeletePlaybook, addressed by type and mapped to the incidents scope group. Regenerates the proto TypeScript and the OpenAPI documents.
Adds the Playbooks reference page, lists the playbook tools in the MCP docs and points the dashboard tab's docs link at the new page.
Playbooks are keyed by a hyphenated slug instead of a type, and carry a
title and description that default per slug and can be edited in place on
the playbook page. The RPC API takes the slug as a string and accepts
optional title and description on UpdatePlaybook.
A workspace can create playbooks under its own slugs next to the four
built-in ones, from a Create playbook sheet, the RPC API or the agent.
A custom slug needs a title, has no template and is capped at 20 per
workspace.
Both columns are NOT NULL. A built-in slug stores its default title and description when it is first written; a custom slug must send both. Empty and null values are rejected on every surface, and the update_playbook approval card names the stored title.
create_playbook and CreatePlaybook create a custom playbook under a new slug.
update_playbook and UpdatePlaybook no longer create one: an unknown custom
slug is not found, while a built-in slug is still written on first use.
The checks live in the createPlaybook and updatePlaybook service verbs.

EventRowDate renders the empty cell itself, and the docs name the slugs
that code reads by name.
The tool was registered as non-destructive, which is the flag the dashboard
and Slack use to show the approval card. EventRowDate also keeps a passed
className on its empty cell.

This branch was successfully deployed

3 active deployments
Preview – openstatus-web — 7813450a Deployed Nov 27, 2026 by vercel[bot]
Preview – openstatus-dashboard — 7813450a Deployed Nov 27, 2026 by vercel[bot]
Preview – openstatus-status-page — 7813450a Deployed Nov 27, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant