Documentation
¶
Overview ¶
Package simulate provides AI-powered "what-if" scenario analysis for cloop PM projects. It lets PMs ask counterfactual questions — "What if we cut scope?", "What if deadline moves up 2 weeks?", "What if we add an engineer?" — and get structured impact projections.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ProjectSnapshot ¶
func ProjectSnapshot(s *state.ProjectState) string
ProjectSnapshot builds a concise text summary of current project state for AI context.
Types ¶
type SimResult ¶
type SimResult struct {
Scenario string `json:"scenario"`
Summary string `json:"summary"`
TimelineDelta int `json:"timeline_delta_days"` // +days = delayed, -days = faster
BaselineDays float64 `json:"baseline_days"`
SimulatedDays float64 `json:"simulated_days"`
RiskBefore string `json:"risk_before"` // "low" | "medium" | "high" | "critical"
RiskAfter string `json:"risk_after"`
Confidence string `json:"confidence"` // "low" | "medium" | "high"
Recommendations []string `json:"recommendations"`
TaskChanges []TaskChange `json:"task_changes,omitempty"`
TradeOffs []string `json:"trade_offs,omitempty"`
Warnings []string `json:"warnings,omitempty"`
}
SimResult is the structured output of a scenario simulation.
type SimulationReport ¶
type SimulationReport struct {
Goal string `json:"goal"`
GeneratedAt time.Time `json:"generated_at"`
Predictions []TaskPrediction `json:"predictions"`
OverallConfidence int `json:"overall_confidence"` // 0-100 average success prob
}
SimulationReport aggregates per-task predictions into an overall assessment.
func Simulate ¶
func Simulate(ctx context.Context, prov provider.Provider, model string, plan *pm.Plan, workDir string) (*SimulationReport, error)
Simulate runs a dry-run simulation of all pending tasks in the plan. It calls the AI provider once per pending task to predict the outcome and returns a SimulationReport. The report is also saved to .cloop/simulation-<timestamp>.json.
type TaskChange ¶
type TaskChange struct {
TaskID int `json:"task_id"`
TaskTitle string `json:"task_title"`
Action string `json:"action"` // "cut", "defer", "reprioritize", "add", "split"
NewPrio int `json:"new_prio,omitempty"`
Rationale string `json:"rationale"`
}
TaskChange describes a recommended change to a specific task.
type TaskPrediction ¶
type TaskPrediction struct {
TaskID int `json:"task_id"`
TaskTitle string `json:"task_title"`
SuccessProb int `json:"success_probability"` // 0-100
ExpectedOutput string `json:"expected_output"`
Risks []string `json:"risks"`
PreConditions []string `json:"pre_conditions"`
}
TaskPrediction holds the AI-predicted outcome for a single pending task.