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

# Prompt-set analysis

> Review your tracked prompts and approve changes individually.

## Analysis and review

Open **Visibility → Prompts** and expand **Prompt-set analysis**. Review the credit estimate, then start an analysis. It assesses active prompts in active topics and creates proposals for your review. Starting an analysis never applies its proposals.

Review each proposed addition, rewrite or retirement before applying it. You can undo an applied proposal, dismiss a proposal, or restore a dismissed proposal to review. Prompt quotas still apply. If a prompt or topic has changed since analysis, refresh and review the conflict; a new analysis may be needed.

## Credits

Reading results or estimates does not consume credits. Starting an analysis reserves its estimated agent credits from the account's shared balance. Completed analyses settle recorded usage; failed analyses release their reservation without charging. The available balance is shared across projects.

An active analysis is reused when you retry. Retrying a queued analysis can safely requeue it. Starting again after a completed or failed analysis creates a new analysis and reservation. The estimate can change as your active prompt set changes. Applying, undoing, dismissing and restoring proposals do not start another analysis or incur an analysis credit charge.

## API and MCP

API and public MCP use the same project-scoped workflow as the app. API access retains its normal plan requirements. Interactive proposal review is available in-app. Slack execution and scheduled analysis are unsupported.

| Operation                        | API v2                                                     | MCP tool                             | Scope             |
| -------------------------------- | ---------------------------------------------------------- | ------------------------------------ | ----------------- |
| Read results and credit estimate | `GET /projects/{projectId}/prompt-set-analysis`            | `devtune_get_prompt_set_analysis`    | `visibility.read` |
| Start or retry analysis          | `POST /projects/{projectId}/prompt-set-analysis`           | `devtune_start_prompt_set_analysis`  | `actions.write`   |
| Apply, undo, dismiss or restore  | `POST /projects/{projectId}/prompt-set-analysis/proposals` | `devtune_review_prompt_set_proposal` | `actions.write`   |

API paths above are relative to `/api/v2`. Mutations require a user-attributed credential and that user's current permission to manage prompts. API keys use their creator's identity; OAuth MCP uses the authenticated user. Keys without a creator can read if authorized but cannot mutate.

### Human approval

Agents must show the human the estimate before starting analysis, and the proposal and requested operation before changing a proposal. Obtain explicit approval first. A read, analysis request or earlier approval of a different proposal does not approve a mutation.

After obtaining that approval, start with `{"humanApproved": true, "approvedEstimatedCredits": 0.5}`, replacing `0.5` with the exact `creditState.estimatedCredits` value the human approved. If the estimate changes before the start, the request returns 409; read the current estimate and obtain approval again. For review, send:

```json theme={null}
{
  "proposalId": "00000000-0000-4000-8000-000000000001",
  "operation": "apply",
  "humanApproved": true
}
```

`humanApproved` attests that the caller obtained human approval. It is not permission for an agent to approve its own output. `operation` also accepts `undo`, `dismiss` and `restore`. Restore returns the proposal to review without applying it.

### Results and pagination

Reads return `run`, `proposals`, `latestCompletedAnalysis`, `creditState` and `nextOffset`. A missing latest analysis returns `run: null`. A requested run that does not exist in the project returns 404. `meteredCredits: null` means settlement is not yet available; it does not mean zero usage.

Use `pageSize` from 1 to 100 (default 25). Both assessments and proposals are paginated. If `nextOffset` is present, pass it as `offset` together with the returned `run.id` as `runId`. An exhausted collection can be empty while the other still has another page. Proposal states may change during review; refresh before acting.

Insufficient credits return 402. Unauthorized credentials or missing scopes return 403. Stale or conflicting proposals return 409; refresh and review the current state before retrying.
