{"modulePath":"github.com/GrayCodeAI/iterate","version":"v0.0.0-20260824034349-16827216a2d3","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package evolution\n\nPackage evolution provides autonomous code evolution capabilities through iterative improvement cycles with safety checks and version control integration.\n\n### Architecture {#hdr-Architecture}\n\nThe evolution system is the core self-improvement engine of iterate. It operates in phases: plan, code, review, and merge. Each phase uses specialized tools and agents to safely modify the codebase.\n\n### Phase Overview {#hdr-Phase_Overview}\n\n  - Plan Phase: Analyzes the codebase, identifies bugs/issues, and creates a SESSION\\_PLAN.md with tasks. Uses read-only tools. See: Engine.RunPlanPhase(), BuildSystemPromptAider()\n\n  - Code Phase: Executes tasks from the plan, generating unified diffs that fix bugs or add features. Supports parallel task execution via git worktrees to avoid conflicts. See: Engine.RunCodePhase(), ApplyUnifiedDiffs()\n\n  - Review Phase: Validates changes through build, test, and vet checks. Rejects changes that break the codebase. See: Engine.RunReviewPhase(), verifyProtected()\n\n  - Merge Phase: Commits and optionally creates pull requests with detailed descriptions of changes made. See: phases\\_pr.go, buildPRBody()\n\n### Diff Application {#hdr-Diff_Application}\n\nThe system uses unified diff format (git-style) for code changes, which is 3x more effective than custom formats. Three fallback strategies ensure robust application:\n\n 1. Strategy 1: Exact match with context lines\n 2. Strategy 2: Normalized whitespace matching\n 3. Strategy 3: Block-level replacement without context\n\nSee: prompts\\_aider.go (ApplyUnifiedDiffs, applyDiffStrategy1-3)\n\n### Safety Mechanisms {#hdr-Safety_Mechanisms}\n\n  - Sandboxed execution: Commands validated against allowlists and blocked patterns (sandbox.go)\n  - Protected files: Git-related and config files cannot be modified (safety.go)\n  - Protected directories: vendor, node\\_modules, .git are excluded\n  - Verification gates: go build, go vet, go test run after changes (verify.go)\n  - Git snapshots: Automatic backup before changes (snapshot.go)\n\n### Multi-Agent Architecture {#hdr-Multi_Agent_Architecture}\n\nSpecialized agent types handle different aspects:\n\n  - Plan Agent: Analyzes codebase, creates plans (read-only tools)\n  - Build Agent: Implements code changes (full tool access)\n  - Review Agent: Validates changes (read + test tools)\n  - Test Agent: Writes and runs tests\n\nSee: agents.go for AgentType, AgentConfig\n\n### Provider Management {#hdr-Provider_Management}\n\nSupports multiple AI model providers with automatic fallback on rate limits or failures.\n\nSee: provider\\_pool.go\n\n### Memory \u0026 Learning {#hdr-Memory___Learning}\n\nThe system maintains memory of:\n\n  - Active learnings (memory/ACTIVE\\_LEARNINGS.md)\n  - Evolution journal (internal/evolution/journal.go)\n  - Failure patterns (failure\\_learning.go)\n  - Historical evolution data (memory.go)\n\n### Test-Driven Development {#hdr-Test_Driven_Development}\n\nTDD enforcement ensures code changes include tests:\n\n  - Write failing test → Write code fix → Verify test passes\n\nSee: tdd.go\n\n### MCP Integration {#hdr-MCP_Integration}\n\nModel Context Protocol support for external tool integration.\n\nSee: mcp.go\n\n### Repository Mapping {#hdr-Repository_Mapping}\n\nBuilds comprehensive maps of files, functions, and imports for better context during planning.\n\nSee: repo\\_map.go\n\n## Variables\n\n```go\nvar DefaultAgentConfigs = map[AgentType]AgentConfig{\n\tAgentPlan: {\n\t\tType:        AgentPlan,\n\t\tName:        \"planner\",\n\t\tDescription: \"Analyzes codebase and creates implementation plans without making changes\",\n\t\tTools:       []string{\"glob\", \"grep\", \"read\", \"bash\"},\n\t\tMaxSteps:    20,\n\t\tTimeout:     5 * time.Minute,\n\t},\n\tAgentBuild: {\n\t\tType:        AgentBuild,\n\t\tName:        \"builder\",\n\t\tDescription: \"Implements code changes based on plans\",\n\t\tTools:       []string{\"glob\", \"grep\", \"read\", \"write\", \"edit\", \"bash\", \"todo\"},\n\t\tMaxSteps:    50,\n\t\tTimeout:     15 * time.Minute,\n\t},\n\tAgentReview: {\n\t\tType:        AgentReview,\n\t\tName:        \"reviewer\",\n\t\tDescription: \"Reviews code changes for quality and correctness\",\n\t\tTools:       []string{\"glob\", \"grep\", \"read\", \"bash\"},\n\t\tMaxSteps:    30,\n\t\tTimeout:     10 * time.Minute,\n\t},\n\tAgentTest: {\n\t\tType:        AgentTest,\n\t\tName:        \"tester\",\n\t\tDescription: \"Writes and verifies tests\",\n\t\tTools:       []string{\"glob\", \"grep\", \"read\", \"write\", \"edit\", \"bash\"},\n\t\tMaxSteps:    40,\n\t\tTimeout:     10 * time.Minute,\n\t},\n}\n```\n\n```go\nvar DefaultSandboxConfig = SandboxConfig{\n\tAllowedCommands: []string{\n\t\t\"go\", \"git\", \"ls\", \"cat\", \"grep\", \"find\", \"echo\", \"pwd\",\n\t\t\"mkdir\", \"rm\", \"cp\", \"mv\", \"chmod\", \"chown\",\n\t\t\"npm\", \"yarn\", \"pnpm\", \"pip\", \"python\", \"python3\",\n\t\t\"cargo\", \"rustc\", \"make\", \"cmake\",\n\t\t\"docker\", \"docker-compose\",\n\t\t\"curl\", \"wget\",\n\t},\n\tBlockedPatterns: []string{\n\t\t`rm\\s+-rf\\s+/(?!\\.)`,\n\t\t`dd\\s+of=`,\n\t\t`mkfs`,\n\t\t`curl.*\\|.*sh`,\n\t\t`wget.*\\|.*sh`,\n\t\t`:(){ :|:\u0026 };:`,\n\t\t`fork\\(\\)`,\n\t\t`chmod\\s+777`,\n\t\t`\u003e\\s*/dev/sd`,\n\t\t`curl\\s+.+\\s+-o\\s+/etc`,\n\t\t`sudo\\s+rm`,\n\t\t`git\\s+push\\s+--force`,\n\t\t`git\\s+push\\s+-f`,\n\t},\n\tAllowedPaths: []string{\n\t\t\"/home/runner/work\",\n\t\t\"/tmp\",\n\t},\n\tTimeout:       5 * time.Minute,\n\tMaxOutputSize: 1024 * 1024,\n\tEnvWhitelist: []string{\n\t\t\"HOME\", \"PATH\", \"USER\", \"GITHUB_TOKEN\", \"GITHUB_REPOSITORY\",\n\t\t\"GO111MODULE\", \"GOPROXY\", \"GOSUMDB\",\n\t},\n}\n```\n\n```go\nvar DefaultTDDVerification = TDDVerification{\n\tRequireTest:        true,\n\tRequireFailingTest: true,\n\tRequirePassingTest: true,\n}\n```\n\n```go\nvar LanguageExtensions = map[string]string{\n\t\".go\":    \"go\",\n\t\".py\":    \"python\",\n\t\".js\":    \"javascript\",\n\t\".ts\":    \"typescript\",\n\t\".tsx\":   \"typescript\",\n\t\".jsx\":   \"javascript\",\n\t\".java\":  \"java\",\n\t\".c\":     \"c\",\n\t\".cpp\":   \"cpp\",\n\t\".h\":     \"c\",\n\t\".hpp\":   \"cpp\",\n\t\".rs\":    \"rust\",\n\t\".rb\":    \"ruby\",\n\t\".php\":   \"php\",\n\t\".cs\":    \"csharp\",\n\t\".swift\": \"swift\",\n\t\".kt\":    \"kotlin\",\n\t\".scala\": \"scala\",\n\t\".html\":  \"html\",\n\t\".css\":   \"css\",\n\t\".scss\":  \"scss\",\n\t\".sql\":   \"sql\",\n\t\".sh\":    \"bash\",\n\t\".yaml\":  \"yaml\",\n\t\".yml\":   \"yaml\",\n\t\".json\":  \"json\",\n\t\".md\":    \"markdown\",\n}\n```\n\n```go\nvar ProtectedFiles = []string{\n\n\t\"internal/evolution/engine.go\",\n\t\"internal/evolution/*.go\",\n\n\t\".github/workflows/evolve.yml\",\n\t\".github/workflows/*.yml\",\n\n\t\"cmd/iterate/repl.go\",\n\t\"cmd/iterate/main.go\",\n\n\t\".iterate/config.json\",\n\n\t\"scripts/evolution/evolve.sh\",\n\t\"scripts/social/social.sh\",\n}\n```\nProtectedFiles defines patterns for files the agent MUST NOT edit during evolution. These are core infrastructure that could break the evolution system itself.\n\n## Functions\n\n```go\nfunc BuildRetryPrompt(attempt int, previousOutput string) string\n```\nBuildRetryPrompt creates an escalating prompt for retry attempts\n\n```go\nfunc BuildRetryPromptAider(attempt int, previousOutput string) string\n```\nBuildRetryPromptAider creates an escalating retry prompt\n\n```go\nfunc BuildSystemPromptAider(repoPath, identity string) string\n```\nBuildSystemPromptAider creates a prompt inspired by Aider's approach Uses unified diff format (like git diff) - this is 3X more effective than custom formats\n\n```go\nfunc BuildUserMessageAider(repoPath, journal, issues string, mode string) string\n```\nBuildUserMessageAider creates an aggressive, action-oriented user message\n\n```go\nfunc CountUnifiedDiffs(output string) int\n```\nCountUnifiedDiffs returns the number of unified diff blocks\n\n```go\nfunc CreateMCPConfigFile(repoPath string, servers []MCPServerConfig) error\n```\n\n```go\nfunc DetectUnifiedDiffs(output string) bool\n```\nDetectUnifiedDiffs checks if output contains unified diffs\n\n```go\nfunc FindMCPConfigFiles(repoPath string) []string\n```\n\n```go\nfunc ValidateUnifiedDiffs(diffs []UnifiedDiff) []string\n```\nValidateUnifiedDiffs checks if diffs are well-formed - Lenient version\n\n## Types\n\n```go\ntype AgentConfig struct {\n\tType         AgentType\n\tName         string\n\tDescription  string\n\tTools        []string\n\tSystemPrompt string\n\tMaxSteps     int\n\tTimeout      time.Duration\n}\n```\n\n```go\ntype AgentResult struct {\n\tSuccess     bool\n\tOutput      string\n\tChanges     []string\n\tTestResults string\n\tError       error\n\tStepsUsed   int\n\tDuration    time.Duration\n}\n```\n\n```go\ntype AgentType string\n```\n\n```go\nconst (\n\tAgentPlan   AgentType = \"plan\"\n\tAgentBuild  AgentType = \"build\"\n\tAgentReview AgentType = \"review\"\n\tAgentTest   AgentType = \"test\"\n)\n```\n\n```go\ntype CodeAnalysis struct {\n\tTODOs      []string // file:line: content\n\tHotspots   []string // most changed files\n\tNoTestPkgs []string // packages without test files\n\tBuildOK    bool\n\tTestOK     bool\n}\n```\nCodeAnalysis holds analysis results for the codebase.\n\n```go\nfunc AnalyzeCodebase(repoPath string) CodeAnalysis\n```\nAnalyzeCodebase scans the repo for improvement opportunities.\n\n```go\nfunc (a CodeAnalysis) FormatAnalysis() string\n```\nFormatAnalysis returns a human-readable summary for the agent.\n\n```go\ntype CoverageConfig struct {\n\tMinCoverage     float64 // Minimum overall coverage percentage (0-100)\n\tMinFileCoverage float64 // Minimum per-file coverage percentage (0-100)\n\tMaxCoverageDrop float64 // Max allowed coverage drop from baseline\n}\n```\nCoverageConfig defines coverage enforcement thresholds.\n\n```go\nfunc DefaultCoverageConfig() CoverageConfig\n```\nDefaultCoverageConfig returns sensible coverage enforcement defaults.\n\n```go\ntype DiffHunk struct {\n\tContext []string\n\tAdded   []string\n\tRemoved []string\n}\n```\nDiffHunk represents a single hunk in a unified diff\n\n```go\ntype DryRunSandbox struct {\n\tSandbox\n\tCommands []string\n}\n```\n\n```go\nfunc (d *DryRunSandbox) Execute(ctx context.Context, cmd string) (string, error)\n```\n\n```go\ntype Engine struct {\n\t// contains filtered or unexported fields\n}\n```\nEngine runs one evolution session.\n\n```go\nfunc New(repoPath string, logger *slog.Logger) *Engine\n```\nNew creates a new evolution engine.\n\n```go\nfunc (e *Engine) AnalyzeFailures() ([]*FailurePattern, error)\n```\n\n```go\nfunc (e *Engine) ApplyUnifiedDiffs(diffs []UnifiedDiff) ([]string, error)\n```\nApplyUnifiedDiffs applies unified diffs to files with flexible error recovery\n\n```go\nfunc (e *Engine) BuildRepoMap() (*RepoMap, error)\n```\n\n```go\nfunc (e *Engine) CallMCPTool(ctx context.Context, server, tool string, args map[string]interface{}) (string, error)\n```\n\n```go\nfunc (e *Engine) CreateSnapshot(ctx context.Context, message string) (*Snapshot, error)\n```\n\n```go\nfunc (e *Engine) GetAvoidanceGuidelines() string\n```\n\n```go\nfunc (e *Engine) GetFailurePatternSummary() string\n```\n\n```go\nfunc (e *Engine) GetMCPTools() []iteragent.Tool\n```\n\n```go\nfunc (e *Engine) GetRepoMapForPrompt() (string, error)\n```\n\n```go\nfunc (e *Engine) GetSnapshotList() []*Snapshot\n```\n\n```go\nfunc (e *Engine) NewMultiAgent(agentType AgentType) *MultiAgentEngine\n```\n\n```go\nfunc (e *Engine) RecordAndAnalyzeFailure(taskTitle, reason string) error\n```\n\n```go\nfunc (e *Engine) RestoreSnapshot(ctx context.Context, snapshotID string) error\n```\n\n```go\nfunc (e *Engine) Run(ctx context.Context, p iteragent.Provider, issues string) (*RunResult, error)\n```\n\n```go\nfunc (e *Engine) RunCommunicatePhase(ctx context.Context, p iteragent.Provider) error\n```\nRunCommunicatePhase writes journal, posts issue comments, records learnings.\n\n```go\nfunc (e *Engine) RunImplementPhase(ctx context.Context, p iteragent.Provider) error\n```\nRunImplementPhase reads SESSION\\_PLAN.md and executes tasks.\n\n```go\nfunc (e *Engine) RunMergePhase(ctx context.Context) error\n```\nRunMergePhase merges the open PR, clears state, and returns to main.\n\n```go\nfunc (e *Engine) RunPRPhase(ctx context.Context) error\n```\nRunPRPhase creates a feature branch from the current HEAD, pushes it, and opens a PR. It is designed to run after RunImplementPhase has already committed changes to main.\n\n```go\nfunc (e *Engine) RunPlanPhase(ctx context.Context, p iteragent.Provider, issues string) error\n```\nRunPlanPhase runs the planning phase. Creates SESSION\\_PLAN.md via agent or fallback.\n\n```go\nfunc (e *Engine) RunReviewPhase(ctx context.Context, p iteragent.Provider) error\n```\nRunReviewPhase runs an AI self-review of the open PR.\n\n```go\nfunc (e *Engine) RunSafetyChecks(ctx context.Context, prFiles []string) (bool, string, error)\n```\n\n```go\nfunc (e *Engine) TraceID() string\n```\nTraceID returns the trace ID for this engine instance.\n\n```go\nfunc (e *Engine) WithEventSink(sink chan\u003c- iteragent.Event) *Engine\n```\nWithEventSink sets a channel that receives live agent events during evolution.\n\n```go\nfunc (e *Engine) WithThinking(level iteragent.ThinkingLevel) *Engine\n```\nWithThinking sets the extended thinking level for all agents spawned by this engine.\n\n```go\nfunc (e *Engine) WriteLearningsToMemory(title, context, takeaway string) error\n```\nWriteLearningsToMemory is the public entry point for the synthesize workflow.\n\n```go\ntype FailureAnalyzer struct {\n\t// contains filtered or unexported fields\n}\n```\n\n```go\nfunc NewFailureAnalyzer(repoPath string, logger *slog.Logger) *FailureAnalyzer\n```\n\n```go\nfunc (fa *FailureAnalyzer) AnalyzeFailures() ([]*FailurePattern, error)\n```\n\n```go\nfunc (fa *FailureAnalyzer) GetAvoidanceGuidelines() string\n```\n\n```go\nfunc (fa *FailureAnalyzer) GetPatternSummary() string\n```\n\n```go\nfunc (fa *FailureAnalyzer) SavePatterns() error\n```\n\n```go\ntype FailureEntry struct {\n\tDay    int    `json:\"day\"`\n\tTask   string `json:\"task\"`\n\tReason string `json:\"reason\"`\n\tTS     string `json:\"ts\"`\n\tType   string `json:\"type\"`\n}\n```\n\n```go\ntype FailurePattern struct {\n\tPattern      string   `json:\"pattern\"`\n\tCategory     string   `json:\"category\"`\n\tCount        int      `json:\"count\"`\n\tFirstSeen    string   `json:\"first_seen\"`\n\tLastSeen     string   `json:\"last_seen\"`\n\tSuggestions  []string `json:\"suggestions\"`\n\tExampleTasks []string `json:\"example_tasks\"`\n}\n```\n\n```go\ntype FileInfo struct {\n\tPath       string   `json:\"path\"`\n\tName       string   `json:\"name\"`\n\tLanguage   string   `json:\"language\"`\n\tSize       int64    `json:\"size\"`\n\tFunctions  []string `json:\"functions\"`\n\tClasses    []string `json:\"classes\"`\n\tInterfaces []string `json:\"interfaces\"`\n\tImports    []string `json:\"imports\"`\n\tExports    []string `json:\"exports\"`\n}\n```\n\n```go\ntype MCPClient struct {\n\t// contains filtered or unexported fields\n}\n```\n\n```go\nfunc GetMCPClient(repoPath string, logger *slog.Logger) *MCPClient\n```\n\n```go\nfunc (m *MCPClient) CallTool(ctx context.Context, serverName, toolName string, args map[string]interface{}) (string, error)\n```\n\n```go\nfunc (m *MCPClient) Close()\n```\n\n```go\nfunc (m *MCPClient) GetAvailableTools() []iteragent.Tool\n```\n\n```go\nfunc (m *MCPClient) HealthCheck() map[string]bool\n```\n\n```go\nfunc (m *MCPClient) Init(ctx context.Context) error\n```\n\n```go\nfunc (m *MCPClient) ListTools(serverName string) ([]MCPTool, error)\n```\n\n```go\nfunc (m *MCPClient) LoadConfig(configPath string) error\n```\n\n```go\nfunc (m *MCPClient) ReconnectServer(ctx context.Context, serverName string) error\n```\n\n```go\ntype MCPConfig struct {\n\tEnabled       bool              `json:\"enabled\"`\n\tServers       []MCPServerConfig `json:\"servers\"`\n\tTimeout       time.Duration     `json:\"timeout\"`\n\tRetryAttempts int               `json:\"retry_attempts\"`\n}\n```\n\n```go\nfunc DefaultMCPConfig() MCPConfig\n```\n\n```go\nfunc LoadMCPConfigFromDefaultLocations(repoPath string) (*MCPConfig, error)\n```\n\n```go\ntype MCPConnection struct {\n\t// contains filtered or unexported fields\n}\n```\n\n```go\ntype MCPError struct {\n\tCode    int    `json:\"code\"`\n\tMessage string `json:\"message\"`\n}\n```\n\n```go\ntype MCPMessage struct {\n\tJSONRPC string          `json:\"jsonrpc\"`\n\tID      int             `json:\"id,omitempty\"`\n\tMethod  string          `json:\"method,omitempty\"`\n\tParams  json.RawMessage `json:\"params,omitempty\"`\n\tResult  json.RawMessage `json:\"result,omitempty\"`\n\tError   *MCPError       `json:\"error,omitempty\"`\n}\n```\n\n```go\ntype MCPRequest struct {\n\tJSONRPC string                 `json:\"jsonrpc\"`\n\tID      int                    `json:\"id,omitempty\"`\n\tMethod  string                 `json:\"method\"`\n\tParams  map[string]interface{} `json:\"params,omitempty\"`\n}\n```\n\n```go\ntype MCPServerConfig struct {\n\tName        string            `json:\"name\"`\n\tCommand     string            `json:\"command\"`\n\tArgs        []string          `json:\"args\"`\n\tEnv         map[string]string `json:\"env\"`\n\tTransport   string            `json:\"transport\"` // stdio, http\n\tURL         string            `json:\"url\"`\n\tAutoConnect bool              `json:\"auto_connect\"`\n}\n```\n\n```go\nfunc GetCommonMCPServers() []MCPServerConfig\n```\n\n```go\ntype MCPTool struct {\n\tName        string `json:\"name\"`\n\tDescription string `json:\"description\"`\n\tInputSchema string `json:\"inputSchema\"`\n}\n```\n\n```go\ntype MultiAgentEngine struct {\n\t// contains filtered or unexported fields\n}\n```\n\n```go\nfunc (ma *MultiAgentEngine) Execute(ctx context.Context, p iteragent.Provider, task string) *AgentResult\n```\n\n```go\ntype PRState struct {\n\tPRNumber int    `json:\"pr_number\"`\n\tPRURL    string `json:\"pr_url\"`\n\tBranch   string `json:\"branch\"`\n}\n```\nPRState persists PR info between phases (evolve.sh runs phases as separate CLI invocations).\n\n```go\ntype ParallelAgent struct {\n\t// contains filtered or unexported fields\n}\n```\n\n```go\nfunc NewParallelAgent(e *Engine, agentTypes ...AgentType) *ParallelAgent\n```\n\n```go\nfunc (pa *ParallelAgent) Execute(ctx context.Context, p iteragent.Provider, tasks []string) []*AgentResult\n```\n\n```go\ntype ProviderConfig struct {\n\tName               string\n\tPriority           int\n\tRateLimitPerMinute int\n}\n```\n\n```go\ntype ProviderPool struct {\n\t// contains filtered or unexported fields\n}\n```\n\n```go\nfunc CreateProviderPoolForEngine(logger *slog.Logger, modelName string) *ProviderPool\n```\n\n```go\nfunc NewProviderPool(logger *slog.Logger) *ProviderPool\n```\n\n```go\nfunc (p *ProviderPool) AddProvider(provider iteragent.Provider, config ProviderConfig)\n```\n\n```go\nfunc (p *ProviderPool) GetProvider() iteragent.Provider\n```\n\n```go\nfunc (p *ProviderPool) GetStats() map[string]ProviderStats\n```\n\n```go\nfunc (p *ProviderPool) RecordFailure(providerName string, err error)\n```\n\n```go\nfunc (p *ProviderPool) RecordSuccess(providerName string)\n```\n\n```go\ntype ProviderStats struct {\n\tTotalCalls   int\n\tSuccessCalls int\n\tFailedCalls  int\n\tRateLimited  int\n\tLastCall     time.Time\n\tLastError    string\n}\n```\n\n```go\ntype ProviderWithStats struct {\n\titeragent.Provider\n\tConfig ProviderConfig\n\tStats  ProviderStats\n}\n```\n\n```go\ntype RepoMap struct {\n\tRootPath   string               `json:\"root_path\"`\n\tFiles      map[string]*FileInfo `json:\"files\"`\n\tFunctions  map[string][]string  `json:\"functions\"`\n\tClasses    map[string][]string  `json:\"classes\"`\n\tImports    map[string][]string  `json:\"imports\"`\n\tDepGraph   map[string][]string  `json:\"dependency_graph\"`\n\tLastUpdate string               `json:\"last_update\"`\n\t// contains filtered or unexported fields\n}\n```\n\n```go\nfunc LoadRepoMap(path string) (*RepoMap, error)\n```\n\n```go\nfunc NewRepoMap(rootPath string) *RepoMap\n```\n\n```go\nfunc (rm *RepoMap) Build() error\n```\n\n```go\nfunc (rm *RepoMap) FindFilesByKeyword(keyword string) []*FileInfo\n```\n\n```go\nfunc (rm *RepoMap) FindRelatedFiles(filePath string) []string\n```\n\n```go\nfunc (rm *RepoMap) Save(path string) error\n```\n\n```go\nfunc (rm *RepoMap) ToJSON() (string, error)\n```\n\n```go\nfunc (rm *RepoMap) ToPrompt() string\n```\n\n```go\ntype RunResult struct {\n\tStatus     string\n\tStartedAt  time.Time\n\tFinishedAt time.Time\n\tPRNumber   int\n\tPRURL      string\n}\n```\nRunResult holds the outcome of a completed evolution run.\n\n```go\ntype SafetyCheck struct {\n\tLintCheck             bool\n\tTestModificationCheck bool\n\tSmokeTestCheck        bool\n\tRequireHumanReview    bool\n}\n```\n\n```go\nfunc DefaultSafetyCheck() *SafetyCheck\n```\n\n```go\ntype Sandbox struct {\n\t// contains filtered or unexported fields\n}\n```\n\n```go\nfunc NewSandbox(dir string) *Sandbox\n```\n\n```go\nfunc (s *Sandbox) Execute(ctx context.Context, cmd string) (string, error)\n```\n\n```go\nfunc (s *Sandbox) ExecuteWithRetry(ctx context.Context, cmd string, maxRetries int) (string, error)\n```\n\n```go\ntype SandboxConfig struct {\n\tAllowedCommands []string\n\tBlockedPatterns []string\n\tAllowedPaths    []string\n\tTimeout         time.Duration\n\tMaxOutputSize   int\n\tEnvWhitelist    []string\n}\n```\n\n```go\ntype SequentialAgent struct {\n\t// contains filtered or unexported fields\n}\n```\n\n```go\nfunc NewSequentialAgent(e *Engine, agentTypes ...AgentType) *SequentialAgent\n```\n\n```go\nfunc (sa *SequentialAgent) Execute(ctx context.Context, p iteragent.Provider, task string) *AgentResult\n```\n\n```go\ntype Snapshot struct {\n\tID        string    `json:\"id\"`\n\tCreatedAt time.Time `json:\"created_at\"`\n\tCommitSHA string    `json:\"commit_sha\"`\n\tMessage   string    `json:\"message\"`\n\tFiles     []string  `json:\"files\"`\n}\n```\n\n```go\ntype SnapshotManager struct {\n\t// contains filtered or unexported fields\n}\n```\n\n```go\nfunc NewSnapshotManager(repoPath string, logger *slog.Logger) *SnapshotManager\n```\n\n```go\nfunc (sm *SnapshotManager) Create(ctx context.Context, message string) (*Snapshot, error)\n```\n\n```go\nfunc (sm *SnapshotManager) CreateBranch(ctx context.Context, branchName, baseSnapshotID string) error\n```\n\n```go\nfunc (sm *SnapshotManager) Delete(ctx context.Context, snapshotID string) error\n```\n\n```go\nfunc (sm *SnapshotManager) Diff(ctx context.Context, snapshotID string) (string, error)\n```\n\n```go\nfunc (sm *SnapshotManager) DiscardUncommittedChanges(ctx context.Context) error\n```\n\n```go\nfunc (sm *SnapshotManager) Get(snapshotID string) (*Snapshot, bool)\n```\n\n```go\nfunc (sm *SnapshotManager) HasUncommittedChanges(ctx context.Context) (bool, error)\n```\n\n```go\nfunc (sm *SnapshotManager) List() []*Snapshot\n```\n\n```go\nfunc (sm *SnapshotManager) LoadSnapshots() error\n```\n\n```go\nfunc (sm *SnapshotManager) Restore(ctx context.Context, snapshotID string) error\n```\n\n```go\nfunc (sm *SnapshotManager) SaveSnapshotMetadata(snapshot *Snapshot) error\n```\n\n```go\ntype TDDEngine struct {\n\t// contains filtered or unexported fields\n}\n```\n\n```go\nfunc NewTDDEngine(e *Engine) *TDDEngine\n```\n\n```go\nfunc (t *TDDEngine) ExecuteTask(ctx context.Context, task string) *TDDResult\n```\n\n```go\nfunc (t *TDDEngine) Verify(result *TDDResult) error\n```\n\n```go\ntype TDDPhase string\n```\n\n```go\nconst (\n\tTDDPhaseWriteTest TDDPhase = \"write_test\"\n\tTDDPhaseRunTest   TDDPhase = \"run_test\"\n\tTDDPhaseWriteCode TDDPhase = \"write_code\"\n\tTDDPhaseVerify    TDDPhase = \"verify\"\n)\n```\n\n```go\ntype TDDResult struct {\n\tPhase    TDDPhase\n\tSuccess  bool\n\tTestFile string\n\tCodeFile string\n\tOutput   string\n\tError    error\n}\n```\n\n```go\ntype TDDVerification struct {\n\tRequireTest        bool\n\tRequireFailingTest bool\n\tRequirePassingTest bool\n}\n```\n\n```go\ntype UnifiedDiff struct {\n\tOldFile string\n\tNewFile string\n\tHunks   []DiffHunk\n}\n```\nUnifiedDiff represents a parsed unified diff\n\n```go\nfunc ParseUnifiedDiffs(output string) []UnifiedDiff\n```\nParseUnifiedDiffs extracts unified diffs from LLM output\n\n```go\ntype VerboseSandbox struct {\n\tSandbox\n\tLog func(string)\n}\n```\n\n```go\nfunc (v *VerboseSandbox) Execute(ctx context.Context, cmd string) (string, error)\n```\n\n```go\ntype VerificationResult struct {\n\tBuildPassed  bool\n\tTestPassed   bool\n\tVetPassed    bool\n\tCoverage     float64\n\tCoverageOK   bool\n\tCoveredFiles int\n\tTotalFiles   int\n\tOutput       string\n\tError        error\n\tViolations   []string\n\tDuration     time.Duration\n}\n```\nVerificationResult holds the outcome of a build + test verification run.\n\n","path":"github.com/GrayCodeAI/iterate/internal/evolution","name":"evolution","synopsis":"Package evolution provides autonomous code evolution capabilities through iterative improvement cycles with safety checks and version control integration.","isRedistributable":true}
