selfimprove

package
v0.0.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 27, 2026 License: MIT Imports: 15 Imported by: 0

Documentation

Overview

Package selfimprove implements the cloop self-improve meta-command. It collects execution telemetry (metrics, task stats, prompt stats, checkpoint data) and the cloop source tree, then asks the AI to identify performance bottlenecks, missing error handling, and UX gaps with concrete file:line citations.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BuildPrompt

func BuildPrompt(t *Telemetry, sourceDir string) string

BuildPrompt constructs the AI prompt for self-improvement analysis.

Types

type Suggestion

type Suggestion struct {
	Rank         int    `json:"rank"`
	Category     string `json:"category"` // "performance"|"error_handling"|"ux"|"reliability"|"testing"
	Title        string `json:"title"`
	Description  string `json:"description"`
	FileCitation string `json:"file_citation"` // "pkg/foo/bar.go:42" or "pkg/foo/"
	Impact       string `json:"impact"`        // "high"|"medium"|"low"
	Effort       string `json:"effort"`        // "small"|"medium"|"large"
}

Suggestion is a concrete improvement recommendation with a source location.

func Analyze

func Analyze(ctx context.Context, prov provider.Provider, model string, timeout time.Duration, prompt string) ([]*Suggestion, error)

Analyze calls the provider and parses the ranked improvement suggestions.

type Telemetry

type Telemetry struct {
	MetricsSummary   *metrics.Summary
	AggStats         *taskstats.AggregateStats
	PromptStats      promptstats.Summary
	CheckpointExists bool
	CheckpointTaskID int
	SourceFileTree   string // compact listing of .go source files
}

Telemetry holds all gathered runtime signals used to build the prompt.

func CollectTelemetry

func CollectTelemetry(s *state.ProjectState, workDir, sourceDir, model string) *Telemetry

CollectTelemetry gathers runtime telemetry from the project working directory. The state is loaded by the caller and passed in. workDir is the project root. sourceDir is the root of the cloop source tree (may be empty to skip source scanning).

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL