

# AWS Assurance skill

With the MCP server, your client has access to the AWS Assurance tools. This skill tells the client how to use them — the order to call them in, which values to look up rather than guess, and how to read what an assessment produced. We strongly recommend installing it alongside the server, as described in [Installing the skill](mcp-server.md#mcp-server-skill).

The skill is six files: `SKILL.md`, which a client loads first, and five reference files it loads only when it needs them. Recreate this layout wherever your client keeps its skills.

```
assurance-compliance/
├── SKILL.md
└── references/
    ├── api-reference.md
    ├── custom-frameworks.md
    ├── data-model.md
    ├── reading-assessment-progress.md
    └── workflows.md
```

Each of the following sections reproduces one file in full. Use the copy button on a block to take the file exactly as it is, then save it under the matching name. The content is written as instructions to the client, so it addresses the client directly throughout.

**Topics**
+ [SKILL.md](#mcp-skill-skill)
+ [api-reference.md](#mcp-skill-api-reference)
+ [custom-frameworks.md](#mcp-skill-custom-frameworks)
+ [data-model.md](#mcp-skill-data-model)
+ [reading-assessment-progress.md](#mcp-skill-reading-assessment-progress)
+ [workflows.md](#mcp-skill-workflows)

## SKILL.md
<a name="mcp-skill-skill"></a>

The skill itself — its front matter, operating rules, and workflows. This is the only file a client loads up front.

### SKILL.md
<a name="mcp-skill-skill-file"></a>

```
---
name: assurance-compliance
description: "Operate the AWS Assurance service (compliance/governance) through its MCP tools: set up projects, discover in-scope resources, enable managed or custom frameworks (PCI DSS, SOC 2, NIST, CIS), guide the user to upload or reference evidence via the AWS CLI, run and re-run control assessments, monitor the recurring assessments the service runs, track progress, read findings (annotations) and remediation tasks, add reviewer notes or comments, and help close readiness gaps. Use whenever the user is working in AWS Assurance or asks about a compliance assessment, a control's status (for example, NEEDS_ATTENTION, USER_ERROR), a readiness score (outcomePercentage), evidence for a control, a remediation task, or enabling/scheduling a framework — even if they don't say 'Assurance'. Not for general compliance advice, drafting policy documents, or other AWS security tools (Config, Inspector, IAM, Security Hub)."
trigger: /assurance-compliance
---

# AWS Assurance Compliance Skill

## Overview

AWS Assurance (service id `assurance`) helps a customer stay audit-ready for security/governance frameworks (PCI DSS, SOC 2, NIST, CIS, and custom). It discovers in-scope resources, runs **assessments** against framework **controls**, captures **evidence**, records per-evidence **annotations**, and tracks **tasks** for remediation. You drive it entirely through the **`assurance` MCP tools** (for example, `assurance:ListEnvironments`, `assurance:ListProjects`, `assurance:StartAssessment`, `assurance:ListEvidence`, `assurance:ListAssessmentJournalRecords`, `assurance:ListAssessmentAnnotations`, `assurance:ListTasks`, `assurance:UpdateTask`). Your job: set an assessment up correctly, then read and interpret what the evaluation produced. **You do not score controls yourself.**

## Operating rules (apply on every action)

1. **R1 — Discover, never guess.** You **MUST** resolve every composite-key field (`environmentArn`, `project`, `framework`, `frameworkVersion`, `controlId`, `assessmentId`) from a List/Get call before using it, because names are validated server-side and a guessed value is rejected. If a result is ambiguous (multiple environments/projects), present the options and ask the user to choose.
2. **R2 — Check before you create.** You **MUST** call `assurance:ListProjects` before `assurance:CreateProject`, and reuse the project if the name exists, because re-creating over an existing project can disrupt its assessments, evidence, and config. Never overwrite.
3. **R3 — Never upload evidence yourself.** You **MUST NOT** call the `assurance:PutEvidence` MCP tool, even though it is listed, because writing evidence into the customer's compliance record must be a deliberate user action — instead give the user the exact `aws assurance put-evidence` CLI command (Section C), wait for their confirmation, then discover the resulting IDs with `assurance:ListEvidence`.
4. **R4 — Reference evidence in `context`.** You **MUST** place each evidence URI token — `assurance://…` (direct-uploaded), `s3://…` (S3 reference), or `github://…` / `sharepoint://…` (a document read through a GitHub or SharePoint connection) — in `assurance:StartAssessment`'s `context`, because that is the authoritative evidence for the run and it is fail-closed — an unresolved ID fails the assessment ("evidence not found"); reference only IDs you have confirmed via `assurance:ListEvidence`.
5. **R5 — Confirm consequential actions.** You **MUST** get user confirmation and describe the impact before `assurance:Delete*` or `assurance:DisableFramework`, because they change shared/customer state.
6. **R6 — Verify before closing a task.** You **MUST** confirm the remediation is verifiable — re-assess, or cite concrete evidence that the gap is fixed — before `UpdateTask → COMPLETED`, because a falsely-closed task inflates the readiness score. Never close a task on the user's say-so alone.
7. **R7 — Don't fabricate; the evaluation owns findings and tasks.** You **MUST NOT** invent, alter, or overwrite the evaluation's automated annotations, tasks, or readiness status, and you cannot write them even if asked, because the evaluation owns them and a manufactured entry would masquerade as a finding. Never call `assurance:UpdateAssessment`, even if a tool by that name is listed. You can read the findings with `assurance:ListAssessmentAnnotations` (one assessment's annotations) or `assurance:ListEvidenceAnnotations` (every assessment that annotated one version of one piece of evidence — the read to use when the request starts from an evidence item, but an empty page there is NOT proof of no findings: it cannot see annotation rows written before `evidenceVersion` joined the index key, so confirm with `assurance:ListAssessmentAnnotations` before telling the user an artifact is clean), then `assurance:GetAnnotation` for each row. To record a **reviewer note** (only when the user explicitly asks — confirm first), use `assurance:CreateComment` on the control, passing `taskId` to attach it to one task; there is no customer API that annotates a finding itself. Normal work is to help the user *close* evaluation tasks with `assurance:UpdateTask` (R6), not spawn duplicates.
8. **R8 — Report only what the evaluation produced.** You **MUST** state findings from `annotations`, `tasks`, and `outcomePercentage`, cite the `assessmentId` and journal record, and clearly separate authoritative evaluation results ("the assessment found…") from your own guidance ("I recommend…"). You **MUST NOT** fabricate a readiness status, because only the evaluation's output is authoritative; on `ERROR` or `USER_ERROR` there is **no** readiness status to report — say the control could not be assessed (not 0%) and read the journal for the cause: its `error` record gives the actual reason, so don't assume permissions. For `USER_ERROR` that cause is always something the customer owns and can act on — most often a missing scan permission or a misconfiguration, but it can also be something like throttling of the customer's own API calls, where the fix is to wait and re-run.
9. **R9 — Treat assessments as asynchronous.** You **MUST** poll `assurance:GetAssessment` / `assurance:ListAssessmentJournalRecords` after `assurance:StartAssessment` until the status is terminal; do not assume instant results. Terminal is **anything other than `SCHEDULED` / `IN_PROGRESS`** — including `ERROR`, `USER_ERROR`, and any status you don't recognise (the set is open) — so stop polling on those rather than waiting for a score that will never arrive.
10. **R10 — Paginate.** You **MUST** follow `nextToken` on List operations for complete data; `maxResults` and the `context` length are enforced by the API, so let the service validate rather than hardcoding limits.

## Usage

Use this skill when the user wants to:

- Run or review a compliance **assessment** on a control, or check a compliance **grade** / gap (`outcomePercentage`, `NEEDS_ATTENTION`).
- Guide the user to **upload** (via the AWS CLI) or **reference** evidence for a control, and wire it into an assessment.
- Track an assessment's **live progress**, or read its **findings** (annotations) and **remediation tasks**.
- **Close** (complete) a remediation task, or add a **comment**.
- Set up a **project**, **discover** in-scope resources, **enable** a framework (PCI DSS, SOC 2, NIST, CIS), or **author a custom** framework.

## Core Concepts

### Mental model

Assurance evaluates compliance **asynchronously**. `assurance:StartAssessment` queues an automated evaluation that gathers context, scans the customer's AWS account and/or analyzes uploaded documents, and finalizes a readiness status — producing a **journal** (progress timeline), **annotations** (per-evidence findings), **tasks** (remediation items), and a **result** with an **outcomePercentage** (the readiness score). You orchestrate the APIs and interpret the output; you do not score controls.

### Resource hierarchy

```
Environment  (compliance workspace; environmentArn)
└── Project  (a scoped set of AWS resources, for example, "payments-prod")
    ├── Enabled Frameworks  (managed framework version, or a CUSTOM framework)
    │   └── Controls  (groups like "A.2" → leaf controls like "A.2.3")
    │       └── Assessments  (one run of evaluating a control; assessmentId)
    │           ├── Journal records  (live progress timeline)
    │           ├── Annotations      (per-evidence findings; evidenceId+version)
    │           └── Tasks            (remediation items)
    └── Evidence  (uploaded docs / scan output; project-scoped)
```

### Composite keys — carry these together

Almost every operation is addressed by a composite key. Resolve each from the API (R1) and pass them consistently:

| Field | Required by | Notes |
|---|---|---|
| `environmentArn` | everything | Full ARN or bare environment ID. |
| `project` | most data ops | Starts with an alphanumeric character. |
| `framework` | controls/assessments/tasks | Managed frameworks are `AWS:`-prefixed (for example, `AWS:PCI-DSS`, `AWS:NIST-CSF`, `AWS:SSAE-18-SOC-2`); custom use your own id (not `AWS:`). The version is a separate field — never fold it into the id. |
| `frameworkVersion` | controls/assessments/tasks | For example, `2022`, `8.1`. |
| `controlId` | control-scoped ops | For example, `A.2.3`, `AC-2(1)`, `2.1.1`. A leaf control, **not** a control group (groups are bare section numbers — see `ListControlGroups`) and **not** a task/requirement id: strip any `-R{n}`/`-DOC` suffix, so task `2.1.1-R1` → control `2.1.1`. |
| `assessmentId` | annotations / journal / GetAssessment (optional for tasks) | Returned by `assurance:StartAssessment`. |

### Assessment status

| Status | Meaning |
|---|---|
| `SCHEDULED` | Queued, not yet running. |
| `IN_PROGRESS` | Evaluation running. |
| `NEEDS_ATTENTION` | Terminal and actionable — open (`OPEN`/`PENDING`) tasks remain; not a confirmed deficiency (for example, evidence missing/inaccessible). Re-supply evidence or remediate, then re-run. |
| `FINISHED` | Terminal and met — nothing left to remediate. |
| `NOT_APPLICABLE` | Terminal — the control does not apply to this scope. |
| `ERROR` | Terminal and unscored — the run itself failed for a system, unknown, or mixed cause (not a compliance result). Read the journal; the fix is usually to retry. |
| `USER_ERROR` | Terminal, unscored, and **customer-actionable** — a fatal, customer-owned problem stopped the run entirely (most often a missing scan permission or a misconfiguration; sometimes throttling of the customer's own API calls, where the fix is to wait and re-run). Not a readiness result and **not** a 0% score: no readiness status exists. Read the journal's `error` record for the actual reason — `missingPermission`/`failedApi` name the exact fix when it is a permission — then re-run. |

`assurance:GetAssessment` returns `status`, `outcomePercentage`, and a structured `result` — read `result` for the reason. There is no `assessmentOutcome` field; `outcomePercentage` is the readiness score. The service evolves quickly and this status list is **open, not closed**, so **rely on the live `status` / `result`, not assumptions** — treat any status you don't recognise as terminal and unscored, and stop polling it (R9).

**Unscored statuses.** `ERROR` and `USER_ERROR` carry no `outcomePercentage` and no readiness status — never report either as 0% or as a failing grade (R8). The difference between them is ownership: `ERROR` is a system, unknown, or mixed-cause failure (retry, escalate if it persists), while `USER_ERROR` is entirely inside the customer's control (act on what the journal's `error` record names — grant the permission, fix the configuration, or simply wait if the run was throttled — then re-run). `NOT_APPLICABLE` is also unscored, but it *is* a settled answer.

**`USER_ERROR` is only for fatal, nothing-assessable failures.** A *partial* customer-caused problem — some scan targets denied, one document unreadable — does **not** become `USER_ERROR`: the run completes on the evidence it could use and returns `NEEDS_ATTENTION`, recording the parts it could not assess as requirements/tasks. So the ordinary "your permissions are incomplete" case is `NEEDS_ATTENTION`.

Generally `NEEDS_ATTENTION` carries open (`OPEN`/`PENDING`) tasks. Closing a task does **not** change the readiness status — the evaluation re-derives findings and tasks from the evidence on each run, so re-running with the gap still open returns `NEEDS_ATTENTION` and re-opens the same tasks. Reaching `FINISHED` requires evidence that satisfies the requirements. Re-run with the **control** id, not the task id (`2.1.1-R1` → `2.1.1`), and note the re-run returns a **new** `assessmentId` — that holds for every terminal status, `USER_ERROR` and `ERROR` included; the previous run is left as history and nothing is reset in place.

### Discovery order

`assurance:ListEnvironments` → `assurance:ListProjects` → `assurance:ListEnabledFrameworks` (else `assurance:ListFrameworks` to choose) → `assurance:ListControlGroups` → `assurance:ListControls` (requires a group id from the previous step) → `assurance:GetControl` → `assurance:ListAssessments`.

## Core workflows

Top-down lifecycle: **set up a project → scope it (framework + resources) → provide evidence → assess a control → read and remediate → keep it assessed.**

### A. Set up a project safely (R2)

`assurance:ListProjects` first. If the name exists → reuse it and tell the user (never `assurance:CreateProject` over an existing name — it can disrupt existing assessments/evidence). If not → confirm the name, then `assurance:CreateProject`.

### B. Scope it: enable a framework

- **Enable a framework:** `assurance:ListFrameworks` (managed options) → `assurance:EnableFramework` for the project → `assurance:ListEnabledFrameworks` to confirm `framework` + `frameworkVersion`.
- **Custom framework (advanced):** author control groups/controls/workflows, then `assurance:PublishFramework`. Publishing freezes its groups and controls; to change a published framework, create a new framework version. See `references/custom-frameworks.md`.

### C. Provide evidence — the user uploads via CLI; you never call `assurance:PutEvidence` (R3)

Evidence writes to the customer's compliance record, so it is always the **user's** action. Your job: give the exact command, wait for confirmation, then discover and reference the resulting IDs.

**1. Give the user the upload command** (direct upload → `assurance://…`, or reference an existing S3 object):

```
aws assurance put-evidence --environment-arn ENV_ARN_OR_ID --project PROJECT \
  --title "ai-policy.pdf" \
  --content fileb:///path/to/ai-policy.pdf --content-mime-type application/pdf
# ...or reference an object under a registered S3 evidence source:
aws assurance put-evidence --environment-arn ENV_ARN_OR_ID --project PROJECT \
  --title "ai-policy.pdf" --reference s3://SOURCE_BUCKET/path/ai-policy.pdf
```

- `--title` is the stored **filename**: on a direct upload it is required and must end in a supported extension matching the bytes; on a reference it defaults to the document's file name, which must pass the same name and extension rules. The `assurance://…` id is derived from it (a slug-safe title like `ai-policy.pdf` yields `assurance://ai-policy.pdf`); there is no `--name` flag.
- `--content` (`fileb://…`) and `--reference` are **mutually exclusive**. An `s3://…` reference must sit under a registered S3 evidence source, and a GitHub or SharePoint reference needs a connection to that provider (both below).
- **Only `assurance://`, `s3://`, `github://` and `sharepoint://` evidence are sources you suggest or reference — no other source.** A new version comes from re-uploading the same file or `evidenceId` with new content.

**2. Wait for confirmation, then discover IDs.** `ListEvidence { environmentArn, project }` → use the returned `evidenceId` values (never invent them).

**3. Reference in the assessment (R4).** Put the evidence's `assurance://…`, `s3://…`, `github://…` or `sharepoint://…` token in `assurance:StartAssessment`'s `context`, for example, `"Evaluate against assurance://ai-policy.pdf. Focus on the incident-response section."`

**Link evidence to controls.** Attach evidence to the controls it supports with `--control-references` on `put-evidence`, or afterwards by having the user run `aws assurance update-evidence`, which adds/removes control links **without creating a new version** (and also edits metadata); once the evidence has passed its scan, a link change re-assesses the controls it adds or removes. `UpdateEvidence` is not one of your MCP tools, so link at upload time where you can.

**External S3 evidence source (for `--reference`).** `--reference s3://…` only resolves if the bucket is a registered evidence source. The user registers one (a one-time setup step) with `aws assurance create-environment-connection`, whose input is `{ environmentArn, providerConfig: { s3: { sourceUri: "s3://BUCKET/PREFIX", expectedBucketOwner } } }`; then `--reference` objects under that prefix resolve. `CreateEnvironmentConnection` is not one of your MCP tools.

**GitHub and SharePoint documents (for `--reference`).** `--reference` also takes the URL of a GitHub file, or any link to a SharePoint document (a sharing link works), once the user has connected GitHub or SharePoint to the environment: in the console, or with `aws assurance create-environment-connection` and then the `authorizationUrl` it returns, opened in a browser to approve access. If the environment has more than one connection to that provider, add `--connection-id` (from `aws assurance list-environment-connections`). The evidence then has a `github://…` or `sharepoint://…` id.

### D. Run an assessment on a control

```
1. Orient (R1): ListEnvironments → ListProjects → ListEnabledFrameworks → ListControlGroups → ListControls → GetControl
2. Evidence (document/hybrid controls): provide it first (Section C). Automated-scan
   controls usually need none — the account is scanned directly; use context for guidance.
3. StartAssessment { environmentArn, project, framework, frameworkVersion, controlId,
                     context: "<evidence URI tokens> + guidance" }  -> assessmentId, IN_PROGRESS
4. Poll (R9): GetAssessment + ListAssessmentJournalRecords until terminal.
5. Interpret (R8): ListAssessmentAnnotations then GetAnnotation, plus ListTasks -> report findings, help remediate.
```

### E. Track progress and read results

`assurance:ListAssessmentJournalRecords` = live human-readable timeline; `assurance:ListAssessmentAnnotations` = which evidence carries a finding for ONE assessment, `assurance:ListEvidenceAnnotations` = which assessments found something about ONE evidence version (both return summaries only — call `assurance:GetAnnotation` per entry for the finding itself); `assurance:ListTasks` = remediation items (task `status`: `OPEN`/`PENDING` = to do, `COMPLETED` = remediated (R6), `CANCELLED`). Parsing all three: `references/reading-assessment-progress.md`.

### F. Maintain compliance continuously (Daily and Continuous modes)

Compliance is ongoing, not one-shot, and the service owns the recurrence — there is no API to create, change, list, or delete an assessment schedule. Each framework enablement in a project has an `assessmentMode`, and it decides how that framework is re-assessed:

- `SCHEDULED` (Daily in the console; the default when `assurance:EnableFramework` omits the mode) — a framework-level assessment runs once a day.
- `CONTINUOUS` (Continuous in the console) — no daily run. The service starts a control-level assessment for each affected control when it detects a change: an in-scope resource change for `automated-scan` and `hybrid` controls (`workflowType`), or a change to the evidence linked to any control (linking or unlinking a control on evidence, or deleting evidence). A resource change never triggers a `document` control. Rapid changes to the same control are consolidated by a cooldown of about 10 minutes, and a change older than the control's last completed assessment triggers nothing.

The mode is per framework per project, so one project can run one framework Daily and another Continuous. To switch, call `assurance:EnableFramework` again with the other mode — it updates the enablement in place and takes up to about 5 minutes to apply. Pass `assessmentMode` only when the user asks for a mode. `assurance:DisableFramework` stops all automatic runs (confirm first — R5).

Every automatic run, daily or change-triggered, yields the same journal / annotations / tasks / `outcomePercentage` as a manual run: find them with `assurance:ListAssessments`, monitor for `NEEDS_ATTENTION`, and drive remediation (R6) between runs. In Continuous mode, a user's fix to a resource or to linked evidence re-assesses the control on its own; use `assurance:StartAssessment` when the user wants a result now, or in Daily mode before the next run.

## Worked example — take a control from gap to met

1. **Orient (R1):** `assurance:ListEnvironments` → pick the env; `assurance:ListProjects` → `payments-prod`; `assurance:ListEnabledFrameworks` → `AWS:SSAE-18-SOC-2` `Oct-2023`; `assurance:ListControlGroups` → `CC6`; `assurance:ListControls` for `CC6` → `GetControl CC6.1` (a `hybrid` control — scanning plus documents).
2. **Evidence (R3):** the control needs an access-control policy. Give the user `aws assurance put-evidence --environment-arn … --project payments-prod --title "access-control-policy.pdf" --content fileb:///path/access-policy.pdf --content-mime-type application/pdf`; after they confirm, `assurance:ListEvidence` → `assurance://access-control-policy.pdf`.
3. **Assess:** `StartAssessment { …, controlId: "CC6.1", context: "Evaluate against assurance://access-control-policy.pdf. Focus on least-privilege and quarterly access reviews." }` → `assessmentId`, `IN_PROGRESS`.
4. **Poll (R9):** `assurance:GetAssessment` / journal → `NEEDS_ATTENTION`, `outcomePercentage` 60, one open task.
5. **Interpret (R8):** `assurance:ListTasks` → "policy lacks a quarterly access-review requirement"; `assurance:ListAssessmentAnnotations` → `assurance:GetAnnotation` → the exact evidence gap. Report this and cite the `assessmentId`.
6. **Remediate (R6):** guide the user to fix the policy and re-upload evidence; verify the fix; `UpdateTask → COMPLETED`.
7. **Re-assess:** `assurance:StartAssessment` again → a new `assessmentId`; poll it. If the evidence now satisfies every requirement the run reaches `FINISHED` with `outcomePercentage` 100; if a gap remains it returns `NEEDS_ATTENTION` and re-raises the tasks for what is still missing. Report the result, citing the new `assessmentId`.

## Common Mistakes

| Symptom | Cause | Fix |
|---|---|---|
| Assessment seems to hang | You didn't poll; it's async | Poll `assurance:GetAssessment`/journal until terminal (R9) |
| Still polling a run that already stopped | Treated only `FINISHED`/`NEEDS_ATTENTION` as terminal, or didn't recognise the status | `ERROR`, `USER_ERROR`, `NOT_APPLICABLE` and any unrecognised status are terminal — stop polling (R9) |
| `ERROR` result | The run failed for a system/unknown/mixed cause — not a grade | Read the journal's `error` record; re-run, and escalate if it repeats |
| `USER_ERROR` result | The run couldn't complete at all because of a customer-owned problem (usually permissions/configuration, sometimes customer-side throttling) — not a grade | Read the journal's `error` record for the reason (`missingPermission`/`failedApi` when present); have the user fix it, or wait if it was throttled, then re-run |
| Reported an errored run as a 0% score | `ERROR`/`USER_ERROR` are unscored — there is no readiness status | Say the control could not be assessed and give the reason (R8) |
| Called a partial permissions gap `USER_ERROR` | `USER_ERROR` is only for fatal, nothing-assessable failures | A run that used the evidence it could read is `NEEDS_ATTENTION` — remediate and re-run |
| "evidence not found" fails the run | Referenced an ID in `context` that isn't uploaded/resolvable (fail-closed) | Confirm via `assurance:ListEvidence`; only reference real IDs (R4) |
| Uploaded doc wasn't evaluated | Its `assurance://…` token wasn't in `context` | Add the token to `assurance:StartAssessment` `context` (R4) |
| Grade didn't move after "fixing" | Task marked `COMPLETED` without a real, verified fix, or no re-assessment | Verify remediation, then re-run (R6) |
| Lost existing assessments/config | `assurance:CreateProject` on an existing name | Always `assurance:ListProjects` first; reuse (R2) |
| Called the `assurance:PutEvidence` tool | Evidence upload is the user's deliberate CLI action | Give the user the `aws assurance put-evidence` command; discover IDs with `assurance:ListEvidence` (R3) |

## Reference files

Load on demand — do not read all up front.

| File | Read it when |
|---|---|
| `references/data-model.md` | You need exact ID patterns, status/enum values, the hierarchy, or validation rules. |
| `references/api-reference.md` | You need precise parameters/outputs for a specific `assurance` tool. |
| `references/workflows.md` | You are running an assessment, setting up a project, discovering resources, enabling a framework, or handling evidence. |
| `references/reading-assessment-progress.md` | You need to parse the journal, annotations, tasks, or result. |
| `references/custom-frameworks.md` | The user wants to author a custom framework, control group, control, or workflow. |
```

## api-reference.md
<a name="mcp-skill-api-reference"></a>

Parameters and outputs for each `assurance` tool.

### api-reference.md
<a name="mcp-skill-api-reference-file"></a>

```
# Assurance MCP Tool Reference

Per-tool parameters and outputs for the `assurance` MCP tools you have. Common
key fields (`environmentArn`, `project`, `framework`, `frameworkVersion`,
`controlId`, `assessmentId`) are described in `SKILL.md` and `data-model.md`;
this file lists what each tool specifically needs and returns.

Conventions:
- **Required** fields are marked `*`. Everything else is optional.
- All list tools except `ListTagsForResource` accept `maxResults` (1–1000) and
  `nextToken`, and return `nextToken` for paging.
- "keys" = the composite key fields a tool needs (see each section).
- Tool names are shown bare here for readability; when **invoking** a tool,
  use the fully qualified `assurance:<Tool>` form (SKILL.md).

---

## Environment

### GetEnvironment
- Input: `lookup*` — exactly one of `{ environmentArn }` or `{ domain }`.
- Output: full `Environment` (id, name, ARN, description, regions, evidence
  location, status, timestamps).

### ListEnvironments
- Input: `maxResults`, `nextToken`.
- Output: `environments` (summaries: id, name, ARN, status).

> Environment creation/update/deletion is administrator-provisioned and not part
> of this toolset.

---

## Projects

### CreateProject
- Input: `environmentArn*`, `project*`, `resourceFilters` (≤ 10 AWS Resource
  Explorer query strings).
- Output: `project`, `resourceFilters`.

### GetProject
- Input: `environmentArn*`, `project*`.
- Output: `project`, `resourceFilters`.

### ListProjects
- Input: `environmentArn*`.
- Output: `projects` (each with `project` name).

### UpdateProject
- Input: `environmentArn*`, `project*`, `resourceFilters`.

### DeleteProject
- Input: `environmentArn*`, `project*`. **Destructive** — confirm first.

---

## Discovered resources

### ListDiscoveredResources
- Input: `environmentArn*`, `project`, `accountId`, `maxResults`, `nextToken`.
- Lists the current in-scope resources: the resources that the project's
  resource filters select, or the whole environment when you omit `project`.
  `accountId` keeps only the resources in that AWS account.
- Output: `resourceIdentifiers` (each `{ resourceIdentifier, resourceType,
  accountId, region }`, where `resourceIdentifier` is the resource ARN),
  `nextToken`, and `coverage`.
- `coverage`: whether the environment's resource inventory has finished
  loading. `PARTIAL` means it is still loading after the environment was
  created, so the list can be missing resources that a later call returns.
  When it is absent, treat it as `COMPLETE`.
- A page can hold fewer than `maxResults` resources, or none, and still return
  `nextToken`. Page until `nextToken` is absent before you conclude that a
  project has no resources.
- An `automated-scan` or `hybrid` assessment whose project or control can't be
  found ends in a terminal error status — `USER_ERROR`, or `ERROR` on older
  runs — with `reason: NoResources` and the message "We could not find the
  resources in scope for this assessment. Check that the project and control
  exist, then re-run the assessment." A control with no in-scope resources of
  its target type is `NOT_APPLICABLE`, not an error.

---

## Frameworks

### ListFrameworks
- Input: `environmentArn*`, `type` (`MANAGED` | `CUSTOM`; omit for both).
- Output: `frameworks` (summaries: type, name, version, title, status).

### GetFramework
- Input: `environmentArn*`, `framework*`, `frameworkVersion*`.
- Output: full `Framework`.

### CreateFramework (custom only)
- Input: `environmentArn*`, `framework*` (must **not** start with `AWS:`),
  `frameworkVersion*`, `title`, `description`. Created as `PENDING`.

### UpdateFramework / DeleteFramework (custom only)
- `UpdateFramework`: mutable `title`/`description` only (not name/version).
  Still allowed after publishing.
- `DeleteFramework`: refused with `ConflictException` while the framework is
  enabled for any project (disable it first). A published (`ACTIVE`) framework
  is deleted together with its control groups and controls; if the request
  fails partway, retry it to finish the deletion. A framework that is not
  `ACTIVE` must be empty (no groups/controls), or it fails with
  `ConflictException`. When the environment has projects, the call returns once
  the framework is marked for deletion, and the framework's assessment history
  in every project is then deleted in the background; from that point every
  operation treats the framework as gone. **Destructive.**

### PublishFramework (custom only)
- Input: `environmentArn*`, `framework*`, `frameworkVersion*` (no `project`). Transitions `PENDING` → `ACTIVE`. Required before a custom
  framework can be enabled.
- A framework with no controls cannot be published (`ValidationException`).
- Publishing freezes the framework's contents and cannot be undone. On an
  `ACTIVE` framework, `CreateControlGroup`, `UpdateControlGroup`,
  `DeleteControlGroup`, `CreateControl`, `UpdateControl`, and `DeleteControl`
  fail with `ConflictException` (deleting a group or control that no longer
  exists still succeeds). To change a published framework, create a new
  version with `CreateFramework` (same `framework`, new `frameworkVersion`):
  it starts as an empty `PENDING` draft, so add its groups and controls, then
  publish it.

### EnableFramework
- Input: `environmentArn*`, `framework*`, `project*`, `frameworkVersion`,
  `assessmentMode`.
- `assessmentMode` sets how the enabled framework is re-assessed: `SCHEDULED`
  (the default when omitted — a daily, server-owned schedule) or `CONTINUOUS`
  (re-assessed on resource changes; see SKILL.md §F). Pass it only when the
  user asks for a mode. Calling again with the other mode switches it.
- Output: enablement record (environment, framework, version, project, type,
  and `assessmentMode`).

### DisableFramework
- Input: `environmentArn*`, `framework*`, `frameworkVersion*`, `project*`.
  Also clears project-scoped scan-plan overrides. **Destructive** — confirm.

### ListEnabledFrameworks
- Input: `environmentArn*`, `project`, `filters`. Pass `project` as a top-level
  **query selector** — it narrows which partition is read, and it is what
  project-scoped permissions are enforced against. There are no top-level
  `framework` / `frameworkVersion` members; every criterion other than the
  project goes in `filters`.
- `filters`: `{ name, values }` criteria. Names are `framework`,
  `framework-version` and `type`. Values within one criterion are OR'ed, criteria
  naming different attributes are AND'ed, and matching is exact equality.
- A **single-valued** `project` criterion whose value fits `ProjectName` is
  accepted and selects the same enabled frameworks as the member, but prefer the
  member: only the member carries the `ProjectName` length and pattern
  constraints, and only the member is read by the project-scoped permission
  checks, so scoping through `filters` alone leaves the call authorized against
  the whole environment. Supplying both is accepted and they are AND'ed, so
  disagreeing values select nothing.
- A `project` criterion that is **multi-valued**, or that carries a value the
  member could not, is **not** equivalent to the member: it stays a response
  filter over the whole environment, matched by the same OR / exact-equality rules
  as any other criterion. Several values therefore return the union across those
  projects — which the member cannot express — and a value nothing matches just
  contributes no rows. The criterion is kept for compatibility only and is slated
  for removal, so prefer the member for new calls.
- A page narrowed by response filters is backfilled from at most 50 backing pages,
  so an **empty page with a `nextToken` does not mean there are no matches** —
  page until no `nextToken` is returned rather than stopping at the first empty
  response.
- Output: `enabledFrameworks` (framework, version, project, type, and
  `assessmentMode`). `createdAt` and
  `updatedAt` are modeled but never populated by the service, so do not rely on
  them — and correspondingly neither is a `filters` name.

---

## Controls

Controls form **two levels**: control **groups** (sections, for example, CIS `1 - Identity
and Access Management`) and the leaf **controls** inside them (for example, `1.11`). The
two levels are separate operations, and `ListControls` lists the children of **one
group** — it is not a flat list of every control in the framework.

Discovery order is therefore: `ListControlGroups` → pick a group's `controlId` →
`ListControls` with that value as `controlGroupId`.

### ListControlGroups
- Input: `environmentArn*`, `framework*`, `frameworkVersion*`.
- Output: `controlGroups` — each a summary with `controlId` (**the group id**),
  `title`, `description`, `framework`, `frameworkVersion`, `type`.
- The group `controlId` is a bare section number (`1`, `2`, `3`), not a dotted
  control id. Start here when you do not already know the group.

### ListControls
- Input: `environmentArn*`, `framework*`, `frameworkVersion*`, `controlGroupId*`.
- Output: `controls` — summaries with `controlId`, `title`, `description`, `type`,
  `workflowType`, `status`.
- `controlGroupId` is **required**, and it takes a **group** id from
  `ListControlGroups` — the field is named `controlId` in that response. Passing a
  leaf control id such as `1.11` returns
  `ResourceNotFoundException: Control group not found`, because `1.11` is a control
  inside group `1`, not a group. To fetch a single leaf control, use `GetControl`.

### GetControlGroup
- Input: `environmentArn*`, `framework*`, `frameworkVersion*`, `controlId*` (the
  group id).
- Output: `controlGroup`.

### GetControl
- Input: `environmentArn*`, `framework*`, `controlId*`, `frameworkVersion*`.
- Output: `control` — `controlId`, `title`, `description`, `type`, `framework`,
  `frameworkVersion`, `groupId`, `requirements`, `workflowType`, `controlIntents`,
  `status`, `createdAt`, `updatedAt`.

### Custom control authoring (custom frameworks only)
- Drafts only: on a published (`ACTIVE`) framework the operations below refuse
  changes with `ConflictException` (deleting a group or control that no longer
  exists still succeeds). See PublishFramework for the new-version path.
- `CreateControlGroup`: keys + `controlId*` (group id, for example, `A.1`) + `title*` +
  `description` + `displayOrder`.
- `CreateControl`: keys + `controlId*` + `title*` + `parentControlId*` (the
  group the control belongs to; create it with `CreateControlGroup` first) +
  `description` + `requirements` + `displayOrder` +
  `workflowType` (`automated-scan` | `document` | `hybrid`) +
  `controlIntents` (for automated-scan/hybrid).
- `UpdateControl` / `UpdateControlGroup`: same keys; only supplied fields change.
  `UpdateControl`'s `parentControlId` moves the control to another group; omit
  it to keep the current group. A control cannot be taken out of its group, and
  an update to a control that has no group is accepted only if it names one.
- `DeleteControl` / `DeleteControlGroup`: keys + `controlId*`. Groups must be
  empty. Deleting one that no longer exists succeeds. **Destructive.**
- **Control workflow** is the `workflowType` field on the control — there are
  **no** `*ControlWorkflow` operations and no nested `workflow` object. Set it via
  `CreateControl` or `UpdateControl` (`workflowType`, `controlIntents`,
  `requirements`); read it via `GetControl`. See `custom-frameworks.md`.

---

## Evidence

> **Per SKILL.md R3, you never call `PutEvidence` yourself**, even though it is
> one of the listed MCP tools. Evidence upload writes to the customer's
> compliance record and is always the user's action: give them the exact
> `aws assurance put-evidence` CLI command (see `workflows.md` §5), then discover
> the resulting id with `ListEvidence` and reference it in `StartAssessment`
> `context`. The `PutEvidence` shape below is documented so you can construct the
> correct CLI command and read results.

### PutEvidence (user runs this via the AWS CLI — you do not call it)
- Fields: `environmentArn*`, `project*`, and **exactly one** of `content` (raw
  bytes, ≤ 10 MB) **or** `reference` (`s3://{bucket}/{key}` under an S3 evidence
  source registered with `CreateEnvironmentConnection`, read with the caller's
  own credentials; or the URL of a GitHub file or any link to a SharePoint
  document, read through a GitHub or SharePoint connection on the environment).
  Optional: `title` (required with `content`; with `reference` it defaults to
  the document's file name), `description`,
  `contentMIMEType`, `evidenceId` (supply to upload a new **version** of
  existing evidence), `controlReferences` (link the evidence to controls at upload
  time; each entry is `{ framework, frameworkVersion, controlId }`, all three
  required — on the CLI, `--control-references
  'framework=AWS:CIS-AWS-Benchmark,frameworkVersion=1.4,controlId=1.1'`),
  `linkMode` (`AUTO`, the default for control evidence, or `MANUAL`;
  `DISABLED` is a value you may read back, never one a caller can set),
  `purpose` (`CONTROL_EVIDENCE`, the default, or
  `FRAMEWORK_SOURCE`; only `CONTROL_EVIDENCE` evidence can carry control links,
  `SCAN_EVIDENCE` is set only by the service, and a new version cannot change
  the purpose), and `connectionId` (the connection to read `reference` through,
  from `aws assurance list-environment-connections`; needed only when the
  environment has more than one connection to that provider).
- **`title` is the filename and is strictly validated**, the defaulted title of a
  reference included: ≤ 255 chars; no `..`, `/`, `\`, or null bytes (and, on a
  direct upload, no `#`); and it
  **must end in a supported extension** (a title with no extension is treated as
  `.txt`). On a direct upload the title is required and the extension must also
  match the actual file content. Supported extensions: `pdf, doc, docx, xls,
  xlsx, csv, png, jpg, jpeg, txt, json, md, xml, html, tf, hcl, yaml, yml` (`gif`
  is no longer accepted), so a referenced object whose name has another extension
  needs a valid `--title`.
  Content with active/unsafe payloads (macros, PDF JavaScript, CSV formulas, HTML
  scripts, XML DOCTYPE, hidden Unicode, oversized/polyglot images) is rejected.
- The evidence id is derived from `title`, so every direct upload gets an
  `assurance://…` id to reference in `StartAssessment` `context`.
- Output: `evidenceId` and `version` only. Read the rest — `checksum`, `status`,
  `reference`, `linkedControls`, timestamps — back with `GetEvidence`.
- Full rules + the extension table are in `workflows.md` §5.

### UpdateEvidence
- Input: `environmentArn*`, `project*`, `evidenceId*`; optional `title` /
  `description` (metadata), `addControlReferenceLinks` /
  `removeControlReferenceLinks` (each a list of `{ framework, frameworkVersion,
  controlId }`, all three required — on the CLI,
  `--add-control-reference-links 'framework=AWS:CIS-AWS-Benchmark,frameworkVersion=1.4,controlId=1.1'`),
  `linkMode` (`AUTO` runs an automatic linking analysis on the latest version,
  which adds links and removes none; omitted or `MANUAL` runs none). There is no
  `reanalyze` member.
- Adding links (or `linkMode` `AUTO`) is refused on evidence whose `purpose` is
  not `CONTROL_EVIDENCE`; removing links is always allowed. A removed link is
  not re-added by automatic linking.
- `ConflictException` means the evidence changed or was deleted concurrently,
  or, with `linkMode` `AUTO`, it is still being scanned or an analysis run is in
  progress; retry later. `AUTO` on `QUARANTINED` or `SCAN_FAILED` evidence is a
  `ValidationException`.
- Updates evidence **metadata** and **manages control links (add/remove)**
  **without creating a new version**; once the evidence has passed its scan,
  adding or removing a link re-assesses those controls against the document. This is how you link
  already-uploaded evidence to the controls it supports post-upload (use
  `--control-references` on the upload itself to link at upload time).
- Returns an empty body; read the result back with `GetEvidence`.
- **Not one of your MCP tools** — the user runs `aws assurance update-evidence`.
  It is documented so you can construct that command.

### GetEvidence
- Input: `environmentArn*`, `project*`, `evidenceId*`, `evidenceVersion` (omit for latest).
- Output: metadata incl. `status` (`EvidenceStatus`), `checksum`, `reference`.

### GetEvidenceContent
- Input: `environmentArn*`, `project*`, `evidenceId*`, `evidenceVersion` (omit for latest).
- Output: `content`, `contentType`, `title`, `checksum`, `version`.
- `IntegrityException` means the stored content failed its checksum check, or the
  referenced source changed since that version was recorded.

### ListEvidence
- Input: `environmentArn*`, `project*`, `filters`. `project` is a **required
  query selector** — it picks which evidence partition is listed, and is **not**
  one of the `filters` names.
- Output: `evidence` (summaries: id, version, title, project, timestamps,
  `status`, `linkedControls`, `uploadedBy`, `purpose`, `linkMode`,
  `lastAutoAnalysisStartedAt`, and `connectionType` on reference evidence).
- `filters`: up to 20 `{ name, values }` criteria matched against the returned
  summaries. Names are `evidence-id`, `status`, `framework`,
  `framework-version`, `control-id`, `purpose` and
  `connection-type`. Values within one criterion
  are OR'ed, criteria naming different attributes are AND'ed, and matching is
  exact equality — no prefix or substring match. `framework`,
  `framework-version` and `control-id` match against a summary's
  `linkedControls`, and each criterion is evaluated independently, so
  `framework` + `control-id` do **not** require one single linked control to
  carry both. Keep the criteria identical while paging; changing them while
  passing a `nextToken` is a `ValidationException`.

### DeleteEvidence
- Input: `environmentArn*`, `project*`, `evidenceId*`. **Destructive** — confirm.

---

## Assessments

### StartAssessment
- Input: `environmentArn*`, `framework*`, `frameworkVersion*`, `project*`,
  `controlId` (omit → **framework-level**: no `assessmentId` is returned and the
  assessments it schedules start as `SCHEDULED`; provide → **control-level**: an
  `assessmentId` is returned and that assessment starts as `IN_PROGRESS`. Must be a
  leaf control id such as `2.1.1` — not a task/requirement id like `2.1.1-R1`, which
  fails with `ResourceNotFoundException: Control not found`), `context` (≤ 2000 chars — embed evidence URIs + guidance; see
  SKILL.md "evidence + context").
- Output: `assessmentId` **only** — null for a framework-level start. The call
  does not echo the status or context, so read them back with `GetAssessment`
  (control-level) or `ListAssessments` (framework-level).
- Behavior for control-level: if the latest assessment is already `IN_PROGRESS`
  it is returned as-is (no duplicate run). From any terminal status a **new
  assessment with a new `assessmentId`** is created — nothing is reset in place.
  So re-calling `StartAssessment` is how you re-run a control, and you must carry
  the returned id forward.

### GetAssessment
- Input: `environmentArn*`, `framework*`, `frameworkVersion*`, `controlId*`,
  `project*`, `assessmentId*`.
- Output: `status`, `result` (structured findings JSON), `outcomePercentage`,
  `context`, timestamps.

### ListAssessments
- Input: `environmentArn*`, `project*`, `filters`. `project` is a **required
  query selector** — it picks which partition is read, and it is what
  project-scoped permissions are enforced against. There are no top-level
  `framework` / `frameworkVersion` / `controlId` members; every other criterion
  goes in `filters`.
- `filters`: `{ name, values }` criteria. Names are `framework`,
  `framework-version`, `control-id`, `assessment-id` and `status`. Values within
  one criterion are OR'ed, criteria naming different attributes are AND'ed, and
  matching is exact equality. Each criterion stands alone — `control-id` may be
  supplied without `framework`. Because matching is exact, `status=ERROR` does
  **not** return `USER_ERROR` runs (or vice versa) — pass both values to catch
  every run that produced no readiness status.
- Output: `assessments` (summaries: id, framework, version, controlId, project,
  status, outcomePercentage, createdAt). **Not sorted** — do not assume the first
  entry is the newest; compare `createdAt` yourself, and scope with `project` and
  `filters` rather than paging (a busy environment fills page 1 with other
  projects).

### UpdateAssessment (internal — never call it)
- An internal operation the evaluation uses to write `status`, `result` and
  `outcomePercentage`; it is not a customer API. Do not call it, even if a tool
  by that name is listed, and do not suggest a CLI command for it (SKILL.md R7).

### ListAssessmentJournalRecords
- Input: `environmentArn*`, `project*`, `framework*`, `frameworkVersion*`,
  `controlId*`, `assessmentId*`.
- Output: `records` — each `{ recordId, recordType, phase, createdAt, content,
  invocationId }`. `content` is a JSON string. See
  `reading-assessment-progress.md` for how to parse.

---

## Annotations

Annotations are findings the evaluation attaches to specific evidence — **the
evaluation authors them.** You read them (`ListAssessmentAnnotations` / `ListEvidenceAnnotations` /
`GetAnnotation`) and
cannot write them. For a
reviewer note, use `CreateComment` on the control (with `taskId` to attach it to
one task).

### ListAssessmentAnnotations
- Input: `environmentArn*`, `project*`, `framework*`, `frameworkVersion*`,
  `controlId*`, `assessmentId*` — all required; this lists the annotations of one
  assessment, so it cannot be called as a broad filter. There is no `evidenceId` or
  `evidenceVersion` input; those appear on each returned annotation.
- Output: `annotations` — summaries carrying only the keys plus `evidenceId` and
  `evidenceVersion`. The finding itself is **not** in the list response: call
  `GetAnnotation` with an entry's `evidenceId`/`evidenceVersion` to read `notes`
  (usually a structured JSON finding — see `reading-assessment-progress.md`).

### ListEvidenceAnnotations
- Input: `environmentArn*`, `project*`, `evidenceId*`, `evidenceVersion*` — all
  required. Lists what every assessment in the project found about **one version**
  of one piece of evidence; each row names the assessment that authored it. The
  version is required because it is part of the key this reads, so ask about one
  version at a time.
- Output: the same `annotations` summaries, and the same `GetAnnotation` follow-up
  for `notes`.
- **An empty result is not proof there are none.** This reads the versioned-evidence
  index, so annotation rows stored before the evidence version became part of that key
  are invisible here; `ListAssessmentAnnotations` can still return findings on the same
  evidence. Cross-check there before telling the user an artifact carries no findings.

### GetAnnotation
- Input: keys + `controlId*` + `assessmentId*` + `evidenceId*` + `evidenceVersion*`.
- Output: the annotation (`notes`, `createdAt`).


---

## Tasks

Tasks are remediation items **created by the Assurance evaluation** to record
each readiness gap. Your job is to help the user **close** them, not to add new
ones — so `ListTasks`, `GetTask`, and `UpdateTask` (to mark `COMPLETED`) are the
tools you use in normal compliance work. You cannot create tasks, so the
evaluation's task list is the only source of truth for what remains. To track
work the evaluation did not raise, use a comment (`CreateComment`) on the
control.

### ListTasks
- Input: `environmentArn*`, `project*`, `filters`. `project` is a **required
  query selector** — it picks which partition is read, and is **not** one of the
  `filters` names. Every other criterion goes in `filters`.
- Output: `tasks` (summaries incl. title, status, priority, dueAt, createdBy,
  and `assessmentId` — set only when an `assessment-id` criterion selected one
  assessment, absent otherwise). `dueAt` is null unless someone set it. Task ids
  repeat across re-runs of a control (`{controlId}-R{n}`), so when a control has
  been assessed more than once, scope by `assessment-id` to know which run's
  tasks you are reading.
- `filters`: `{ name, values }` criteria. Names are `framework`,
  `framework-version`, `control-id`, `task-id`, `status`, `priority` and
  `assessment-id`. Values within one criterion are OR'ed, criteria naming
  different attributes are AND'ed, and matching is exact equality.
- `assessment-id` is single-valued and lists one assessment's tasks; it requires
  `framework`, `framework-version` and `control-id` alongside it, since together
  with `project` they form the key it reads.
- `OPEN` and `PENDING` are the still-open states (a `status` criterion matches
  one at a time; to see all remaining work, exclude `COMPLETED`/`CANCELLED`).

### GetTask
- Input: keys + `controlId*` + `taskId*` (no `assessmentId`). Use before acting to
  read a task's current status and description.

### UpdateTask  (primary task action)
- Input: keys + `controlId*` + `taskId*` + any of `status`, `dueAt`, `priority`,
  `assessmentId`. There is no `assignee` member, and a task's `title` and
  `description` are the evaluation's, not editable through this call. Mark a task `COMPLETED` only once the
  gap is genuinely fixed. Closing a task does **not** move the readiness status: the
  evaluation re-derives its findings and its tasks from the evidence and scan
  results on every run, so a re-run with the underlying gap still present returns
  `NEEDS_ATTENTION` and re-opens the same `{controlId}-R{n}` tasks. Task status is
  bookkeeping for the user; `FINISHED` comes from evidence that satisfies the
  requirements.

### ListTaskHistory
- Input: keys + `controlId*` + `taskId*`.
- Output: `history` — change entries `{ comment, modifiedBy, updatedAt }`, newest first.

---

## Comments

Comments are free-text collaboration on a control (**your channel for notes** —
distinct from evaluation-authored annotations, which you cannot write).

- `CreateComment` / `UpdateComment` / `GetComment` / `DeleteComment` /
  `ListComments` — keyed by environment + project + framework + version +
  control (+ `commentId` for get/update/delete). The text is `content`
  (1–4096 chars). `CreateComment` takes an optional `taskId` to attach the
  comment to one task, and `ListComments` takes a `task-id` filter.

---

## Tags (read)

- `ListTagsForResource` — tags on a resource ARN.
```

## custom-frameworks.md
<a name="mcp-skill-custom-frameworks"></a>

Authoring a custom framework, control group, control, or workflow.

### custom-frameworks.md
<a name="mcp-skill-custom-frameworks-file"></a>

```
# Authoring Custom Frameworks

When the user wants their own framework (their internal policy set, a regulation
not yet provided as managed content, or a tailored control list), you author a
**custom** framework. Managed frameworks (PCI DSS, SOC 2, NIST, CIS) are
read-only — you enable them, you do not edit them.

## Lifecycle

```
CreateFramework (status: PENDING)
   → CreateControlGroup / CreateControl  (build the control tree)
   → set each control's workflow via CreateControl/UpdateControl (how it's evaluated)
   → PublishFramework (status: PENDING → ACTIVE; contents are now frozen)
   → EnableFramework  (turn it on for a project)
   → StartAssessment  (assess its controls, as in workflows.md)
```

A custom framework can only be **enabled** once it is `ACTIVE` (published), and a
control can only be assessed once its framework is enabled on the project.

Groups and controls can only be changed while the framework is an unpublished
draft. Once it is published (`ACTIVE`), `CreateControlGroup`, `UpdateControlGroup`,
`DeleteControlGroup`, `CreateControl`, `UpdateControl`, and `DeleteControl` fail
with `ConflictException` (deleting a group or control that no longer exists
still succeeds). To change a published framework, create a new version:
`CreateFramework` with the same `framework` and a new `frameworkVersion`. The new
version starts empty, so add its groups and controls, then publish it.

## 1. Create the framework

```
CreateFramework({
  environmentArn,
  framework: "acme-ai-policy",     // MUST NOT start with "AWS:"; pattern ^[a-zA-Z0-9][a-zA-Z0-9._:-]*$
  frameworkVersion: "1.0",
  title: "ACME AI Governance Policy",
  description: "Internal controls for responsible AI use at ACME",
})
// → Framework with type CUSTOM, status PENDING
```

`UpdateFramework` can later change `title`/`description` (not name/version),
also after publishing.
`DeleteFramework` is refused while the framework is enabled for any project. A
published framework is deleted together with its groups and controls (if the
request fails partway, retry it to finish); a draft must be empty (no
groups/controls). The framework's assessment history in every project goes with
it.

## 2. Build the control tree

Controls are hierarchical: **groups** contain **leaf controls**.

```
CreateControlGroup({
  environmentArn, framework: "acme-ai-policy", frameworkVersion: "1.0",
  controlId: "A.1", title: "Governance", description: "...", displayOrder: 1,
})

CreateControl({
  environmentArn, framework: "acme-ai-policy", frameworkVersion: "1.0",
  controlId: "A.1.1",
  parentControlId: "A.1",                 // required: the group it belongs to
  title: "AI usage policy exists and is reviewed",
  description: "...",
  requirements: [                          // the atomic, individually-scored checks
    { id: "A.1.1-R1", description: "A written AI usage policy exists" },
    { id: "A.1.1-R2", description: "The policy is reviewed at least annually" },
  ],
  displayOrder: 1,
})
```

Notes:
- `controlId` pattern allows parentheses for enhancement notation (for example, `AC-2(1)`).
- Give each requirement a stable `id` of the form `{controlId}-R{n}` — this is the
  id that findings, the assessment `result`, and remediation tasks key off.
- Every control belongs to a group: `parentControlId` is required on
  `CreateControl`. `UpdateControl` can move a control to another group but
  cannot take it out of its group.
- `UpdateControl`/`UpdateControlGroup` change only the fields you supply, and
  only while the framework is a draft.
- `DeleteControlGroup` requires the group to be empty.

## 3. Define the control workflow (how it is evaluated)

A control's evaluation workflow is the single **`workflowType`** field on the
control — there is no separate workflow operation and no nested `workflow`
object. Set it with `CreateControl` or `UpdateControl` (`workflowType`:
`automated-scan`, `document`, or `hybrid`) and read it back with `GetControl`.
The type decides how evidence is collected:

| `workflowType` | Evidence source | Provide |
|---|---|---|
| `document` | Uploaded documents | `requirements` — the evaluation prompts for documents and scores each requirement |
| `automated-scan` | The customer's AWS account | `controlIntents` (the evaluation derives the AWS checks) |
| `hybrid` | Combination | both of the above |

```
UpdateControl({
  environmentArn, framework: "acme-ai-policy", frameworkVersion: "1.0",
  controlId: "A.1.1",
  workflowType: "document",
  requirements: [
    { id: "A.1.1-R1", description: "An AI usage policy exists and is published." },
    { id: "A.1.1-R2", description: "The policy is reviewed at least annually." },
  ],
})
```

Beyond the composite keys — `environmentArn*`, `framework*`, `frameworkVersion*`,
`controlId*`, all required — the only content fields `CreateControl`/`UpdateControl`
accept are `title` and `parentControlId` (both required on create), `description`,
`requirements`, `controlIntents`, `workflowType`, and `displayOrder`. So
`workflowType` and `controlIntents` are the only workflow inputs available to you,
and `GetControl` returns only those two back.

How the evaluation runs a control is otherwise not customer-configurable. There is
no API field for a document prompt, a required-evidence list,
or per-requirement weighting, so guidance about what to upload belongs in the
requirement `description`. AWS-managed controls reject edits entirely.

### Automated-scan controls: controlIntents

For `automated-scan`/`hybrid` controls, the AWS checks are derived by the
evaluation from the control's `controlIntents` (set via `CreateControl`/
`UpdateControl`). There is no separate scan-plan operation.

## 4. Publish and enable

```
PublishFramework({ environmentArn, framework: "acme-ai-policy", frameworkVersion: "1.0" })
// status PENDING → ACTIVE; fails with ValidationException if the framework has no controls

EnableFramework({ environmentArn, framework: "acme-ai-policy",
                  frameworkVersion: "1.0", project: "payments-prod" })
```

Now the custom framework's controls can be assessed exactly like managed ones —
see `workflows.md` workflow 1.

## Tips

- Get requirement ids (`{controlId}-R{n}`) right before publishing. Findings,
  the result, and tasks key off them, and a published framework's groups and
  controls cannot be edited; such a change means a new framework version.
- Start with `document` controls (no AWS scanning needed) — they are the simplest
  to author and assess.
- Confirm `Delete*` operations with the user; they remove framework content.
```

## data-model.md
<a name="mcp-skill-data-model"></a>

ID patterns, status and enum values, the resource hierarchy, and validation rules.

### data-model.md
<a name="mcp-skill-data-model-file"></a>

```
# Assurance Data Model

The reference for the resource hierarchy, identifiers, enums, and validation
rules you need to address Assurance operations correctly.

## Resource hierarchy

```
Environment            compliance workspace (the top-level container)
└── Project            a named, scoped set of AWS resources
    ├── Enabled Framework   a framework version turned on for a project
    │   └── Control         a control group (for example, "A.2") or leaf control (for example, "A.2.3")
    │       └── Assessment  one evaluation run of a control (has assessmentId)
    │           ├── Journal record   progress/audit entry for the run
    │           ├── Annotation       finding attached to a piece of evidence
    │           └── Task             remediation item
    └── Evidence       uploaded document or scan output, scoped to the project
```

- **Frameworks and controls** are *defined* at the environment level (managed
  frameworks are global catalog content; custom frameworks belong to the
  environment). They become assessable only after being **enabled on a project**.
- **Evidence** is project-scoped, not assessment-scoped: it is uploaded to a
  project (by the user, via the AWS CLI — see SKILL.md R3), then referenced from
  an assessment via the `context` field.
- **Annotations and journal records** are assessment-scoped and require an
  `assessmentId`. **Tasks** are keyed by control and `taskId` (`GetTask` takes no
  `assessmentId`); an `assessment-id` filter on `ListTasks` selects one run's tasks.

## Identifiers and validation

All names are validated server-side. A value that fails the pattern is rejected
with a `ValidationException`.

| Identifier | Pattern / form | Notes |
|---|---|---|
| `environmentArn` | `arn:aws:assurance:{region}:{accountId}:environment/{id}` **or** bare `{id}` | The id segment matches `^[a-zA-Z0-9][a-zA-Z0-9-]*$`. A bare id resolves in the caller's own account. |
| `domain` (GetEnvironment) | lowercase domain prefix **or** a UUID | Alternative lookup key for `GetEnvironment`. |
| `ProjectName` | `^[a-zA-Z0-9][a-zA-Z0-9._-]*$`, len 1–256 | |
| `FrameworkName` | `^[a-zA-Z0-9][a-zA-Z0-9._:-]*$`, len 1–256 | Colon allowed (managed names use it). Custom names must **not** start with `AWS:`. |
| `FrameworkVersion` | `^[a-zA-Z0-9][a-zA-Z0-9._-]*$`, len 1–64 | Opaque string, for example, `1.0`, `2.2`. |
| `ControlID` | `^[a-zA-Z0-9][a-zA-Z0-9._()-]*$`, len 1–256 | Parentheses allowed for enhancement notation like `AC-2(1)`. A control id never carries a `-R{n}`/`-DOC` suffix — that is a task/requirement id. |
| `AssessmentId` | `^[a-zA-Z0-9][a-zA-Z0-9\-_]*$`, len 1–128 | Returned by control-level `StartAssessment`. |
| `evidenceId` | UUID **or** `assurance://…` / `s3://…` / `github://…` / `sharepoint://…` URI | Returned when evidence is uploaded: `assurance://` for a direct upload, `s3://` for an object under a registered S3 evidence source, `github://` or `sharepoint://` for a document read through a GitHub or SharePoint connection. |
| `TaskId` | len 1–256 | Convention: `{controlId}-R{n}`, `{controlId}-DOC` (see Tasks). |
| `dueAt` | ISO-8601 instant | Task deadline. Its UTC calendar date is the due date; a date-only deadline means `00:00:00Z` on that date. |

`maxResults` on every paginated list op (all but `ListTagsForResource`) is an
integer **1–1000**. List ops return an opaque
`nextToken`; pass it back unchanged to page.

## Enums

### AssessmentStatus
- `SCHEDULED` — queued, not started (framework-level start; `assessmentId` null).
- `IN_PROGRESS` — evaluation running.
- `NEEDS_ATTENTION` — terminal, actionable: `outcomePercentage` < 100 with ≥ 1 open task.
- `FINISHED` — `outcomePercentage` == 100, no open tasks.
- `NOT_APPLICABLE` — terminal; the control does not apply to this scope.
- `ERROR` — terminal, unscored: operational failure of the run from a system,
  unknown, or mixed cause (not a compliance result).
- `USER_ERROR` — terminal, unscored, customer-actionable: a fatal, customer-owned
  problem stopped the run entirely — usually a missing scan permission or a
  misconfiguration, sometimes throttling of the customer's own API calls (where the
  fix is to wait and re-run). Not a readiness result and **not** a 0% score — no
  readiness status exists for the control. Read the journal's `error` record for the actual
  reason instead of assuming permissions.

`SCHEDULED` and `IN_PROGRESS` are the only non-terminal statuses; everything else
is terminal. This list is **not closed** — the service adds statuses, so treat an
unrecognised value as terminal and unscored rather than as an error or as
something still running. There is no `FAILED` assessment status.

Status filters are **exact-match**, so a `status=ERROR` criterion on
`ListAssessments` does **not** return `USER_ERROR` runs (or vice versa). Filter on
both values when you want every run that failed to produce a readiness status.

**`ERROR` vs `USER_ERROR` vs `NEEDS_ATTENTION`.** The split is ownership and
severity, and only genuinely unassessable runs are error statuses at all:

| Situation | Status |
|---|---|
| Fatal failure entirely inside the customer's control — for example, the scan role lacks a required read permission, or the customer's own API calls were throttled, so nothing could be collected (the journal's `error` record names the actual reason) | `USER_ERROR` |
| Fatal failure that is service-owned, of unknown origin, or mixed (some causes customer-side, some not) | `ERROR` |
| Customer-caused problem that was only **partial** — some targets denied or one document unreadable, but usable evidence remained | `NEEDS_ATTENTION`, with the unassessable parts recorded as requirements/tasks |
| A confirmed deficiency in the customer's controls | `NEEDS_ATTENTION` with open tasks |

So the ordinary "permissions are incomplete" case is `NEEDS_ATTENTION`, not
`USER_ERROR`; `USER_ERROR` means the run produced no readiness status at all.

`outcomePercentage` (float) is the readiness score, and is the only score field
`GetAssessment` returns; read `result` for the reason. Only `NEEDS_ATTENTION` and
`FINISHED` carry it — it is **absent** on `NOT_APPLICABLE`, `ERROR`, and
`USER_ERROR`, and absent is not zero, so never render those as 0%. There is no
`assessmentOutcome` field.

### Framework / Control type
- `FrameworkType` / `ControlType`: `MANAGED` (Assurance-provided catalog content)
  or `CUSTOM` (customer-authored within the environment).
- `ReleaseStatus` (lifecycle of frameworks/controls): `ACTIVE`, `PENDING`,
  `PRE_PROD`. A custom framework is `PENDING` until published, then `ACTIVE`.

### WorkflowType (a control's `workflowType`, set via create/update-control)
- `automated-scan` — the customer's AWS account is scanned directly; no upload needed.
- `document` — requires uploaded policy/process documents.
- `hybrid` — combines scanning with documents.

`workflowType` can also come back **null** from `ListControls`/`GetControl` on some
AWS-managed controls. Treat null as `hybrid` rather than as an error: read the
control's `requirements` to see which documents it needs, and the evaluation scans
what it can.

### TaskStatus / TaskPriority
- `TaskStatus`: `OPEN`, `PENDING`, `COMPLETED`, `CANCELLED`. `OPEN` and `PENDING` are both open / "to do" states; `COMPLETED` and `CANCELLED` are closed. Treat a task as **remaining** unless it is `COMPLETED` or `CANCELLED` (don't filter on a single open status and miss the other).
- `TaskPriority`: `HIGH`, `MEDIUM`, `LOW`.

### EvidenceStatus
- `VALID`, `SCANNING`, `QUARANTINED`, `SCAN_FAILED`, `NOT_AUTO_ANALYZED`,
  `VALID_AUTO_ANALYZED`. Content is scanned on upload: `SCANNING` is transient,
  `QUARANTINED` means the scan rejected the content, and `SCAN_FAILED` means the
  scan itself could not complete.

### EvidencePurpose / LinkMode
- `EvidencePurpose` (an evidence item's `purpose`, and a `ListEvidence` filter
  value): `CONTROL_EVIDENCE`, `SCAN_EVIDENCE` (the stored scan readings of an
  assessment), `FRAMEWORK_SOURCE`.
- `LinkMode` (`linkMode` on evidence): `AUTO`, `MANUAL`, `DISABLED`. A caller
  may set only `AUTO` or `MANUAL`.

### CoverageStatus
- `COMPLETE`, `PARTIAL`. The `coverage` of a `ListDiscoveredResources` listing;
  see that operation in `references/api-reference.md`.

## Managed vs custom frameworks

- **Managed** frameworks (for example, PCI DSS, SOC 2, NIST, CIS) are provided by
  Assurance. Their names are `AWS:`-prefixed (and contain a colon). They are
  read-only — you can `GetFramework`, `ListFrameworks`, `ListControls`,
  `GetControl`, and **enable** them on a project, but you cannot modify their
  controls.
- **Custom** frameworks are authored within the environment. Their names must
  **not** start with `AWS:`. You create the framework, add control groups and
  controls, optionally attach workflows, **publish** it (PENDING → ACTIVE), and
  then **enable** it on a project. See `custom-frameworks.md`.

## Control structure

Groups and controls are **separate resources with separate operations**, not one
polymorphic shape:

- A **control group** is a section (CIS `1 - Identity and Access Management`).
  `ListControlGroups` returns `controlGroups`; each entry carries the group id in a
  field named `controlId`, plus `title`, `description`, `type`. `GetControlGroup`
  returns one `controlGroup`.
- A **control** is a leaf inside a group (`1.11`). `GetControl` returns a `Control`
  with `controlId`, `title`, `description`, `type`, `groupId` (its parent group),
  `requirements` (list of `{ id, description }` — the atomic, testable requirements
  the evaluation scores individually), `workflowType`, `controlIntents`, `status`.

There is no nested `workflow` object and no `relatedControls` field; the workflow is
the single `workflowType` value.

`ListControls` lists the controls of **one** group and requires
`controlGroupId` — the group id from `ListControlGroups`. It returns `controls`,
not `groups`, and there is no operation that returns every control in a framework
in one flat call. Passing a leaf id such as `1.11` as `controlGroupId` fails with
`ResourceNotFoundException: Control group not found`.

## Tasks: ID conventions

Remediation tasks are **created by the Assurance evaluation** to record each
readiness gap; your role is to help the user **close** them. Each task ID
follows a stable convention tied to what it remediates:

| Form | Meaning |
|---|---|
| `{controlId}-R{n}` | A specific requirement gap (for example, `A.2.3-R1`). |
| `{controlId}-DOC` | The control's one evidence task: it asks for the missing document of a document control, or for evidence on requirements that were `unable_to_assess`. |

An open `-R{n}` task whose requirement is now `not_applicable` closes as
`CANCELLED`. When the control does not apply (a `NOT_APPLICABLE` run), every
open task on it, `-DOC` included, closes as `CANCELLED`, not
`COMPLETED`: the ask was withdrawn, not met.

A task id is **not** a control id. It is the control id plus a suffix, so strip
the `-R{n}` / `-DOC` to get the `controlId` that control-scoped
operations want: task `2.1.1-R1` belongs to control `2.1.1`. The same applies to
the `requirements[].id` values in an assessment `result` or an annotation. Passing
a requirement id where a `controlId` is expected satisfies the `ControlID` pattern
(hyphens are legal) and then fails at lookup with
`ResourceNotFoundException: Control not found`, so the mistake surfaces as a
missing resource rather than a malformed request.

These IDs let you map a task back to the exact requirement or document it
represents. Priority maps to a default due date: `HIGH` ≈
30 days, `MEDIUM` ≈ 3 months, `LOW` ≈ 6 months. Closing tasks does not change an
assessment's outcome — each run re-derives its tasks from the evidence, so a task
whose gap is still open comes back. `FINISHED` (100%) requires evidence that
satisfies every requirement.
```

## reading-assessment-progress.md
<a name="mcp-skill-reading-assessment-progress"></a>

Parsing the journal, annotations, tasks, and result of an assessment.

### reading-assessment-progress.md
<a name="mcp-skill-reading-assessment-progress-file"></a>

```
# Reading Assessment Progress & Results

How to turn the raw outputs of `GetAssessment`, `ListAssessmentJournalRecords`,
`ListAssessmentAnnotations`/`GetAnnotation`, and `ListTasks` into a clear status report and a remediation
plan for the user. Assessments run asynchronously, so you read these repeatedly
as the run progresses.

## What to read, and in what order

1. `GetAssessment` → `status` + `outcomePercentage` + `result` (the headline).
2. `ListAssessmentJournalRecords` → the live, human-readable timeline (what the
   evaluation is doing / did).
3. `ListAssessmentAnnotations` → which evidence has findings, then `GetAnnotation` per entry → the finding itself (why each requirement passed/failed).
4. `ListTasks` → the remaining gaps to close (status `OPEN` or `PENDING` — anything not `COMPLETED`/`CANCELLED`).

## 1. The headline: GetAssessment

- `status` — `SCHEDULED`/`IN_PROGRESS` (keep polling), or terminal: `FINISHED`,
  `NEEDS_ATTENTION`, `NOT_APPLICABLE`, `ERROR`, `USER_ERROR` (see SKILL.md status
  table). The set is open, so stop polling on anything that isn't `SCHEDULED` or
  `IN_PROGRESS`.
- `outcomePercentage` (float) — the readiness score. Report this as the score.
  (`outcomePercentage` is the only score field; there is no `assessmentOutcome`.)
  It is **absent** on `NOT_APPLICABLE`, `ERROR`, and `USER_ERROR` — those runs have
  no grade, and absent must never be reported as 0%.
- `result` — a structured findings summary. It is JSON with `schemaVersion`, a
  one-paragraph `summary`, and a `requirements` array of
  `{ id, status, confidence, rationale }` entries (status values like `met` / `not_met` /
  `partial` / `not_applicable` / `unable_to_assess`). Use it to list which requirements passed and
  which need work. If `result` is not JSON, treat it as a free-text summary. On
  `ERROR`/`USER_ERROR` there are no per-requirement results to report — read it
  (and the journal, §2) for the failure reason instead.

Pair the grade with the tasks: **`NEEDS_ATTENTION` always means ≥ 1 open task**,
and `FINISHED` means 100% with no open tasks.

### When the status is `ERROR` or `USER_ERROR`

Neither is a compliance result, so there is nothing to score — report that the
control **could not be assessed**, then give the cause from the journal's `error`
record (§2).

- `USER_ERROR` — terminal and **customer-actionable**: the run was stopped by a
  fatal, customer-owned problem and produced no readiness status at all. Usually a missing
  scan permission or a misconfiguration, but it can also be something like
  throttling of the customer's own API calls, where the fix is to wait and re-run.
  Take the reason from the `error` record — its `missingPermission` / `failedApi`
  is the concrete fix when it is a permission. Walk the user through it, then
  re-run (which yields a new `assessmentId` — poll that one).
- `ERROR` — the failure was service-owned, of unknown origin, or mixed (both
  customer-side and system-side causes). Re-running is reasonable; escalate if it
  repeats. Do not tell the user it is their fault.
- Neither status means that the control needs attention. A *partial* customer-caused problem never
  lands here at all: if usable evidence remained, the run completes as
  `NEEDS_ATTENTION` with the unassessable parts recorded as requirements/tasks,
  and you report it as a normal findings-and-remediation case.

## 2. The timeline: ListAssessmentJournalRecords

Each record is `{ recordId, recordType, phase, createdAt, content, invocationId }`.
`content` is a **JSON string** — parse it before using. Records are time-ordered
by `createdAt`; sort ascending to replay the run.

### `phase` — which stage of evaluation produced the record
Observable values, roughly in order:
- `gathering_context` — scope and prior context are being collected.
- `evaluating` — evidence is being gathered (scanning the account and/or
  analyzing documents).
- `auditor` — the gathered evidence is reviewed and interpreted into findings.
- `finalising` — the readiness status, tasks, and report are written.
- `needs_input` — the run is waiting on something from the user.
- `failed` — the run hit an error.

### `recordType` — the kind of entry, and how to render it
- `phase_start` — a stage began. `content`: `{ node }`. Use it to show progress
  milestones ("Gathering context…", "Evaluating evidence…", "Finalising…").
- `narrative` — human-readable narration. `content`: `{ type, text }` where
  `type` is `intro` (what the stage is about to do) or `conclusion` (what it
  found). **These are the best lines to surface to the user verbatim.**
- `thinking` — the stage's explanation of its judgement, written for the
  customer. `content`: `{ node, text }`. Only the context and audit stages
  write one; the document-analysis and scan stages report what they read in
  their `narrative`, and readiness statuses come only from the audit. Usually too
  verbose to show; summarize if needed.
- `tool_start` / `tool_result` — an action was taken. `content`:
  `{ summary, category, success, error?, analysis | output }`. **Display the
  `summary`** (for example, "Scanning 12 resources: 12 S3 buckets", "Scanned 12
  resources", "Finalizing assessment"). `category` is one of `scan`,
  `analysis`, `evidence`, `verdict`,
  `action`. On a `tool_result`, `success: false` plus `error` flags a problem.
  Structured detail is in `analysis` (for analysis steps: the run status and the
  documents that were read, never a readiness status) or `output` (for others).
- `executed_scan_plan` — what the scan covered. The first record (the
  manifest) has `content`: `{ node, schemaVersion, framework,
  frameworkVersion, project, executedPlans, resourceScopeByControl, totals,
  readCounts, parts }`. `executedPlans` names each control's `controlIntents`;
  `resourceScopeByControl` gives resources in scope by type and region (one
  entry per account on a cross-account assessment); `readCounts` is
  `{ total, read, absent, unreadable }`. When `parts.count` is above 1, more
  `executed_scan_plan` records follow with `continuation: true` and a
  `segment`: `unreadableReads` lists every read that could not be completed
  (`resource`, `service`, `api`, `reason` such as `Access denied` or
  `Throttled`), and `resourceScope` continues the per-account list. The
  journal never holds the readings themselves: the stored scan evidence
  (`ListEvidence` / `GetEvidenceContent`, purpose `SCAN_EVIDENCE`) is the full
  record, with the auditor's finding on each reading.
- `error` — the run failed. `content`: `{ summary, reason?, missingPermission?,
  failedApi?, error? }`. `error` carries raw detail (often a validation dump) —
  keep it out of user-facing text. **`summary` is the user-facing reason**; `missingPermission` /
  `failedApi` tell you exactly what to fix (most often a missing read permission
  needed for an automated scan). This is the record to read for both terminal error
  statuses — see §1 for how the next step differs between `USER_ERROR` and `ERROR`.

### A practical rendering recipe
- Build a progress feed from `phase_start` (milestones) + `narrative`
  (intro/conclusion) + `tool_result.summary` (actions), in `createdAt` order.
- If you see an `error` record, stop and surface its `summary` + the
  missing permission/API — that is the actionable fix.
- Use `thinking` only when the user asks "why" and the narrative is insufficient.

## 3. The findings: ListAssessmentAnnotations + GetAnnotation

Annotations are the evaluation's findings attached to specific evidence, keyed by
`(evidenceId, evidenceVersion)`. **The evaluation authors them** — you read them by listing the
annotated evidence with `ListAssessmentAnnotations` (which returns keys only) and then calling
`GetAnnotation` for each entry to get `notes`. Annotation writes are internal
operations with no MCP tool and no customer CLI command, and you never fabricate
findings. For a reviewer note, use `CreateComment` on the control (with `taskId`
to attach it to one task). The detail lives in the `notes` field, which
is usually a **structured JSON finding**. Parse it:

```jsonc
{
  "schemaVersion": 1,
  "method": "EXAMINE" | "TEST",                 // how the evidence was assessed
  "origin": "Document Analysis",                 // human label for the source
  "collected": "2024-06-01T12:00:00Z",
  "summary": "…one-paragraph finding…",
  "status": "FULLY_MET" | "PARTIALLY_MET" | "NOT_MET" | "NOT_APPLICABLE" | "INSUFFICIENT",
  "coverage": 0-100 | null,                      // % of requirements satisfied by this evidence
  "requirements": [
    {
      "id": "A.2.3-R1",
      "status": "met" | "not_met" | "partial" | "not_applicable",
      "confidence": 0.0-1.0,
      "excerpt": "…quoted text from the evidence…",   // optional
      "location": "page 4, §2.1",                       // optional
      "rationale": "…why this status…"
    }
  ]
}
```

To report findings: show each annotation's `summary` and `status`, then the
per-requirement table from `requirements` (id → status, with `rationale` and the
`excerpt`/`location` citation). If `notes` is **not** JSON (older annotations),
treat the whole string as the finding text.

`coverage` and the requirement statuses are how the grade is built: requirements
that are `not_met`/`partial` are the gaps that become tasks; `unable_to_assess`
requirements are asked for in the control's `{controlId}-DOC` task instead.

## 4. The remaining work: ListTasks

Tasks are the evaluation's record of each gap. List them and treat any with
status `OPEN` or `PENDING` as still open (anything not `COMPLETED`/`CANCELLED`).

A `USER_ERROR` run never got as far as deriving gaps, so expect **no tasks** for
it; an `ERROR` run usually has none either, but one that failed while recording its
findings can leave some behind. Either way an empty list is not "nothing to fix" —
it means the run itself did not complete; the fix is in the journal's `error`
record.

Each task's `taskId` tells you what it represents:
- `{controlId}-R{n}` — a specific requirement gap (cross-reference the annotation
  `requirements[].id`).
- `{controlId}-DOC` — the control's one evidence task: a document control has
  no document, or some requirements were `unable_to_assess` and its description
  lists them (up to 20 by name) → the user should upload a document or other
  evidence (via the CLI), then re-run with its `assurance://` id in `context`.

Every form is the control id plus a suffix, so when you re-run `StartAssessment`
after closing a task, pass the **control** id — `2.1.1`, not `2.1.1-R1`. A
requirement id is accepted by validation and then fails with
`ResourceNotFoundException: Control not found`.

### Helping the user close tasks (your core job)
1. Read the open tasks + the annotations that explain them.
2. Explain each gap in plain language, citing the annotation `rationale`/`excerpt`
   and the task `title`/`description`.
3. Guide the concrete fix (have the user upload the missing policy via the CLI,
   answer the question, or change the AWS configuration the scan flagged).
4. Once the gap is genuinely fixed, mark the task `COMPLETED` with `UpdateTask`.
5. **Re-run** the control with `StartAssessment` — this creates a new assessment
   with a new `assessmentId`, so poll that one — and confirm `outcomePercentage`
   improved.

Do **not** create tasks to track this work — the evaluation owns the task list,
and a re-run re-derives its tasks from the evidence — so tasks whose gaps remain open come back, and `FINISHED` (100%) requires evidence that satisfies every requirement rather than a cleared task list.
Use `ListTaskHistory` to see how a task has changed over time, and `CreateComment`
to leave notes on the control for the user or other reviewers.

## Putting it together — a status report template

> **Control A.2.3 — {control title}**
> Status: **NEEDS_ATTENTION** · Score: **75%**
> Progress: gathered context → analyzed 2 documents → audited → finalized.
> Findings: R1 met, R2 met, **R3 not met** ("retention period not specified" —
> Policy.pdf p.4).
> Open tasks: **A.2.3-R3** (HIGH) — define a data-retention period in the policy.
> Next step: update the policy, re-upload it, mark A.2.3-R3 complete, and re-run.

And when the run could not be assessed at all (`USER_ERROR` — note there is no
score and no readiness status, so none is shown):

> **Control 1.11 — {control title}**
> Status: **USER_ERROR** · Score: **none — this control could not be assessed**
> Progress: gathered context → scan blocked.
> Reason: the assessment role could not read the resources it needed
> (`missingPermission: ec2:DescribeVolumes`, `failedApi: DescribeVolumes`).
> This is not a failed control — no readiness status was produced.
> Next step: grant that read permission to the assessment role, then re-run the
> control (a new `assessmentId`; poll the new one).
```

## workflows.md
<a name="mcp-skill-workflows"></a>

Running an assessment, setting up a project, discovering resources, enabling a framework, and handling evidence.

### workflows.md
<a name="mcp-skill-workflows-file"></a>

```
# Assurance Workflows

Step-by-step, parameter-level walkthroughs for the common things a compliance
user asks for. All tool names are `assurance` MCP tools (invoke as
`assurance:<Tool>`). Resolve the composite key by reading (see `data-model.md`)
before acting.

---

## 1. Run an assessment on a single control (the main workflow)

### Step 1 — Orient (resolve the composite key)
```
GetEnvironment({ lookup: { environmentArn } })        # or { domain }
ListProjects({ environmentArn })                      # pick `project`
ListEnabledFrameworks({ environmentArn, project })    # pick `framework` + `frameworkVersion`
ListControlGroups({ environmentArn, framework, frameworkVersion })  # → group ids in `controlId`
ListControls({ environmentArn, framework, frameworkVersion, controlGroupId })   # find the controlId
GetControl({ environmentArn, framework, frameworkVersion, controlId })  # read requirements + workflowType
```
`workflowType` tells you how the control is evaluated (`automated-scan`, `document`, or `hybrid`):
- `automated-scan` → no upload; the account is scanned. Go to Step 3.
- `document` → the user uploads the policy/process doc(s) in Step 2, then you reference them.
- `hybrid` → may need both an upload and scanning.

### Step 2 — Evidence (document / hybrid controls): the user uploads via the CLI
Per SKILL.md R3 you never call the `PutEvidence` MCP tool. Give the user the
exact command, wait for confirmation, then discover the id:
```
# You give the user this (they run it):
aws assurance put-evidence \
  --environment-arn ENV_ARN_OR_ID --project PROJECT \
  --title "infosec-policy-2024.pdf" \
  --content fileb:///path/to/policy.pdf --content-mime-type application/pdf
# ...or reference an object under a registered S3 evidence source:
#   --reference s3://SOURCE_BUCKET/policy.pdf   (instead of --content)

# Then you discover the resulting id:
ListEvidence({ environmentArn, project })   # → evidenceId "assurance://infosec-policy-2024.pdf"

# Link it to the control(s) it supports. Either at upload time with
#   --control-references 'framework=…,frameworkVersion=…,controlId=…'
# or afterwards, by having the user run:
aws assurance update-evidence \
  --environment-arn ENV_ARN_OR_ID --project PROJECT \
  --evidence-id "assurance://infosec-policy-2024.pdf" \
  --add-control-reference-links 'framework=AWS:CIS-AWS-Benchmark,frameworkVersion=1.4,controlId=1.1'
# GetEvidence then shows the link in `linkedControls`; the version does not change.
# Linking is what lets the evaluation attach an annotation to this evidence for
# that control — an unlinked upload referenced only from `context` still counts,
# but the finding is easier to trace when the link exists.
```
Repeat for each document. (See section 5 for the evidence rules to convey.)

### Step 3 — Start the assessment with the right context
```
StartAssessment({
  environmentArn, project, framework, frameworkVersion, controlId,
  context: "Evaluate against assurance://infosec-policy-2024.pdf. "
         + "Our access reviews run quarterly via IAM Access Analyzer.",
})
# → { assessmentId }   (the assessment starts IN_PROGRESS; read it with GetAssessment)
```
The `context` must include any evidence URIs you want evaluated (authoritative,
fail-closed) plus free-text guidance. See SKILL.md "evidence + context".

### Step 4 — Poll until terminal
```
ListAssessmentJournalRecords({ environmentArn, project, framework,
                               frameworkVersion, controlId, assessmentId })
GetAssessment({ environmentArn, project, framework, frameworkVersion,
                controlId, assessmentId })
```
Repeat periodically. Terminal statuses: `FINISHED`, `NEEDS_ATTENTION`,
`NOT_APPLICABLE`, `ERROR`, `USER_ERROR` — and the list is open, so stop polling on
anything that isn't `SCHEDULED`/`IN_PROGRESS`. `ERROR` and `USER_ERROR` are
unscored, so waiting for an `outcomePercentage` polls forever. (Parsing is in
`reading-assessment-progress.md`.)

### Step 5 — Interpret and help remediate
```
ListAssessmentAnnotations({ environmentArn, project, framework, frameworkVersion,
                  controlId, assessmentId })   # summaries: which evidence has a finding
GetAnnotation({ environmentArn, project, framework, frameworkVersion, controlId,
                assessmentId, evidenceId, evidenceVersion })   # the finding (`notes`)
ListTasks({ environmentArn, project,        # project stays top-level
            filters: [{ name: 'framework', values: [framework] },
                      { name: 'framework-version', values: [frameworkVersion] },
                      { name: 'control-id', values: [controlId] }] })
                            # remaining gaps = status OPEN or PENDING (not COMPLETED/CANCELLED)
```
Explain the `outcomePercentage`, the per-requirement findings, and what each open
task needs. Help the user fix each gap, then **mark the task `COMPLETED`** with
`UpdateTask`. Re-run by calling `StartAssessment` again (Step 3) — that creates a
new assessment with a new `assessmentId`; poll the new one.

---

## 2. Re-run a control after remediation

Re-calling `StartAssessment` for the same control:
- If the latest assessment is terminal — `NEEDS_ATTENTION`, `FINISHED`,
  `NOT_APPLICABLE`, `ERROR`, `USER_ERROR` — a **new assessment with a new
  `assessmentId`** is created. The earlier one is left as history; nothing is reset
  in place, so keep the new id and stop polling the old one.
- If a previous run is already `IN_PROGRESS`, the same assessment is returned (no
  duplicate run).

So the remediation loop is: read tasks → fix gaps → `UpdateTask` to `COMPLETED` →
`StartAssessment` again → poll → confirm the grade improved.

A `USER_ERROR` run is re-run the same way, but the loop is different: there are no
tasks and no grade to improve. Act on whatever the journal's `error` record names —
grant the permission, fix the configuration, or simply wait if the run was
throttled — then re-run to get an actual readiness status for the first time.

---

## 3. Assess a whole framework at once

Call `StartAssessment` **without** `controlId`:
```
StartAssessment({ environmentArn, project, framework, frameworkVersion,
                  context: "..." })
# → no assessmentId; the per-control assessments it queues start as SCHEDULED
```
This queues per-control assessments across the framework. Then track each control
with
```
ListAssessments({ environmentArn, project, filters: [
  { name: "framework",         values: [framework] },
  { name: "framework-version", values: [frameworkVersion] },
] })
```
and drill into individual controls as in workflow 1. `project` is a top-level
query selector; `framework` and `frameworkVersion` are not input members, so they
are expressed as criteria.

---

## 4. Set up a project and list its resources

The following example creates a project scoped by resource filters, then lists its resources.

```
CreateProject({ environmentArn, project: "payments-prod",
  resourceFilters: [ "resourcetype:s3:bucket region:us-east-1",
                     "tag:env=prod" ] })       # ≤ 10 resource filters

ListDiscoveredResources({ environmentArn, project })  # resourceIdentifiers + nextToken
```
- `resourceFilters` use the AWS Assurance resource filter syntax; max 10.
- The listing is paginated: repeat the call with `nextToken` until it returns no token.

---

## 5. Evidence — details (rules to convey to the user)

Evidence is uploaded by the **user** via `aws assurance put-evidence` (per
SKILL.md R3 you never call the MCP `PutEvidence` tool). These are the rules to
convey so their upload succeeds, and to read back results.

### Direct content vs reference
The upload takes **exactly one** of:
- `--content` — raw file bytes (≤ 10 MB). The service inspects the actual bytes to
  detect the real content type (it does not trust the extension or the declared
  MIME).
- `--reference` — a pointer instead of bytes, either:
  - `s3://{bucket}/{key}`, which must sit under an S3 evidence source registered
    on the environment (the user registers one with
    `aws assurance create-environment-connection`); the user's own credentials
    must be able to read the object; or
  - the URL of a GitHub file, or any link to a SharePoint document (a sharing
    link works), read through a GitHub or SharePoint connection the user added
    to the environment. If the environment has more than one connection to
    that provider, add `--connection-id`.

  With `--reference`, `--title` is optional and defaults to the document's file
  name, which must pass the same name and extension rules below.

### Title = filename — extension rules (convey before uploading)
The `--title` (or a reference's defaulted title) is used as the stored
**filename**, so it is validated strictly:
- **≤ 255 characters**, and required on a direct upload.
- Must **not** contain `..`, `/`, `\`, or null bytes (path-traversal protection),
  nor, on a direct upload, `#`.
- Must end in a **supported extension** (a title with no extension is treated as
  `.txt`), and on a direct upload the file's **actual content must match that
  extension** (verified by content inspection). A mismatch is rejected
  with `File content type '…' does not match declared extension '…'`.

**Supported extensions (the only allowed file types):**

| Category | Extensions |
|---|---|
| Documents | `pdf`, `doc`, `docx` |
| Spreadsheets | `xls`, `xlsx`, `csv` |
| Images | `png`, `jpg`, `jpeg` |
| Text / data | `txt`, `json`, `md`, `xml`, `html` |
| IaC / config | `tf`, `hcl`, `yaml`, `yml` |

Anything else, `gif` included, is rejected with
`Unsupported file type. Allowed types: …`. So
always give `--title` a correct extension that matches the bytes — for example, a policy
PDF → `"AI Policy v3.pdf"`; structured/scan data → `"…-evidence.json"`.

### Content type matching
- If `--content-mime-type` is passed, it must be acceptable for the title's
  extension (it must match the detected type or an accepted alias, for example,
  `text/plain` is accepted for `.json`/`.csv`/IaC formats). A bad declaration is
  rejected with `Declared content type '…' is not acceptable for extension '…'`.
- It can usually be omitted and detection handles it; only set it to assert the
  type explicitly.

### Active / unsafe content is rejected
Uploads are scanned and rejected (`File contains harmful content and is not
permitted`) if they contain active or dangerous content, including: PDF
JavaScript / auto-actions / embedded executables; Office (`doc`/`docx`/`xls`/
`xlsx`) VBA macros, OLE objects, or ActiveX; `csv` cells starting with `=`, `@`,
or a non-numeric `+`/`-` (formula injection); `html` with `<script>`, `<iframe>`,
event handlers, or `javascript:` URIs; `xml` with `<!DOCTYPE>`/`<!ENTITY>` (XXE);
images with embedded scripts, polyglot trailing data, or > 50 MP; and invisible /
bidirectional Unicode control characters in text formats. When advising on
generated evidence, keep it to plain data — no macros, scripts, formulas, or
hidden characters.

### The `assurance://` id
- The id is **derived from `--title`** (the extension is stripped, non-alphanumeric
  runs become `-`, then the extension is re-appended), so every direct upload gets
  an `assurance://…` id you can reference in `StartAssessment` `context`. There is
  no `--name` flag — the caller cannot choose the id. Give the title a slug-safe
  name so the id is predictable: `infosec-policy-2024.pdf` yields
  `assurance://infosec-policy-2024.pdf`. Otherwise read the id back from
  `ListEvidence` rather than constructing it.
- Output carries `evidenceId` and `version` only; `GetEvidence` returns the
  `checksum` (SHA-256), `status`, and `linkedControls`.

### Versioning and de-duplication
- To replace a document, the user re-uploads with the same `evidenceId` and new
  content — it stores a new `version`.
- An upload whose content checksum matches the latest
  version is treated as idempotent and returns the existing metadata (no new
  version).
- `GetEvidence`/`GetEvidenceContent` default to the latest version; pass
  `evidenceVersion` for a specific one.

### Listing / inspecting / removing
`ListEvidence({ environmentArn, project })`,
`GetEvidence({ environmentArn, project, evidenceId })` (metadata + `status`),
`GetEvidenceContent(...)` (bytes). Deletion is a destructive user action — confirm.

---

## 6. Enable / disable a managed framework on a project

```
ListFrameworks({ environmentArn, type: "MANAGED" })   # discover available frameworks
EnableFramework({ environmentArn, framework, frameworkVersion, project })
ListEnabledFrameworks({ environmentArn, project })     # confirm
```
- A framework must be enabled on a project before its controls can be assessed.
- `DisableFramework({ environmentArn, framework, frameworkVersion, project })`
  turns it off and clears project-scoped scan-plan overrides — confirm first.

For authoring a **custom** framework, see `custom-frameworks.md`.

---

## 7. Collaborate with comments

Use comments for your own notes / handoffs on a control (distinct from
evaluation-authored annotations):
```
CreateComment({ environmentArn, project, framework, frameworkVersion, controlId,
                content: "...",          # 1-4096 chars
                taskId })                # optional: attach the comment to one task
ListComments({ environmentArn, project, framework, frameworkVersion, controlId })
```

---

## Error handling

- `ValidationException` — a key field failed its pattern (check `data-model.md`),
  or `context` exceeded 2000 chars, or a mutually-exclusive pair was both set
  (for example, evidence `content` + `reference`).
- `ResourceNotFoundException` — a key field points at something that doesn't
  exist; re-run discovery.
- A fail-closed **"evidence not found"** assessment error means a URI in your
  `context` didn't resolve — fix the evidence ID and re-run.
- `ConflictException` on `UpdateTask` — the row changed since you read it;
  re-fetch and retry. On `update-evidence` it means the evidence changed or was
  deleted concurrently, or, with `--link-mode AUTO`, a scan or analysis is still
  running; retry later.
- An assessment ending in `ERROR` or `USER_ERROR` — read the journal's `error`
  record; neither is a compliance result and neither carries an
  `outcomePercentage`, so report that the control could not be assessed rather
  than a 0% grade.
  - `USER_ERROR` — terminal and customer-actionable: a fatal, customer-owned
    problem stopped the run. Usually a missing read permission for an automated
    scan (`missingPermission` / `failedApi` name it), sometimes a misconfiguration
    or throttling of the customer's own API calls — where the fix is to wait and
    re-run. The `error` record's `summary` is the actual reason: have the user act
    on it, then re-run.
  - `ERROR` — the cause was service-owned, unknown, or mixed. Re-run; escalate if
    it repeats.
  - Neither covers a *partial* customer-caused problem: if the run had usable
    evidence it completes as `NEEDS_ATTENTION` with the unassessable parts recorded
    as requirements/tasks, and you handle it as normal remediation (workflow 2).
```