---
name: system_runbook_writer
description: Use only when the user explicitly asks to create, update, or persist a Cerebra runbook card, and optionally its graph sidecar.
disable-model-invocation: true
owner-feature: runbooks
primary-job: Persist exactly one runbook card, and optionally its approved graph, into a profile.
allowed-tools:
  - mcp__cerebra__toolkit_state_get
  - mcp__cerebra__runbooks_list
  - mcp__cerebra__runbook_get
  - mcp__cerebra__runbook_save
  - mcp__cerebra__runbook_get_graph
  - mcp__cerebra__runbook_save_graph
  - mcp__cerebra__graph_preview_promote
---

# Mission

Persist exactly one runbook card at a time into a Cerebra profile.

This skill is explicit-only. Use it only after the user clearly asks to save or update a runbook.

This skill only works inside a Cerebra AI session with the Cerebra MCP server available. If those MCP tools are unavailable, say that this skill only works inside Cerebra and stop. Do not edit repo files or profile JSON files directly.

## Workflow

1. Confirm that the user explicitly asked to save or update a runbook.
2. Resolve the target profile with `runbooks_list` if the name might be ambiguous.
3. Read the full target profile with `runbook_get`.
4. Merge the requested card into the profile's `commands` array and save the full profile back with `runbook_save`.
5. If the user approved the currently open preview graph for this runbook, resolve the active preview through `toolkit_state_get` and promote it with `graph_preview_promote`.
6. Otherwise save a graph sidecar with `runbook_save_graph` only if the user explicitly asked for graph persistence and you already have graph JSON ready for the specific command id.

## Persistence Rules

- Preserve every unrelated command in the profile exactly as-is.
- Update by exact `id` when the target command id is known.
- If no id is provided, only match an existing command by exact label when the intent is unambiguous. Otherwise ask before saving.
- If creating a new card and no id is provided, derive a stable ASCII id from the label using the target profile's existing style.
- Save the real runtime shape:
  - `profile.name`
  - `profile.commands[]` with `id`, `label`, `command`, `description`, `tags`, and optional `color`
- Keep `description` as HTML.
- Keep multi-stage command text inside the single `command` field, using `::cerebra:split::` only when separate execution blocks are intended.
- Never embed graph JSON inside the runbook profile object.
- Use `runbook_get_graph` before overwriting an existing graph sidecar so you understand whether you are replacing or preserving one.
- When the user is approving a graph preview they just reviewed, prefer `graph_preview_promote` over reconstructing the graph JSON manually.
- Use `toolkit_state_get` to find the active preview id when the user says things like "save this graph" or "add the preview to that runbook".

## Safe Behavior

- Do not save multiple new cards in one operation unless the user explicitly asked for that batch save.
- Do not silently rename the profile, remove commands, or normalize unrelated fields.
- If you are missing the target profile, target command, or final card content, stop and ask.
- After saving, report exactly what profile and command id were written and whether a graph sidecar was also saved.

## Completion Check

- The correct profile was selected.
- Unrelated commands were preserved.
- The command id was resolved safely.
- The profile was saved through `runbook_save`.
- A graph sidecar was saved or promoted only if the user explicitly requested it.
