Persona playbooks
The four shipped Goni playbooks - Data Analyst, Diagnostic, Data Architect, Data Engineer - their YAML shape, tool inventory, proposal contract, and endpoints.
What playbooks are
Playbooks are the persona system prompts that ground Goni’s AI surfaces. Each playbook is a YAML-fronted markdown document loaded once at boot, validated strictly, and served over REST for the web app’s persona picker and over MCP for external clients like Claude Desktop or Cursor.
Endpoints on this page
| Method | Path | Auth | Response |
|---|---|---|---|
| GET | /api/playbooks | Session or JWT | {playbooks: [...meta only...], default_id} |
| GET | /api/playbooks/{id} | Session or JWT | {meta} (metadata only; body withheld) |
Both endpoints reject anonymous callers with 401.
Neither endpoint serves the playbook body. The persona system prompt is confidential and never leaves the server: /api/ai/chat applies the body internally when it dispatches to the tenant’s BYOK provider, and the MCP surface returns meta plus a notice field explaining the split.
The four shipped playbooks
Data Analyst (default)
Answers business questions by grounding every reply in the semantic layer. Emits a strict metric-plan JSON that the Ask endpoint dispatches to the semantic layer. Cannot invent metrics, cannot write raw SQL, cannot access tables directly. The plan may include a save_as block so a chart, dashboard tile, or alert is auto-persisted when the user asks to “save this” or “alert me on this” (dry-run by default; the reviewer confirms with save_as.confirm=true). See Ask: save-as contract for the canonical JSON tag.
id: data-analysttarget_audience: business_usersexpected_model_tier: mid_or_betterdefault: true- the picker opens on this playbook, and it is the persona used when a new Ask session omits an explicit choicescope: chat(works through/api/ai/chatand/api/ask)version: 2.2.0tools_used:list_metrics,describe_metric,query_metric,list_dimensions,proposed:get_glossary
Diagnostic
Answers “why did X change?” questions. The persona itself does NOT compute deltas so a weaker model cannot hallucinate movement numbers - it only emits the metric plan for the moved metric plus any question-specific filters. The server fans out per declared entity, compares current vs prior period, and returns the top-3 ranked movements as hypotheses. The fan-out is dispatched by /api/ai/chat when playbook_id="diagnostic".
id: diagnostictarget_audience: business_usersexpected_model_tier: small_or_better(a Haiku-class model is enough because the persona does not compute numbers itself)scope: chat(works through/api/ai/chat)version: 1.0.0tools_used:list_metrics,describe_metric,list_dimensions,query_metric
Refuses forecasting, prescriptive questions, non-metric questions, ungrounded metrics, and diagnostics that cross a definition_changed_at boundary.
Data Architect
Designs the semantic layer: metric definitions, dimension joins, dbt-style models, freshness contracts. Emits proposals in a propose_metric / propose_model / propose_join / propose_metric_change / propose_conformed_dim shape.
id: data-architecttarget_audience: analytics_engineersexpected_model_tier: mid_or_betterscope: mcp_onlyversion: 2.2.0tools_used:list_metrics,describe_metric,list_models,describe_model,create_metric,create_model,proposed:propose_join,proposed:propose_metric_change,proposed:propose_conformed_dim
The create_metric and create_model MCP tools now consume the propose_metric / propose_model JSON shapes: each call stores a pending Proposal and returns {proposal_id, status:"pending", preview, apply_url, reject_url}. A human reviewer commits it via POST /api/ai/proposals/{id}/apply. The remaining propose_join, propose_metric_change, and propose_conformed_dim shapes are still emit-only; external MCP clients with their own write tools consume those directly. The in-app /ask dropdown filters this playbook out because it does not answer business questions.
Data Engineer
Designs ingestion pipelines: source, mode (batch / incremental / CDC), ClickHouse table engine, ORDER BY key, cron. Emits a propose_pipeline JSON shape.
id: data-engineertarget_audience: data_engineersexpected_model_tier: mid_or_betterscope: mcp_onlyversion: 2.2.0tools_used:list_connections,describe_source_table,list_pipelines,list_warehouse_tables,create_pipeline
The create_pipeline MCP tool consumes the propose_pipeline shape: server introspects the source, validates inc_column exists, renders a preview (proposed Pipeline + target DDL hint + warnings), and stores as a pending Proposal. A human reviewer commits via POST /api/ai/proposals/{id}/apply, which re-runs the preview at apply time to catch source-schema drift and then invokes the same pipeline-write path a REST call would take. All four read tools (list_connections, describe_source_table, list_pipelines, list_warehouse_tables) are wired and respect the caller’s RBAC.
Proposal-first write pattern
Architect and Engineer write tools never mutate state directly. Every call to create_pipeline, create_metric, or create_model runs through the same lifecycle:
- Preview. The server introspects the target (source table for pipelines, catalog for metrics, existing model tree for models), validates required fields, and renders a preview. If validation fails, the tool returns
mcpErrInvalidParamsimmediately and no Proposal is stored. - Store. A
Proposal { id, kind, status:"pending", payload, preview, created_by, created_at, expires_at }record is persisted by bi-api. Default TTL is 30 days;expiredis a terminal state. - Review. The MCP tool returns
{proposal_id, status:"pending", preview, apply_url, reject_url}. The apply and reject URLs point at/api/ai/proposals/{id}/applyand/api/ai/proposals/{id}/reject. The Goni web app renders the pending queue at/ai-proposals. - Apply. The reviewer’s
POST /api/ai/proposals/{id}/applyre-runs the preview (to catch source-schema drift between propose-time and apply-time) and then invokes the sameStore.PutPipeline/ metrics-YAML / models-YAML write path a hand-authored REST call would take. RBAC, validation, and audit stay identical; the Proposal is only the queueing envelope.
State machine: pending -> approved -> applied on success, pending -> rejected, pending -> expired, or pending -> approved -> failed if the apply-time preview or the underlying Put* call errors. See Proposals for the full contract.
File shape
Every playbook is YAML frontmatter followed by a markdown body. The frontmatter is strictly validated; a bad playbook is fatal at boot, not a runtime fallback.
id: data-analyst # required, [a-z0-9][a-z0-9-]{0,62}, path-traversal-safe
name: Data Analyst # required, human-readable picker label
version: 2.2.0 # required, semver; bump on every change
owner: "Goni Team" # required, human owner for review + escalation
last_reviewed: "2026-08-17" # required, ISO date of the last content review
description: > # required, one to three sentences shown in the picker tooltip
Helps non-engineers explore the warehouse via grounded metric queries.
expected_model_tier: mid_or_better # one of: small_or_better | mid_or_better | large_only
tools_used: # informational; not enforced by the server
- list_metrics
- describe_metric
- query_metric
- list_dimensions
- proposed:get_glossary
target_audience: business_users # drives picker grouping
default: true # exactly one file should set this; first alphabetical wins otherwise
# scope: chat | mcp_only # optional; defaults to `chat`
# System prompt body starts here
You are Goni's Data Analyst persona...
The body is the LLM’s system prompt. It is never served over REST or MCP - /api/playbooks/{id} returns metadata only, and /api/ai/chat applies the body internally when it dispatches to the tenant’s BYOK provider. The body is confidential and is not exposed on any wire boundary.
The loader appends a canonical confidentiality block to every body at load time, so authors do not hand-write it. Legacy playbooks that ship the block inline are normalised so it stays byte-identical across every persona.
Tool inventory
tools_used in the frontmatter is a declared expectation. The Goni MCP server (see MCP server) exposes tools split into four groups: semantic reads, operational reads, semantic-model reads, and Proposal-first writes. Write tools never mutate state directly; each one renders a preview and stores a pending Proposal for human review.
Semantic tools (5, read-only):
list_metrics- enumerate the compiled metric catalog visible underAllowMetricsdescribe_metric- grain, entities, source model, freshness for one metriclist_dimensions- dimensions available for a given metricquery_metric- execute a metric plan through the semantic compiler (row_filters + column masks applied)list_playbooks- return the same envelope asGET /api/playbooks
Operational read tools (4, read-only):
list_connections-[{id, name, kind, status}]filtered by the caller’s RBAC (empty when the caller lacksallow_save)list_pipelines- optionalconnection_idfilterlist_warehouse_tables- optionaldatabasefilter; enumerates ClickHousesystem.tablesscoped to user databasesdescribe_source_table-{connection_id, database, table, columns}where each column is{name, type, nullable}; call BEFOREcreate_pipelineso the target DDL matches the real source schema
Semantic-model read tools (2, read-only):
list_models- every semantic-layer model with materialization + schemadescribe_model- config + description + provenance for one model
Write tools (3, Proposal-first):
create_pipeline- validates + previews + stores a pending Proposal; NEVER creates the pipeline directlycreate_metric- validates payload against the parser contract + stores a pending Proposal; apply lands in the tenant-overridemetrics.ymlcreate_model- validates payload + extracts Jinja refs + stores a pending Proposal; apply writes themodels.ymlentry and.sqlbody atomically
Each write tool returns {proposal_id, status:"pending", preview, apply_url, reject_url}. A human reviewer commits at /api/ai/proposals/{id}/apply.
The following tool names appear in tools_used on Data Analyst / Data Architect frontmatter but are still declared with the proposed: prefix and not wired: get_glossary, propose_join, propose_metric_change, propose_conformed_dim. Each needs its own preview builder + apply path before it can graduate. Because tools_used is informational, an unwired reference loads fine and the LLM simply gets no results if it tries to call the name.
Attribution and audit trail
Every AI-initiated mutation records an origin value in the audit log so a human reviewer can tell a Goni-approved AI action apart from a purely-human REST call. The mapping is:
data-analyst->ai:data-analystdata-engineer->ai:data-engineerdata-architect->ai:data-architectdiagnostic->ai:diagnostic- MCP call without
_persona->system:mcp - Empty
playbook_id-> the standard user origin (a human REST call was replayed through the AI stack, not an AI decision)
The mapping is enforced by every AI-initiated write path: the chat and save-as flows, the scheduled-task sweeper, and every proposal-apply endpoint. Pass _persona: "<id>" as an argument on every MCP call so the audit log tags the invocation correctly instead of the default system:mcp. See Audit and lineage.
Choosing a persona for a session
When a new Ask session starts and the client does not pass an explicit playbook_id, the server picks the playbook marked default: true in its frontmatter. Today that is data-analyst. If no playbook is marked default, the loader falls back to the first alphabetically so the API always answers with something rather than crashing.
To switch persona from the app, use the picker in the Ask panel. The picker calls GET /api/playbooks, filters out scope: mcp_only entries, and posts the chosen id alongside the question. Today that leaves data-analyst and diagnostic in the picker; Architect and Engineer are MCP-only.
From an MCP client, invoke the persona through the Goni MCP surface (goni://playbooks/<id>). The server applies the confidential body internally when it dispatches to your BYOK provider - the MCP resource returns metadata plus a notice explaining the split. Fetch the metadata via:
curl -s -H "Authorization: Bearer $GONI_PAT" \
https://your-goni-host/api/playbooks/data-architect \
| jq '.meta'
Only the built-in personas honour scope: mcp_only. The scope is a hint about which surface hosts the human review of the persona’s proposals, not a body-permission gate; there is no path that returns the body over the wire.
Forking a playbook for a custom persona
Playbooks are built into Goni. To request a custom persona, open a support conversation with the persona description and desired tool inventory. Bodies are not accepted or returned over any public API; the playbook registry is fixed per install.
Related
- Ask: grounded AI Q&A - the endpoint that consumes the Data Analyst and Diagnostic playbooks
- Proposals - the pending-review inbox for AI-authored writes
- Scheduled AI tasks - recurring persona runs that share the same origin-attribution rules
- MCP server - how external agents load playbook bodies as system prompts
- Semantic layer overview - the catalog every playbook is grounded in
- Pipelines - the ingestion surface the Data Engineer playbook proposes changes to
- Access control - RBAC that gates who can call the Ask endpoint at all
- Audit and lineage - where
ai:<persona>origin tags surface - REST API - full endpoint reference
Last updated