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

# Obter Plano de Remediação

> Retorna os detalhes completos do plano de remediação, incluindo evidências de execução, informações de rollback, restrições de segurança e histórico de conversação agêntica

<ParamField path="name" type="string" required>
  Nome único do plano de remediação
</ParamField>

<ParamField query="namespace" type="string" default="default">
  Namespace Kubernetes
</ParamField>

## Detalhes da Resposta

A resposta detalhada estende o item da lista com:

| Campo               | Descrição                                                                   |
| ------------------- | --------------------------------------------------------------------------- |
| `safetyConstraints` | Restrições que devem ser respeitadas durante a execução                     |
| `evidence`          | Evidências coletadas durante a execução (logs, métricas, falhas, rollbacks) |
| `rollbackPerformed` | Se o rollback automático foi acionado                                       |
| `rollbackResult`    | Resultado da tentativa de rollback                                          |
| `agenticHistory`    | Raciocínio e ações passo a passo da IA (apenas modo agêntico)               |

### Histórico Agêntico

Quando `agenticMode` é true, o array `agenticHistory` mostra a conversação completa da IA:

* **`aiMessage`**: O raciocínio da IA para cada passo
* **`action`**: A ação concreta proposta (null se for um passo apenas de observação)
* **`observation`**: O resultado após executar a ação
* **`stepNumber`**: Número sequencial do passo

Estes são os dados-chave para entender **como a IA pensou** durante o processo de remediação.

<ResponseExample>
  ```json Response 200 theme={"system"}
  {
    "apiVersion": "v1",
    "kind": "RemediationPlan",
    "resourceMeta": {
      "name": "remediation-inc-20260319-002-1",
      "namespace": "production",
      "creationTimestamp": "2026-03-19T15:09:00Z"
    },
    "spec": {
      "name": "remediation-inc-20260319-002-1",
      "namespace": "production",
      "issueRef": "INC-20260319-002",
      "attempt": 1,
      "strategy": "Agentic mode: no matching runbook found",
      "state": "Completed",
      "startedAt": "2026-03-19T15:10:00Z",
      "completedAt": "2026-03-19T15:16:00Z",
      "result": "Issue resolved after 4 agentic steps",
      "agenticMode": true,
      "agenticStepCount": 4,
      "actions": [],
      "creationTimestamp": "2026-03-19T15:09:00Z",
      "safetyConstraints": [
        "Do not scale below current replica count",
        "Verify health for 90 seconds after each action"
      ],
      "evidence": [
        {
          "type": "action_success",
          "data": "ScaleDeployment executed: replicas 3 -> 5",
          "timestamp": "2026-03-19T15:11:00Z"
        },
        {
          "type": "health_check",
          "data": "All 5/5 pods ready after 45 seconds",
          "timestamp": "2026-03-19T15:12:30Z"
        }
      ],
      "rollbackPerformed": false,
      "rollbackResult": "",
      "agenticHistory": [
        {
          "stepNumber": 1,
          "aiMessage": "The deployment has 3 replicas but CPU usage is at 95%. The error rate spike correlates with high CPU. I'll scale up to reduce per-pod load.",
          "action": {"type": "ScaleDeployment", "params": {"replicas": "5"}},
          "observation": "ScaleDeployment executed successfully. New pods are starting.",
          "timestamp": "2026-03-19T15:11:00Z"
        },
        {
          "stepNumber": 2,
          "aiMessage": "Pods are starting. Let me observe the metrics to verify the scale-up is helping.",
          "action": null,
          "observation": "5/5 pods ready. CPU usage dropped to 62%. Error rate decreasing.",
          "timestamp": "2026-03-19T15:12:30Z"
        },
        {
          "stepNumber": 3,
          "aiMessage": "CPU is now at safe levels and error rate is dropping. Let me also adjust the HPA to prevent this from happening again.",
          "action": {"type": "AdjustHPA", "params": {"maxReplicas": "8", "targetCPU": "70"}},
          "observation": "HPA updated. maxReplicas=8, targetCPU=70%.",
          "timestamp": "2026-03-19T15:14:00Z"
        },
        {
          "stepNumber": 4,
          "aiMessage": "The deployment is stable with healthy CPU usage and zero errors. The HPA will handle future load spikes. Issue resolved.",
          "action": null,
          "observation": "Health verified: all pods ready, error rate 0%, CPU 58%.",
          "timestamp": "2026-03-19T15:16:00Z"
        }
      ]
    }
  }
  ```
</ResponseExample>

<ResponseExample>
  ```json Response 404 theme={"system"}
  {
    "apiVersion": "v1",
    "kind": "Error",
    "error": {
      "code": 404,
      "message": "Remediation plan not found: remediation-inc-20260319-999"
    }
  }
  ```
</ResponseExample>


## OpenAPI

````yaml GET /remediations/{name}
openapi: 3.1.0
info:
  title: ChatCLI AIOps Platform API
  description: >-
    REST API for the ChatCLI AIOps Platform — incidents, SLOs, runbooks,
    approvals, postmortems, analytics, audit, federation and health.


    The playground below uses **editable server variables** so you can point
    requests at your own self-hosted instance. Adjust `host`, `port` and
    `basePath` to match your deployment, then click **Try it**.
  version: 1.0.0
  contact:
    name: ChatCLI
    url: https://github.com/diillson/chatcli
  license:
    name: Apache-2.0
    identifier: Apache-2.0
