> ## Documentation Index
> Fetch the complete documentation index at: https://docs.sureops.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# The .sureops/ Repo Layout

> How to structure your service contract repository so sureops agents understand your environment.

The `.sureops/` directory in your knowledge base repository is where you define how sureops understands your environment. Agents read this during incident diagnosis, post-incident analysis, and fix-PR generation. The better you fill it in, the more grounded and accurate the AI output.

## Directory structure

```
(repo root)
├── README.md                # Scaffolded at the repo root; explains the repo to new readers
└── .sureops/
    ├── services.yaml        # Service catalog: ownership, dependencies, runbook pointers
    ├── policy.yaml          # Operational policy: PR behavior, postmortem routing
    ├── operating-context.md # Free-form prose context, read alongside services.yaml
    ├── skills/               # Custom agent skill definitions, one Markdown file per skill (you create this — nothing here is auto-scaffolded)
    │   └── incident-triage.md
    ├── runbooks/             # Markdown runbooks, one per issue type or service
    │   ├── README.md
    │   ├── payments.md
    │   ├── auth-service.md
    │   └── checkout.md
    └── postmortems/          # Written by sureops when an incident close creates a Problem Record (do not edit manually)
        ├── README.md
        └── PRB-2026-0042.md
```

Note the `README.md` at the top: it's scaffolded at the **repo root**, not inside `.sureops/` — only `runbooks/README.md` and `postmortems/README.md` (per-directory usage notes) are auto-scaffolded inside `.sureops/`. `skills/` isn't scaffolded at all — if you want custom agent skills, you create the directory and files yourself; sureops still reads `.sureops/skills/*.md` at ingest, there's just no starter content for it.

Today's **Generate starter contract** flow creates exactly six files: `.sureops/services.yaml`, `.sureops/policy.yaml`, `.sureops/runbooks/README.md`, `.sureops/runbooks/_example.md`, `.sureops/postmortems/README.md`, and the repo-root `README.md`. Everything else shown above — `operating-context.md`, `skills/`, and any runbook beyond the example — is something you add yourself.

