Documentation
¶
Overview ¶
Package riskmatrix combines impact scoring (pkg/impact) and risk assessment (pkg/risk) to produce a 2D quadrant visualization of all pending tasks. Tasks are placed in one of four quadrants based on their risk level (Y axis, 1-10) and strategic impact (X axis, 1-10):
Critical — high risk + high impact (risk≥6, impact≥6) Mitigate — high risk + low impact (risk≥6, impact<6) Leverage — low risk + high impact (risk<6, impact≥6) Defer — low risk + low impact (risk<6, impact<6)
Index ¶
Constants ¶
const ( QuadrantCritical = "Critical" // high risk, high impact QuadrantMitigate = "Mitigate" // high risk, low impact QuadrantLeverage = "Leverage" // low risk, high impact QuadrantDefer = "Defer" // low risk, low impact )
Quadrant names.
const DefaultTimeout = 5 * time.Minute
DefaultTimeout is the timeout used when building a risk matrix.
Variables ¶
This section is empty.
Functions ¶
func RenderASCII ¶
func RenderASCII(entries []MatrixEntry) string
RenderASCII renders a 2D ASCII quadrant chart. The chart is 40 columns wide and 20 rows tall. Each task is plotted as "#<id>" at the (impact, risk) coordinate, with quadrant labels in the background.
func RenderHTML ¶
func RenderHTML(entries []MatrixEntry, goal string) (string, error)
RenderHTML returns a standalone HTML page with a canvas-based scatter plot.
Types ¶
type MatrixEntry ¶
type MatrixEntry struct {
TaskID int `json:"task_id"`
TaskTitle string `json:"task_title"`
RiskScore int `json:"risk_score"` // 1-10 (1=low risk, 10=critical)
ImpactScore int `json:"impact_score"` // 1-10 (1=low impact, 10=high impact)
Quadrant string `json:"quadrant"` // Critical/Mitigate/Leverage/Defer
}
MatrixEntry is a single task's position on the 2D risk/impact matrix.
func Build ¶
func Build(ctx context.Context, prov provider.Provider, opts provider.Options, plan *pm.Plan, apply bool) ([]MatrixEntry, error)
Build scores all pending/in-progress tasks using the AI provider and returns a slice of MatrixEntry. If a task already has both RiskScore and ImpactScore cached (non-zero), those cached values are used without calling the AI. When apply is true, the computed scores are written back to each task in the plan (caller is responsible for saving state).
func BuildFromCache ¶
func BuildFromCache(plan *pm.Plan) []MatrixEntry
BuildFromCache returns matrix entries for all active tasks using only cached scores. Tasks without cached scores are included with score 0. This is used by the API endpoint to avoid blocking on AI calls.