Documentation
¶
Index ¶
- Constants
- func ConsolidationCompletionFilePath(worktreePath string) string
- func GenerateID() string
- func GroupConsolidationCompletionFilePath(worktreePath string) string
- func PlanFilePath(worktreePath string) string
- func RevisionCompletionFilePath(worktreePath string) string
- func SynthesisCompletionFilePath(worktreePath string) string
- func TaskCompletionFilePath(worktreePath string) string
- func ValidatePlan(plan *PlanSpec) error
- type AggregatedTaskContext
- type ConflictError
- type ConflictResolution
- type ConsolidationCompletionFile
- type ConsolidationConfig
- type ConsolidationEvent
- type ConsolidationEventType
- type ConsolidationMode
- type ConsolidationPhase
- type ConsolidationState
- type Consolidator
- type Coordinator
- func (c *Coordinator) Cancel()
- func (c *Coordinator) GetConsolidation() *ConsolidationState
- func (c *Coordinator) GetProgress() (completed, total int, phase UltraPlanPhase)
- func (c *Coordinator) GetRunningTasks() map[string]string
- func (c *Coordinator) Manager() *UltraPlanManager
- func (c *Coordinator) Plan() *PlanSpec
- func (c *Coordinator) ResumeWithPartialWork() error
- func (c *Coordinator) RetryFailedTasks() error
- func (c *Coordinator) RunPlanning() error
- func (c *Coordinator) RunSynthesis() error
- func (c *Coordinator) Session() *UltraPlanSession
- func (c *Coordinator) SetCallbacks(cb *CoordinatorCallbacks)
- func (c *Coordinator) SetPlan(plan *PlanSpec) error
- func (c *Coordinator) StartConsolidation() error
- func (c *Coordinator) StartExecution() error
- func (c *Coordinator) StartRevision(issues []RevisionIssue) error
- func (c *Coordinator) TriggerConsolidation() error
- func (c *Coordinator) Wait()
- type CoordinatorCallbacks
- type CoordinatorEvent
- type CoordinatorEventType
- type FlexibleString
- type GroupConsolidationCompletionFile
- type GroupConsolidationInfo
- type GroupConsolidationResult
- type GroupDecisionState
- type Instance
- type InstanceStatus
- type Metrics
- type Orchestrator
- func (o *Orchestrator) AddInstance(session *Session, task string) (*Instance, error)
- func (o *Orchestrator) AddInstanceFromBranch(session *Session, task string, baseBranch string) (*Instance, error)
- func (o *Orchestrator) AddInstanceToWorktree(session *Session, task string, worktreePath string, branch string) (*Instance, error)
- func (o *Orchestrator) BranchPrefix() string
- func (o *Orchestrator) CleanOrphanedTmuxSessions() (int, error)
- func (o *Orchestrator) ClearCompletedInstances(session *Session) (int, error)
- func (o *Orchestrator) Config() *config.Config
- func (o *Orchestrator) GetConflictDetector() *conflict.Detector
- func (o *Orchestrator) GetInstance(id string) *Instance
- func (o *Orchestrator) GetInstanceDiff(worktreePath string) (string, error)
- func (o *Orchestrator) GetInstanceManager(id string) *instance.Manager
- func (o *Orchestrator) GetInstanceMetrics(id string) *Metrics
- func (o *Orchestrator) GetOrphanedTmuxSessions() ([]string, error)
- func (o *Orchestrator) GetPRWorkflow(id string) *instance.PRWorkflow
- func (o *Orchestrator) GetSessionMetrics() *SessionMetrics
- func (o *Orchestrator) HasExistingSession() bool
- func (o *Orchestrator) HasLegacySession() bool
- func (o *Orchestrator) Init() error
- func (o *Orchestrator) LoadSession() (*Session, error)
- func (o *Orchestrator) LoadSessionWithLock() (*Session, error)
- func (o *Orchestrator) ReconnectInstance(inst *Instance) error
- func (o *Orchestrator) RecoverSession() (*Session, []string, error)
- func (o *Orchestrator) ReleaseLock() error
- func (o *Orchestrator) RemoveInstance(session *Session, instanceID string, force bool) error
- func (o *Orchestrator) ResizeAllInstances(width, height int)
- func (o *Orchestrator) SaveSession() error
- func (o *Orchestrator) Session() *Session
- func (o *Orchestrator) SessionID() string
- func (o *Orchestrator) SetBellCallback(cb func(instanceID string))
- func (o *Orchestrator) SetDisplayDimensions(width, height int)
- func (o *Orchestrator) SetPRCompleteCallback(cb func(instanceID string, success bool))
- func (o *Orchestrator) SetPROpenedCallback(cb func(instanceID string))
- func (o *Orchestrator) SetTimeoutCallback(cb func(instanceID string, timeoutType instance.TimeoutType))
- func (o *Orchestrator) StartInstance(inst *Instance) error
- func (o *Orchestrator) StartPRWorkflow(inst *Instance) error
- func (o *Orchestrator) StartSession(name string) (*Session, error)
- func (o *Orchestrator) StopInstance(inst *Instance) error
- func (o *Orchestrator) StopInstanceWithAutoPR(inst *Instance) (bool, error)
- func (o *Orchestrator) StopSession(sess *Session, force bool) error
- type PRContent
- type PRInfo
- type PlanSpec
- type PlannedTask
- type RevisionCompletionFile
- type RevisionIssue
- type RevisionState
- type Session
- type SessionMetrics
- type SynthesisCompletionFile
- type TaskCompletionFile
- type TaskComplexity
- type TaskRetryState
- type TaskWorktreeInfo
- type UltraPlanConfig
- type UltraPlanManager
- func (m *UltraPlanManager) AssignTaskToInstance(taskID, instanceID string)
- func (m *UltraPlanManager) Events() <-chan CoordinatorEvent
- func (m *UltraPlanManager) MarkTaskComplete(taskID string)
- func (m *UltraPlanManager) MarkTaskFailed(taskID string, reason string)
- func (m *UltraPlanManager) Session() *UltraPlanSession
- func (m *UltraPlanManager) SetEventCallback(cb func(CoordinatorEvent))
- func (m *UltraPlanManager) SetPhase(phase UltraPlanPhase)
- func (m *UltraPlanManager) Stop()
- type UltraPlanPhase
- type UltraPlanSession
- func (s *UltraPlanSession) AdvanceGroupIfComplete() (advanced bool, previousGroup int)
- func (s *UltraPlanSession) GetReadyTasks() []string
- func (s *UltraPlanSession) GetTask(taskID string) *PlannedTask
- func (s *UltraPlanSession) HasMoreGroups() bool
- func (s *UltraPlanSession) IsCurrentGroupComplete() bool
- func (s *UltraPlanSession) IsTaskReady(taskID string) bool
- func (s *UltraPlanSession) Progress() float64
- type VerificationResult
- type VerificationStep
Constants ¶
const ConsolidationCompletionFileName = ".claudio-consolidation-complete.json"
ConsolidationCompletionFileName is the sentinel file that consolidation writes when complete
const ConsolidationPromptTemplate = `You are consolidating completed ultraplan task branches into pull requests. ## Objective %s ## Branch Configuration - Branch prefix: %s - Main branch: %s - Consolidation mode: %s - Create drafts: %v ## Execution Groups and Task Branches %s ## Task Worktree Details The following are the exact worktree paths for each completed task. Use these paths to review the work if needed: %s ## Synthesis Review Context The following is context from the synthesis review phase: %s ## Instructions Your job is to consolidate all the task branches into group branches and create pull requests. ### For Stacked PRs Mode 1. For each execution group (starting from group 1): - Create a consolidated branch from the appropriate base: - Group 1: branch from main - Group N: branch from group N-1's branch - Cherry-pick all task commits from that group's task branches - Push the consolidated branch - Create a PR with appropriate title and description 2. PRs should be stacked: each PR's base is the previous group's branch. ### For Single PR Mode 1. Create one consolidated branch from main 2. Cherry-pick all task commits in execution order 3. Push the branch and create a single PR ### Commands to Use - Use ` + "`" + `git cherry-pick` + "`" + ` to bring commits from task branches - Use ` + "`" + `git push -u origin <branch>` + "`" + ` to push branches - Use ` + "`" + `gh pr create` + "`" + ` to create pull requests - If cherry-pick has conflicts, resolve them or report them clearly - You can use the worktree paths above to review file changes if needed ### PR Format Title: "ultraplan: group N - <objective summary>" (for stacked) or "ultraplan: <objective summary>" (for single) Body should include: - The objective - Which tasks are included - Integration notes from synthesis review (if any) - For stacked PRs: note the merge order dependency ## Completion Protocol When consolidation is complete, you MUST write a completion file: 1. Use Write tool to create ` + "`" + ConsolidationCompletionFileName + "`" + ` in your worktree root 2. Include this JSON structure: ` + "```json" + ` { "status": "complete", "mode": "%s", "group_results": [ { "group_index": 0, "branch_name": "branch-name", "tasks_included": ["task-1", "task-2"], "commit_count": 5, "success": true } ], "prs_created": [ { "url": "https://github.com/owner/repo/pull/123", "title": "PR title", "group_index": 0 } ], "total_commits": 10, "files_changed": ["file1.go", "file2.go"] } ` + "```" + ` 3. Set status to "complete" if all PRs were created successfully 4. Set status to "partial" if some PRs failed to create 5. Set status to "failed" if consolidation could not complete 6. List all PR URLs in prs_created array This file signals that consolidation is done and provides a record of the PRs created.`
ConsolidationPromptTemplate is the prompt used for the consolidation phase This prompts Claude to consolidate task branches into group branches and create PRs
const GroupConsolidationCompletionFileName = ".claudio-group-consolidation-complete.json"
GroupConsolidationCompletionFileName is the sentinel file that per-group consolidators write when complete
const PlanFileName = ".claudio-plan.json"
PlanFileName is the name of the file where the planning agent writes its plan
const PlanningPromptTemplate = `You are a senior software architect planning a complex task. ## Objective %s ## Instructions 1. **Explore** the codebase to understand its structure and patterns 2. **Decompose** the objective into discrete, parallelizable tasks 3. **Write your plan** to the file ` + "`" + PlanFileName + "`" + ` in JSON format ## Plan JSON Schema Write a JSON file with this structure: - "summary": Brief executive summary (string) - "tasks": Array of task objects, each with: - "id": Unique identifier like "task-1-setup" (string) - "title": Short title (string) - "description": Detailed instructions for another Claude instance to execute independently (string) - "files": Files this task will modify (array of strings) - "depends_on": IDs of tasks that must complete first (array of strings, empty for independent tasks) - "priority": Lower = higher priority within dependency level (number) - "est_complexity": "low", "medium", or "high" (string) - "insights": Key findings about the codebase (array of strings) - "constraints": Risks or constraints to consider (array of strings) ## Guidelines - Prefer granular tasks that can run in parallel over large sequential ones - Assign clear file ownership to avoid merge conflicts - Each task description should be complete enough for independent execution - Use Write tool to create the plan file when ready`
PlanningPromptTemplate is the prompt used for the planning phase
const RevisionCompletionFileName = ".claudio-revision-complete.json"
RevisionCompletionFileName is the sentinel file that revision tasks write when complete
const RevisionPromptTemplate = `You are addressing issues identified during review of completed work. ## Original Objective %s ## Task Being Revised - Task ID: %s - Task Title: %s - Original Description: %s - Revision Round: %d ## Issues to Address %s ## Worktree Information You are working in the same worktree that was used for the original task. All previous changes from this task are already present. ## Instructions 1. **Review** the issues identified above 2. **Fix** each issue in the codebase 3. **Test** that your fixes don't break existing functionality 4. **Commit** your changes with a clear message describing the fixes Focus only on addressing the identified issues. Do not refactor or make other changes unless directly related to fixing the issues. ## Completion Protocol When your revision is complete, you MUST write a completion file: 1. Use Write tool to create ` + "`" + RevisionCompletionFileName + "`" + ` in your worktree root 2. Include this JSON structure: ` + "```json" + ` { "task_id": "%s", "revision_round": %d, "issues_addressed": ["Description of issue 1 that was fixed", "Description of issue 2"], "summary": "Brief summary of the changes made", "files_modified": ["file1.go", "file2.go"], "remaining_issues": ["Any issues that could not be fixed"] } ` + "```" + ` 3. List all issues you successfully addressed in issues_addressed 4. Leave remaining_issues empty if all issues were fixed 5. This file signals that your revision is done`
RevisionPromptTemplate is the prompt used for the revision phase It instructs Claude to fix the identified issues in a specific task's worktree
const SynthesisCompletionFileName = ".claudio-synthesis-complete.json"
SynthesisCompletionFileName is the sentinel file that synthesis writes when complete
const SynthesisPromptTemplate = `You are reviewing the results of a parallel execution plan. ## Original Objective %s ## Completed Tasks %s ## Task Results Summary %s ## Instructions 1. **Review** all completed work to ensure it meets the original objective 2. **Identify** any integration issues, bugs, or conflicts that need resolution 3. **Verify** that all pieces work together correctly 4. **Check** for any missing functionality or incomplete implementations ## Completion Protocol When your review is complete, you MUST write a completion file to signal the orchestrator: 1. Use Write tool to create ` + "`" + SynthesisCompletionFileName + "`" + ` in your worktree root 2. Include this JSON structure: ` + "```json" + ` { "status": "complete", "revision_round": %d, "issues_found": [ { "task_id": "task-id-here", "description": "Clear description of the issue", "files": ["file1.go", "file2.go"], "severity": "critical|major|minor", "suggestion": "How to fix this issue" } ], "tasks_affected": ["task-1", "task-2"], "integration_notes": "Observations about how the pieces integrate", "recommendations": ["Suggestions for the consolidation phase"] } ` + "```" + ` 3. Set status to "needs_revision" if critical/major issues require fixing, "complete" otherwise 4. Leave issues_found as empty array [] if no issues found 5. Include integration_notes with observations about cross-task integration 6. Add recommendations for the consolidation phase (merge order, potential conflicts, etc.) This file signals that your review is done and provides context for subsequent phases.`
SynthesisPromptTemplate is the prompt used for the synthesis phase
const TaskCompletionFileName = ".claudio-task-complete.json"
TaskCompletionFileName is the name of the sentinel file that tasks write when complete
Variables ¶
This section is empty.
Functions ¶
func ConsolidationCompletionFilePath ¶
ConsolidationCompletionFilePath returns the full path to the consolidation completion file
func GenerateID ¶
func GenerateID() string
GenerateID generates a new random 8-character hex ID for sessions and instances. Exported for use by cmd package.
func GroupConsolidationCompletionFilePath ¶
GroupConsolidationCompletionFilePath returns the full path to the group consolidation completion file
func PlanFilePath ¶
PlanFilePath returns the full path to the plan file for a given worktree
func RevisionCompletionFilePath ¶
RevisionCompletionFilePath returns the full path to the revision completion file
func SynthesisCompletionFilePath ¶
SynthesisCompletionFilePath returns the full path to the synthesis completion file
func TaskCompletionFilePath ¶
TaskCompletionFilePath returns the full path to the task completion file for a given worktree
func ValidatePlan ¶
ValidatePlan checks the plan for validity (no cycles, valid dependencies)
Types ¶
type AggregatedTaskContext ¶
type AggregatedTaskContext struct {
TaskSummaries map[string]string // taskID -> summary
AllIssues []string // All issues from all tasks
AllSuggestions []string // All suggestions from all tasks
Dependencies []string // Deduplicated list of new dependencies
Notes []string // Implementation notes from all tasks
}
AggregatedTaskContext holds the aggregated context from all task completion files
func (*AggregatedTaskContext) FormatForPR ¶
func (a *AggregatedTaskContext) FormatForPR() string
FormatForPR formats the aggregated context for inclusion in a PR description
func (*AggregatedTaskContext) HasContent ¶
func (a *AggregatedTaskContext) HasContent() bool
HasContent returns true if there is any aggregated context worth displaying
type ConflictError ¶
type ConflictError struct {
TaskID string
Branch string
Files []string
WorktreePath string
Underlying error
}
ConflictError represents a conflict during consolidation
func (*ConflictError) Error ¶
func (e *ConflictError) Error() string
type ConflictResolution ¶
type ConflictResolution struct {
File string `json:"file"` // File that had the conflict
Resolution string `json:"resolution"` // Description of how it was resolved
}
ConflictResolution describes how a merge conflict was resolved
type ConsolidationCompletionFile ¶
type ConsolidationCompletionFile struct {
Status string `json:"status"` // "complete", "partial", "failed"
Mode string `json:"mode"` // "stacked" or "single"
GroupResults []GroupConsolidationInfo `json:"group_results"`
PRsCreated []PRInfo `json:"prs_created"`
SynthesisContext *SynthesisCompletionFile `json:"synthesis_context,omitempty"`
TotalCommits int `json:"total_commits"`
FilesChanged []string `json:"files_changed"`
}
ConsolidationCompletionFile represents the completion report from consolidation
func ParseConsolidationCompletionFile ¶
func ParseConsolidationCompletionFile(worktreePath string) (*ConsolidationCompletionFile, error)
ParseConsolidationCompletionFile reads and parses a consolidation completion file
type ConsolidationConfig ¶
type ConsolidationConfig struct {
Mode ConsolidationMode
BranchPrefix string
CreateDraftPRs bool
PRLabels []string
}
ConsolidationConfig holds configuration for branch consolidation
type ConsolidationEvent ¶
type ConsolidationEvent struct {
Type ConsolidationEventType `json:"type"`
GroupIdx int `json:"group_idx,omitempty"`
TaskID string `json:"task_id,omitempty"`
Message string `json:"message,omitempty"`
Timestamp time.Time `json:"timestamp"`
}
ConsolidationEvent represents an event during consolidation
type ConsolidationEventType ¶
type ConsolidationEventType string
ConsolidationEventType represents events during consolidation
const ( EventConsolidationStarted ConsolidationEventType = "consolidation_started" EventConsolidationGroupStarted ConsolidationEventType = "consolidation_group_started" EventConsolidationTaskMerging ConsolidationEventType = "consolidation_task_merging" EventConsolidationTaskMerged ConsolidationEventType = "consolidation_task_merged" EventConsolidationGroupComplete ConsolidationEventType = "consolidation_group_complete" EventConsolidationPRCreating ConsolidationEventType = "consolidation_pr_creating" EventConsolidationPRCreated ConsolidationEventType = "consolidation_pr_created" EventConsolidationConflict ConsolidationEventType = "consolidation_conflict" EventConsolidationComplete ConsolidationEventType = "consolidation_complete" EventConsolidationFailed ConsolidationEventType = "consolidation_failed" )
type ConsolidationMode ¶
type ConsolidationMode string
ConsolidationMode defines how work is consolidated after ultraplan execution
const ( // ModeStackedPRs creates one PR per execution group, stacked on each other ModeStackedPRs ConsolidationMode = "stacked" // ModeSinglePR consolidates all work into a single PR ModeSinglePR ConsolidationMode = "single" )
type ConsolidationPhase ¶
type ConsolidationPhase string
ConsolidationPhase represents sub-phases within consolidation
const ( ConsolidationIdle ConsolidationPhase = "idle" ConsolidationDetecting ConsolidationPhase = "detecting_conflicts" ConsolidationCreatingBranches ConsolidationPhase = "creating_branches" ConsolidationMergingTasks ConsolidationPhase = "merging_tasks" ConsolidationPushing ConsolidationPhase = "pushing" ConsolidationCreatingPRs ConsolidationPhase = "creating_prs" ConsolidationPaused ConsolidationPhase = "paused" ConsolidationComplete ConsolidationPhase = "complete" ConsolidationFailed ConsolidationPhase = "failed" )
type ConsolidationState ¶
type ConsolidationState struct {
Phase ConsolidationPhase `json:"phase"`
CurrentGroup int `json:"current_group"`
TotalGroups int `json:"total_groups"`
CurrentTask string `json:"current_task,omitempty"`
GroupBranches []string `json:"group_branches"`
PRUrls []string `json:"pr_urls"`
ConflictFiles []string `json:"conflict_files,omitempty"`
ConflictTaskID string `json:"conflict_task_id,omitempty"`
ConflictWorktree string `json:"conflict_worktree,omitempty"`
Error string `json:"error,omitempty"`
StartedAt *time.Time `json:"started_at,omitempty"`
CompletedAt *time.Time `json:"completed_at,omitempty"`
}
ConsolidationState tracks the progress of consolidation
type Consolidator ¶
type Consolidator struct {
// contains filtered or unexported fields
}
Consolidator handles the consolidation of task branches into group branches and PR creation
func NewConsolidator ¶
func NewConsolidator(orch *Orchestrator, session *UltraPlanSession, baseSession *Session, config ConsolidationConfig) *Consolidator
NewConsolidator creates a new consolidator
func (*Consolidator) Results ¶
func (c *Consolidator) Results() []*GroupConsolidationResult
Results returns the consolidation results
func (*Consolidator) Resume ¶
func (c *Consolidator) Resume() error
Resume resumes consolidation after conflict resolution
func (*Consolidator) Run ¶
func (c *Consolidator) Run() error
Run executes the full consolidation process
func (*Consolidator) SetEventCallback ¶
func (c *Consolidator) SetEventCallback(cb func(ConsolidationEvent))
SetEventCallback sets the callback for consolidation events
func (*Consolidator) State ¶
func (c *Consolidator) State() *ConsolidationState
State returns a copy of the current consolidation state
type Coordinator ¶
type Coordinator struct {
// contains filtered or unexported fields
}
Coordinator orchestrates the execution of an ultra-plan
func NewCoordinator ¶
func NewCoordinator(orch *Orchestrator, baseSession *Session, ultraSession *UltraPlanSession) *Coordinator
NewCoordinator creates a new coordinator for an ultra-plan session
func (*Coordinator) GetConsolidation ¶
func (c *Coordinator) GetConsolidation() *ConsolidationState
GetConsolidation returns the current consolidation state
func (*Coordinator) GetProgress ¶
func (c *Coordinator) GetProgress() (completed, total int, phase UltraPlanPhase)
GetProgress returns the current progress
func (*Coordinator) GetRunningTasks ¶
func (c *Coordinator) GetRunningTasks() map[string]string
GetRunningTasks returns the currently running tasks and their instance IDs
func (*Coordinator) Manager ¶
func (c *Coordinator) Manager() *UltraPlanManager
Manager returns the underlying ultra-plan manager
func (*Coordinator) Plan ¶
func (c *Coordinator) Plan() *PlanSpec
Plan returns the current plan, if available
func (*Coordinator) ResumeWithPartialWork ¶
func (c *Coordinator) ResumeWithPartialWork() error
ResumeWithPartialWork continues execution with only the successful tasks
func (*Coordinator) RetryFailedTasks ¶
func (c *Coordinator) RetryFailedTasks() error
RetryFailedTasks retries the failed tasks in the current group
func (*Coordinator) RunPlanning ¶
func (c *Coordinator) RunPlanning() error
RunPlanning executes the planning phase This creates a coordinator instance that explores the codebase and generates a plan
func (*Coordinator) RunSynthesis ¶
func (c *Coordinator) RunSynthesis() error
RunSynthesis executes the synthesis phase
func (*Coordinator) Session ¶
func (c *Coordinator) Session() *UltraPlanSession
Session returns the ultra-plan session
func (*Coordinator) SetCallbacks ¶
func (c *Coordinator) SetCallbacks(cb *CoordinatorCallbacks)
SetCallbacks sets the coordinator callbacks
func (*Coordinator) SetPlan ¶
func (c *Coordinator) SetPlan(plan *PlanSpec) error
SetPlan sets the plan for this ultra-plan session (used after planning completes)
func (*Coordinator) StartConsolidation ¶
func (c *Coordinator) StartConsolidation() error
StartConsolidation begins the consolidation phase This creates a Claude instance that performs branch consolidation and PR creation
func (*Coordinator) StartExecution ¶
func (c *Coordinator) StartExecution() error
StartExecution begins the execution phase This spawns child instances for each task group
func (*Coordinator) StartRevision ¶
func (c *Coordinator) StartRevision(issues []RevisionIssue) error
StartRevision begins the revision phase to address identified issues
func (*Coordinator) TriggerConsolidation ¶
func (c *Coordinator) TriggerConsolidation() error
TriggerConsolidation manually signals that synthesis is done and consolidation should proceed. This is called from the TUI when the user indicates they're done with synthesis review.
type CoordinatorCallbacks ¶
type CoordinatorCallbacks struct {
// OnPhaseChange is called when the ultra-plan phase changes
OnPhaseChange func(phase UltraPlanPhase)
// OnTaskStart is called when a task begins execution
OnTaskStart func(taskID, instanceID string)
// OnTaskComplete is called when a task completes successfully
OnTaskComplete func(taskID string)
// OnTaskFailed is called when a task fails
OnTaskFailed func(taskID, reason string)
// OnGroupComplete is called when an execution group completes
OnGroupComplete func(groupIndex int)
// OnPlanReady is called when the plan is ready (after planning phase)
OnPlanReady func(plan *PlanSpec)
// OnProgress is called periodically with progress updates
OnProgress func(completed, total int, phase UltraPlanPhase)
// OnComplete is called when the entire ultra-plan completes
OnComplete func(success bool, summary string)
}
CoordinatorCallbacks holds callbacks for coordinator events
type CoordinatorEvent ¶
type CoordinatorEvent struct {
Type CoordinatorEventType `json:"type"`
TaskID string `json:"task_id,omitempty"`
InstanceID string `json:"instance_id,omitempty"`
Message string `json:"message,omitempty"`
Timestamp time.Time `json:"timestamp"`
}
CoordinatorEvent represents an event from the coordinator during execution
type CoordinatorEventType ¶
type CoordinatorEventType string
CoordinatorEventType represents the type of coordinator event
const ( EventTaskStarted CoordinatorEventType = "task_started" EventTaskComplete CoordinatorEventType = "task_complete" EventTaskFailed CoordinatorEventType = "task_failed" EventTaskBlocked CoordinatorEventType = "task_blocked" EventGroupComplete CoordinatorEventType = "group_complete" EventPhaseChange CoordinatorEventType = "phase_change" EventConflict CoordinatorEventType = "conflict" EventPlanReady CoordinatorEventType = "plan_ready" )
type FlexibleString ¶
type FlexibleString string
FlexibleString is a type that can unmarshal from either a JSON string or an array of strings. When unmarshaling an array, the strings are joined with newlines. This provides flexibility for Claude instances that may write notes as either format.
func (FlexibleString) String ¶
func (f FlexibleString) String() string
String returns the underlying string value
func (*FlexibleString) UnmarshalJSON ¶
func (f *FlexibleString) UnmarshalJSON(data []byte) error
UnmarshalJSON implements json.Unmarshaler for FlexibleString
type GroupConsolidationCompletionFile ¶
type GroupConsolidationCompletionFile struct {
GroupIndex int `json:"group_index"`
Status string `json:"status"` // "complete", "failed"
BranchName string `json:"branch_name"`
TasksConsolidated []string `json:"tasks_consolidated"`
ConflictsResolved []ConflictResolution `json:"conflicts_resolved,omitempty"`
Verification VerificationResult `json:"verification"`
AggregatedContext *AggregatedTaskContext `json:"aggregated_context,omitempty"`
Notes string `json:"notes,omitempty"` // Consolidator's observations
IssuesForNextGroup []string `json:"issues_for_next_group,omitempty"` // Warnings/concerns to pass forward
}
GroupConsolidationCompletionFile is written by the per-group consolidator session when it finishes consolidating a group's task branches
func ParseGroupConsolidationCompletionFile ¶
func ParseGroupConsolidationCompletionFile(worktreePath string) (*GroupConsolidationCompletionFile, error)
ParseGroupConsolidationCompletionFile reads and parses a group consolidation completion file
type GroupConsolidationInfo ¶
type GroupConsolidationInfo struct {
GroupIndex int `json:"group_index"`
BranchName string `json:"branch_name"`
TasksIncluded []string `json:"tasks_included"`
CommitCount int `json:"commit_count"`
Success bool `json:"success"`
}
GroupConsolidationInfo holds info about a consolidated group
type GroupConsolidationResult ¶
type GroupConsolidationResult struct {
GroupIndex int `json:"group_index"`
TaskIDs []string `json:"task_ids"`
BranchName string `json:"branch_name"`
CommitCount int `json:"commit_count"`
FilesChanged []string `json:"files_changed"`
PRUrl string `json:"pr_url,omitempty"`
Success bool `json:"success"`
Error string `json:"error,omitempty"`
}
GroupConsolidationResult holds the result of consolidating one group
type GroupDecisionState ¶
type GroupDecisionState struct {
GroupIndex int `json:"group_index"`
SucceededTasks []string `json:"succeeded_tasks"` // Tasks with verified commits
FailedTasks []string `json:"failed_tasks"` // Tasks that failed or produced no commits
AwaitingDecision bool `json:"awaiting_decision"` // True when paused for user input
}
GroupDecisionState tracks state when a group has partial success/failure
type Instance ¶
type Instance struct {
ID string `json:"id"`
WorktreePath string `json:"worktree_path"`
Branch string `json:"branch"`
Task string `json:"task"`
Status InstanceStatus `json:"status"`
PID int `json:"pid,omitempty"`
FilesModified []string `json:"files_modified,omitempty"`
Created time.Time `json:"created"`
TmuxSession string `json:"tmux_session,omitempty"` // Tmux session name for recovery
Metrics *Metrics `json:"metrics,omitempty"`
Output []byte `json:"-"` // Not persisted, runtime only
}
Instance represents a single Claude Code instance
func NewInstance ¶
NewInstance creates a new instance with a generated ID
type InstanceStatus ¶
type InstanceStatus string
InstanceStatus represents the current state of a Claude instance
const ( StatusPending InstanceStatus = "pending" StatusWorking InstanceStatus = "working" StatusWaitingInput InstanceStatus = "waiting_input" StatusPaused InstanceStatus = "paused" StatusCompleted InstanceStatus = "completed" StatusError InstanceStatus = "error" StatusCreatingPR InstanceStatus = "creating_pr" StatusStuck InstanceStatus = "stuck" // No activity for configured timeout period StatusTimeout InstanceStatus = "timeout" // Total runtime exceeded configured limit )
type Metrics ¶
type Metrics struct {
InputTokens int64 `json:"input_tokens"`
OutputTokens int64 `json:"output_tokens"`
CacheRead int64 `json:"cache_read,omitempty"`
CacheWrite int64 `json:"cache_write,omitempty"`
Cost float64 `json:"cost"`
APICalls int `json:"api_calls"`
StartTime *time.Time `json:"start_time,omitempty"`
EndTime *time.Time `json:"end_time,omitempty"`
}
Metrics tracks resource usage and costs for an instance
func (*Metrics) TotalTokens ¶
TotalTokens returns the sum of input and output tokens
type Orchestrator ¶
type Orchestrator struct {
// contains filtered or unexported fields
}
Orchestrator manages the Claudio session and coordinates instances
func New ¶
func New(baseDir string) (*Orchestrator, error)
New creates a new Orchestrator for the given repository
func NewWithConfig ¶
func NewWithConfig(baseDir string, cfg *config.Config) (*Orchestrator, error)
NewWithConfig creates a new Orchestrator with the given configuration. This is a legacy constructor that doesn't support multi-session - use NewWithSession instead.
func NewWithSession ¶
func NewWithSession(baseDir, sessionID string, cfg *config.Config) (*Orchestrator, error)
NewWithSession creates a new Orchestrator for a specific session. This is the preferred constructor for multi-session support. The sessionID determines the storage location and lock file.
func (*Orchestrator) AddInstance ¶
func (o *Orchestrator) AddInstance(session *Session, task string) (*Instance, error)
AddInstance adds a new Claude instance to the session
func (*Orchestrator) AddInstanceFromBranch ¶
func (o *Orchestrator) AddInstanceFromBranch(session *Session, task string, baseBranch string) (*Instance, error)
AddInstanceFromBranch adds a new Claude instance with a worktree branched from a specific base branch. This is used for ultraplan tasks where the next group should build on the consolidated branch from the previous group.
func (*Orchestrator) AddInstanceToWorktree ¶
func (o *Orchestrator) AddInstanceToWorktree(session *Session, task string, worktreePath string, branch string) (*Instance, error)
AddInstanceToWorktree adds a new instance that uses an existing worktree This is used for revision tasks that need to work in the same worktree as the original task
func (*Orchestrator) BranchPrefix ¶
func (o *Orchestrator) BranchPrefix() string
BranchPrefix returns the configured branch prefix for use by other packages
func (*Orchestrator) CleanOrphanedTmuxSessions ¶
func (o *Orchestrator) CleanOrphanedTmuxSessions() (int, error)
CleanOrphanedTmuxSessions kills all orphaned claudio tmux sessions
func (*Orchestrator) ClearCompletedInstances ¶
func (o *Orchestrator) ClearCompletedInstances(session *Session) (int, error)
ClearCompletedInstances removes all instances with StatusCompleted from the session Returns the number of instances removed and any error encountered
func (*Orchestrator) Config ¶
func (o *Orchestrator) Config() *config.Config
Config returns the orchestrator's configuration
func (*Orchestrator) GetConflictDetector ¶
func (o *Orchestrator) GetConflictDetector() *conflict.Detector
GetConflictDetector returns the conflict detector
func (*Orchestrator) GetInstance ¶
func (o *Orchestrator) GetInstance(id string) *Instance
GetInstance returns an instance by ID from the current session
func (*Orchestrator) GetInstanceDiff ¶
func (o *Orchestrator) GetInstanceDiff(worktreePath string) (string, error)
GetInstanceDiff returns the git diff for an instance against main
func (*Orchestrator) GetInstanceManager ¶
func (o *Orchestrator) GetInstanceManager(id string) *instance.Manager
GetInstanceManager returns the manager for an instance
func (*Orchestrator) GetInstanceMetrics ¶
func (o *Orchestrator) GetInstanceMetrics(id string) *Metrics
GetInstanceMetrics returns the current metrics for a specific instance
func (*Orchestrator) GetOrphanedTmuxSessions ¶
func (o *Orchestrator) GetOrphanedTmuxSessions() ([]string, error)
GetOrphanedTmuxSessions returns tmux sessions that exist but aren't tracked by the current session
func (*Orchestrator) GetPRWorkflow ¶
func (o *Orchestrator) GetPRWorkflow(id string) *instance.PRWorkflow
GetPRWorkflow returns the PR workflow for an instance, if any
func (*Orchestrator) GetSessionMetrics ¶
func (o *Orchestrator) GetSessionMetrics() *SessionMetrics
GetSessionMetrics aggregates metrics across all instances in the session
func (*Orchestrator) HasExistingSession ¶
func (o *Orchestrator) HasExistingSession() bool
HasExistingSession checks if there's an existing session file
func (*Orchestrator) HasLegacySession ¶
func (o *Orchestrator) HasLegacySession() bool
HasLegacySession checks if there's a legacy single-session file that might need migration to multi-session format.
func (*Orchestrator) Init ¶
func (o *Orchestrator) Init() error
Init initializes the Claudio directory structure
func (*Orchestrator) LoadSession ¶
func (o *Orchestrator) LoadSession() (*Session, error)
LoadSession loads an existing session from disk
func (*Orchestrator) LoadSessionWithLock ¶
func (o *Orchestrator) LoadSessionWithLock() (*Session, error)
LoadSessionWithLock loads an existing session and acquires a lock on it. Use this for multi-session mode to prevent concurrent access.
func (*Orchestrator) ReconnectInstance ¶
func (o *Orchestrator) ReconnectInstance(inst *Instance) error
ReconnectInstance attempts to reconnect to a stopped or paused instance If the tmux session still exists, it reconnects to it If not, it restarts Claude with the same task in the existing worktree
func (*Orchestrator) RecoverSession ¶
func (o *Orchestrator) RecoverSession() (*Session, []string, error)
RecoverSession loads a session and attempts to reconnect to running tmux sessions Returns a list of instance IDs that were successfully reconnected
func (*Orchestrator) ReleaseLock ¶
func (o *Orchestrator) ReleaseLock() error
ReleaseLock releases the session lock if one is held. Safe to call multiple times.
func (*Orchestrator) RemoveInstance ¶
func (o *Orchestrator) RemoveInstance(session *Session, instanceID string, force bool) error
RemoveInstance stops and removes a specific instance, including its worktree and branch
func (*Orchestrator) ResizeAllInstances ¶
func (o *Orchestrator) ResizeAllInstances(width, height int)
ResizeAllInstances resizes all running tmux sessions to the given dimensions and stores the dimensions for new instances
func (*Orchestrator) SaveSession ¶
func (o *Orchestrator) SaveSession() error
SaveSession is a public wrapper for saveSession, used by components like the Coordinator that need to trigger session persistence
func (*Orchestrator) Session ¶
func (o *Orchestrator) Session() *Session
Session returns the current session
func (*Orchestrator) SessionID ¶
func (o *Orchestrator) SessionID() string
SessionID returns the current session ID
func (*Orchestrator) SetBellCallback ¶
func (o *Orchestrator) SetBellCallback(cb func(instanceID string))
SetBellCallback sets the callback for when a terminal bell is detected in an instance
func (*Orchestrator) SetDisplayDimensions ¶
func (o *Orchestrator) SetDisplayDimensions(width, height int)
SetDisplayDimensions sets the initial display dimensions for new instances This should be called before the TUI starts to ensure instances are created with the correct size from the beginning
func (*Orchestrator) SetPRCompleteCallback ¶
func (o *Orchestrator) SetPRCompleteCallback(cb func(instanceID string, success bool))
SetPRCompleteCallback sets the callback for PR workflow completion
func (*Orchestrator) SetPROpenedCallback ¶
func (o *Orchestrator) SetPROpenedCallback(cb func(instanceID string))
SetPROpenedCallback sets the callback for when a PR URL is detected in instance output
func (*Orchestrator) SetTimeoutCallback ¶
func (o *Orchestrator) SetTimeoutCallback(cb func(instanceID string, timeoutType instance.TimeoutType))
SetTimeoutCallback sets the callback for when an instance timeout is detected
func (*Orchestrator) StartInstance ¶
func (o *Orchestrator) StartInstance(inst *Instance) error
StartInstance starts a Claude process for an instance
func (*Orchestrator) StartPRWorkflow ¶
func (o *Orchestrator) StartPRWorkflow(inst *Instance) error
StartPRWorkflow starts the commit-push-PR workflow for an instance
func (*Orchestrator) StartSession ¶
func (o *Orchestrator) StartSession(name string) (*Session, error)
StartSession creates and starts a new session
func (*Orchestrator) StopInstance ¶
func (o *Orchestrator) StopInstance(inst *Instance) error
StopInstance stops a running Claude instance
func (*Orchestrator) StopInstanceWithAutoPR ¶
func (o *Orchestrator) StopInstanceWithAutoPR(inst *Instance) (bool, error)
StopInstanceWithAutoPR stops an instance and optionally starts PR workflow Returns true if PR workflow was started, false if instance was just stopped
func (*Orchestrator) StopSession ¶
func (o *Orchestrator) StopSession(sess *Session, force bool) error
StopSession stops all instances and optionally cleans up
type PRInfo ¶
type PRInfo struct {
URL string `json:"url"`
Title string `json:"title"`
GroupIndex int `json:"group_index"`
}
PRInfo holds information about a created PR
type PlanSpec ¶
type PlanSpec struct {
ID string `json:"id"`
Objective string `json:"objective"` // Original user request
Summary string `json:"summary"` // Executive summary of the plan
Tasks []PlannedTask `json:"tasks"`
DependencyGraph map[string][]string `json:"dependency_graph"` // task_id -> depends_on[]
ExecutionOrder [][]string `json:"execution_order"` // Groups of parallelizable tasks
Insights []string `json:"insights"` // Key findings from exploration
Constraints []string `json:"constraints"` // Identified constraints/risks
CreatedAt time.Time `json:"created_at"`
}
PlanSpec represents the output of the planning phase
func ParsePlanFromFile ¶
ParsePlanFromFile reads and parses a plan from a JSON file
type PlannedTask ¶
type PlannedTask struct {
ID string `json:"id"`
Title string `json:"title"`
Description string `json:"description"` // Detailed task prompt for child session
Files []string `json:"files,omitempty"` // Expected files to be modified
DependsOn []string `json:"depends_on"` // Task IDs this depends on
Priority int `json:"priority"` // Execution priority (lower = earlier)
EstComplexity TaskComplexity `json:"est_complexity"`
}
PlannedTask represents a single decomposed task from the planning phase
type RevisionCompletionFile ¶
type RevisionCompletionFile struct {
TaskID string `json:"task_id"`
RevisionRound int `json:"revision_round"`
IssuesAddressed []string `json:"issues_addressed"` // Issue descriptions that were fixed
Summary string `json:"summary"` // What was changed
FilesModified []string `json:"files_modified"`
RemainingIssues []string `json:"remaining_issues"` // Issues that couldn't be fixed
}
RevisionCompletionFile represents the completion report from a revision task
func ParseRevisionCompletionFile ¶
func ParseRevisionCompletionFile(worktreePath string) (*RevisionCompletionFile, error)
ParseRevisionCompletionFile reads and parses a revision completion file
type RevisionIssue ¶
type RevisionIssue struct {
TaskID string `json:"task_id"` // Task ID that needs revision (empty for cross-cutting issues)
Description string `json:"description"` // Description of the issue
Files []string `json:"files,omitempty"` // Files affected by the issue
Severity string `json:"severity,omitempty"` // "critical", "major", "minor"
Suggestion string `json:"suggestion,omitempty"` // Suggested fix
}
RevisionIssue represents an issue identified during synthesis that needs to be addressed
func ParseRevisionIssuesFromOutput ¶
func ParseRevisionIssuesFromOutput(output string) ([]RevisionIssue, error)
ParseRevisionIssuesFromOutput extracts revision issues from synthesis output It looks for JSON wrapped in <revision_issues></revision_issues> tags
type RevisionState ¶
type RevisionState struct {
Issues []RevisionIssue `json:"issues"` // Issues identified during synthesis
RevisionRound int `json:"revision_round"` // Current revision iteration (starts at 1)
MaxRevisions int `json:"max_revisions"` // Maximum allowed revision rounds
TasksToRevise []string `json:"tasks_to_revise,omitempty"` // Task IDs that need revision
RevisedTasks []string `json:"revised_tasks,omitempty"` // Task IDs that have been revised
RevisionPrompts map[string]string `json:"revision_prompts,omitempty"` // Task ID -> revision prompt
StartedAt *time.Time `json:"started_at,omitempty"`
CompletedAt *time.Time `json:"completed_at,omitempty"`
}
RevisionState tracks the state of the revision phase
func NewRevisionState ¶
func NewRevisionState(issues []RevisionIssue) *RevisionState
NewRevisionState creates a new revision state
func (*RevisionState) IsComplete ¶
func (r *RevisionState) IsComplete() bool
IsComplete returns true if all tasks have been revised
type Session ¶
type Session struct {
ID string `json:"id"`
Name string `json:"name"`
BaseRepo string `json:"base_repo"`
Created time.Time `json:"created"`
Instances []*Instance `json:"instances"`
// UltraPlan holds the ultra-plan session state (nil for regular sessions)
UltraPlan *UltraPlanSession `json:"ultra_plan,omitempty"`
}
Session represents a Claudio work session
func NewSession ¶
NewSession creates a new session with a generated ID
func (*Session) GetInstance ¶
GetInstance returns an instance by ID
type SessionMetrics ¶
type SessionMetrics struct {
TotalInputTokens int64
TotalOutputTokens int64
TotalCacheRead int64
TotalCacheWrite int64
TotalCost float64
TotalAPICalls int
TotalDuration time.Duration
InstanceCount int
ActiveCount int
}
SessionMetrics holds aggregated metrics for the entire session
type SynthesisCompletionFile ¶
type SynthesisCompletionFile struct {
Status string `json:"status"` // "complete", "needs_revision"
RevisionRound int `json:"revision_round"` // Current round (0 for first synthesis)
IssuesFound []RevisionIssue `json:"issues_found"` // All issues identified
TasksAffected []string `json:"tasks_affected"` // Task IDs needing revision
IntegrationNotes string `json:"integration_notes"` // Free-form observations about integration
Recommendations []string `json:"recommendations"` // Suggestions for consolidation phase
}
SynthesisCompletionFile represents the completion report from the synthesis phase
func ParseSynthesisCompletionFile ¶
func ParseSynthesisCompletionFile(worktreePath string) (*SynthesisCompletionFile, error)
ParseSynthesisCompletionFile reads and parses a synthesis completion file
type TaskCompletionFile ¶
type TaskCompletionFile struct {
TaskID string `json:"task_id"`
Status string `json:"status"` // "complete", "blocked", or "failed"
Summary string `json:"summary"`
FilesModified []string `json:"files_modified"`
// Rich context for consolidation
Notes FlexibleString `json:"notes,omitempty"` // Free-form implementation notes (accepts string or array)
Issues []string `json:"issues,omitempty"` // Blocking issues or concerns found
Suggestions []string `json:"suggestions,omitempty"` // Integration suggestions for other tasks
Dependencies []string `json:"dependencies,omitempty"` // Runtime dependencies added
}
TaskCompletionFile represents the completion report written by a task This file serves as both a sentinel (existence = task done) and a context carrier
func ParseTaskCompletionFile ¶
func ParseTaskCompletionFile(worktreePath string) (*TaskCompletionFile, error)
ParseTaskCompletionFile reads and parses a task completion file
type TaskComplexity ¶
type TaskComplexity string
TaskComplexity represents the estimated complexity of a planned task
const ( ComplexityLow TaskComplexity = "low" ComplexityMedium TaskComplexity = "medium" ComplexityHigh TaskComplexity = "high" )
type TaskRetryState ¶
type TaskRetryState struct {
TaskID string `json:"task_id"`
RetryCount int `json:"retry_count"`
MaxRetries int `json:"max_retries"`
LastError string `json:"last_error,omitempty"`
CommitCounts []int `json:"commit_counts,omitempty"` // Commits per attempt (for debugging)
}
TaskRetryState tracks retry attempts for a task that produces no commits
type TaskWorktreeInfo ¶
type TaskWorktreeInfo struct {
TaskID string `json:"task_id"`
TaskTitle string `json:"task_title"`
WorktreePath string `json:"worktree_path"`
Branch string `json:"branch"`
}
TaskWorktreeInfo holds information about a task's worktree for consolidation
type UltraPlanConfig ¶
type UltraPlanConfig struct {
MaxParallel int `json:"max_parallel"` // Maximum concurrent child sessions
DryRun bool `json:"dry_run"` // Run planning only, don't execute
NoSynthesis bool `json:"no_synthesis"` // Skip synthesis phase after execution
AutoApprove bool `json:"auto_approve"` // Auto-approve spawned tasks without confirmation
// Consolidation settings
ConsolidationMode ConsolidationMode `json:"consolidation_mode,omitempty"` // "stacked" or "single"
CreateDraftPRs bool `json:"create_draft_prs"` // Create PRs as drafts
PRLabels []string `json:"pr_labels,omitempty"` // Labels to add to PRs
BranchPrefix string `json:"branch_prefix,omitempty"` // Branch prefix for consolidated branches
// Task verification settings
MaxTaskRetries int `json:"max_task_retries,omitempty"` // Max retry attempts for tasks with no commits (default: 3)
RequireVerifiedCommits bool `json:"require_verified_commits"` // If true, tasks must produce commits to be marked successful (default: true)
}
UltraPlanConfig holds configuration for an ultra-plan session
func DefaultUltraPlanConfig ¶
func DefaultUltraPlanConfig() UltraPlanConfig
DefaultUltraPlanConfig returns the default configuration
type UltraPlanManager ¶
type UltraPlanManager struct {
// contains filtered or unexported fields
}
UltraPlanManager manages the execution of an ultra-plan session
func NewUltraPlanManager ¶
func NewUltraPlanManager(orch *Orchestrator, baseSession *Session, ultraSession *UltraPlanSession) *UltraPlanManager
NewUltraPlanManager creates a new ultra-plan manager
func (*UltraPlanManager) AssignTaskToInstance ¶
func (m *UltraPlanManager) AssignTaskToInstance(taskID, instanceID string)
AssignTaskToInstance records the mapping from task to instance
func (*UltraPlanManager) Events ¶
func (m *UltraPlanManager) Events() <-chan CoordinatorEvent
Events returns the event channel for monitoring
func (*UltraPlanManager) MarkTaskComplete ¶
func (m *UltraPlanManager) MarkTaskComplete(taskID string)
MarkTaskComplete marks a task as completed
func (*UltraPlanManager) MarkTaskFailed ¶
func (m *UltraPlanManager) MarkTaskFailed(taskID string, reason string)
MarkTaskFailed marks a task as failed
func (*UltraPlanManager) Session ¶
func (m *UltraPlanManager) Session() *UltraPlanSession
Session returns the ultra-plan session
func (*UltraPlanManager) SetEventCallback ¶
func (m *UltraPlanManager) SetEventCallback(cb func(CoordinatorEvent))
SetEventCallback sets the callback for coordinator events
func (*UltraPlanManager) SetPhase ¶
func (m *UltraPlanManager) SetPhase(phase UltraPlanPhase)
SetPhase updates the session phase and emits an event
func (*UltraPlanManager) Stop ¶
func (m *UltraPlanManager) Stop()
Stop stops the ultra-plan execution
type UltraPlanPhase ¶
type UltraPlanPhase string
UltraPlanPhase represents the current phase of an ultra-plan session
const ( PhasePlanning UltraPlanPhase = "planning" PhaseRefresh UltraPlanPhase = "context_refresh" PhaseExecuting UltraPlanPhase = "executing" PhaseSynthesis UltraPlanPhase = "synthesis" PhaseRevision UltraPlanPhase = "revision" PhaseConsolidating UltraPlanPhase = "consolidating" PhaseComplete UltraPlanPhase = "complete" PhaseFailed UltraPlanPhase = "failed" )
type UltraPlanSession ¶
type UltraPlanSession struct {
ID string `json:"id"`
Objective string `json:"objective"`
Plan *PlanSpec `json:"plan,omitempty"`
Phase UltraPlanPhase `json:"phase"`
Config UltraPlanConfig `json:"config"`
CoordinatorID string `json:"coordinator_id,omitempty"` // Instance ID of the planning coordinator
SynthesisID string `json:"synthesis_id,omitempty"` // Instance ID of the synthesis reviewer
RevisionID string `json:"revision_id,omitempty"` // Instance ID of the current revision coordinator
ConsolidationID string `json:"consolidation_id,omitempty"` // Instance ID of the consolidation agent
TaskToInstance map[string]string `json:"task_to_instance"` // PlannedTask.ID -> Instance.ID
CompletedTasks []string `json:"completed_tasks"`
FailedTasks []string `json:"failed_tasks"`
CurrentGroup int `json:"current_group"` // Index into ExecutionOrder
Created time.Time `json:"created"`
StartedAt *time.Time `json:"started_at,omitempty"`
CompletedAt *time.Time `json:"completed_at,omitempty"`
Error string `json:"error,omitempty"` // Error message if failed
// Revision state (persisted for recovery and display)
Revision *RevisionState `json:"revision,omitempty"`
// Synthesis completion context (populated from sentinel file)
SynthesisCompletion *SynthesisCompletionFile `json:"synthesis_completion,omitempty"`
// Task worktree information for consolidation context
TaskWorktrees []TaskWorktreeInfo `json:"task_worktrees,omitempty"`
// Per-group consolidated branches: index -> branch name
// After each group completes, parallel task branches are merged into one consolidated branch
// The next group's tasks use this consolidated branch as their base
GroupConsolidatedBranches []string `json:"group_consolidated_branches,omitempty"`
// Per-group consolidator instance IDs: index -> instance ID
// Each group has a dedicated Claude session that consolidates its task branches
GroupConsolidatorIDs []string `json:"group_consolidator_ids,omitempty"`
// Per-group consolidation contexts: index -> completion file data
// Stores the context from each group's consolidator to pass to the next group
GroupConsolidationContexts []*GroupConsolidationCompletionFile `json:"group_consolidation_contexts,omitempty"`
// Consolidation results (persisted for recovery and display)
Consolidation *ConsolidationState `json:"consolidation,omitempty"`
PRUrls []string `json:"pr_urls,omitempty"`
// Task retry tracking: task ID -> retry state
TaskRetries map[string]*TaskRetryState `json:"task_retries,omitempty"`
// Group decision state (set when group has mix of success/failure)
GroupDecision *GroupDecisionState `json:"group_decision,omitempty"`
// Verified commit counts per task (populated after task completion)
TaskCommitCounts map[string]int `json:"task_commit_counts,omitempty"`
}
UltraPlanSession represents an ultra-plan orchestration session
func NewUltraPlanSession ¶
func NewUltraPlanSession(objective string, config UltraPlanConfig) *UltraPlanSession
NewUltraPlanSession creates a new ultra-plan session
func (*UltraPlanSession) AdvanceGroupIfComplete ¶
func (s *UltraPlanSession) AdvanceGroupIfComplete() (advanced bool, previousGroup int)
AdvanceGroupIfComplete checks if the current group is complete and advances to the next group. Returns true if the group was advanced, along with the previous group index.
func (*UltraPlanSession) GetReadyTasks ¶
func (s *UltraPlanSession) GetReadyTasks() []string
GetReadyTasks returns all tasks that are ready to execute (in current group, dependencies met, not yet started) This respects group boundaries - only tasks from the current execution group are considered
func (*UltraPlanSession) GetTask ¶
func (s *UltraPlanSession) GetTask(taskID string) *PlannedTask
GetTask returns a planned task by ID
func (*UltraPlanSession) HasMoreGroups ¶
func (s *UltraPlanSession) HasMoreGroups() bool
HasMoreGroups returns true if there are more groups to execute after the current one
func (*UltraPlanSession) IsCurrentGroupComplete ¶
func (s *UltraPlanSession) IsCurrentGroupComplete() bool
IsCurrentGroupComplete returns true if all tasks in the current group are completed or failed
func (*UltraPlanSession) IsTaskReady ¶
func (s *UltraPlanSession) IsTaskReady(taskID string) bool
IsTaskReady returns true if all dependencies for a task have completed
func (*UltraPlanSession) Progress ¶
func (s *UltraPlanSession) Progress() float64
Progress returns the completion progress as a percentage (0-100)
type VerificationResult ¶
type VerificationResult struct {
ProjectType string `json:"project_type,omitempty"` // Detected: "go", "node", "ios", "python", etc.
CommandsRun []VerificationStep `json:"commands_run"`
OverallSuccess bool `json:"overall_success"`
Summary string `json:"summary,omitempty"` // Brief summary of verification outcome
}
VerificationResult holds the results of build/lint/test verification The consolidator determines appropriate commands based on project type
type VerificationStep ¶
type VerificationStep struct {
Name string `json:"name"` // e.g., "build", "lint", "test"
Command string `json:"command"` // Actual command run
Success bool `json:"success"`
Output string `json:"output,omitempty"` // Truncated output on failure
}
VerificationStep represents a single verification command and its result