The files you author and maintain are `services.yaml`, `policy.yaml`, `operating-context.md`, `skills/`, and `runbooks/`. The `postmortems/` directory is written by sureops via pull requests when an incident close creates a Problem Record — not every incident close does; a policy gate on severity and closure reason decides whether one is created at all. During the private beta, sureops merges those PRs as soon as they open (if a merge fails, the PR stays open for you), because every organization delegates merge authority to sureops by default (see [Guided onboarding journey](https://docs.sureops.ai/onboarding/guided-onboarding-journey.md)). sureops can also open a second, separate kind of PR under the same condition: one adding a new file to `.sureops/runbooks/`, when the Problem Commander judges the incident revealed a reusable diagnosis/remediation pattern worth capturing as a runbook — during the beta, sureops merges these on open too. See [Skills](https://docs.sureops.ai/ai-agents/skills.md) for what goes in `.sureops/skills/*.md`.

***

## services.yaml

**Who reads it**: Diagnosis Specialist, Incident Commander, Fix PR Agent, Problem Commander

Defines the service catalog: what services exist, who owns them, how they depend on each other, and where their runbooks live.

This is the single most impactful file. If you only author one file, make it this one.

See [services.yaml reference](https://docs.sureops.ai/your-rules/services-yaml.md) for the full field-by-field guide.

***

## policy.yaml

**Who reads it**: Resolution Specialist (incident fix PRs), Fix PR Agent (Problem Record fix PRs), Problem Commander (postmortem and runbook PRs)

Controls operational policy: whether fix PRs and postmortem PRs open automatically, which kinds of fix PR are allowed, draft vs. ready-for-review, which teams to request review from, and per-environment and per-service overrides.

Example structure:

```yaml theme={null}
# .sureops/policy.yaml
version: 1

defaults:
  source_fix_pr:
    auto_fix_pr: false
    draft: true
    reviewers: ["alice", "bob"]
  postmortem_pr:
    auto_pr: true
    reviewers: ["alice", "bob"]

environments:
  prod:
    source_fix_pr:
      auto_fix_pr: false
      reviewers: ["oncall-lead"]
    postmortem_pr:
      reviewers: ["oncall-lead", "compliance-reviewer"]

per_service:
  payments:
    source_fix_pr:
      auto_fix_pr: false
      reviewers: ["payments-dev"]
    environments:
      prod:
        source_fix_pr:
          reviewers: ["payments-dev", "oncall-lead"]
```

| Field | Default | What it does |
| - | - | - |
| `source_fix_pr.auto_fix_pr` | `false` | Open a Problem Record fix PR automatically after an incident closes — a revert if `allow_revert` is on and a commit is identified, otherwise a Markdown fix plan under `fixes/` |
| `source_fix_pr.allow_revert` | `false` | Allow revert PRs (needed for a revert, from either path) |
| `source_fix_pr.allow_forward_diff` | `false` | Allow fix PRs with newly written code during an incident (these always stay drafts) |
| `source_fix_pr.draft` | `true` | Open Problem Record fix PRs as drafts — always applies to fix-plan PRs; applies to revert PRs only when sureops doesn't have merge authority (with it, a revert PR opens ready and sureops tries to merge it on open; if that fails it stays open, ready for review); incident fix PRs always open as drafts |
| `source_fix_pr.reviewers` | none | GitHub usernames requested as reviewers on fix PRs — bare logins only, each a collaborator with access to the repo; teams and `@` prefixes aren't supported, and one invalid entry means no reviewers are requested |
| `postmortem_pr.auto_pr` | `true` | Open postmortem PRs, runbook PRs, and postmortem-export PRs |
| `postmortem_pr.reviewers` | none | GitHub usernames requested as reviewers on those PRs (same format rules) |

> [!WARNING]
>
> During the private beta, the `policy.yaml` in sureops' starter contract turns on automatic fix PRs, revert PRs, and fix PRs with newly written code (`auto_fix_pr`, `allow_revert`, and `allow_forward_diff` all `true`, `draft: false`). If you don't want that, edit those values everywhere they appear (including any `per_service` block) after the starter PR lands. The starter file also contains `auto_open` keys; they have no effect — use `auto_fix_pr`, and add `postmortem_pr.auto_pr: false` to stop postmortem and runbook PRs.

Resolution order for `policy.yaml` (most specific wins):

1. Per-service, per-environment setting
2. Per-service setting
3. Per-environment setting
4. Default setting

The per-service layers apply to `source_fix_pr` only. For `postmortem_pr`, sureops reads `defaults` plus the matching `environments.<env>` block (the key must match your environment's name or slug); `per_service` `postmortem_pr` blocks are ignored, and **+ New runbook** drafts use `defaults` only.

***

## runbooks/

**Who reads it**: Diagnosis Specialist, Incident Commander, Resolution Specialist, Verification Specialist

A collection of Markdown files describing how to diagnose and resolve known issue patterns. sureops uses vector search to find the most relevant runbooks for each incident automatically.

See [Runbooks & Knowledge Base](https://docs.sureops.ai/your-rules/runbooks-and-knowledge-base.md) for authoring best practices.

***

## postmortems/

This directory is written by sureops, not by you. When an incident close creates a Problem Record, the Problem Commander agent generates a root cause analysis and opens a pull request with a new file in this directory. Not every incident close creates a Problem Record — a policy gate on severity and closure reason decides whether one is created at all, so a low-severity or self-recovered incident may close without ever reaching this directory.

The filename format is: `{problem_external_id}.md` — no date prefix, no slug. `problem_external_id` is the `PRB-YYYY-NNNN` external ID (e.g. `PRB-2026-0042.md`).

Separately, if you use the manual **export** feature on a problem's detail page, that export writes its own file with a date-prefixed name — `{date}-{problem_external_id}.md` (e.g. `2026-05-12-PRB-2026-0042.md`) — in a different pull request, distinct from the automatic post-closure PR above.

During the private beta, sureops merges both kinds of postmortem PR as soon as they open (if a merge fails, the PR stays open for you), because every organization delegates merge authority to sureops by default. If your organization has had that switched off, you review the PR and merge when satisfied. The postmortem becomes part of your historical record and is indexed for future incident grounding.

***

## Where to put the .sureops/ directory

### Dedicated knowledge base repo (recommended)

Put the `.sureops/` directory in a dedicated knowledge base repository — a repo that holds documentation and configuration, separate from your application code. Connect this repo in **Settings → Organization → Knowledge Base**.

This is the recommended layout for most teams. It gives you a single place to manage ownership, runbooks, and policies.

### Monorepo

For teams with a monorepo, put `.sureops/` at the root of the monorepo — then, just as with a dedicated repo, you still need to **designate that repo as your organization's knowledge base repo in Settings → Organization → Knowledge Base**. Ingest only ever reads from the one designated KB repo; putting `.sureops/` in a repo you haven't designated has no effect. sureops reads it from the default branch (`main` unless you configure otherwise).

***

## Which branch does sureops read from?

sureops reads from your configured knowledge base branch (default: `main`). New services, new runbooks, and policy changes take effect the next time the contract is ingested after a push to that branch.

Edits to a service that's already in your contract take effect the same way: changed values replace the old ones, values you remove are cleared, and a changed owner, runbook, repository or dependency replaces the old link. Alias identifiers are additive — see [Customer Landscape](https://docs.sureops.ai/your-rules/customer-landscape.md#conflict-resolution).

Ingestion happens automatically on push via a webhook. You can also trigger a manual re-ingest from the **Advanced** section of **Settings → Organization → Knowledge Base** using the **Force re-ingest** button — it re-pulls the contract from the KB repo's current head, ignoring the last-seen commit.

***

## Creating .sureops/ for the first time

Two paths:

**Author it yourself**: Create the directory and files following the schemas documented in this section. Start with a minimal `services.yaml` (2 required fields per service: `name` and `git_repo`) and expand from there.

**Accept a sureops-generated starter PR**: From **Settings → Organization → Knowledge Base**, click "Generate starter contract." sureops composes a scaffold from whatever's available — a Backstage catalog you provide, telemetry/Kubernetes discovery already in your landscape graph, or auto-discovered GitHub repos — falling back to an empty starter if none of those yield anything. On a demo environment sureops merges it for you; on your own environment it opens as a draft — review it, edit anything incorrect, mark it ready, and merge. See [Customer Landscape](https://docs.sureops.ai/your-rules/customer-landscape.md) for details on this path.

***

## Editing .sureops/

All edits go through pull requests to your knowledge base repository. sureops does not provide a form-based editor for these files — the YAML is the source of truth, and your normal code review process governs changes you make. During the beta, PRs sureops writes to this repo (postmortems, runbook PRs from closed incidents, and **+ New runbook** drafts) are merged as soon as they open; if a merge fails, the PR stays open for you. The onboarding runbook-starter PR is not merged for you.

The Settings UI shows the current state of your contract (last ingest status, active services, runbook count) and deep-links to GitHub for editing. For a fuller read-only view of what agents are actually reading right now, use the **.sureops/ Repo** browser (**Settings → Organization → Knowledge Base → Browse in app**), which also has a **Validate** action to check for parse warnings without waiting for the next push. The **Validate** button requires permission to edit settings (Admin, Owner, or Compliance Officer); others won't see it.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.