Documentation
¶
Overview ¶
Package pivot implements AI-powered goal pivot and plan re-generation. Given an old goal and a new goal, it asks the AI to classify existing tasks as keep/skip and generate new tasks to fulfil the new goal.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func PivotPrompt ¶
PivotPrompt builds the AI prompt that asks for a JSON pivot plan. oldGoal and newGoal are the project goals before and after the pivot. plan is the current task plan (may include done, in_progress, and pending tasks).
Types ¶
type NewTaskSpec ¶
type NewTaskSpec struct {
Title string `json:"title"`
Description string `json:"description"`
Priority int `json:"priority"`
Role pm.AgentRole `json:"role,omitempty"`
EstimatedMinutes int `json:"estimated_minutes,omitempty"`
Tags []string `json:"tags,omitempty"`
}
NewTaskSpec is a task the AI wants to add to fulfil the new goal.
type PivotResult ¶
type PivotResult struct {
// Keep lists IDs of completed/in_progress/pending tasks that are still
// relevant to the new goal and should be preserved unchanged.
Keep []int `json:"keep"`
// Skip lists pending tasks that are no longer relevant.
Skip []SkipDirective `json:"skip"`
// Add lists brand-new tasks required to fulfil the new goal.
Add []NewTaskSpec `json:"add"`
// Rationale is a short human-readable explanation of the pivot decisions.
Rationale string `json:"rationale"`
}
PivotResult is the structured JSON returned by the AI during a pivot.
func Pivot ¶
func Pivot(ctx context.Context, p provider.Provider, model string, oldGoal, newGoal string, plan *pm.Plan) (*PivotResult, error)
Pivot sends the current plan and both goals to the AI provider and applies the returned JSON diff to produce an updated plan.
The plan passed in is modified in place:
- Pending tasks in the skip list are marked TaskSkipped with the AI reason.
- New tasks from the add list are appended with fresh IDs.
- plan.Goal is updated to newGoal.
The plan is returned for convenience.
type SkipDirective ¶
SkipDirective tells the AI which pending task to skip and why.