Documentation
¶
Index ¶
- Constants
- Variables
- func ApplyLifecycleState(paths Paths, profile SkillProfile, next SkillStatus) error
- func SaveAppliedProfile(store *Store, workspace string, draft SkillDraft, now time.Time) error
- func ValidateDraft(draft SkillDraft) []string
- type Applier
- type AttemptTrail
- type CaseWriter
- type ChangeKind
- type ColdPathRunner
- type DefaultDraftGenerator
- type DraftEvidence
- type DraftGenerator
- type DraftPreview
- type DraftReviewResult
- type DraftStatus
- type DraftType
- type EvidenceAwareDraftGenerator
- type HeuristicPatternClusterer
- type HeuristicSuccessJudge
- type LLMDraftGenerator
- type LLMPatternClusterer
- func (c *LLMPatternClusterer) BuildPatterns(ctx context.Context, workspace string, tasks []LearningRecord, ...) ([]LearningRecord, []string, error)
- func (c *LLMPatternClusterer) BuildPatternsWithEvidence(ctx context.Context, workspace string, successfulTasks []LearningRecord, ...) ([]LearningRecord, []string, error)
- type LLMTaskSuccessJudge
- type LearningRecord
- type LifecycleRunSummary
- type Organizer
- type OrganizerOptions
- type Paths
- type PatternClusterer
- type RecordKind
- type RecordStatus
- type Runtime
- type RuntimeOptions
- type SkillContextSnapshot
- type SkillDraft
- type SkillProfile
- type SkillStatus
- type SkillVersionEntry
- type SkillsRecaller
- type Store
- func (s *Store) AppendLearningRecord(ctx context.Context, record LearningRecord) error
- func (s *Store) AppendLearningRecords(records []LearningRecord) error
- func (s *Store) AppendPatternRecords(records []LearningRecord) error
- func (s *Store) AppendTaskRecord(ctx context.Context, record LearningRecord) error
- func (s *Store) AppendTaskRecords(ctx context.Context, records []LearningRecord) error
- func (s *Store) LoadDrafts() ([]SkillDraft, error)
- func (s *Store) LoadLearningRecords() ([]LearningRecord, error)
- func (s *Store) LoadPatternRecords() ([]LearningRecord, error)
- func (s *Store) LoadProfile(skillName string) (SkillProfile, error)
- func (s *Store) LoadProfiles() ([]SkillProfile, error)
- func (s *Store) LoadTaskRecords() ([]LearningRecord, error)
- func (s *Store) MarkTaskRecordsClustered(ids []string) error
- func (s *Store) MergePatternRecords(records []LearningRecord) error
- func (s *Store) SaveDrafts(drafts []SkillDraft) error
- func (s *Store) SavePatternRecords(records []LearningRecord) error
- func (s *Store) SaveProfile(profile SkillProfile) error
- func (s *Store) SaveTaskRecords(records []LearningRecord) error
- func (s *Store) UpdateProfile(workspaceID, skillName string, ...) error
- type SuccessJudge
- type TaskSuccessDecision
- type ToolExecutionRecord
- type TurnCaseInput
Constants ¶
View Source
const ( RecordKindTask RecordKind = "task" RecordKindPattern RecordKind = "pattern" // Deprecated: use RecordKindTask. RecordKindCase = RecordKindTask // Deprecated: use RecordKindPattern. RecordKindRule = RecordKindPattern )
Variables ¶
View Source
var ErrApplyDraftFailed = errors.New("apply draft failed")
Functions ¶
func ApplyLifecycleState ¶
func ApplyLifecycleState(paths Paths, profile SkillProfile, next SkillStatus) error
func SaveAppliedProfile ¶
func ValidateDraft ¶
func ValidateDraft(draft SkillDraft) []string
Types ¶
type Applier ¶
type Applier struct {
// contains filtered or unexported fields
}
func (*Applier) ApplyDraft ¶
type AttemptTrail ¶
type AttemptTrail struct {
AttemptedSkills []string `json:"attempted_skills,omitempty"`
FinalSuccessfulPath []string `json:"final_successful_path,omitempty"`
SkillContextSnapshots []SkillContextSnapshot `json:"skill_context_snapshots,omitempty"`
}
type CaseWriter ¶
type CaseWriter struct {
// contains filtered or unexported fields
}
func NewCaseWriter ¶
func NewCaseWriter(paths Paths) *CaseWriter
func (*CaseWriter) AppendCase ¶
func (w *CaseWriter) AppendCase(ctx context.Context, record LearningRecord) error
type ChangeKind ¶
type ChangeKind string
const ( ChangeKindCreate ChangeKind = "create" ChangeKindAppend ChangeKind = "append" ChangeKindReplace ChangeKind = "replace" ChangeKindMerge ChangeKind = "merge" )
type ColdPathRunner ¶
type ColdPathRunner struct {
// contains filtered or unexported fields
}
func NewColdPathRunner ¶
func NewColdPathRunner(runtime coldPathRuntime) *ColdPathRunner
func NewColdPathRunnerWithErrorHandler ¶
func NewColdPathRunnerWithErrorHandler(runtime coldPathRuntime, onError func(error)) *ColdPathRunner
func (*ColdPathRunner) Close ¶
func (r *ColdPathRunner) Close() error
func (*ColdPathRunner) Trigger ¶
func (r *ColdPathRunner) Trigger(workspace string) bool
type DefaultDraftGenerator ¶
type DefaultDraftGenerator struct {
// contains filtered or unexported fields
}
func NewDefaultDraftGenerator ¶
func NewDefaultDraftGenerator(workspace string) *DefaultDraftGenerator
func (*DefaultDraftGenerator) GenerateDraft ¶
func (g *DefaultDraftGenerator) GenerateDraft( _ context.Context, rule LearningRecord, matches []skills.SkillInfo, ) (SkillDraft, error)
func (*DefaultDraftGenerator) GenerateDraftWithEvidence ¶
func (g *DefaultDraftGenerator) GenerateDraftWithEvidence( _ context.Context, rule LearningRecord, matches []skills.SkillInfo, evidence DraftEvidence, ) (SkillDraft, error)
type DraftEvidence ¶
type DraftEvidence struct {
TaskRecords []LearningRecord
}
type DraftGenerator ¶
type DraftGenerator interface {
GenerateDraft(ctx context.Context, rule LearningRecord, matches []skills.SkillInfo) (SkillDraft, error)
}
func NewDraftGeneratorForWorkspace ¶
func NewDraftGeneratorForWorkspace(workspace string, provider providers.LLMProvider, modelID string) DraftGenerator
type DraftPreview ¶
func BuildDraftPreview ¶
func BuildDraftPreview(workspace string, draft SkillDraft) (DraftPreview, error)
type DraftReviewResult ¶
type DraftReviewResult struct {
Status DraftStatus
Findings []string
ReviewNotes []string
}
func ReviewDraft ¶
func ReviewDraft(draft SkillDraft) DraftReviewResult
type DraftStatus ¶
type DraftStatus string
const ( DraftStatusCandidate DraftStatus = "candidate" DraftStatusQuarantined DraftStatus = "quarantined" DraftStatusAccepted DraftStatus = "accepted" )
type EvidenceAwareDraftGenerator ¶
type EvidenceAwareDraftGenerator interface {
GenerateDraftWithEvidence(
ctx context.Context,
rule LearningRecord,
matches []skills.SkillInfo,
evidence DraftEvidence,
) (SkillDraft, error)
}
type HeuristicPatternClusterer ¶
type HeuristicPatternClusterer struct {
// contains filtered or unexported fields
}
func NewHeuristicPatternClusterer ¶
func NewHeuristicPatternClusterer(minCaseCount int, now func() time.Time) *HeuristicPatternClusterer
func (*HeuristicPatternClusterer) BuildPatterns ¶
func (c *HeuristicPatternClusterer) BuildPatterns( _ context.Context, workspace string, tasks []LearningRecord, existing []LearningRecord, ) ([]LearningRecord, []string, error)
type HeuristicSuccessJudge ¶
type HeuristicSuccessJudge struct{}
func (*HeuristicSuccessJudge) JudgeTaskRecord ¶
func (j *HeuristicSuccessJudge) JudgeTaskRecord( _ context.Context, record LearningRecord, ) (TaskSuccessDecision, error)
type LLMDraftGenerator ¶
type LLMDraftGenerator struct {
// contains filtered or unexported fields
}
func NewLLMDraftGenerator ¶
func NewLLMDraftGenerator(provider providers.LLMProvider, model string, fallback DraftGenerator) *LLMDraftGenerator
func (*LLMDraftGenerator) GenerateDraft ¶
func (g *LLMDraftGenerator) GenerateDraft( ctx context.Context, rule LearningRecord, matches []skills.SkillInfo, ) (SkillDraft, error)
func (*LLMDraftGenerator) GenerateDraftWithEvidence ¶
func (g *LLMDraftGenerator) GenerateDraftWithEvidence( ctx context.Context, rule LearningRecord, matches []skills.SkillInfo, evidence DraftEvidence, ) (SkillDraft, error)
type LLMPatternClusterer ¶
type LLMPatternClusterer struct {
// contains filtered or unexported fields
}
func NewLLMPatternClusterer ¶
func NewLLMPatternClusterer( provider providers.LLMProvider, model string, fallback PatternClusterer, minCount int, now func() time.Time, ) *LLMPatternClusterer
func (*LLMPatternClusterer) BuildPatterns ¶
func (c *LLMPatternClusterer) BuildPatterns( ctx context.Context, workspace string, tasks []LearningRecord, existing []LearningRecord, ) ([]LearningRecord, []string, error)
func (*LLMPatternClusterer) BuildPatternsWithEvidence ¶
func (c *LLMPatternClusterer) BuildPatternsWithEvidence( ctx context.Context, workspace string, successfulTasks []LearningRecord, evidenceTasks []LearningRecord, existing []LearningRecord, minSuccessRatio float64, ) ([]LearningRecord, []string, error)
type LLMTaskSuccessJudge ¶
type LLMTaskSuccessJudge struct {
// contains filtered or unexported fields
}
func NewLLMTaskSuccessJudge ¶
func NewLLMTaskSuccessJudge(provider providers.LLMProvider, model string, fallback SuccessJudge) *LLMTaskSuccessJudge
func (*LLMTaskSuccessJudge) JudgeTaskRecord ¶
func (j *LLMTaskSuccessJudge) JudgeTaskRecord( ctx context.Context, record LearningRecord, ) (TaskSuccessDecision, error)
type LearningRecord ¶
type LearningRecord struct {
ID string `json:"id"`
Kind RecordKind `json:"kind"`
WorkspaceID string `json:"workspace_id"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt *time.Time `json:"updated_at,omitempty"`
SessionKey string `json:"session_key,omitempty"`
TaskHash string `json:"task_hash,omitempty"`
Summary string `json:"summary"`
UserGoal string `json:"user_goal,omitempty"`
FinalOutput string `json:"final_output,omitempty"`
Source map[string]any `json:"source,omitempty"`
Status RecordStatus `json:"status"`
Success *bool `json:"success,omitempty"`
ToolKinds []string `json:"tool_kinds,omitempty"`
ToolExecutions []ToolExecutionRecord `json:"tool_executions,omitempty"`
InitialSkillNames []string `json:"initial_skill_names,omitempty"`
AddedSkillNames []string `json:"added_skill_names,omitempty"`
UsedSkillNames []string `json:"used_skill_names,omitempty"`
AllLoadedSkillNames []string `json:"all_loaded_skill_names,omitempty"`
ActiveSkillNames []string `json:"active_skill_names,omitempty"`
AttemptTrail *AttemptTrail `json:"attempt_trail,omitempty"`
Signals []string `json:"signals,omitempty"`
SourceRecordIDs []string `json:"source_record_ids,omitempty"`
TaskRecordIDs []string `json:"task_record_ids,omitempty"`
Label string `json:"label,omitempty"`
ClusterReason string `json:"cluster_reason,omitempty"`
EventCount int `json:"event_count,omitempty"`
SuccessRate float64 `json:"success_rate,omitempty"`
MaturityScore float64 `json:"maturity_score,omitempty"`
WinningPath []string `json:"winning_path,omitempty"`
LateAddedSkills []string `json:"late_added_skills,omitempty"`
FinalSnapshotTrigger string `json:"final_snapshot_trigger,omitempty"`
MatchedSkillNames []string `json:"matched_skill_names,omitempty"`
}
type LifecycleRunSummary ¶
type LifecycleRunSummary struct {
EvaluatedProfiles int
TransitionedProfiles int
DeletedSkills int
}
func RunLifecycleOnce ¶
type Organizer ¶
type Organizer struct {
// contains filtered or unexported fields
}
func NewOrganizer ¶
func NewOrganizer(opts OrganizerOptions) *Organizer
func (*Organizer) BuildRules ¶
func (o *Organizer) BuildRules(records []LearningRecord) ([]LearningRecord, error)
type OrganizerOptions ¶
type Paths ¶
type PatternClusterer ¶
type PatternClusterer interface {
BuildPatterns(
ctx context.Context,
workspace string,
tasks []LearningRecord,
existing []LearningRecord,
) ([]LearningRecord, []string, error)
}
type RecordKind ¶
type RecordKind string
type RecordStatus ¶
type RecordStatus string
type Runtime ¶
type Runtime struct {
// contains filtered or unexported fields
}
func NewRuntime ¶
func NewRuntime(opts RuntimeOptions) (*Runtime, error)
func (*Runtime) FinalizeTurn ¶
func (rt *Runtime) FinalizeTurn(ctx context.Context, input TurnCaseInput) error
type RuntimeOptions ¶
type RuntimeOptions struct {
Config config.EvolutionConfig
Now func() time.Time
Store *Store
Organizer *Organizer
PatternClusterer PatternClusterer
SuccessJudge SuccessJudge
SkillsRecaller *SkillsRecaller
DraftGenerator DraftGenerator
GeneratorFactory func(workspace string) DraftGenerator
SuccessJudgeFactory func(workspace string) SuccessJudge
Applier *Applier
ApplierFactory func(workspace string) *Applier
}
type SkillContextSnapshot ¶
type SkillDraft ¶
type SkillDraft struct {
ID string `json:"id"`
WorkspaceID string `json:"workspace_id"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt *time.Time `json:"updated_at,omitempty"`
SourceRecordID string `json:"source_record_id"`
TargetSkillName string `json:"target_skill_name"`
MatchedSkillRefs []string `json:"matched_skill_refs,omitempty"`
DraftType DraftType `json:"draft_type"`
ChangeKind ChangeKind `json:"change_kind"`
HumanSummary string `json:"human_summary"`
IntendedUseCases []string `json:"intended_use_cases,omitempty"`
PreferredEntryPath []string `json:"preferred_entry_path,omitempty"`
AvoidPatterns []string `json:"avoid_patterns,omitempty"`
BodyOrPatch string `json:"body_or_patch"`
Status DraftStatus `json:"status"`
ReviewNotes []string `json:"review_notes,omitempty"`
ScanFindings []string `json:"scan_findings,omitempty"`
}
type SkillProfile ¶
type SkillProfile struct {
SkillName string `json:"skill_name"`
WorkspaceID string `json:"workspace_id"`
CurrentVersion string `json:"current_version"`
Status SkillStatus `json:"status"`
Origin string `json:"origin"`
HumanSummary string `json:"human_summary"`
ChangeReason string `json:"change_reason,omitempty"`
IntendedUseCases []string `json:"intended_use_cases,omitempty"`
PreferredEntryPath []string `json:"preferred_entry_path,omitempty"`
AvoidPatterns []string `json:"avoid_patterns,omitempty"`
LastUsedAt time.Time `json:"last_used_at"`
UseCount int `json:"use_count"`
RetentionScore float64 `json:"retention_score"`
VersionHistory []SkillVersionEntry `json:"version_history"`
}
type SkillStatus ¶
type SkillStatus string
const ( SkillStatusActive SkillStatus = "active" SkillStatusCold SkillStatus = "cold" SkillStatusArchived SkillStatus = "archived" SkillStatusDeleted SkillStatus = "deleted" )
func NextLifecycleState ¶
func NextLifecycleState(profile SkillProfile, now time.Time) SkillStatus
type SkillVersionEntry ¶
type SkillVersionEntry struct {
Version string `json:"version"`
Action string `json:"action"`
Timestamp time.Time `json:"timestamp"`
DraftID string `json:"draft_id,omitempty"`
Summary string `json:"summary"`
Rollback bool `json:"rollback,omitempty"`
RollbackReason string `json:"rollback_reason,omitempty"`
}
type SkillsRecaller ¶
type SkillsRecaller struct {
// contains filtered or unexported fields
}
func NewSkillsRecaller ¶
func NewSkillsRecaller(workspace string) *SkillsRecaller
func (*SkillsRecaller) RecallSimilarSkills ¶
func (r *SkillsRecaller) RecallSimilarSkills(rule LearningRecord) ([]skills.SkillInfo, error)
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
func (*Store) AppendLearningRecord ¶
func (s *Store) AppendLearningRecord(ctx context.Context, record LearningRecord) error
func (*Store) AppendLearningRecords ¶
func (s *Store) AppendLearningRecords(records []LearningRecord) error
func (*Store) AppendPatternRecords ¶
func (s *Store) AppendPatternRecords(records []LearningRecord) error
func (*Store) AppendTaskRecord ¶
func (s *Store) AppendTaskRecord(ctx context.Context, record LearningRecord) error
func (*Store) AppendTaskRecords ¶
func (s *Store) AppendTaskRecords(ctx context.Context, records []LearningRecord) error
func (*Store) LoadDrafts ¶
func (s *Store) LoadDrafts() ([]SkillDraft, error)
func (*Store) LoadLearningRecords ¶
func (s *Store) LoadLearningRecords() ([]LearningRecord, error)
func (*Store) LoadPatternRecords ¶
func (s *Store) LoadPatternRecords() ([]LearningRecord, error)
func (*Store) LoadProfile ¶
func (s *Store) LoadProfile(skillName string) (SkillProfile, error)
func (*Store) LoadProfiles ¶
func (s *Store) LoadProfiles() ([]SkillProfile, error)
func (*Store) LoadTaskRecords ¶
func (s *Store) LoadTaskRecords() ([]LearningRecord, error)
func (*Store) MarkTaskRecordsClustered ¶
func (*Store) MergePatternRecords ¶
func (s *Store) MergePatternRecords(records []LearningRecord) error
func (*Store) SaveDrafts ¶
func (s *Store) SaveDrafts(drafts []SkillDraft) error
func (*Store) SavePatternRecords ¶
func (s *Store) SavePatternRecords(records []LearningRecord) error
func (*Store) SaveProfile ¶
func (s *Store) SaveProfile(profile SkillProfile) error
func (*Store) SaveTaskRecords ¶
func (s *Store) SaveTaskRecords(records []LearningRecord) error
func (*Store) UpdateProfile ¶
type SuccessJudge ¶
type SuccessJudge interface {
JudgeTaskRecord(ctx context.Context, record LearningRecord) (TaskSuccessDecision, error)
}
type TaskSuccessDecision ¶
type ToolExecutionRecord ¶
type TurnCaseInput ¶
type TurnCaseInput struct {
Workspace string
WorkspaceID string
TurnID string
SessionKey string
AgentID string
Status string
UserMessage string
FinalContent string
ToolKinds []string
ToolExecutions []ToolExecutionRecord
ActiveSkillNames []string
AttemptedSkillNames []string
FinalSuccessfulPath []string
SkillContextSnapshots []SkillContextSnapshot
}
Source Files
¶
- apply.go
- case_writer.go
- cold_path_runner.go
- draft_review.go
- drafts.go
- generator_factory.go
- lifecycle.go
- llm_draft_generator.go
- llm_timeout.go
- organizer.go
- paths.go
- pattern_clusterer.go
- preview.go
- profile_sync.go
- record_kinds.go
- runtime.go
- skill_content.go
- skill_draft_policy.go
- skills_recall.go
- store.go
- success_judge.go
- types.go
Click to show internal directories.
Click to hide internal directories.