Documentation
¶
Overview ¶
Package risk provides AI-powered pre-execution risk assessment for cloop tasks. For each task (or the full plan) it asks the provider to output a structured JSON list of findings, each with a severity level, category, rationale, and mitigation.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Finding ¶
type Finding struct {
// Level is the severity: LOW, MEDIUM, HIGH, or CRITICAL.
Level Level `json:"level"`
// Category classifies the risk type.
Category Category `json:"category"`
// Rationale explains why this is a risk.
Rationale string `json:"rationale"`
// Mitigation suggests how to reduce or eliminate the risk.
Mitigation string `json:"mitigation"`
}
Finding is a single risk finding for a task.
type RiskReport ¶
type RiskReport struct {
// TaskID is the numeric task ID (0 if this is a plan-level report).
TaskID int `json:"task_id,omitempty"`
// TaskTitle is the title of the assessed task ("(plan)" for plan-level).
TaskTitle string `json:"task_title"`
// Findings is the ordered list of risk findings (highest severity first).
Findings []Finding `json:"findings"`
// OverallLevel is the highest severity level across all findings.
OverallLevel Level `json:"overall_level"`
}
RiskReport is the result of assessing a single task or the full plan.
func Assess ¶
func Assess(ctx context.Context, p provider.Provider, model string, plan *pm.Plan, taskID string) ([]*RiskReport, error)
Assess runs a risk assessment for the given tasks using the AI provider.
If taskID is non-empty it must be a numeric task ID; only that task is assessed. If taskID is empty, all pending tasks are assessed and one RiskReport is returned per task. model may be empty (the provider will use its default).
func AssessTask ¶
func AssessTask(ctx context.Context, p provider.Provider, model string, plan *pm.Plan, task *pm.Task) (*RiskReport, error)
AssessTask assesses a single task by value (used by the orchestrator pre-execution check).
func (*RiskReport) HasCritical ¶
func (r *RiskReport) HasCritical() bool
HasCritical reports whether the report contains at least one CRITICAL finding.