Documentation
¶
Index ¶
- func BuildAgentSwitchMessage(planPath, planContent string) m31types.Message
- func CaptureDiffSummary(g *git.Git, beforeHash, afterHash string) (*m31types.DiffSummary, error)
- func ClassifyIntent(ctx context.Context, p provider.LLMProvider, modelID string, input string, ...) (*m31types.IntentResult, error)
- func ClassifyPrompt(goal string, workDir string) m31types.ComplexityLevel
- func ExtractWebsiteTemplate(destDir string) error
- func FallbackClassifyIntent(goal string, workDir string) *m31types.IntentResult
- func FormatDiffSummary(ds *m31types.DiffSummary) string
- func ParsePlan(markdown string) (*m31types.Plan, error)
- func SelectTemplate(modelID string) string
- func ShouldStartWorkflow(result *m31types.IntentResult) bool
- func WorkflowModeForComplexity(c m31types.ComplexityLevel) m31types.WorkflowMode
- type AgentSwitchMsg
- type BehavioralResult
- type CheckpointData
- type CompactionCompleteMsg
- type ContextChange
- type Convention
- type DemonstrationReadyMsg
- type DiffStats
- type DiscussCompleteness
- type DiscussCompletenessMsg
- type DiscussIssue
- type DiscussQualityMsg
- type DiscussState
- type DynamicContextRegistry
- type Engine
- func (e *Engine) BehavioralVerification(task m31types.Task) ([]BehavioralResult, error)
- func (e *Engine) BuildSummary() ShipSummary
- func (e *Engine) CheckDiscussCompleteness() DiscussCompleteness
- func (e *Engine) Close()
- func (e *Engine) DiscussState() DiscussState
- func (e *Engine) ExtractWebsiteTemplateTo() (string, error)
- func (e *Engine) FinalizeDiscuss() error
- func (e *Engine) FlushDecisions() []decision.DecisionReceipt
- func (e *Engine) GenerateFollowUpsIfNeeded(ctx context.Context) ([]string, error)
- func (e *Engine) GetCheckpointData() *CheckpointData
- func (e *Engine) HealTask(ctx context.Context, taskID int) (bool, error)
- func (e *Engine) IntentResult() *m31types.IntentResult
- func (e *Engine) IsPlanComplete() bool
- func (e *Engine) LastHealReport() *m31types.HealReport
- func (e *Engine) LoadCheckpointData(data *CheckpointData)
- func (e *Engine) LogDecision(r decision.DecisionReceipt)
- func (e *Engine) PlanContent() string
- func (e *Engine) PlanVersion() int
- func (e *Engine) PreparePlanFile(planContent string) (string, error)
- func (e *Engine) RunPhase(ctx context.Context, phase m31types.WorkflowPhase, goal string) (*PhaseResult, error)
- func (e *Engine) SaveCheckpointData(goal string)
- func (e *Engine) ScopeIncludes(term string) bool
- func (e *Engine) SessionID() string
- func (e *Engine) SetCollector(c *metrics.Collector)
- func (e *Engine) SetGit(g *git.Git)
- func (e *Engine) SetIntentResult(ir *m31types.IntentResult)
- func (e *Engine) SetLedger(l *ledger.Ledger)
- func (e *Engine) SetModel(modelID string, p provider.LLMProvider)
- func (e *Engine) SetMsgEmitter(em MsgEmitter)
- func (e *Engine) SetPhaseModel(phase m31types.WorkflowPhase, modelID string)
- func (e *Engine) SetRefinementFeedback(feedback string)
- func (e *Engine) SetSessionID(id string)
- func (e *Engine) SetWorkflowMode(mode m31types.WorkflowMode)
- func (e *Engine) SkipDiscuss() error
- func (e *Engine) SnapshotDecisions() []decision.DecisionReceipt
- func (e *Engine) SubmitDiscussAnswer(index int, answer string) error
- func (e *Engine) Transition(ctx context.Context, from, to m31types.WorkflowPhase) error
- func (e *Engine) WorkflowMode() m31types.WorkflowMode
- type EngineOptions
- type ExecuteLoopDetectMsg
- type ExecutePreflightMsg
- type ExecutePreflightResult
- type ExecuteQualityGateMsg
- type Fact
- type FileKnowledge
- type InitAnalysisMsg
- type InitPreflightMsg
- type IntermediateProgressMsg
- type Knowledge
- func (k *Knowledge) AddConvention(c Convention)
- func (k *Knowledge) AddFact(f Fact)
- func (k *Knowledge) AddPattern(p Pattern)
- func (k *Knowledge) DetectConventions(workDir string, files []*codeintel.FileInfo)
- func (k *Knowledge) FormatContext(maxLen int) string
- func (k *Knowledge) GetConventions() []Convention
- func (k *Knowledge) GetFacts() []Fact
- func (k *Knowledge) GetPatterns() []Pattern
- func (k *Knowledge) UpdateFileKnowledge(path string, fk FileKnowledge)
- type MsgEmitter
- type Pattern
- type PhaseResult
- type PhaseTransitionCompleteMsg
- type PhaseTransitionStartMsg
- type PlanCheckMsg
- type PlanCheckResult
- type PlanChunkProgressMsg
- type PlanIssue
- type PlanOutline
- type PlanProgressMsg
- type PlanRevisionMsg
- type PreflightCheck
- type ProjectAnalysis
- type PromptRegistry
- type QualityGateResult
- type ResearchProgressMsg
- type RuntimeCheckCompleteMsg
- type RuntimeSummary
- type SecurityFinding
- type SelfHealCompleteMsg
- type SelfHealStartMsg
- type ShipChangelogMsg
- type ShipPreflightMsg
- type ShipPreflightResult
- type ShipSummary
- type SmokeTestResult
- type TaskDiffSummaryMsg
- type TaskStartMsg
- type TaskStub
- type TaskUpdateMsg
- type ThinkingCompleteMsg
- type ThinkingStartMsg
- type ToolCallTracker
- type ToolCompleteMsg
- type ToolStartMsg
- type VerificationResult
- type VerifyReport
- type VerifyReportMsg
- type VerifyTaskReport
- type WaveOutline
- type WorkflowState
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BuildAgentSwitchMessage ¶ added in v1.3.0
BuildAgentSwitchMessage creates a synthetic user message that instructs the builder agent to execute the plan.
func CaptureDiffSummary ¶ added in v1.3.0
CaptureDiffSummary computes a diff summary between two git commit hashes. Uses git diff --numstat for structured additions/deletions data.
func ClassifyIntent ¶ added in v1.2.0
func ClassifyIntent(ctx context.Context, p provider.LLMProvider, modelID string, input string, prompts *PromptRegistry, timeoutSecs int) (*m31types.IntentResult, error)
ClassifyIntent uses an LLM to classify the user's input intent. Falls back to the keyword-based ClassifyPrompt on failure or timeout. timeoutSecs controls the per-attempt deadline; 0 uses the default (25s).
func ClassifyPrompt ¶
func ClassifyPrompt(goal string, workDir string) m31types.ComplexityLevel
ClassifyPrompt estimates the complexity of a user's goal using heuristics. Factors considered:
- Keyword/phrase matching
- Goal length and sentence count
- Number of existing project files (proxy for project size)
func ExtractWebsiteTemplate ¶ added in v1.3.0
ExtractWebsiteTemplate extracts the bundled Next.js website template to the specified directory. It creates the directory structure and writes all template files. Returns an error if extraction fails.
func FallbackClassifyIntent ¶ added in v1.2.0
func FallbackClassifyIntent(goal string, workDir string) *m31types.IntentResult
FallbackClassifyIntent converts the keyword-based ClassifyPrompt result into an IntentResult for consistent downstream handling.
func FormatDiffSummary ¶ added in v1.3.0
func FormatDiffSummary(ds *m31types.DiffSummary) string
FormatDiffSummary renders a human-readable diff summary.
func ParsePlan ¶
ParsePlan extracts a structured Plan from rich markdown content. The markdown is expected to follow the format defined in plan-format.md. Sections that cannot be parsed are left empty rather than causing an error.
func SelectTemplate ¶ added in v1.3.0
SelectTemplate returns the model-specific prompt template for the given model ID. Falls back to the default template if no model-specific match is found.
func ShouldStartWorkflow ¶ added in v1.2.0
func ShouldStartWorkflow(result *m31types.IntentResult) bool
ShouldStartWorkflow returns true when the classified intent warrants a structured workflow (feature, bugfix, refactor, chore) with sufficient confidence (≥ 0.7).
func WorkflowModeForComplexity ¶
func WorkflowModeForComplexity(c m31types.ComplexityLevel) m31types.WorkflowMode
WorkflowModeForComplexity maps complexity to a workflow mode. ModeAuto delegates to this mapping.
Types ¶
type AgentSwitchMsg ¶ added in v1.3.0
AgentSwitchMsg is emitted when the engine suggests switching from planner to builder agent after plan completion.
type BehavioralResult ¶ added in v1.5.0
type BehavioralResult struct {
Command string `json:"command"`
Passed bool `json:"passed"`
Output string `json:"output"`
Error string `json:"error,omitempty"`
Duration int64 `json:"duration_ms"`
}
BehavioralResult holds the outcome of running a verification command.
type CheckpointData ¶ added in v1.5.0
type CheckpointData struct {
Phase m31types.WorkflowPhase `json:"phase"`
Goal string `json:"goal"`
PlanVersion int `json:"plan_version"`
Decisions []decision.DecisionReceipt `json:"decisions,omitempty"`
Timestamp time.Time `json:"timestamp"`
}
CheckpointData holds data that can be saved/restored across checkpoints.
type CompactionCompleteMsg ¶ added in v1.3.0
CompactionCompleteMsg is emitted when automatic session compaction completes.
type ContextChange ¶ added in v1.5.0
type ContextChange struct {
Source string // e.g., "knowledge", "conventions", "patterns"
Type string // e.g., "refresh", "update", "new"
}
ContextChange represents a change in a context source.
type Convention ¶ added in v1.5.0
type Convention struct {
Category string `json:"category"` // naming, imports, errors, etc.
Pattern string `json:"pattern"` // e.g., "error handling uses sentinel errors"
Example string `json:"example"` // e.g., "m31errors.ErrNotFound"
Confidence float64 `json:"confidence"`
}
Convention represents a detected coding convention.
type DemonstrationReadyMsg ¶
type DemonstrationReadyMsg struct {
Content string
}
DemonstrationReadyMsg carries the generated demonstration content to the TUI.
type DiffStats ¶
type DiffStats struct {
FilesAdded int
FilesModified int
FilesDeleted int
Insertions int
Deletions int
}
DiffStats holds file change statistics from git diff.
type DiscussCompleteness ¶ added in v1.2.0
type DiscussCompleteness struct {
Score int // 0-100
Answered int
Skipped int
Total int
MissingAreas []string
}
DiscussCompleteness holds the result of an answer completeness check.
type DiscussCompletenessMsg ¶ added in v1.2.0
DiscussCompletenessMsg is emitted after the answer completeness check.
type DiscussIssue ¶ added in v1.2.0
type DiscussIssue struct {
Severity string // "blocker" or "warning"
Category string // yes_no, vague, duplicate, redundant
Message string
QuestionIndex int
}
DiscussIssue represents a quality issue found in generated questions.
type DiscussQualityMsg ¶ added in v1.2.0
DiscussQualityMsg is emitted after the question quality checker runs.
type DiscussState ¶
DiscussState holds the questions and collected answers for the discuss phase.
type DynamicContextRegistry ¶ added in v1.5.0
type DynamicContextRegistry struct {
// contains filtered or unexported fields
}
DynamicContextRegistry maintains project knowledge and provides dynamic context for LLM calls. Integrates with code intelligence and knowledge subsystem.
func NewDynamicContextRegistry ¶ added in v1.5.0
func NewDynamicContextRegistry(workDir string, ci *codeintel.Indexer) *DynamicContextRegistry
NewDynamicContextRegistry creates a new registry.
func (*DynamicContextRegistry) GetKnowledge ¶ added in v1.5.0
func (r *DynamicContextRegistry) GetKnowledge() *Knowledge
GetKnowledge returns the project knowledge instance.
func (*DynamicContextRegistry) LoadAll ¶ added in v1.5.0
func (r *DynamicContextRegistry) LoadAll(ctx context.Context) map[string]string
LoadAll returns the current snapshot of all context sources.
func (*DynamicContextRegistry) Reconcile ¶ added in v1.5.0
func (r *DynamicContextRegistry) Reconcile(ctx context.Context, snapshot map[string]string) []ContextChange
Reconcile checks if context sources have changed and returns updates.
type Engine ¶
type Engine struct {
// contains filtered or unexported fields
}
Engine orchestrates the seven active workflow phases (Initialize, Discuss, Plan, Execute, Verify, Runtime, Ship).
func NewEngine ¶
func NewEngine(sessionID, workDir, backupDir, planningDir string, p provider.LLMProvider, modelID string, dispatcher *tools.Dispatcher, tokenEst *tokens.Estimator, sessionMgr *session.Manager, cfg *config.Config) (*Engine, error)
NewEngine creates a workflow engine.
func NewEngineFromOptions ¶
func NewEngineFromOptions(opts EngineOptions) (*Engine, error)
NewEngineFromOptions creates a workflow engine from an EngineOptions struct.
func NewEngineWithCollector ¶ added in v1.5.0
func NewEngineWithCollector(opts EngineOptions) (*Engine, error)
NewEngineWithCollector creates a workflow engine with metrics collection.
func (*Engine) BehavioralVerification ¶ added in v1.5.0
func (e *Engine) BehavioralVerification(task m31types.Task) ([]BehavioralResult, error)
BehavioralVerification runs CMDs from acceptance criteria and validates outcomes. Commands are checked against a blocklist (destructive/dangerous) and allowlist (safe). Commands outside both lists are rejected (would require permission modal in interactive mode).
func (*Engine) BuildSummary ¶
func (e *Engine) BuildSummary() ShipSummary
BuildSummary creates a ShipSummary from the current session state.
func (*Engine) CheckDiscussCompleteness ¶ added in v1.2.0
func (e *Engine) CheckDiscussCompleteness() DiscussCompleteness
CheckDiscussCompleteness evaluates how well the collected answers cover the goal. Called by the TUI after all answers are collected, before proceeding to Plan.
func (*Engine) Close ¶ added in v1.6.1
func (e *Engine) Close()
Close flushes and shuts down the decision logger. Safe to call multiple times.
func (*Engine) DiscussState ¶
func (e *Engine) DiscussState() DiscussState
DiscussState returns a copy of the current discuss state. The TUI uses this to read the parsed questions after the discuss phase returns. The returned struct is a value copy so mutations by the TUI do not affect the engine's internal state.
func (*Engine) ExtractWebsiteTemplateTo ¶ added in v1.3.0
ExtractWebsiteTemplateTo extracts the bundled website template to a temporary directory and stores the path for later injection into the plan/execute context. Returns the path to the extracted template, or an error if extraction fails.
func (*Engine) FinalizeDiscuss ¶
func (*Engine) FlushDecisions ¶ added in v1.5.0
func (e *Engine) FlushDecisions() []decision.DecisionReceipt
FlushDecisions synchronously returns all logged decisions and resets the buffer.
func (*Engine) GenerateFollowUpsIfNeeded ¶ added in v1.2.0
GenerateFollowUpsIfNeeded creates follow-up questions when answers are incomplete. Called by the TUI after CheckDiscussCompleteness if score is low.
func (*Engine) GetCheckpointData ¶ added in v1.5.0
func (e *Engine) GetCheckpointData() *CheckpointData
GetCheckpointData returns the current checkpoint data, or nil if none.
func (*Engine) HealTask ¶
HealTask triggers self-healing for a specific task by ID. Returns true if healing was attempted, false if the task cannot be healed.
func (*Engine) IntentResult ¶ added in v1.2.0
func (e *Engine) IntentResult() *m31types.IntentResult
IntentResult returns the stored intent classification result, or nil if unset.
func (*Engine) IsPlanComplete ¶ added in v1.3.0
IsPlanComplete checks if the engine's plan phase produced a valid plan.
func (*Engine) LastHealReport ¶ added in v1.5.0
func (e *Engine) LastHealReport() *m31types.HealReport
LastHealReport returns the most recent self-heal report, or nil if none.
func (*Engine) LoadCheckpointData ¶ added in v1.5.0
func (e *Engine) LoadCheckpointData(data *CheckpointData)
LoadCheckpointData restores workflow state from a checkpoint. If data is nil, it attempts to load from disk via the session manager.
func (*Engine) LogDecision ¶ added in v1.5.0
func (e *Engine) LogDecision(r decision.DecisionReceipt)
LogDecision records a decision in the session log.
func (*Engine) PlanContent ¶
PlanContent returns the current plan markdown content.
func (*Engine) PlanVersion ¶
PlanVersion returns the current plan version number. Version 1 is the initial plan; each refinement increments it.
func (*Engine) PreparePlanFile ¶ added in v1.3.0
PreparePlanFile creates a plan file at .m31a/plans/<session-id>.md and writes the plan content. Returns the file path.
func (*Engine) RunPhase ¶
func (e *Engine) RunPhase(ctx context.Context, phase m31types.WorkflowPhase, goal string) (*PhaseResult, error)
RunPhase executes the given workflow phase and returns the result.
func (*Engine) SaveCheckpointData ¶ added in v1.5.0
SaveCheckpointData saves current workflow state for checkpoint resume. It persists to both in-memory state and disk via the session manager.
func (*Engine) ScopeIncludes ¶ added in v1.3.0
ScopeIncludes returns true if the intent result's scope contains the given term.
func (*Engine) SetCollector ¶ added in v1.5.0
SetCollector attaches a metrics collector to the engine for recording tool calls, LLM interactions, phase durations, and heal/bisect events.
func (*Engine) SetGit ¶
SetGit sets the git instance on the engine. Required before running any phase that uses git operations.
func (*Engine) SetIntentResult ¶ added in v1.2.0
func (e *Engine) SetIntentResult(ir *m31types.IntentResult)
SetIntentResult stores the LLM-classified intent result for downstream enrichment.
func (*Engine) SetLedger ¶ added in v1.1.0
SetLedger sets the shared ledger instance on the engine so the ship phase writes session records to the application-configured path instead of creating a new ledger at a hardcoded location.
func (*Engine) SetModel ¶
func (e *Engine) SetModel(modelID string, p provider.LLMProvider)
SetModel updates the active model ID and provider for the engine.
func (*Engine) SetMsgEmitter ¶
func (e *Engine) SetMsgEmitter(em MsgEmitter)
SetMsgEmitter sets the callback for emitting messages back to the TUI.
func (*Engine) SetPhaseModel ¶
func (e *Engine) SetPhaseModel(phase m31types.WorkflowPhase, modelID string)
SetPhaseModel assigns a model ID to a specific workflow phase. This takes the highest priority over AgentsConfig and cfg.Model.Default. Called by the TUI after the user selects Planning/Coding models in the picker.
func (*Engine) SetRefinementFeedback ¶
SetRefinementFeedback stores user feedback for the next plan regeneration. The plan phase reads this field to inject feedback into the LLM context. Duplicate feedback is ignored — only new feedback bumps the plan version.
func (*Engine) SetSessionID ¶
SetSessionID updates the engine's session ID.
func (*Engine) SetWorkflowMode ¶
func (e *Engine) SetWorkflowMode(mode m31types.WorkflowMode)
SetWorkflowMode sets the mode that controls phase-skipping behaviour.
func (*Engine) SkipDiscuss ¶
SkipDiscuss fills default (empty) answers and saves.
func (*Engine) SnapshotDecisions ¶ added in v1.5.0
func (e *Engine) SnapshotDecisions() []decision.DecisionReceipt
SnapshotDecisions returns a copy of buffered decisions without flushing.
func (*Engine) SubmitDiscussAnswer ¶
SubmitDiscussAnswer records an answer for a discuss question.
func (*Engine) Transition ¶
Transition saves a checkpoint and writes STATE.md for the new phase. Validates the transition is allowed by the phase ordering guard.
func (*Engine) WorkflowMode ¶
func (e *Engine) WorkflowMode() m31types.WorkflowMode
WorkflowMode returns the current workflow mode.
type EngineOptions ¶
type EngineOptions struct {
SessionID string
WorkDir string
BackupDir string
PlanningDir string
Provider provider.LLMProvider
ModelID string
Dispatcher *tools.Dispatcher
TokenEst *tokens.Estimator
SessionMgr *session.Manager
Config *config.Config
Collector *metrics.Collector
}
EngineOptions holds all parameters for creating a new Engine.
type ExecuteLoopDetectMsg ¶ added in v1.2.0
ExecuteLoopDetectMsg is emitted when a tool call loop is detected.
type ExecutePreflightMsg ¶ added in v1.2.0
ExecutePreflightMsg is emitted after pre-execution validation.
type ExecutePreflightResult ¶ added in v1.2.0
ExecutePreflightResult holds the outcome of pre-execution validation.
type ExecuteQualityGateMsg ¶ added in v1.2.0
ExecuteQualityGateMsg is emitted after per-task acceptance criteria check.
type Fact ¶ added in v1.5.0
type Fact struct {
Category string `json:"category"` // success, failure, preference
Statement string `json:"statement"` // e.g., "go test -race catches data races"
SessionID string `json:"session_id"`
Timestamp time.Time `json:"timestamp"`
}
Fact represents a learned fact from previous sessions.
type FileKnowledge ¶ added in v1.5.0
type FileKnowledge struct {
LastModified time.Time `json:"last_modified"`
Complexity string `json:"complexity"` // low, medium, high
IsTest bool `json:"is_test"`
IsHot bool `json:"is_hot"` // frequently modified
Language string `json:"language"`
}
FileKnowledge holds per-file intelligence.
type InitAnalysisMsg ¶ added in v1.2.0
type InitAnalysisMsg struct {
ProjectType string
Framework string
Language string
DependencyCount int
TestFileRatio float64
FileCount int
HealthScore int // 0-100
}
InitAnalysisMsg is emitted when deep project analysis completes.
type InitPreflightMsg ¶ added in v1.2.0
type InitPreflightMsg struct {
Passed bool
RuntimeVersion string
DiskSpaceOK bool
GitRemoteOK bool
Issues []string
}
InitPreflightMsg is emitted when environment pre-flight checks complete.
type IntermediateProgressMsg ¶
IntermediateProgressMsg is emitted during long operations to show progress.
type Knowledge ¶ added in v1.5.0
type Knowledge struct {
// Conventions detected from codebase (naming, imports, error handling)
Conventions []Convention `json:"conventions"`
// Patterns observed in the codebase (architectural patterns, common shapes)
Patterns []Pattern `json:"patterns"`
// Learned facts from previous sessions (what worked, what failed)
Facts []Fact `json:"facts"`
// File-specific knowledge (hot files, complex files, test patterns)
FileKnowledge map[string]FileKnowledge `json:"file_knowledge"`
// Last analysis timestamp
LastAnalyzed time.Time `json:"last_analyzed"`
// contains filtered or unexported fields
}
Knowledge holds project-specific learnings accumulated across sessions. Stored as methods on WorkflowState (not separate package) until data model proven.
func NewKnowledge ¶ added in v1.5.0
func NewKnowledge() *Knowledge
NewKnowledge creates a new Knowledge instance.
func (*Knowledge) AddConvention ¶ added in v1.5.0
func (k *Knowledge) AddConvention(c Convention)
AddConvention adds a convention if not already present. Caps at 50 conventions to prevent unbounded growth.
func (*Knowledge) AddFact ¶ added in v1.5.0
AddFact adds a learned fact if not already present (dedup by Statement).
func (*Knowledge) AddPattern ¶ added in v1.5.0
AddPattern adds a pattern if not already present. Caps at 50 patterns to prevent unbounded growth.
func (*Knowledge) DetectConventions ¶ added in v1.5.0
DetectConventions analyzes codebase files to detect conventions.
func (*Knowledge) FormatContext ¶ added in v1.5.0
FormatContext returns a formatted string of knowledge for injection into LLM context.
func (*Knowledge) GetConventions ¶ added in v1.5.0
func (k *Knowledge) GetConventions() []Convention
GetConventions returns a copy of all conventions.
func (*Knowledge) GetPatterns ¶ added in v1.5.0
GetPatterns returns a copy of all patterns.
func (*Knowledge) UpdateFileKnowledge ¶ added in v1.5.0
func (k *Knowledge) UpdateFileKnowledge(path string, fk FileKnowledge)
UpdateFileKnowledge updates knowledge for a specific file. Caps at 200 entries to prevent unbounded growth.
type MsgEmitter ¶
type MsgEmitter interface {
Emit(msg any)
}
MsgEmitter is a callback interface for emitting events back to the TUI. Uses `any` to avoid coupling the workflow to the Bubble Tea framework.
type Pattern ¶ added in v1.5.0
type Pattern struct {
Name string `json:"name"` // e.g., "Opts pattern", "sentinel errors"
Description string `json:"description"` // e.g., "Constructor uses Opts struct"
Files []string `json:"files"` // files where pattern is observed
Confidence float64 `json:"confidence"`
}
Pattern represents an observed architectural pattern.
type PhaseResult ¶
type PhaseResult struct {
Phase m31types.WorkflowPhase
Success bool
Messages []m31types.Message
Tasks []m31types.Task
Error string
DurationMs int64
NeedsAnswers bool
RequiresManualInput bool
WorkflowMode m31types.WorkflowMode // mode to use for subsequent transitions
// Execution metrics (populated by Execute/Ship phases)
Usage *m31types.Usage // token usage from LLM calls
Cost float64 // estimated cost
ToolCalls int // number of tool calls made
Commits []git.CommitInfo // commits created during phase
DiffStats DiffStats // file change statistics (Ship phase)
// Manual verification steps from the plan (populated by Verify phase)
ManualVerificationSteps []string
// Demonstration content (populated by Ship phase)
Demonstration string
// Runtime verification results (populated by Runtime phase)
RuntimeSummary *RuntimeSummary
}
PhaseResult holds the outcome of a workflow phase.
type PhaseTransitionCompleteMsg ¶
PhaseTransitionCompleteMsg is emitted when a phase transition completes.
type PhaseTransitionStartMsg ¶
PhaseTransitionStartMsg is emitted when a phase transition begins.
type PlanCheckMsg ¶ added in v1.2.0
PlanCheckMsg is emitted after the plan checker reviews the plan.
type PlanCheckResult ¶ added in v1.2.0
PlanCheckResult holds the outcome of the plan checker review.
type PlanChunkProgressMsg ¶ added in v1.2.0
PlanChunkProgressMsg is emitted during chunked plan generation.
type PlanIssue ¶ added in v1.2.0
type PlanIssue struct {
Severity string // "blocker" or "warning"
Category string // granularity, acceptance, dependency, coverage, alignment, concreteness, security, gap
Message string
TaskID int // 0 if not task-specific
}
PlanIssue represents a single issue found by the plan checker or coverage gates.
type PlanOutline ¶ added in v1.2.0
type PlanOutline struct {
Title string `json:"title"`
Waves []WaveOutline `json:"waves"`
TotalTasks int `json:"total_tasks"`
}
PlanOutline represents the high-level structure of a chunked plan.
type PlanProgressMsg ¶
PlanProgressMsg reports plan generation progress with version info.
type PlanRevisionMsg ¶ added in v1.2.0
PlanRevisionMsg is emitted during each plan revision iteration.
type PreflightCheck ¶ added in v1.2.0
type PreflightCheck struct {
Passed bool
RuntimeVersion string
DiskSpaceOK bool
GitRemoteOK bool
Issues []string
}
PreflightCheck holds the results of environment pre-flight checks.
type ProjectAnalysis ¶ added in v1.2.0
type ProjectAnalysis struct {
ProjectType string
Framework string
Language string
DependencyCount int
TestFileRatio float64
FileCount int
HealthScore int
Details []string
}
ProjectAnalysis holds the results of deep project analysis.
type PromptRegistry ¶
type PromptRegistry struct {
Base string
ToolUse string
PlanFormat string
ExecuteTask string
Discuss string
SelfHeal string
Demonstration string
Autonomous string
ContextAwareness string
CodeQuality string
CodeIntelligence string
Research string
PlanCheck string
PlanRevise string
PlanOutline string
DiscussFollowup string
IntentClassify string
WebsiteBuild string
}
PromptRegistry holds all loaded prompt templates.
func LoadPrompts ¶
func LoadPrompts() (*PromptRegistry, error)
LoadPrompts reads all embedded prompt files and returns a registry.
type QualityGateResult ¶ added in v1.2.0
QualityGateResult holds the outcome of checking acceptance criteria against file state.
type ResearchProgressMsg ¶ added in v1.2.0
ResearchProgressMsg is emitted during the pre-plan research sub-step.
type RuntimeCheckCompleteMsg ¶ added in v1.3.0
type RuntimeCheckCompleteMsg struct {
Summary RuntimeSummary
}
RuntimeCheckCompleteMsg is emitted when runtime smoke tests complete.
type RuntimeSummary ¶ added in v1.3.0
type RuntimeSummary struct {
ProjectType string `json:"project_type"`
ServerURL string `json:"server_url"`
ServerReady bool `json:"server_ready"`
Tests []SmokeTestResult `json:"tests"`
TotalPassed int `json:"total_passed"`
TotalFailed int `json:"total_failed"`
TotalTests int `json:"total_tests"`
Errors []string `json:"errors,omitempty"`
DurationMs int64 `json:"duration_ms"`
}
RuntimeSummary holds the overall runtime verification results.
type SecurityFinding ¶ added in v1.2.0
type SecurityFinding struct {
Severity string // "high", "medium", "low"
File string
Line int
Pattern string
Message string
}
SecurityFinding holds a security-related finding from scanning task files.
type SelfHealCompleteMsg ¶
SelfHealCompleteMsg is emitted when a self-heal attempt finishes.
type SelfHealStartMsg ¶
SelfHealStartMsg is emitted when a self-heal attempt begins.
type ShipChangelogMsg ¶ added in v1.2.0
ShipChangelogMsg is emitted when the changelog is generated.
type ShipPreflightMsg ¶ added in v1.2.0
ShipPreflightMsg is emitted when the pre-ship checklist runs.
type ShipPreflightResult ¶ added in v1.2.0
ShipPreflightResult holds the outcome of the pre-ship checklist.
type ShipSummary ¶
type ShipSummary struct {
TaskDone int
TaskTotal int
TaskFailed int
TaskSkipped int
Commits []git.CommitInfo
Duration time.Duration
SessionID string
}
ShipSummary holds the session completion summary.
type SmokeTestResult ¶ added in v1.3.0
type SmokeTestResult struct {
Route string `json:"route"`
Method string `json:"method"`
Status int `json:"status"`
Passed bool `json:"passed"`
Error string `json:"error,omitempty"`
DurationMs int64 `json:"duration_ms"`
BodySize int `json:"body_size"`
HasContent bool `json:"has_content"`
}
SmokeTestResult holds the result of a single HTTP smoke test.
type TaskDiffSummaryMsg ¶ added in v1.3.0
type TaskDiffSummaryMsg struct {
TaskID int
Summary *m31types.DiffSummary
}
TaskDiffSummaryMsg is emitted after a task commit to report file changes.
type TaskStartMsg ¶
TaskStartMsg is emitted when a task begins execution.
type TaskStub ¶ added in v1.2.0
type TaskStub struct {
ID int `json:"id"`
Action string `json:"action"`
Description string `json:"description"`
Dependencies []int `json:"dependencies"`
Category string `json:"category"`
}
TaskStub is a minimal task representation for the outline phase.
type TaskUpdateMsg ¶
TaskUpdateMsg is emitted when a task status changes during execution.
type ThinkingCompleteMsg ¶
type ThinkingCompleteMsg struct {
Context string
}
ThinkingCompleteMsg is emitted when LLM processing ends.
type ThinkingStartMsg ¶
type ThinkingStartMsg struct {
Context string
}
ThinkingStartMsg is emitted when LLM processing begins.
type ToolCallTracker ¶ added in v1.2.0
type ToolCallTracker struct {
// contains filtered or unexported fields
}
ToolCallTracker tracks tool call patterns across iterations to detect loops.
func NewToolCallTracker ¶ added in v1.2.0
func NewToolCallTracker(maxLoop int) *ToolCallTracker
NewToolCallTracker creates a tracker with the given loop threshold.
func (*ToolCallTracker) Count ¶ added in v1.2.0
func (t *ToolCallTracker) Count() int
Count returns total tool calls recorded.
func (*ToolCallTracker) LastLoopTool ¶ added in v1.2.0
func (t *ToolCallTracker) LastLoopTool() string
LastLoopTool returns the tool name involved in the most recent loop, or empty.
func (*ToolCallTracker) Record ¶ added in v1.2.0
func (t *ToolCallTracker) Record(name, input string) bool
Record adds a tool call to the history and returns true if a loop is detected.
type ToolCompleteMsg ¶
type ToolCompleteMsg struct {
ToolName string
Success bool
DurationMs int64
Error string
FilePath string // populated for file-writing tools (FileWrite, Edit, FileDelete, FileMove)
}
ToolCompleteMsg is emitted when a tool call finishes execution.
type ToolStartMsg ¶
ToolStartMsg is emitted when a tool call begins execution.
type VerificationResult ¶
type VerificationResult struct {
TaskID int
FilesExist bool
SyntaxOK bool
TestsOK bool
Errors []string
}
VerificationResult holds the outcome of verifying a task.
type VerifyReport ¶ added in v1.2.0
type VerifyReport struct {
SessionID string
Timestamp time.Time
Total int
Passed int
Failed int
Skipped int
Results []VerifyTaskReport
Security []SecurityFinding
ManualSteps []string
}
VerifyReport holds the structured verification report.
type VerifyReportMsg ¶ added in v1.2.0
VerifyReportMsg is emitted when the verification report is generated.
type VerifyTaskReport ¶ added in v1.2.0
type VerifyTaskReport struct {
TaskID int
Description string
Status string
FilesExist bool
BuildOK bool
TestsOK bool
Errors []string
Duration time.Duration
}
VerifyTaskReport holds per-task verification results.
type WaveOutline ¶ added in v1.2.0
WaveOutline groups tasks by execution wave.
type WorkflowState ¶ added in v1.5.0
type WorkflowState struct {
// Conversation messages for the workflow (updated by /compress proactively)
Messages []m31types.Message
// contains filtered or unexported fields
}
WorkflowState groups mutable session state extracted from Engine. This struct owns plan state, cached data, intent classification, and v1.5 subsystems (decision log, knowledge, budget tracker). The Engine retains phase dispatch, LLM streaming, and subsystem orchestration.
Source Files
¶
- agent_switch.go
- classify.go
- coverage_gates.go
- diff_summary.go
- discuss.go
- discuss_check.go
- engine.go
- engine_messages.go
- engine_parse.go
- engine_verify.go
- execute.go
- execute_preflight.go
- execute_quality.go
- init_deep.go
- initialize.go
- intent.go
- knowledge.go
- knowledge_context.go
- plan.go
- plan_check.go
- plan_chunk.go
- plan_parser.go
- prompt_templates.go
- research.go
- runtime.go
- runtime_proc_unix.go
- ship.go
- ship_lock_unix.go
- ship_preflight.go
- verify.go
- verify_report.go