servers:
  - url: http://{host}:{port}/{basePath}
    description: >-
      Self-hosted ChatCLI AIOps Platform — adjust host, port and basePath to
      match your deployment.
    variables:
      host:
        default: localhost
        description: >-
          Hostname or IP of your ChatCLI operator. For Kubernetes, use the
          Service DNS (e.g. chatcli-api.chatcli-system.svc) or your Ingress
          host.
      port:
        default: '8090'
        description: >-
          Port the API listens on. Default is 8090; configurable via Helm value
          `apiPort` or env var CHATCLI_API_PORT.
      basePath:
        default: api/v1
        description: >-
          API base path. Always `api/v1` unless you have a custom proxy rewrite
          in front of the operator.
security:
  - ApiKeyAuth: []
tags:
  - name: Incidents
    description: >-
      Incident lifecycle: list, fetch, acknowledge, resolve, snooze, timeline
      and remediation views.
  - name: Runbooks
    description: Remediation runbooks (list, create, update, delete).
  - name: SLOs
    description: Service Level Objectives and error budgets.
  - name: Approvals
    description: Approval workflow for risky remediations.
  - name: Postmortems
    description: Auto-generated postmortems with review, feedback and close.
  - name: Remediations
    description: Remediation plans and agentic execution history.
  - name: AI Insights
    description: AI root-cause analysis and recommendations per incident.
  - name: Analytics
    description: 'Operational analytics: MTTD, MTTR, trends, capacity, compliance.'
  - name: Audit
    description: Immutable audit log and exports.
  - name: Federation
    description: 'Multi-cluster federation: clusters, status and cross-cluster correlations.'
  - name: Health
    description: Liveness and readiness probes.
paths:
  /remediations/{name}:
    get:
      tags:
        - Remediations
      summary: Get Remediation Plan
      description: >-
        Returns full remediation plan details, including execution evidence,
        rollback info, safety constraints and agentic conversation history.
      operationId: getRemediationDetail
      parameters:
        - name: name
          in: path
          required: true
          description: Unique remediation plan name.
          schema:
            type: string
            example: remediation-inc-20260319-002-1
        - name: namespace
          in: query
          required: false
          description: Kubernetes namespace.
          schema:
            type: string
            default: default
      responses:
        '200':
          description: Remediation plan details
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/RemediationPlan'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '404':
          $ref: '#/components/responses/NotFound'
        '429':
          $ref: '#/components/responses/RateLimited'
components:
  schemas:
    RemediationPlan:
      type: object
      properties:
        apiVersion:
          type: string
          example: v1
        kind:
          type: string
          example: RemediationPlan
        resourceMeta:
          type: object
          properties:
            name:
              type: string
            namespace:
              type: string
            creationTimestamp:
              type: string
              format: date-time
        spec:
          allOf:
            - $ref: '#/components/schemas/RemediationPlanListItem'
            - type: object
              properties:
                safetyConstraints:
                  type: array
                  items:
                    type: string
                evidence:
                  type: array
                  items:
                    type: object
                    properties:
                      type:
                        type: string
                      data:
                        type: string
                      timestamp:
                        type: string
                        format: date-time
                rollbackPerformed:
                  type: boolean
                rollbackResult:
                  type: string
                agenticHistory:
                  type: array
                  items:
                    $ref: '#/components/schemas/AgenticHistoryEntry'
    RemediationPlanListItem:
      type: object
      properties:
        name:
          type: string
        namespace:
          type: string
        issueRef:
          type: string
        attempt:
          type: integer
        strategy:
          type: string
        state:
          type: string
          enum:
            - Pending
            - Executing
            - Verifying
            - Completed
            - Failed
            - RolledBack
        startedAt:
          type: string
          format: date-time
        completedAt:
          type: string
          format: date-time
        result:
          type: string
        agenticMode:
          type: boolean
        agenticStepCount:
          type: integer
        actions:
          type: array
          items:
            $ref: '#/components/schemas/RemediationPlanAction'
        creationTimestamp:
          type: string
          format: date-time
    AgenticHistoryEntry:
      type: object
      properties:
        stepNumber:
          type: integer
        aiMessage:
          type: string
        action:
          anyOf:
            - $ref: '#/components/schemas/RemediationPlanAction'
            - type: 'null'
        observation:
          type: string
        timestamp:
          type: string
          format: date-time
    Error:
      type: object
      required:
        - apiVersion
        - kind
        - error
      properties:
        apiVersion:
          type: string
          example: v1
        kind:
          type: string
          example: Error
        error:
          oneOf:
            - type: object
              required:
                - code
                - message
              properties:
                code:
                  type: integer
                  example: 404
                message:
                  type: string
                  example: Resource not found
                details:
                  type: string
            - type: string
        code:
          type: integer
          description: Top-level code (only used by some endpoints).
          example: 400
    RemediationPlanAction:
      type: object
      properties:
        type:
          type: string
          example: AdjustResources
        params:
          type: object
          additionalProperties: true
  responses:
    Unauthorized:
      description: Missing or invalid API token
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    NotFound:
      description: Resource not found
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    RateLimited:
      description: Rate limit exceeded for this token's role
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: Authorization
      description: >-
        Bearer token issued by the operator. Format: `Authorization: Bearer
        <token>`.

````