{"id":15466,"plugin_id":"plugin_asdk_app_6a96923ff47481919800bde485be3075","kind":"skill","collection_source":null,"comparison_source":null,"observed_at":"2026-09-30T23:11:28.243Z","digest":"093902196028adc0266afa41a924a5286cb0f7198ad488577ac115c6e3b1397b","against":null,"payload":{"name":"mcp-agent-operating-model","description":"Configure safe agent behavior around PlanetScale MCP, Insights, schema recommendations, and repository work without autonomous production mutation.","included_files":[],"skill_md_contents":"---\nname: mcp-agent-operating-model\ndescription: Configure safe agent behavior around PlanetScale MCP, Insights, schema recommendations, and repository work without autonomous production mutation.\n---\n\n# MCP agent operating model\n\n## Purpose\n\nDefine how agents should use PlanetScale MCP safely. Agents should use production telemetry to generate useful work while avoiding autonomous production changes.\n\n## Default MCP choice\n\nUse the PlanetScale MCP insights-only server when the task only needs Insights and Schema Recommendations.\n\nUse the full PlanetScale MCP server only when the task explicitly requires database/schema access beyond Insights. Prefer read-only scopes.\n\nThe full MCP server has query execution tools. Treat write query tools as disabled unless the operator explicitly approves a specific non-production action or a carefully reviewed production action.\n\n## AGENTS.md guidance\n\nTwo different documents both named `AGENTS.md` serve different purposes:\n\n1. **CLI agent guide** — shipped with `pscale` (`AGENTS.md` in the\n   [planetscale/cli](https://github.com/planetscale/cli) repo, or\n   `pscale agent-guide --format json`). Covers auth, `--format json`, flag\n   placement, and `pscale sql`. Load skill `pscale-cli-automation` for the\n   same conventions inside this skills pack.\n\n2. **Project agent guide** — your application repository's `AGENTS.md` (or\n   equivalent). Covers database targeting and approval policy for *this* app.\n\nWhen working inside a repository, recommend adding a **project** database\ntargeting section to `AGENTS.md` or equivalent project instructions:\n\n- PlanetScale organization.\n- Database.\n- Branch.\n- Engine: Vitess or Postgres.\n- Production branch name.\n- Whether agents may use MCP insights-only or full MCP.\n- Whether write queries are forbidden.\n- Required approval protocol for schema, Traffic Control, webhooks, roles, and network changes.\n\nDo not edit `AGENTS.md` without approval.\n\n## Safe autonomous tasks\n\nAllowed by default:\n\n- Read Insights.\n- Read schema recommendations.\n- Read schema metadata.\n- Read existing webhooks and Traffic Control configuration.\n- Read branch metadata.\n- Inspect repository code.\n- Correlate query patterns with code.\n- File issues.\n- Open pull requests.\n- Create development branches.\n- Apply DDL and migrations to non-production development branches.\n- Open deploy requests into branches protected by a review workflow.\n- Draft Traffic Control budget proposals.\n- Draft webhook receiver requirements.\n\nWhere a PR + deploy-request workflow exists, the default deliverable for a\nschema recommendation is the complete reviewable unit: development branch\nwith the DDL applied, PR with evidence (fingerprint, metrics, expected\neffect), and an open deploy request. The human action is the merge/deploy\ndecision, not shepherding the proposal into existence.\n\nNot allowed by default (the review-gate actions and non-reviewable mutations):\n\n- Execute write SQL against production.\n- Execute DDL directly against production branches.\n- Deploy a deploy request / apply schema to production.\n- Merge pull requests.\n- Create webhooks.\n- Create or enforce Traffic Control budgets.\n- Rotate credentials.\n- Change roles.\n- Change IP restrictions or private connectivity.\n- Restore or promote branches.\n\n## Agent loops\n\n### Daily recommendation loop\n\n1. Read open schema recommendations.\n2. Read top Insights regressions.\n3. Correlate with repository code.\n4. Generate ranked issues or PRs.\n5. Human reviews.\n6. Human approves any database-affecting action.\n\n### Anomaly loop\n\n1. Receive or inspect anomaly.\n2. Gather affected query patterns and tags.\n3. Identify source route/job/deploy.\n4. Produce incident note and proposed remediation.\n5. If code fix is obvious, open PR.\n6. If database change is needed, create a proposed change set only.\n\n### Traffic Control loop\n\n1. Identify unsafe traffic slice from Insights/tags.\n2. Draft `warn` budget proposal.\n3. Human approves creation.\n4. Observe warnings.\n5. Human approves enforce mode only after validation.\n\n## Scheduled loops (cron / Automations)\n\nThe loops above run interactively. They can also run on a schedule with no\nhuman in the loop, in two tiers. Tier 2 requires a standing authorization\nper `../autonomous-execution-mode/SKILL.md`; Tier 1 requires none.\n\nEvery scheduled loop, both tiers: re-read authorization at run start,\nstream status to a configured delivery channel, persist a run log, and\navoid filing duplicates (do not re-file an issue that is already open\nfor the same fingerprint/recommendation ID).\n\n### Tier 1 — propose through the review workflow (no authorization needed)\n\n- **Recommendation-to-PR loop** (daily): list open schema recommendations\n  via MCP; for each new one matching the workflow (additive or destructive\n  — the PR review is the gate), create a development branch, apply the\n  DDL, open a PR with fingerprint, metrics, and expected effect, and open\n  the deploy request. The reviewable unit is complete when a human can\n  ship it with one merge/deploy action. Output: branch + PR + deploy\n  request per recommendation.\n- **Regression watch** (hourly or per-deploy): compare top patterns\n  against a stored baseline (p50/p99, rows read, execution count); on\n  material regression, identify the deploy SHA from query tags and file\n  a report linking pattern to commit range. Output: report.\n- **Tag coverage audit** (weekly): measure percentage of query time\n  carrying tags; list untagged high-cost patterns with likely code\n  paths; open or update a single tracking issue. Output: issue.\n- **Anomaly triage** (webhook-triggered, not polled): on `branch.anomaly`,\n  gather affected patterns, classify probable cause, post triage note to\n  the incident channel. Output: triage note.\n- **Posture drift check** (daily): diff current safe-migrations flags,\n  webhook config, role list, and backup schedule against the last\n  assessment report; report any drift. Output: report.\n\n### Tier 2 — execute the review-gate action (standing authorization required)\n\n- **Recommendation deployer** (daily, after the PR loop): deploy open\n  deploy requests that match the allowlist — typically \"additive DDL,\n  PR approved or authored from an open recommendation, deploy with revert\n  window, max N per run\" — then verify via schema read-back and an\n  Insights follow-up on the target fingerprint. Destructive DDL deploys\n  autonomously only when the authorization states a runtime-verifiable\n  bound (e.g. \"drop only indexes with zero reads in 30 days, confirmed\n  via Insights at run time\"). Where the org requires PR approval before\n  deploy, an approved PR satisfies the review gate and the authorization\n  covers only the mechanical deploy.\n- **Branch hygiene** (weekly): delete development branches older than the\n  authorized age bound with no open deploy request; never touch\n  production or protected branches. \n- **Warn-budget gardener** (weekly): create warn-mode Traffic Control\n  budgets for newly identified expensive slices matching the allowlist;\n  report warn counts on existing budgets. Enforce mode is never entered\n  autonomously unless the authorization names the specific budget.\n- **Credential expiry enforcement** (daily): delete or flag passwords\n  past the authorized max age, only where the authorization lists the\n  affected roles and a rotation runbook exists.\n\n### Loop anti-patterns\n\n- Polling MCP on a cron for events webhooks already deliver — use the\n  webhook as the trigger; use cron for baselines, sweeps, and audits.\n- A Tier 2 loop whose allowlist is an intent (\"keep things healthy\")\n  rather than bounded operations.\n- Loops that mutate without a delivery channel for status.\n- Unbounded fan-out: one run applying every open recommendation at once\n  with no per-run cap.\n\n## Query execution safeguards\n\nFor read queries:\n\n- Prefer replicas when available.\n- `planetscale_execute_read_query` routes reads to replicas by default when a\n  branch has replicas configured (`use_replica: true`). Set\n  `use_replica: false` only when the task needs primary-read semantics, such\n  as checking immediately-after-write state or primary-only behavior.\n- Add source tags/comments for agent work.\n- Avoid unbounded scans.\n- Avoid `EXPLAIN ANALYZE` on production unless explicitly approved.\n- Limit result sizes.\n- Avoid querying sensitive columns unless required and approved.\n- For Postgres tables with row-level security, remember that the MCP read role\n  uses `pg_read_all_data` and does not bypass RLS. If a read query returns zero\n  rows or a zero count and the MCP response warns that RLS may be filtering\n  results, treat the result as policy-filtered/unknown until confirmed through\n  an approved path; do not conclude the table is empty.\n- When debugging high CPU on Postgres, use Insights data sorted by CPU\n  usage (via MCP where available, or `sort=cpuTime` on the Insights API).\n  CPU time metrics are Postgres-only; do not ask for the same CPU-sorted\n  view on Vitess.\n\nFor write queries:\n\n- Default is forbidden.\n- If approved, prefer non-production branch.\n- Require exact SQL review.\n- Require rollback plan.\n- Require branch and database name confirmation.\n\n## Output\n\nReturn:\n\n- Recommended MCP server choice.\n- Required scopes.\n- AGENTS.md instructions to add.\n- Allowed autonomous work.\n- Disallowed work.\n- Proposed agent loops.\n- Approval gates.\n\nEnd with:\n\n“No MCP write tools or database mutations have been used.”\n"},"changes":[],"summary":"First saved snapshot. No earlier version is available for comparison.","summary_kind":"deterministic","summary_metadata":{}}